To get started, first install Husky using the command below.
npm install --save-dev husky
Initialize Husky
npx husky init
This creates a pre-commit script in .husky/ and updates the prepare script in package.json.
Now whenever you make a commit, every command that is in the .husky/pre-commit file will run before your commit is made.