You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Before submitting code changes, we need to identify simple issues, to enforce a certain code structure and check for any issues, that could break the application when pushing it. If anything fails, the code changes won't be submitted to the repository until it gets fixed.
Open questions
What things should be checked using the pre-commit hook?
What tools are available for a pre-commit hook check?
The text was updated successfully, but these errors were encountered:
What tools are available for a pre-commit hook check?
I would suggest husky since it has 3,275,175 weekly downloads, it should be fairly the standard in the npm ecosystem.
What things should be checked using the pre-commit hook?
I wouldn't focus on just the pre-commit hook, but also the pre-push, so we can also implement some more heavy operations such as testing the code. Because we are commiting more often, we don't want to run the whole test suite against each commit, but rather against each push. This makes much more sense in my eyes.
I would suggest the following hooks:
Hook Name
Tool(s)
What to check?
pre-commit
eslint, tsc
Linting the code, perhaps typechecking for typescript issues
commit-msg
commitlint
Linting the commit message, so we also have a unified commit message layout
pre-push
Any test framework
Testing (+ complex operations, that shouldn't run on each commit)
Idea
Before submitting code changes, we need to identify simple issues, to enforce a certain code structure and check for any issues, that could break the application when pushing it. If anything fails, the code changes won't be submitted to the repository until it gets fixed.
Open questions
pre-commit
hook?The text was updated successfully, but these errors were encountered: