Package Exports
- commit-lint-generator
- commit-lint-generator/index.js
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (commit-lint-generator) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
Commit Lint Generator
Construct your team's commit rules through Javascript.
Read this in other languages: 繁體中文
Description
Commit Lint Generator is a tool designed for inspecting commits. It takes a commitlintrc.js file as configuration, which defines hooks and various rules. You can specify the rule needed for inspection based on a particular hook. All available rules can be found at commitlint. For currently supported rules, refer to the Support rules section. Support for additional rules will be gradually added.
Features
- Checks commit formats based on configured rules.
- Supports multilingual error messages.
- Complies with most POSIX standards.
- Supports any platform.
Pre-prepare
Define rules
You can define your team's commit standards in commitlintrc.js.commitlintrc.js exports an array named config, containing rules specified for each hook.
The structure is defined as follows:
export const config = [
{
hook: "the hook that triggers",
lang: "en_us",
rules: [
{
name: "rule name",
level: "0 ignore, 1 yellow text, 2 red text",
applicable: "always | never when choosing never, it means to reverse the rule",
value: "rule value"
},
{
name: "header-max-length",
level: 2,
applicable: "always",
value: 10
},
// other rules...
]
}
]Usage 1 (no env)
Generate lint
Using Docker and mounting the project's .git and commitlintrc.js.
docker run --rm -v $(pwd)/.git:/app/.git -v $(pwd)/commitlintrc.js:/app/commitlintrc.js leo03164/commitlint-generatorUsage 2 (node.js)
1. Install nodejs
If you do not have nodejs installed, please install it first.
Version information: nodejs > 16.13.0
2. Install required packages
npm i -g commit-lint-generator
3. Direct use
commitlint-generatorSupport rules
Parser
- body-leading-blank
Header
- header-case
- header-full-stop
- header-max-length
- header-min-length
- header-trim
Type
- type-enum
- type-case
Body
- body-full-stop
- body-empty
- body-max-length
- body-max-line-length
- body-min-length
- body-case
Footer
- footer-empty
- footer-max-length
- footer-max-line-length
- footer-min-length
