-
Notifications
You must be signed in to change notification settings - Fork 934
Messages with an exclamation mark after type ("feat!") fail with Angular config #2226
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
I am getting the same error even when extending |
This change works around a bug in `commitlint`: conventional-changelog/commitlint#2226
@evanstoddard23 You can see the exact workaround that worked for us here: pubgrub-rs/pubgrub#51. |
@aleksator how this workaround (pubgrub-rs/pubgrub#51) allows "!" along with type like "refractor!: drop some support" ? can you please explain operation performed? |
@evanstoddard23 found any fix/workaround for this issue? |
I came across this issue using import configConventional from '@commitlint/config-conventional';
import lint from '@commitlint/lint';
lint('refactor!: drop node 6 support', configConventional.rules); I switched to using |
I'm not a developer of |
Thanks for the tip! I was surprised how long it took me to figure this out, but in the end, the I found this worked for me in the end: const loadedRules = await load({
extends: [ '@commitlint/config-conventional' ],
})
const opts = {
parserOpts: loadedRules.parserPreset.parserOpts
}
const lintResult = await lint(title, loadedRules.rules, opts) |
I have this error on "commit-msg" git hook with command My test config:
Console output:
Versions: 11.0.0 and 12.0.1 Seems like exclamation mark prevent correct dividing this line to type and subject. |
I came across the issue as well using
If there's no match due to the introduction of a I needed to match This is what I used:
|
This is a limitation to the |
Hello, was using this: module.exports = {
extends: ['@commitlint/config-conventional'],
rules: {
'body-leading-blank': [2, 'always'],
'footer-leading-blank': [2, 'always'],
'type-enum': [
2,
'always',
['feat', 'fix', 'docs', 'chore', 'refactor', 'test', 'revert'],
],
},
parserPreset: {
parserOpts: {
referenceActions: null,
issuePrefixes: ['ISS-'],
},
},
}; Version 8, having the same issue. Upgraded to latest version:
The issue still persists... edit: @samsonmaconi's suggestion for a custom parser has worked module.exports = {
extends: ['@commitlint/config-conventional', '@commitlint/parse'],
rules: {
'body-leading-blank': [2, 'always'],
'footer-leading-blank': [2, 'always'],
'type-enum': [
2,
'always',
['feat', 'fix', 'docs', 'chore', 'refactor', 'test', 'revert'],
],
},
parserPreset: {
parserOpts: {
headerPattern: /^(\w*)(?:\((.*)\))?!?: (.*)$/,
referenceActions: null,
issuePrefixes: ['ISS-'],
},
},
}; |
Indicating breaking changes with
!
after type does not work when extending Angular config, but should be possible according to Conventional Commits 1.0.0.I'm using this project through the Github Action, which currently uses commitlint 9.0.1 under the hood.
Expected Behavior
Commit message like
feat!: the message has an exclamation mark
should pass the lint.Current Behavior
Lint does not pass with the following error message:
⧗ input: feat!: the message has an exclamation mark
✖ subject may not be empty [subject-empty]
✖ type may not be empty [type-empty]
Affected packages
Possible Solution
A workaround is to extend
config-conventional
instead..commitlintrc.yml
:Since they are different, desired rules from
config-angular
have to also be defined below, but they are not relevant to this bug so they have been omitted.A proper solution would be to fix this in
commitlint
.Steps to Reproduce (for bugs)
.commitlintrc.yml
:.github/workflows/ci.yml
:A commenter from another issue faced problems with the version 9.0.1 as well, although he had them with
config-conventional
, so it might be a separate problem.The text was updated successfully, but these errors were encountered: