-
Notifications
You must be signed in to change notification settings - Fork 31
/
commitlint.config.js
46 lines (45 loc) · 1.54 KB
/
commitlint.config.js
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
39
40
41
42
43
44
45
46
module.exports = {
// Set the help url to the contributing guide
helpUrl: 'https://github.com/BattlesnakeOfficial/docs/blob/main/CONTRIBUTING.md',
rules: {
"docs/no-type": [2, "always"],
"docs/no-scope": [2, "always"],
"docs/header-length": [1, "always"],
"docs/body-blank-line": [1, "always"],
},
/**
* We are using custom rules to provide more informative error messages.
*
* NOTE: a rule returns false if the rule was broken, otherwise it returns true.
*/
plugins: [{
rules: {
"docs/no-type": (parsed) => {
return [
parsed.type == null,
`Type is not allowed, type found: '${parsed.type}'`
];
},
"docs/no-scope": (parsed) => {
return [
parsed.scope == null,
`Scope is not allowed, scope found: '${parsed.scope}'`
];
},
"docs/header-length": (parsed) => {
return [
parsed.header.length <= 50,
"Keep the header under 50 characters",
]
},
"docs/body-blank-line": (parsed) => {
// get the first line in the body
const leading = parsed.raw.split(/(?:\r?\n)/)[1];
return [
leading === "",
"There should be a blank line between the header and the body",
]
},
}
}],
}