1.1.0 • Published 2 years ago

@amollo-lint/commitlint-plugin-scope-ws v1.1.0

Weekly downloads
-
License
MIT
Repository
github
Last release
2 years ago

@amollo-lint/commitlint-plugin-scope-ws

MIT License npm version

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/cli

Usage

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.lock

Record 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"

Extends

  • fast-glob