forked from phpjavac/Daosheng
-
Notifications
You must be signed in to change notification settings - Fork 0
/
commitlint.config.js
42 lines (42 loc) · 964 Bytes
/
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
const $$types = [
"feat",
"fix",
"docs",
"style",
"refactor",
"perf",
"test",
"chore",
"chore-release",
"chore-deps",
"build",
"ci",
"release",
"security",
"i18n",
"breaking",
"config",
"add",
"remove",
];
// https://github.com/conventional-changelog/commitlint/blob/master/docs/reference-rules.md
// https://github.com/vidavidorra/commitlint-plugin-function-rules#usage
// 使用 function rules 时,要先禁用同名的rules,否则会重复校验
module.exports = {
extends: ["@commitlint/config-conventional"],
plugins: ["commitlint-plugin-function-rules"],
rules: {
"type-enum": [2, "always", $$types],
"header-max-length": [0],
"function-rules/header-max-length": [
2, // level: error
"always",
(parsed) => {
if (parsed.header.length < 72) {
return [true];
}
return [false, "提交信息的长度不能超过72个字符"];
},
],
},
};