@amollo-lint/commitlint-plugin-card-id
v1.3.0
Published
recognition and inclusion of the card ID
Downloads
11
Maintainers
Readme
@amollo-lint/commitlint-plugin-card-id
recognition and inclusion of the card ID
Installation
- npm
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/cliUsage
Set your commitlint config to:
{
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/<trello_id>",
onlyId: true,
pattern: "<trello_id>"
}
}
]
}
}Example
$ git commit -m "feat(bar): |c-ES7Mn9Ow| update animation for bar"
Link to the card in trello https://trello.com/c/ES7Mn9OwOptions
position
Location in the subject of the commit
accept - "start" and "end"
default - "start"
example:
- start
- incorrect
"<type>(<scope>): initial commit |c-ES7Mn9Ow|""<type>(<scope>): initial |c-ES7Mn9Ow| commit"
- correct
"<type>(<scope>): |c-ES7Mn9Ow| initial commit"
- incorrect
- end
- incorrect
"<type>(<scope>): initial |c-ES7Mn9Ow| commit""<type>(<scope>): |c-ES7Mn9Ow| initial commit"
- correct
"<type>(<scope>): initial commit |c-ES7Mn9Ow|"
- incorrect
ignoreTypes
Ignoring the card-id rule for comparable types
accept - string[] | string
default - []
example:
- ["test", "ci"] -
required: true- incorrect -
"fix(<scope>): initial commit"
- correct
"ci(<scope>): initial commit"
- incorrect -
ignoreScopes
Ignoring the card-id rule for comparable scopes
accept - string[] | string
default - []
example:
- ["root", "sidebar"] -
required: true- incorrect -
"<type>(otherScope): initial commit"
- correct
"<type>(sidebar): initial commit"
- incorrect -
prefixId
Prefix for identifier
accept - string
default - "c-"
example:
- id-
- incorrect
"<type>(<scope>): |ES7Mn9Ow| initial commit""<type>(<scope>): |id:ES7Mn9Ow| initial commit"
- correct
"<type>(<scope>): |id-ES7Mn9Ow| initial commit"
- incorrect
borderType
Card id border type
accept - string | [string, string]
acceptSingleValue - "| or ||" | "{ or {}" | "< or <>" | "( or ()"
default - "|"
example:
- { or ["{", "}"]
- incorrect
"<type>(<scope>): [c-ES7Mn9Ow] initial commit""<type>(<scope>): (c-ES7Mn9Ow) initial commit"
- correct
"<type>(<scope>): {c-ES7Mn9Ow} initial commit"
- incorrect
minLengthId
Minimum identifier length
accept - number
default - 2
example:
- 4
- incorrect
"<type>(<scope>): |c-ES7| initial commit"
- correct
"<type>(<scope>): |c-ES7M| initial commit"
- incorrect
required
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
"<type>(<scope>): |c-ES7| initial commit"
- correct
"<type>(<scope>): initial commit""<type>(<scope>): |c-ES7Mn9Ow| initial commit"
- incorrect
- true
- incorrect
"<type>(<scope>): initial commit"
- correct
"<type>(<scope>): |c-ES7Mn9Ow| initial commit"
- incorrect
idMatch
Matching with your own pattern
accept - RegExp
default - null
example:
- /^\d+$/ - only numbers
- incorrect
"<type>(<scope>): |c-ES7Mn9Ow| initial commit"
- correct
"<type>(<scope>): |c-4129791| initial commit"
- incorrect
spaceBeforeAfter
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
"<type>(<scope>): initial commit |c-ES7Mn9Ow|"
- correct
"<type>(<scope>): initial commit |c-ES7Mn9Ow| "
- incorrect
headerLikeSubject
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
"<type>(<scope>): |c-ES7Mn9Ow| initial commit"
- correct
"|c-ES7Mn9Ow| initial commit"
- incorrect
log
Displaying a message after a successful commit check
accept - {message: string, onlyId: boolean, pattern: string} | string
default - null
