Add linting as a git pre-commit step
Recently I issued a PR to fix a broken build which got merged, but unfortunately I had forgotten to run
npm run lint:fix before committing. This resulted in another broken build, as linting failed.
To prevent this happening with future commits, I have added a pre-commit hook which runs
npm run lint.
While committing staged changes, the command
npm run lint will be executed. If this throws any errors, committing is aborted.
This currently only checks for linting issues, and it’s up to the committer to fix the issues manually. Up to discussion could be to run
npm run lint:fix which would fix issues if possible and finish up the commit.
The following npm packages were used:
Please review this carefully and also check if changes are needed in regard to the CI build: Husky - Git hooks
If the initial PR gets accepted/merged, I’ll create PR’s for the other affected repos.
- Desktop → PR#904
- Directory Connector
ETA: This week