JSPM

polite-linter

1.0.0
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 71
  • Score
    100M100P100Q99851F
  • License MIT

Polite linter to be used with prepush githook

Package Exports

  • polite-linter

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (polite-linter) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

Polite linter for git prepush hooks

Everybody likes git prepush hooks – they prevent us from pushing invalid code to repository.

But there are always two 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
  • 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.

How to use

Polite linter for now supports eslint and tslint linters(contributions for another linters are welcome!)

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

npm run polite-tslint --rules=path_to_custom_rules --config=path_to_tslint_config

Options

tslint

If you are using tslint, there are two options you can provide:

  • --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

eslint

Eslint for now does not support any flags – it will find .eslintrc by itself and use it to lint your files

License

MIT