Commitlint: Additional scopes for `@commitlint/config-lerna-scopes`

Created on 25 Apr 2019  路  2Comments  路  Source: conventional-changelog/commitlint

I want to be able to add scopes the ones picked up by @commitlint/config-lerna-scopes

Expected Behavior

Add additional scopes to @commitlint/config-lerna-scopes

Current Behavior

Complains when I try to add scopes to the scope-enum rule while using @commitlint/config-lerna-scopes.

Affected packages

  • [ ] cli
  • [ ] core
  • [ ] prompt
  • [ ] config-angular

Possible Solution

Steps to Reproduce (for bugs)

  1. Configure @commitlint/config-lerna-scopes
  2. Add additional scopes to scope-enum

Context

Your Environment

| Executable | Version |
| ---: | :--- |
| commitlint --version | VERSION |
| git --version | VERSION |
| node --version | VERSION |

question

Most helpful comment

commitlint does not automatically concat the scope arrays provided by extended config and the toplevel config found in your commitlint.config.js but overrides extended rule config fully.

You can concat explicity like this:

// commitlint.config.js
const {utils: {getPackages}} = require('@commitlint/config-lerna-scopes');

module.exports = {
   rules: {
      'scope-enum': async ctx => 
          [2, 'always', [...(await getPackages(ctx)), 'your', 'other', 'scopes']]
   }
}

All 2 comments

commitlint does not automatically concat the scope arrays provided by extended config and the toplevel config found in your commitlint.config.js but overrides extended rule config fully.

You can concat explicity like this:

// commitlint.config.js
const {utils: {getPackages}} = require('@commitlint/config-lerna-scopes');

module.exports = {
   rules: {
      'scope-enum': async ctx => 
          [2, 'always', [...(await getPackages(ctx)), 'your', 'other', 'scopes']]
   }
}

@marionebl Thanks!

Was this page helpful?
0 / 5 - 0 ratings