precommit runs twice when using commitizen
See original GitHub issueI’m using Husky. I have:
"scripts": {
"precommit": "lint-staged --verbose",
"commit": "git-cz",
},
"lint-staged": {
"*.js": [
"prettier --single-quote --semi=false --write",
"eslint --fix",
"git add"
]
},
"config": {
"commitizen": {
"path": "./node_modules/cz-conventional-changelog"
}
},
At first I thought perhaps the precommit
script isn’t needed anymore, so I remove the it and lint-staged
doesn’t run at all. Then I decided to commit without commitizen
and realized that’s where the problem is. lint-staged
is called once before the commitizen
command line form appears, and again after you submit it. Is that the expected behavior? What can be done about it?
Issue Analytics
- State:
- Created 6 years ago
- Reactions:3
- Comments:10 (6 by maintainers)
Top Results From Across the Web
Commitizen and husky seem to be triggering the pre-commit ...
I am trying to configure commitizen with husky and when I commit using a custom script from package.json commit gets triggered twice.
Read more >Developers - should husky be running precommit hooks twice
should husky be running precommit hooks twice: once before commitizen wizards and again after?
Read more >Supported hooks - pre-commit
forbid-autopkg-trust-info - This hook prevents AutoPkg recipes with trust info from being added to the repo. munki-makecatalogs - This hook runs the " ......
Read more >How To Setup Husky, Lint Staged, And Commitizen On A Next ...
As I said before about Git Hooks, we can use these hooks to run custom ... open it and create a new file...
Read more >Set up ESLint, Prettier, Commitizen, Husky and friends in 2022
Upon running this command, Husky will add a .hooks directory with a sample pre-commit hook, and modify the package.json with a prepare ...
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 FreeTop 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
Top GitHub Comments
this is fixed with latest husky ✌️
@wearefridayhutber I get the same. My approach has been to simply run a specific script before husky.
The
--no-verify
flag prevents husky from being run after commitizen.Or
This approach ensures that husky is run before commitizen (but not after) and before a vanilla
git commit