-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcommitlint.config.js
More file actions
87 lines (77 loc) · 1.9 KB
/
Copy pathcommitlint.config.js
File metadata and controls
87 lines (77 loc) · 1.9 KB
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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
export default {
extends: ["@commitlint/config-conventional"],
plugins: [
{
rules: {
"scope-list-spacing": (parsed) => {
const header = parsed.header || "";
const scopeMatch = header.match(/^[^(]+\(([^)]+)\):/);
if (!scopeMatch) {
return [true];
}
const scopeRaw = scopeMatch[1];
const hasComma = scopeRaw.includes(",");
if (!hasComma) {
return [true];
}
const hasSpaceBeforeComma = /\s,/.test(scopeRaw);
const hasNoSpaceAfterComma = /,(?=\S)/.test(scopeRaw);
const hasTooManySpacesAfterComma = /, {2,}/.test(scopeRaw);
const isValid =
!hasSpaceBeforeComma && !hasNoSpaceAfterComma && !hasTooManySpacesAfterComma;
return [
isValid,
"При перечислении нескольких scope используйте формат `scope1, scope2` (запятая и один пробел).",
];
},
},
},
],
rules: {
"type-enum": [
2,
"always",
[
"feat",
"fix",
"docs",
"format",
"refactor",
"chore",
"content",
"revert",
"merge",
],
],
"scope-enum": [
2,
"always",
[
"app",
"components",
"styles",
"hooks",
"utils",
"aefaq",
"prfaq",
"psfaq",
"rules",
"reg",
"links",
"docs",
"config",
"deps",
"assets",
"scripts",
"*",
],
],
"header-max-length": [2, "always", 150],
"scope-list-spacing": [2, "always"],
"body-leading-blank": [2, "always"],
"footer-leading-blank": [2, "always"],
"type-case": [2, "always", "lower-case"],
"type-empty": [2, "never"],
"subject-empty": [2, "never"],
},
};