Rules are made up by a name and a configuration array. The configuration array contains:
- Level
[0..2]
:0
disables the rule. For1
it will be considered a warning for2
an error. - Applicable
always|never
:never
inverts the rule. - Value: value to use for this rule.
Rule configurations are either of type array
residing on a key with the rule's name as key on the rules object
or of type function returning type array
or Promise<array>
. This means all of the following notations are supported.
Plain array
"rules": {
"header-max-length": [0, "always", 72],
}
Function returning array
"rules": {
"header-max-length": () => [0, "always", 72],
}
Async function returning array
"rules": {
"header-max-length": async () => [0, "always", 72],
}
Function returning a promise resolving to array
"rules": {
"header-max-length": () => Promise.resolve([0, "always", 72]),
}
- condition:
body
begins with blank line - rule:
always
- condition:
body
hasvalue
or less characters - rule:
always
- value
Infinity
- condition:
body
hasvalue
or more characters - rule:
always
- value
0
- condition:
footer
begins with blank line - rule:
always
- condition:
footer
hasvalue
or less characters - rule:
always
- value
Infinity
- condition:
footer
hasvalue
or more characters - rule:
always
- value
0
- condition:
header
hasvalue
or less characters - rule:
always
- value
72
- condition:
header
hasvalue
or more characters - rule:
always
- value
0
- condition:
references
has at least one entry - rule:
never
- condition:
scope
is found in value - rule:
always
- value
[]
- condition:
scope
is in casevalue
- rule:
always
'lowerCase'
- possible values
[
'lower-case', // default
'upper-case', // UPPERCASE
'camel-case', // camelCase
'kebab-case', // kebab-case
'pascal-case', // PascalCase
'sentence-case', // Sentence case
'snake-case', // snake_case
'start-case', // Start Case
]
- condition:
scope
is empty - rule:
never
- condition:
scope
hasvalue
or less characters - rule:
always
- value
Infinity
- condition:
scope
hasvalue
or more characters - rule:
always
- value
0
- condition:
subject
is in casevalue
- rule:
always
'lowerCase'
- possible values
[
'lower-case', // default
'upper-case', // UPPERCASE
'camel-case', // camelCase
'kebab-case', // kebab-case
'pascal-case', // PascalCase
'sentence-case', // Sentence case
'snake-case', // snake_case
'start-case', // Start Case
]
- condition:
subject
is empty - rule:
never
- condition:
subject
ends withvalue
- rule:
never
- value
'.'
- condition:
subject
hasvalue
or less characters - rule:
always
- value
Infinity
- condition:
subject
hasvalue
or more characters - rule:
always
- value
0
- condition:
type
is found in value - rule:
always
- value
[ 'feat', 'fix', 'docs', 'style', 'refactor', 'test', 'revert' ]
- description:
type
is in casevalue
- rule:
always
- value
'lower-case'
- possible values
[
'lower-case', // default
'upper-case', // UPPERCASE
'camel-case', // camelCase
'kebab-case', // kebab-case
'pascal-case', // PascalCase
'sentence-case', // Sentence case
'snake-case', // snake_case
'start-case', // Start Case
]
- condition:
type
is empty - rule:
never
- condition:
type
hasvalue
or less characters - rule:
always
- value
Infinity
- condition:
type
hasvalue
or more characters - rule:
always
- value
0
- condition:
message
hasvalue
- rule:
always
- value
'Signed-off-by:'
- condition:
body
is verbalized in tense present invalue
- rule:
always
- value
['present-imperative']
- possible values
[
'past-tense', // did
'present-imperative', // do
'present-participle', // doing
'present-third-person' // does
]
- condition:
footer
is verbalized in tense present invalue
- rule:
always
- value
['present-imperative']
- possible values
[
'past-tense', // did
'present-imperative', // do
'present-participle', // doing
'present-third-person' // does
]
- condition:
subject
is of languagevalue
- rule:
always
- value
eng
- condition:
subject
is verbalized in tense present invalue
- rule:
always
- value
['present-imperative']
- possible values
[
'past-tense', // did
'present-imperative', // do
'present-participle', // doing
'present-third-person' // does
]