Add Husky to NextJS app
1. Installation
terminal
2. Initialize husky
The command creates a .husky folder with all the necessary client hooks present in the _ folder. This is how it looks like.
terminal
Additionally, it adds a prepare script to package.json.
This is how it looks like.
Add 2 extra scripts in package.json
package.json
Add a precommit hook.
In ./husky/pre-commit file add:
./husky/pre-commit
Add a pre-push hook.
./huskey/pre-push
Test if it works.
Now try to add a commit.
terminal