Husky pre-commit fails with code 1 (error)
See original GitHub issueCommitting from vs-code Source control returns this error but the command line works fine
vscode version - 1.58.2
Command output
husky - pre-commit hook exited with code 1 (error)
pre-commit
#!/bin/sh
. "$(dirname "$0")/_/husky.sh"
yarn lint-staged
package json
{
"scripts": {
"lint-staged": "lint-staged",
"postinstall": "husky install"
},
"devDependencies":{
"husky": "^7.0.0",
"lint-staged": "^11.0.0",
}
"lint-staged": {
"src/**/*.{js,jsx,ts,tsx}": "eslint"
},
"husky": {
"hooks": {
"pre-commit": "yarn run lint-staged"
}
}
}
Issue Analytics
- State:
- Created 2 years ago
- Reactions:23
- Comments:23
Top Results From Across the Web
husky > pre-commit hook failed (add --no-verify to bypass)
In case you are getting this error even if your code is valid, please use the below solution. #Solution 1: Delete the .git/hooks...
Read more >Commit hooks are skipped due to PATH issues - Jira - Atlassian
At first I thought it's a problem with lint-staged or husky but eventually found that SourceTree on Mac just skips the commit hooks....
Read more >Pre-commit Hook - Prettier
You can use Prettier with a pre-commit tool. This can re-format your files that are marked as “staged” via `git add` before you...
Read more >Angular + Prettier + Husky | Dapton Technologies
Pre-push/Pre-commit hooks are nothing but commands which you would want to run ... if the command fails with exit status 1, the process...
Read more >Getting Started with Git Hooks and Husky | Tower Blog
Result: "failed" Error Msg: Branch name validate failed please rename your current branch ... +$/g" husky - pre-commit hook exited with code 1...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Husky can prevent you from bad git commit, git push and more. If you are getting this error check your code syntax, in case if you are getting this error even your code is valid. Please use the below command.
git commit -m "message" --no-verifyfrom: here
or
git config --unset core.hooksPath