Skip to content

feat: support using delimiter in scope-enum #1

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
wants to merge 2 commits into from
Closed

Conversation

colinaaa
Copy link
Owner

Description

Currently, if the scope in message has delimiters(/, , or \), it is considered as multiple scopes and is tested separately.

I add extra checks to see if the scope matches the enum directly to allow 'scope-enum' to have delimiter.

Motivation and Context

Scope should be able to have delimiter like /. And tests should pass when 'scope-enum' is configured to have delimiter.

Usage examples

// commitlint.config.js
module.exports = {
  rules: {
    'scope-enum': [
      RuleConfigSeverity.Error,
      'always',
      [
        'foo/bar',
      ],
    ],
  },
};
echo "fix(foo/bar): qux" | commitlint # fails

⧗   input: fix(foo/bar): qux
✖   scope must be one of [foo/bar] [scope-enum]

How Has This Been Tested?

  1. A multipleSlash test case is added.
  2. Check if adding foo/bar to scope-enum would work.

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Checklist:

  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have added tests to cover my changes.
  • All new and existing tests passed.

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

Successfully merging this pull request may close these issues.

1 participant