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',
],
],
}
commitlint-plugin-scope-enhanced
Usage with 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"]
}