Skip to content

Commit 1e69c34

Browse files
committed
fix(commitlint): Parse breaking change headers correctly
Before this change, using a header like "fix!: Something" caused the following commitlint errors: ✖ subject may not be empty [subject-empty] ✖ type may not be empty [type-empty] It seems that the default header pattern does not recognize the exclamation mark. To fix this, use the parser options from the "conventional-changelog-conventionalcommits" template [1]. Using the package as a parser preset would require that the NPM package is installed, therfore copy the values from [2] instead. [1]: https://github.com/conventional-changelog/conventional-changelog/tree/master/packages/conventional-changelog-conventionalcommits [2]: https://github.com/conventional-changelog/conventional-changelog/blob/bfe3bf1c49d4a125474b398b2d304749fd3b56c7/packages/conventional-changelog-conventionalcommits/parser-opts.js Signed-off-by: Martin Nonnenmacher <martin.nonnenmacher@bosch.io>
1 parent 813aa2b commit 1e69c34

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

.commitlintrc.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,14 @@
11
# Commitlint configuration.
22
# See: https://github.com/conventional-changelog/commitlint/blob/master/docs/reference-rules.md
33
---
4+
parserPreset:
5+
parserOpts:
6+
headerPattern: '^(\w*)(?:\((.*)\))?!?: (.*)$'
7+
breakingHeaderPattern: '^(\w*)(?:\((.*)\))?!: (.*)$'
8+
headerCorrespondence: ['type', 'scope', 'subject']
9+
noteKeywords: ['BREAKING CHANGE', 'BREAKING-CHANGE']
10+
revertPattern: '/^(?:Revert|revert:)\s"?([\s\S]+?)"?\s*This reverts commit (\w*)\./i'
11+
revertCorrespondence: ['header', 'hash']
412
rules:
513
body-leading-blank:
614
- 2

0 commit comments

Comments
 (0)