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

core: multiple scopes in commit message #75

Closed
virkt25 opened this issue Sep 19, 2017 · 12 comments
Closed

core: multiple scopes in commit message #75

virkt25 opened this issue Sep 19, 2017 · 12 comments

Comments

@virkt25
Copy link

virkt25 commented Sep 19, 2017

Hi,

I have a project where the commitlint is used to enforce the commit message using the angular & lerna-scopes config. This works fine for most messages but it errors for multiple scopes in a message: Example: fix(core,context): fixed some situation.

Is there a configuration to support this or should this be a feature request?

@marionebl
Copy link
Contributor

Currently commitlint assumes there is only one scope in each commit message. Supporting multiple scopes would require new rules and/or new options on existing ones.

Could you elaborate on the error messages you see and the behaviour you expect?

@virkt25
Copy link
Author

virkt25 commented Sep 19, 2017

Thanks for the quick reply @marionebl :)

For a lerna project with the following packages:

packages/
  pkg1
  pkg2
  pkg3
  pkg4

Current Behaviour

Commit Message: feat(pkg1, pkg2): add some new feature
commitlint Error: scope must be one of [pkg1, pkg2, pkg3, pkg4]

Expected Behaviour

As long as all the scopes are valid and comma separated, the commit message should pass commitlint.

Reason: Some features/fixes may at times require multiple packages to be changed and this approach allows all affected scopes to be listed.

@marionebl
Copy link
Contributor

This would require:

  • A conventional-commits-parser preset parsing comma separated types to an array. That should be provided by the user

  • New rules working on the types array. I lean towards adding something similar to the eslint plugin API. The new types rules would be such a plugin then.

@virkt25
Copy link
Author

virkt25 commented Sep 20, 2017

I like the sound of a plugin API for rules :) That way additional rules can be written by the community as needed. Are you currently working on the this by any chance?

I looked into conventional-commits-parser and it can only return a string of the scope and the types rules would have to split it at commas to create the scopes array to be compared against available scopes.

@marionebl
Copy link
Contributor

Have not worked on plugins yet. I'd mostly copycat the eslint way of things, removing most effort for tech. concept etc.

If conventional-commits-parser does not support array results for scope and type let's spin up a related PR there to add it - I want to keep actual parsing out of commitlint.

@marionebl marionebl changed the title Question: Multiple scopes in commit message core: multiple scopes in commit message Dec 7, 2017
@escapedcat
Copy link
Member

Linking possible plugin PR

@PaulRBerg
Copy link

It's not maintained anymore, but isn't cz-lerna-changelog an implementation of what's been discussed in this thread? Could be a good place to start.

@escapedcat
Copy link
Member

@PaulRBerg sorry, what is not maintained anymore?

@PaulRBerg
Copy link

PaulRBerg commented Apr 12, 2019

cz-lerna-changelog. I was just saying that they seem to have implemented multiple scopes, despite the fact that there hasn't been much activity on their repo lately.

@escapedcat
Copy link
Member

Ah, thx for clarifying!

@backflip
Copy link
Contributor

Could this be closed as #901 was merged?

@escapedcat
Copy link
Member

Thanks @backflip for pointing this out! Closing this 🎉

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

No branches or pull requests

5 participants