-
Notifications
You must be signed in to change notification settings - Fork 3.9k
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
Force local linting #378
Force local linting #378
Conversation
202a151
to
17d0902
Compare
Give me a second with the actual merge, I figured that Thus, I prefer some script which just checks and informs the developer about what he's got to do. I'll add that in a few |
I figured that lint:fix might not be the best experience: If there are linting errors and the pre-commit fixes them, those changes will stay in the staging area but will not be automatically commited. Thus, a subsequent pre-commit check would succeed without these changes included.
67e624d
to
ad511db
Compare
Soo. I did checkout, I use webstorm and it seems it ignores it and commits without it :D |
Looks like two people like it. |
This is not a feature of the IDE, but if git itself. Even webstorm can't ignore it 😬 The hook is installed on first |
@wonderwhy-er it was not the typecheck that failed, but the subsequent linting. The error also says "❌ Linting failed". How could we improve verboseness? But as the error also says: all of them should be fixable. Simply run |
edit: @wonderwhy-er added a fix to the error message to better help you ;) |
Motivation
Linting as in #367 is essential for concise PRs.
Linting should be enforced prior to merging, latest in CI.
However, it's a bad contributor experience and a waste of resources if a contributor pushes his changes, considers things done and only a pipeline fail tells him that his IDE forgot to prettify for him/her ;)
What's in this PR
This PR adds a pre-commit-hook which lints the code and fixes easy fixes (such as blanks or semicolons) on the contributor's machine. As the name suggests, this process runs prior to completing the commit, meaning the developer can't commit with linting issues.
Considerations