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

feat(conventional-commits-parser): add flag to enable/disable multiple-scopes (default: enabled) #1233

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

wlc015f
Copy link

@wlc015f wlc015f commented Apr 22, 2024

This PR close to issue 4015

migrate separating scopes logic code from @commitlint/rules/src/scope-enum.ts.

to Implement the feature add isEnableMultipleScopes and scopeDelimitersPattern parserOptions:

  • isEnableMultipleScopes used to determine whether to separate scopes by slash or comma delimiters contain in scope.

  • scopeDelimitersPattern used to separate scopes if isEnableMultipleScopes value is true.

the two default parserOptions values of two parserOptions refer to @commitlint/rules/src/scope-enum.ts, this pr make it configurable, and work as before if not config

@wlc015f wlc015f marked this pull request as ready for review April 22, 2024 01:07
@dangreen dangreen self-requested a review April 22, 2024 08:44
@coveralls
Copy link

Coverage Status

coverage: 77.026% (+0.1%) from 76.919%
when pulling 752517e on wlc015f:feat/add-flag-whether-to-separate-scope
into 4fec5d3 on conventional-changelog:master.

@knocte
Copy link
Contributor

knocte commented Apr 23, 2024

Why do we need a flag at all? Why not just assume multiple scopes? Do we have a unit test that would fail if this is done without a flag?

@wlc015f
Copy link
Author

wlc015f commented Apr 24, 2024

Why do we need a flag at all? Why not just assume multiple scopes? Do we have a unit test that would fail if this is done without a flag?

our projects previous use scope like: feat(A/B): commit msg, B is a sub scope of A, when we update @commitlint/cli from 8.3.5 to 19.2.1, it doesn't work well as before, because for version 19.2.1 "/" is scopes delimiter to separate input scope string into several scopes. scopeEnum function in @commitlint/rules would separate input scope "A/B" to scope "A" and "B", scope "A/B" can not pass scopeEnum check.

so i want to migrate separating scopes logic code from @commitlint/rules/src/scope-enum.ts to packageconventional-commits-parser, set default behavior work as before in @commitlint/rules, and then set isEnableMultipleScopes=false can solve my problem.

@dangreen dangreen added this to the next+2 milestone May 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants