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

Apply lint to pre-commit hooks #183

Closed
kylerwsm opened this issue Jun 11, 2020 · 1 comment · Fixed by #187
Closed

Apply lint to pre-commit hooks #183

kylerwsm opened this issue Jun 11, 2020 · 1 comment · Fixed by #187

Comments

@kylerwsm
Copy link
Contributor

Is your feature request related to a problem? Please describe.
While it is good that our code push now fails on lint errors, it is still possible to commit and push badly formatted code (formatting fixes need not be committed before the code can be pushed). While badly formatted code will be caught by our CI, it would be better if we have in-development measures as well.

Describe the solution you'd like
A pre-commit hook with lint-staged may be the ideal solution for this problem. This ensures that all of our commits are properly formatted and structured, and makes dedicated commits to fix stylings redundant. However, an obvious drawback will be additional delays when commit code changes.

Describe alternatives you've considered
I am open to hear alternative solutions!

LoneRifle added a commit that referenced this issue Jun 15, 2020
Allow husky to invoke lint-staged so that files that are about to
be committed get automatically linted.

- Update husky, add lint-staged
- Add lint-staged commands to lint-fix files before they are committed

Closes #183
@LoneRifle
Copy link
Contributor

The pre-commit linting wouldn't have much delay since lint-staged can target only the files that are being committed. Given that CI is already doing the linting too, this would also mean that we can generally avoid linting the entire codebase pre-push, and get pre-push to do something like, say, commitlinting.

liangyuanruo pushed a commit that referenced this issue Jun 15, 2020
Allow husky to invoke lint-staged so that files that are about to
be committed get automatically linted.

Closes #183
LoneRifle added a commit that referenced this issue Jun 17, 2020
Allow husky to invoke lint-staged so that files that are about to
be committed get automatically linted.

Closes #183
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 a pull request may close this issue.

2 participants