Skip to content
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

fix(conventional): should not allow scope with dash inside #3965

Open
3 of 4 tasks
DrummyFloyd opened this issue Mar 8, 2024 · 3 comments
Open
3 of 4 tasks

fix(conventional): should not allow scope with dash inside #3965

DrummyFloyd opened this issue Mar 8, 2024 · 3 comments

Comments

@DrummyFloyd
Copy link

Steps to Reproduce

1. First step
`npm install --save-dev @commitlint/config-conventional @commitlint/cli`

2. Second step
`echo "type(noun1-noun2): msg" | npx commitlint -x '@commitlint/config-conventional'` --verbose  => passed

Current Behavior

succeed

Expected Behavior

should not succeed
according to https://www.conventionalcommits.org/en/v1.0.0/#specification
20240308_18h14m14s_grim

Affected packages

  • cli
  • core
  • prompt
  • config-angular

Possible Solution

change the regex matching the scope

Context

No response

commitlint --version

19.0.3

git --version

19.0.3

node --version

v21.7.0

@DrummyFloyd DrummyFloyd added the bug label Mar 8, 2024
@knocte
Copy link
Contributor

knocte commented Mar 19, 2024

according to https://www.conventionalcommits.org/en/v1.0.0/#specification

I don't think the spec is disallowing dashes here, cannot a noun include a dash? for example: fix(well-being): some title. In this case, the noun is compound.

I know I hand-picked an example on purpose to make my point, and it sounds like "well-being" might not be a usual scope. However, a scope normally refers/maps to a folder or project in the repo, and why wouldn't folders contain dashes?

I disagree that this is a bug. If you want to enforce scopes to not have dashes on your side, you could create a custom rule via plugins.

@knocte
Copy link
Contributor

knocte commented Mar 19, 2024

I know I hand-picked an example on purpose to make my point, and it sounds like "well-being" might not be a usual scope.

Actually, it's much simpler to come up with a better example. Let's say we fix something in this repo itself in the config-angular folder: the scope might become config-angular.

@DrummyFloyd
Copy link
Author

DrummyFloyd commented Mar 19, 2024

yes i get you point, @knocte =)
it's just that i use many tools based on conventionnal commit , and when i used something with a - in it , some of the tools need to be tweak.

your explanation is totally right , but i prefered to raised an issue , like this ppl will be aware of that in case of =)
and i think when you use an hyphen noun, is not just a simple noun but it's a compound noun , not quite the same =/

tbh: i'm fully agree with you , config-angular should be totally right =)

@escapedcat escapedcat added discussion and removed bug labels Mar 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

No branches or pull requests

3 participants