This comment justifies the usage of husky pre-commit hook over pre-commit package.
UPDATE: In summary the husky config file would probably look like:
"husky": {
"hooks": {
"pre-commit": "lint-staged"
},
},
"lint-staged": {
"static/docs/**/*.md": [ "prettier --write"],
}
Yes! I think we don't need Python in this repo, and whatever applies the pre-commit hook should re-use the prettier version already installed by npm, so husky/lint-staged would work unless anyone has a better suggestion. Also:
[ ] The prettier version in package.json should probably go back to ^1.17.0;
[ ] Let's update the doc contrib guide to reflect these changes when implemented.
@jorgeorpinel okay! So I'll integrate husky/lint-staged as soon as possible if you are not working on it and update the docs too.
Awesome. Please remember to remove all traces of Python if it's not used for anything else in this repo (which I think is the case).
Hey, I just noticed the prettier docs have a guide on how to easily install lint-staged and husky: https://prettier.io/docs/en/precommit.html#option-1-lint-staged-https-githubcom-okonet-lint-staged
Lint-staged is dropped since it wasn't bailing out after formatting files. It was staging the files and committing it.
Hi @algomaster99 ! I'm not sure this is working as expected so reopening:
When I add changes to git and then commit, if files are automatically formatted those automatic changes should NOT be staged automatically I think, but they are currently. Not sure it's a huge deal but is it possible to change the setup so automatic formatting isn't automatically staged to git?
Thanks
@jorgeorpinel Okay, I will try that changes don't get staged.
Most helpful comment
@jorgeorpinel Okay, I will try that changes don't get staged.