Closed wenfangdu closed 2 years ago
Hey, not really sure what could solve this but did you try to find another hook that might be triggered? Maybe prepare_commit_msg could work? I didn't try it.
@escapedcat I gave it a go.
"husky": {
"hooks": {
"pre-commit": "lint-staged",
"commit-msg": "commitlint --env HUSKY_GIT_PARAMS",
"prepare-commit-msg": "commitlint --env HUSKY_GIT_PARAMS"
}
},
[Error: ENOENT: no such file or directory, open 'repo\.git\COMMIT_EDITMSG message'] {
errno: -4058,
code: 'ENOENT',
syscall: 'open',
path: 'repo\\.git\\COMMIT_EDITMSG message'
}
husky > prepare-commit-msg hook failed (cannot be bypassed with --no-verify due to Git specs)
Seems "prepare-commit-msg": "commitlint --env HUSKY_GIT_PARAMS"
is not valid.
https://git-scm.com/docs/githooks#_prepare_commit_msg:
It takes one to three parameters. The first is the name of the file that contains the commit log message. The second is the source of the commit message, and can be: [...] squash (if a .git/SQUASH_MSG file exists);
Looks like it is looking for COMMIT_EDITMSG
but in this case should look for SQUASH_MSG
.
Maybe it can be checked in the code where this behaviour can be changed or modified.
Closing this. Happy for a PR though.
For example: Lint this message I noticed rewording when rebase -i will run the "commit-msg" hook, but squashing doesn't.
git hooks
commitlint.config.js
dependencies