Pre-commit hook for Es-Lint
npm i eslint-pre-commit-hook -D
or:
yarn add eslint-pre-commit-hook -D
There is no further requirements after installation. It automatically sets pre-commit
hook after installation
(check .git/hooks/pre-commit
to sure). But you can customize its behaviour by setting eslintPreCommitBaseCommand
field in your package.json
file:
"eslintPreCommitBaseCommand": "eslint --max-warnings=0"
The default value of the above option is "eslint"
. Run git commit ...
on some js(x)
or ts(x)
files and watch the
console to see how this works.