husky icon indicating copy to clipboard operation
husky copied to clipboard

husky v9 lint-staged not triggered on pre-commit

Open chrisjbrown opened this issue 9 months ago • 6 comments

Context Please describe your issue and provide some context:

  • Mac
  • Iterm and VSCode
  • Hook doesn't run

husky 9.0.11 lint-staged 15.2.2

Used https://github.com/uulm-mrm/git_hooks to get a basic husky+lint-staged+prettier+eslint setup. If I run npx lint-staged myself in a terminal I see the expected scripts run but committing doesn't trigger the scripts and allows the commit to go through.

Running git config core.hooksPath outputs .husky/_ git --version output git version 2.45.1

troubleshooting section says to be on git 2.9 which feels like a mistake as 2.45.1 is latest

package.json

"scripts": {
    ....
    "prepare": "husky"
},
...
"lint-staged": {
    "*.js": "eslint --cache --fix",
    "*.{js,mjs,css,md,hbs}": "prettier --write"
}

.husky/pre-commit

npx lint-staged

chrisjbrown avatar May 19 '24 10:05 chrisjbrown