-
-
Notifications
You must be signed in to change notification settings - Fork 3
/
commitlint.config.cjs
38 lines (37 loc) · 1.1 KB
/
commitlint.config.cjs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
module.exports = {
extends: ['@commitlint/config-conventional'],
plugins: [
{
rules: {
'function-rules/header-max-length'(parsed) {
const {length} = parsed.header;
const maxLength = 100;
const maxDepsLength = 200;
const isDepsCommit =
/^(chore|fix)/.test(parsed.type) && parsed.scope === 'deps';
if (
(isDepsCommit && length > maxDepsLength) ||
(!isDepsCommit && length > maxLength)
) {
const type = isDepsCommit ? 'for dependency commits ' : '';
const maxCharacters = isDepsCommit ? maxDepsLength : maxLength;
return [
false,
[
`header ${type}must not be longer than ${maxCharacters}`,
`characters, current length is ${length}`,
].join(' '),
];
}
return [true];
},
},
},
],
rules: {
'body-max-line-length': [0],
'footer-max-line-length': [0],
'header-max-length': [0],
'function-rules/header-max-length': [2, 'always'],
},
};