I am having an issue with husky. I would like for husky to run eslint and prettier at the point at which git commit is about to be done so that it can enforce clean coding checks. I have already setup eslint, prettier and integrated both. They are working fine when used manually. However, husky allows a commit if one of the eslint rules is violated.
I also renamed the pre-commit.sample file in my local project's .git/hooks directory to pre-commit.
This is my package.json file:
"scripts": {
"prettier-format": "prettier --config .prettierrc 'src/**/*.ts' 'test/**/*.ts' --write",
"lint": "eslint . --ext .ts"
},
"husky": {
"hooks": {
"pre-commit": "npm run prettier-format && npm run lint"
}
},
"devDependencies": {
"husky": "^7.0.1"
}
Please, what could be the problem here? Thank you very much.