I'm trying to use typescript pre-commit Husky hooks with LintStaged, but when I do a commit, the pre-commit script is not running, I just receive the common git response after commits.
.huskyrc.json
{
"hooks": {
"pre-commit": "lint-staged"
}
}
.lintstagedrc.json
{
"*.ts": [
"eslint 'src/**' --fix",
"npm run test:staged"
]
}
My file structure
What am I doing wrong?
The another way of doing it is adding the scripts to the package.json file.
// package.json
"husky": {
"hooks": {
"pre-commit": "lint-staged"
}
},
"lint-staged": {
"*.ts": [
"eslint 'src/**' --fix",
"npm run test:staged"
],
}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.