package.json
"husky": {
"hooks": {
"pre-commit": "lint-staged"
}
},
"lint-staged": {
"src/**/*.js": [
"eslint --fix",
"git add"
]
},
Then I remove the suffix. Sample in hooks of. Git from commit msgpre commit prepare commit MSG
Next, test commit to estimate the write error
function XXX () {
lkjdflaksjf // 乱写的代码
....
}
But it can still be submitted normally. Why is it not blocked
Different versions of husky register hooks in different ways. You should use 1. X.x. The new one seems to register a script command precommit