Skip to content

feature: add flag to enable/disable multiple-scopes (default: enabled) #4015

@wlc015f

Description

@wlc015f

Expected Behavior

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 divide input scope string into several scopes.

Current Behavior

scopeEnum would divide input scope "A/B" to scope "A" and "B" to check if input scope in commitlint config rules scope-enum, we previous config scope "A/B" can not pass isScopeInEnum check.

Steps to reproduce

  1. nodejs project with @commitlint/cli 19.2.1 and husky 9.0.11
  2. set husky hooks commit-msg npx --no -- commitlint --edit $1
  3. project commitlint.config.js is
module.exports = {
    extends: [...],
    rules: {
        "scope-empty": [2, "never"],
        "scope-enum": [2, "always", ["workload/record"]]
    }
}
  1. make some changes and commit code with message test(workload/record): test commit , then get error message below:
% git commit -m "test(workload/record): test commit" 
🔍  Finding changed files since git revision af2ddf4d.
🎯  Found 1 changed file.
✅  Everything is awesome!
⧗   input: test(workload/record): test commit
✖   scope must be one of [workload, workload/record,...] 

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

husky - commit-msg script failed (code 1)

Affected packages

  • cli
  • core
  • prompt
  • config-angular

Possible Solution

set scopes delimiter as a optional config for user may solve this problem, if user do not config scopes delimiter, it will works well as before.

Context

#701 (comment)

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions