This allows developers to—optionally—install a pre-commit hook that runs eslint locally on staged files before they're committed, preventing the commit if they are not in the semistandard style.
This uses simple-git-hooks, which has the drawback (vs husky) of making hooks annoying to uninstall, but as the advantage of not uninstalling hooks when you switch branches. This PR also forgoes lint-staged and makes the hook itself not depend on package.json, continuing this trend. I also didn't add .eslintcache to gitignore or add --cache to posttest.
Thus, this branch is a git hook installer that doesn't require changes to the repository. Whee. That is, one can switch to this PR branch, run npm run enable-hooks, switch to another branch, and have the hook continue to work until one manually deletes .git/hooks/pre-commit, which is what I'm doing.
Description
Similar to #1472.
This allows developers to—optionally—install a pre-commit hook that runs eslint locally on staged files before they're committed, preventing the commit if they are not in the semistandard style.
This uses
simple-git-hooks
, which has the drawback (vs husky) of making hooks annoying to uninstall, but as the advantage of not uninstalling hooks when you switch branches. This PR also forgoeslint-staged
and makes the hook itself not depend on package.json, continuing this trend. I also didn't add.eslintcache
togitignore
or add--cache
toposttest
.Thus, this branch is a git hook installer that doesn't require changes to the repository. Whee. That is, one can switch to this PR branch, run
npm run enable-hooks
, switch to another branch, and have the hook continue to work until one manually deletes.git/hooks/pre-commit
, which is what I'm doing.Testing steps