Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create simple optional eslint pre-commit hook #49

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

marcustyphoon
Copy link
Owner

Description

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.

Testing steps

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant