@dazhicheng/common 1.0.2 → 1.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.husky/commit-msg +2 -0
- package/.husky/pre-commit +3 -0
- package/commitlint.config.cjs +12 -6
- package/package.json +3 -2
package/commitlint.config.cjs
CHANGED
|
@@ -5,11 +5,14 @@
|
|
|
5
5
|
* https://cz-git.qbb.sh/zh/guide/
|
|
6
6
|
*/
|
|
7
7
|
|
|
8
|
-
const
|
|
8
|
+
const taskIdPlugin = {
|
|
9
9
|
rules: {
|
|
10
|
-
"
|
|
11
|
-
const
|
|
12
|
-
|
|
10
|
+
"task-id-required": parsed => {
|
|
11
|
+
const { header } = parsed;
|
|
12
|
+
if (!/#\d+#/.test(header)) {
|
|
13
|
+
return [false, "commit message 必须包含任务ID,格式为 #任务ID#(如 #1234567#)"];
|
|
14
|
+
}
|
|
15
|
+
return [true, ""];
|
|
13
16
|
},
|
|
14
17
|
},
|
|
15
18
|
};
|
|
@@ -18,7 +21,7 @@ module.exports = {
|
|
|
18
21
|
// 继承的规则
|
|
19
22
|
extends: ["@commitlint/config-conventional"],
|
|
20
23
|
// 自定义插件
|
|
21
|
-
plugins: [
|
|
24
|
+
plugins: [taskIdPlugin],
|
|
22
25
|
// 自定义规则
|
|
23
26
|
rules: {
|
|
24
27
|
// 提交类型枚举,git提交type必须是以下类型
|
|
@@ -40,8 +43,11 @@ module.exports = {
|
|
|
40
43
|
"wip", // 对构建过程或辅助工具和库的更改(不影响源文件、测试用例)
|
|
41
44
|
],
|
|
42
45
|
],
|
|
46
|
+
"task-id-required": [2, "always"], // 必须包含任务ID
|
|
43
47
|
"subject-case": [0], // subject大小写不做校验
|
|
44
|
-
"
|
|
48
|
+
"subject-empty": [2, "never"], // 禁止空描述
|
|
49
|
+
"type-empty": [2, "never"], // 禁止空类型
|
|
50
|
+
"type-case": [2, "always", "lower-case"],
|
|
45
51
|
},
|
|
46
52
|
|
|
47
53
|
prompt: {
|
package/package.json
CHANGED