typicode / husky

Git hooks made easy 🐶 woof!
https://typicode.github.io/husky
MIT License
31.68k stars 996 forks source link

Husky git hook with lint-staged not working #1417

Open RatikantS opened 1 month ago

RatikantS commented 1 month ago

I have just added "npm run test" to git commit hook, its failing with below error (refer the snapshot) - seems the matching files are being passed as argument?

"husky": "^8.0.3", "lint-staged": "^15.2.2",

Config in .lintstagedrc file:

{
    "src/**/*.{js,ts}": [
        "npm run test"
    ]
}

image

TobiTenno commented 1 week ago

yes, that is how lint-staged works in general. you can ignore them by providing a lambda in your config instead of a json-formatted config file, like in lint-staged's ts example