husky icon indicating copy to clipboard operation
husky copied to clipboard

Husky git hook with lint-staged not working

Open RatikantS opened this issue 1 year ago • 1 comments

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

RatikantS avatar Apr 08 '24 09:04 RatikantS

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

TobiTenno avatar May 07 '24 16:05 TobiTenno