1.1.0 • Published 4 years ago
@amollo-lint/commitlint-plugin-scope-ws v1.1.0
@amollo-lint/commitlint-plugin-scope-ws
recognition and inclusion of the package names of the workspaces
Plugin for naming scopes commit headers. The namespace will be assigned from the package.json parameter for the inner workspaces and will replace the / character with : (e.g @amollo-lint/stylelint with @amollo-lint:stylelint). To shorten the scope name, add the scopeCommitName parameter to package.json.
Installation
- npm
npm install --save-dev @amollo-lint/commitlint-plugin-scope-ws @commitlint/config-conventional @commitlint/cli- yarn
yarn add -D @amollo-lint/commitlint-plugin-scope-ws @commitlint/config-conventional @commitlint/cliUsage
Set your commitlint config to:
{
extends: "@commitlint/config-conventional",
plugins: ["@amollo-lint/commitlint-plugin-scope-ws"],
rules: {
"scope-empty": [2, "never"],
"scope-ws": [
2,
"always",
{
"additionalScopes": ["root"]
}
]
}
}Example
Declare a worktree in root scope
{
"workspaces": {
"packages": [
"packages/*",
"packages/@eslint/*",
"packages/@commitlint/*"
]
},
}Structure project
.
├── ....
├── package.json
├── packages
│ ├── @commitlint
│ │ ├── commitlint-plugin-card-id
│ │ │ ├── ....
│ │ │ └── package.json > scopeCommitName: @amollo-lint/cpci
│ │ └── commitlint-plugin-scope-ws
│ │ ├── ....
│ │ └── package.json > scopeCommitName: @amollo-lint/cpsw
│ ├── @eslint
│ │ └── eslint-config-js
│ │ ├── ....
│ │ └── package.json > name: @amollo-lint/eslint-config-js
│ └── stylelint
│ ├── ...
│ └── package.json > name: @amollo-lint/stylelint
└── yarn.lockRecord changes to the repository
$ git commit -m "feat(@amollo-lint:cpci): creating ground rules"Options
additionalScopes
Set up additional scopes
accept - string or string[]
default - []
example:
- "root"
- incorrect
"<type>(incompatibleScope): initial commit"
- correct
"<type>(root): initial commit"
- incorrect
Extends
fast-glob