-
Notifications
You must be signed in to change notification settings - Fork 60
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
Add precommit hook #129
Add precommit hook #129
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Couple of things:
- move
lint-staged
depedency under coral. - Couple of trivial comments in the actual
pre-commit
file
Lets also keep our minds open for https://pre-commit.com/, which clould also establish a base for git hooks for Java changes.
Is a general personal note: I would have not introduced |
Adding here what we decided about this in a call to be transparent:
|
3b55942
to
f9c6979
Compare
- remove lint-staged that was accidentally installed on root instead of coral. - add lint-staged package to coral - add script to package.json - update pre-commit script to always change to git-root/coral - use variable for frontend-root to make it easier to change that later - remove echo - use --prefix instead of changing directory
f9c6979
to
d15ade4
Compare
lint-staged passes changed filenames as argument. If files are passed as argument `tsc` does not use tsconfig.json, but CLI inline config. Also run plain prettier and eslint commands with lint-staged. the `pnpm lint` does not use files as argument. Refers: #112
About this change - What it does
Introduces
husky
andlint-staged
to run scripts on pre-commit if there are changes incoral
.Resolves: #112
Why this way
prepare
script inpackage.json
is needed in this form ('cd .. && husky install coral/.husky') because.git
folder is not on the same level as thepackage.json
(see documentation)lint-staged
page to enable us to control which scripts have to run dependent on where a file changes:pre-commit
is a check to see if the staged files are in thecoral
directory, so we don't run tests when something outsidecoral
changes.