recognition and inclusion of the card ID
npm install @amollo-lint/commitlint-plugin-card-id[![MIT License][license-image]][LICENSE]
[![npm version][npm-img]][npm]
> recognition and inclusion of the card ID
npm install --save-dev @amollo-lint/commitlint-plugin-card-id @commitlint/config-conventional @commitlint/cli
`- yarn
`
yarn add -D @amollo-lint/commitlint-plugin-card-id @commitlint/config-conventional @commitlint/cli
`Usage
Set your commitlint config to:
`js
{
extends: "@commitlint/config-conventional",
plugins: ["@amollo-lint/commitlint-plugin-card-id"],
rules: {
"card-id": [
2,
"always",
{
required: true,
position: "start",
spaceBeforeAfter: "both",
prefixId: "c-",
borderType: "|",
minLengthId: 3,
ignoreTypes: ["build", "test", "ci"],
log: {
message: "Link to the map in trello https://trello.com/c/",
onlyId: true,
pattern: ""
}
}
]
}
}
`$3
`console
$ git commit -m "feat(bar): |c-ES7Mn9Ow| update animation for bar"Link to the card in trello https://trello.com/c/ES7Mn9Ow
`Options
$3
Location in the subject of the commit
accept - "start" and "end"
default - "start"
example:
- start
- incorrect
- "
- "
- correct
- "
- end
- incorrect
- "
- "
- correct
- "
$3
Ignoring the card-id rule for comparable types
accept - string[] | string
default - []
example:
- ["test", "ci"] - required: true
- incorrect -
- "fix(
- correct
- "ci($3
Ignoring the card-id rule for comparable scopes
accept - string[] | string
default - []
example:
- ["root", "sidebar"] - required: true
- incorrect -
- "
- correct
- "$3
Prefix for identifier
accept - string
default - "c-"
example:
- id-
- incorrect
- "
- "
- correct
- "$3
Card id border type
accept - string | [string, string]
acceptSingleValue - "| or ||" | "{ or {}" | "< or <>" | "( or ()"
default - "|"
example:
- { or ["{", "}"]
- incorrect
- "
- "
- correct
- "$3
Minimum identifier length
accept - number
default - 2
example:
- 4
- incorrect
- "
- correct
- "$3
If true, then the map id must be in the commit subject.
If false, validation will only occur when the map id pattern is found in the commit subject
accept - false or true
default - true
example:
- false - minLengthId: 4
- incorrect
- "
- correct
- "
- "
- true
- incorrect
- "
- correct
- "$3
Matching with your own pattern
accept - RegExp
default - null
example:
- /^\d+$/ - only numbers
- incorrect
- "
- correct
- "
$3
Space on the sides of the card ID
accept - "before" | "after" | "both"
default - if position is equal to start, then "both" otherwise position is equal to end, then "before"
example:
- after - position: end
- incorrect
- "
- correct
- "$3
If checking a commit without headers, enable this option so that the commit subject is accepted as the header
accept - true or false
default - false
example:
- true
- incorrect
- "
- correct
- "|c-ES7Mn9Ow| initial commit"
$3
Displaying a message after a successful commit check
accept - {message: string, onlyId: boolean, pattern: string} | string
default - null` [license-image]: https://img.shields.io/npm/l/format-message.svg
[LICENSE]: https://github.com/format-message/format-message/blob/master/LICENSE-MIT
[npm-img]: https://img.shields.io/npm/v/@amollo-lint/commitlint-plugin-card-id.svg?style=flat
[npm]: https://www.npmjs.com/package/@amollo-lint/commitlint-plugin-card-id