-
Notifications
You must be signed in to change notification settings - Fork 0
/
commitlint.config.cjs
46 lines (45 loc) · 1.27 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
39
40
41
42
43
44
45
46
module.exports = {
extends: ["@commitlint/config-conventional"],
rules: {
"body-case": [2, "always", "sentence-case"],
"body-max-line-length": [2, "always", 200],
"header-max-length": [2, "always", 72],
"footer-max-length": [2, "always", 200],
"type-enum": [2, "always", getTypes()],
"issue-id-required": [2, "always"],
},
plugins: [
{
rules: {
"issue-id-required"({ subject }) {
const issueIdRegex = /\s#(\d+)(\n\n.*)?$/;
if (!issueIdRegex.test(subject)) {
return [
false,
"Issue ID is required at the end of the first line. " +
"If you want to add a footer, separate it with a blank line.",
];
}
return [true];
},
},
},
],
};
function getTypes() {
const baseTypes = [
"feat",
"fix",
"docs",
"style",
"refactor",
"perf",
"test",
"build",
"ci",
"chore",
"revert",
];
baseTypes.push(...baseTypes.map((type) => `${type}!`));
return baseTypes;
}