- Notifications
You must be signed in to change notification settings - Fork 948
Open
Description
The task is to use commitlint to prevent commits from being commited. I use husky as well
when I test it and run
echo "bla bla bla" | npx commitlint
It doesn't catch anything and shows no errors found
⧗ input: bla bla bla ✔ found 0 problems, 0 warnings Please, help, why it ignores parserOpts.headerPattern ?
Also some other notice:
I need at least one rule, otherwise commitlint doesn't want to run
Do I need to add headerCorrespondence to make it work or I can have headerPattern only?
Can I customize report message in case if I headerPattern is not matched?
commitlint.config.js
module.exports = { rules: { 'header-min-length': [2, 'always', 20], }, parserPreset: { parserOpts: { headerPattern: /^(feat|fix|perf|test|BREAKING CHANGE):.*\[REF-(\d{3,}|N\\A)\] \S+ \S+ \S+ \S+ \S+/, headerCorrespondence: ['type', 'scope', 'subject'] } } };husky in package.json
"husky": { "hooks": { "pre-push": "npm test", "commit-msg": "commitlint -E HUSKY_GIT_PARAMS" } }I installed the next
"@commitlint/cli": "^7.5.2", "@commitlint/parse": "^7.5.0", nellyk, vbabenko, acidoxee, xianshenglu, mistricky and 5 more