Hello guys, so this post is just a followup for a post I made at the beginning of 2020, and I recently updated it
How to set Eslint and Prettier for a React project on vs code
David Mendoza (He/Him) ・ Jan 8 '20 ・ 2 min read
What is husky
So basically husky is "Git hooks made easy" and we are going to use to automatically format all of our code that is staged for our commits, so we are going to use the "pre-commit" hook to run pretty-quick a simpler way to run our prettier scripts with configuration
Installing packages
npm i -D husky@4 pretty-quick
that's it...
Setting the scripts
{
// all of your package.json
"husky": {
"hooks": {
"pre-commit": "pretty-quick --staged"
}
}
}
Wrapping up
This is the simplest and quickest way to have "automatic formatting" on our commits, next time you run a commit, you will have a message something like this:
Not much to say but to leave any questions on the comments and I hope you find this post really helpful.
Top comments (0)