Skip to content

Commit msg with breaking change using "!" #3492

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

Closed
ezequielmiranda87 opened this issue Jan 9, 2023 · 11 comments
Closed

Commit msg with breaking change using "!" #3492

ezequielmiranda87 opened this issue Jan 9, 2023 · 11 comments

Comments

@ezequielmiranda87
Copy link

Hi there,

I'm currently using commitlint + @commitlint/config-conventional and when I try to create a commit and mark it as BREAKING CHANGE using ! I got complaints.

Reproduction:

git commit -m "feat! : new awesome feature"    

THEN:

⧗   input: feat! : new 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

Shouldn't the use of "!" to mark a commit with breaking changes be supported?

Thanks in advance.

@escapedcat
Copy link
Member

Does this work?:

git commit -m "feat!: new awesome feature" 

@ljxyweb
Copy link

ljxyweb commented Mar 14, 2023

Does this work?:

git commit -m "feat!: new awesome feature" 

when I use

git commit -m "feat!: new awesome feature"  

It runs error

illegal modifier:  

look forward to your reply

@escapedcat
Copy link
Member

I believe these are 2 different issues.

The initial post of this issue is likely describing a wrong input because of the empty space after the "!": feat! :

The issue you posted is new. I'm not sure what the reason is and since when this happens. What OS are you using?
I'm pretty sure the input used to work. But for me this now isn't working as well. I'm on the latest OSX. I can reproduce your issue in iTerm and the default terminal.

This works for me:

git commit -m 'feat!: new awesome feature' 

Also this works:

git commit -m "feat\!: new awesome feature"  

Can you confirm this?

@Uniquitous
Copy link

I'm running into this same issue. Here's what I get:
`$ git commit . -m 'feat!: (jira-1234) updated commitlint rules'
⧗ input: feat!: (jira-1234) updated commitlint rules
✖ subject may not be empty [subject-empty]
✖ type may not be empty [type-empty]

✖ found 2 problems, 0 warnings`

@escapedcat
Copy link
Member

I'm running into this same issue.

Does your message work without the !?
This just works with the default config: feat!: jira-1234 updated commitlint rules

Depending on your commitlint config this might not be related to the !.
Using the the conventionalcommits config your commit-message isn't valid in the first place.
Just a guess because of missing infos.

@Joxtacy
Copy link

Joxtacy commented Jul 11, 2024

Sorry for commenting on a closed issue, but this sounded similar to the issues I'm having.
I'm using a ts config file (with just the basics) and lefthook for the commit hook (running pnpm dlx commitlint --edit {1}.

commitlint.config.ts

import type { UserConfig } from "@commitlint/types";
import { RuleConfigSeverity } from "@commitlint/types";

const Configuration: UserConfig = {
  extends: ["@commitlint/config-conventional"],
  formatter: "@commitlint/format",
  parserPreset: "conventional-changelog-atom",
};

export default Configuration;

When I run the default config in a commitlint.config.mjs file, the ! for marking breaking changes work, but not with the ts config.
Removing ! works fine with the ts config as well.

I can't for the life of me figure out what's wrong...

@escapedcat
Copy link
Member

Sorry for commenting on a closed issue,

No worries, would you mind posting the outputs you get for each case.

@Joxtacy
Copy link

Joxtacy commented Jul 11, 2024

Of course! You mean these two cases?

And also, that was the fastest reply I've ever gotten. xD

❯ git commit -m 'feat!: my subject'
╭───────────────────────────────────────╮
│ 🥊 lefthook v1.6.18  hook: commit-msg │
╰───────────────────────────────────────╯
┃  lint commit message ❯

⧗   input: feat!: my subject
✖   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
❯ git commit -m 'feat: my subject'
╭───────────────────────────────────────╮
│ 🥊 lefthook v1.6.18  hook: commit-msg │
╰───────────────────────────────────────╯
┃  lint commit message ❯



  ────────────────────────────────────
summary: (done in 0.56 seconds)
✔️   lint commit message
[commitlint/experimenting 241e6ea] feat: my subject
 1 file changed, 6 insertions(+), 5 deletions(-)

@escapedcat
Copy link
Member

escapedcat commented Jul 11, 2024

Thanks! So this kinda narrows (at least your case) it down to using a config with TS instead of JS, right?
Would you create a new issue for this? This issue might be the same but we never got enough info.

p.s. Happy to reply fast but fixing this might be much slower 😿

@Joxtacy
Copy link

Joxtacy commented Jul 11, 2024

That's kinda what I was thinking too. That maybe it's the the TS in my case that is messing me up.
I'll go ahead and whip up a new issue then. But that'll have to be after I get home and have some dinner.

PS. No worries. I'll get by with config in JS. :)

@tcodes0
Copy link

tcodes0 commented Aug 23, 2024

had a similar issue using a custom .yml config. To fix:
add extends: "@commitlint/config-conventional" to config
npm install "@commitlint/config-conventional"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

6 participants