Polite linter to be used with prepush githook
npm install polite-linterEverybody likes git prepush hooks – they prevent us from pushing invalid code to repository.
But there are always few problems:
* hooks run on current INDEX, so if your commits are pure, but INDEX is dirty and contains some lint errors, it won't be pushed.
* or vice versa, you have committed files with mistakes, fixed them after and would easily push them if prepush runs on current INDEX
* linters run on whole project, no matter that you have committed one file
Polite linter analyzes your log and runs linter only on files which are _committed_ since last push, linting their _HEAD_ version.
All linting runs in memory, not using or affecting local files at all
npm i polite-linter --save-dev
If you are using husky, just add to your package.json
"prepush": "polite-tslint --rules=path_to_custom_rules --config=path_to_tslint_config
or
"prepush": "polite-eslint"
--
If you are using pure git hooks, use in your pre-push
polite-tslint --rules=path_to_custom_rules --config=path_to_tslint_config
--rules – path to your custom rules directory(if you are using one)--config – path to your basic config file. By default ./tslint.json is used.eslintrc by itself and use it to lint your files