Steps to Configure ESlint and Pre-commit Hooks in your local repository
Open Your Git bash and run the following commands
1.npx husky install
To add the .husky Directory
2.After that, navigate to the .husky directory which has been Added and add this piece of code to the pre-commit file:
#!/bin/sh
. "$(dirname "$0")/_/husky.sh"
# Run ESLint with --fix option to format code
npx eslint --fix .
# Run tests
npm run test
chmod +x .husky/pre-commit
To Make the pre-commit file executable
note: The above commands has to be run in the Git Bash, not Powershell Terminal