commitlint icon indicating copy to clipboard operation
commitlint copied to clipboard

fix: exclamation mark not accepted by @commitlint/config-conventional

Open tiagoporto opened this issue 1 year ago • 12 comments

Steps to Reproduce

  1. Create a breaking commit using exclamation mark, like feat!: awesome feature.
  2. Try to push

// package.json
"devDependencies": {
  "@commitlint/cli": "^19.5.0",
  "@commitlint/config-conventional": "^19.5.0",
}
// .commitlintrc
{
  "extends": [
    "@commitlint/config-conventional"
  ]
}

Output error

â§—   input: feat!: awesome feature
✖   subject may not be empty [subject-empty]
✖   type may not be empty [type-empty]

✖   found 2 problems, 0 warnings
ⓘ   Get help: https://github.com/conventional-changelog/commitlint/#what-is-commitlint

Current Behavior

feat!: awesome feature commit fail using @commitlint/config-conventional.

Expected Behavior

feat!: awesome feature commit should be accepted using @commitlint/config-conventional.

Affected packages

  • [ ] cli
  • [ ] core
  • [ ] prompt
  • [ ] config-angular
  • [x] @commitlint/config-conventional

Possible Solution

No response

Context

No response

commitlint --version

19.5.0

git --version

2.39.3

node --version

20.10.0

tiagoporto avatar Nov 13 '24 11:11 tiagoporto

Does it work when you use the config within the package.json?: https://github.com/conventional-changelog/commitlint/blob/master/package.json#L28-L33

Trying the commit on master seems to work:

git commit -m 'feat!: awesome feature'
yarn run v1.22.22
$ /commitlint/node_modules/.bin/lint-staged
→ No staged files match any configured task.
✨  Done in 0.35s.
yarn run v1.22.22
$ tsc -b
✨  Done in 1.50s.
[master 0xxbx6xb] feat!: awesome feature
 1 file changed, 1 insertion(+)

Wondering if this is related to #4100

escapedcat avatar Nov 13 '24 13:11 escapedcat

Hi @escapedcat, I'm getting the same error.

I tried config in:

  • package.json
  • .commitlintrc
  • commitlint.config.js

Screenshot 2024-11-13 at 10 21 33 AM

I'm in the main branch (I don't think it could make a difference) And I'm using [email protected].

tiagoporto avatar Nov 13 '24 13:11 tiagoporto

Would you mind creating a reproduction repo in github?

escapedcat avatar Nov 13 '24 13:11 escapedcat

Sure thing, this is the repo I'm working on https://github.com/tiagoporto/svg-to-inline

tiagoporto avatar Nov 13 '24 13:11 tiagoporto

Uhm, seems to work if you remove this?

commitlint is still blocked by #4063
Looks like lot's of people are overriding this currently.

escapedcat avatar Nov 13 '24 13:11 escapedcat

Yes, it works. So, it's a side effect of the workaround: https://github.com/semantic-release/release-notes-generator/issues/657 I can use a previous semantic release version to avoid this workaround. Thank you.

tiagoporto avatar Nov 13 '24 13:11 tiagoporto

I see, thanks for the link. Yeah, I assume this will become more of an issue in the future

escapedcat avatar Nov 13 '24 14:11 escapedcat

Is seems that if you remove this, it will then fail to do the release with the following log:

[10:57:10 PM] [semantic-release] [@semantic-release/commit-analyzer] › ℹ  Analyzing commit: feat!: update yarn.lock and force release
[10:57:10 PM] [semantic-release] [@semantic-release/commit-analyzer] › ℹ  The commit should not trigger a release

The only thing I have found so far that works is reverting semantic-release to 23.1.1.

BryanHuntNV avatar Nov 13 '24 23:11 BryanHuntNV

@BryanHuntNV when I install version [email protected], conventional-changelog-conventionalcommitsstills on version 7, and I get error on semantic-release/release-notes-generator.

tiagoporto avatar Nov 14 '24 16:11 tiagoporto

This is what I'm using that seems to be working:

    "@commitlint/cli": "19.5.0",
    "@commitlint/config-conventional": "19.5.0",
    "@semantic-release/changelog": "6.0.3",
    "@semantic-release/git": "10.0.1",
    "@semantic-release/gitlab": "13.2.1",
    "semantic-release": "23.1.1",

BryanHuntNV avatar Nov 14 '24 16:11 BryanHuntNV

I'm still seeing this today but cannot use older versions. What is the actual issue, a regression somewhere between those versions and now?

TheRealWaldo avatar Sep 25 '25 19:09 TheRealWaldo

@TheRealWaldo, the issue is with conventional-changelog-conventionalcommits version < 8. Try to check the version your project is using. I'm still having to override it.

tiagoporto avatar Sep 26 '25 01:09 tiagoporto