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
ends withvalue
- rule:
never
- value
'.'
- condition:
body
begins with blank line - rule:
always
- condition:
body
is empty - rule:
never
- condition:
body
hasvalue
or less characters - rule:
always
- value
Infinity
- condition:
body
lines hasvalue
or less characters - rule:
always
- value
Infinity
- condition:
body
hasvalue
or more characters - rule:
always
- value
0
- condition:
body
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:
footer
begins with blank line - rule:
always
- condition:
footer
is empty - rule:
never
- condition:
footer
hasvalue
or less characters - rule:
always
- value
Infinity
- condition:
footer
lines hasvalue
or less characters - rule:
always
- value
Infinity
- condition:
footer
hasvalue
or more characters - rule:
always
- value
0
- condition:
header
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:
header
ends withvalue
- rule:
never
- value
'.'
- 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
- 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:
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 one of the cases['sentence-case', 'start-case', 'pascal-case', 'upper-case']
- rule:
always
- value
['sentence-case', 'start-case', 'pascal-case', 'upper-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:
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:
subject
has exclamation before the:
marker - rule:
never
- 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:
message
has trailervalue
- rule:
always
- value
'Signed-off-by:'