2020-07-14
|~1 min read
|103 words
I first learned about git hooks in the context of conventional commits.
Today, I did a little more exploring into the hooks available and found the pre-commit hook. This hook can be used for all sorts of things, but I’m using it for linting by running pretty-quick
before I’m able to commit.
The Prettier docs actually have an entire page on different ways and styles of using the pre-commit hook! Definitely worth a read.
In the mean time, my package.json
now looks like this:
{
"": "...",
"husky": {
"hooks": {
"commit-msg": "commitlint -E HUSKY_GIT_PARAMS",
"pre-commit": "pretty-quick --staged"
}
}
}
Hi there and thanks for reading! My name's Stephen. I live in Chicago with my wife, Kate, and dog, Finn. Want more? See about and get in touch!