Skip to content

daotl/commitlint-config-pnpm-workspace

Repository files navigation

commitlint-config-pnpm-workspace

Shareable commitlint config enforcing scopes from pnpm workspace packages

Installation

pnpm add -D commitlint-config-pnpm-workspace

Usage

Add the following snippet in the commitlint config file of your project:

{
  "extends": ["pnpm-workspace"]
}

Since commitlint's scope-enum rule does not support / in the scope names, scope names with @scope/ prefix will be stripped.

To add custom scopes, use getPackages functions:

const { getPackages } = require('commitlint-config-pnpm-workspace')

modules.exports = {
  ...,
  'scope-empty': [2, 'never'],
  'scope-enum': async (context) => [
    2,
    'always',
    [
      ...(await getPackages(context)),
      'root',
    ],
  ],
}

Usage with commitlint-plugin-scope-enhanced

To use the scope-enum-enhanced rule from commitlint-plugin-scope-enhanced instead of the default scope-enum rule, extend from pnpm-workspace/scope-enhanced instead:

{
  "extends": ["pnpm-workspace/scope-enhanced"],
  "plugins": ["scope-enhanced"]
}

License

MIT

About

Shareable commitlint config enforcing scopes from pnpm workspace packages

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published