-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcommitlint.config.js
50 lines (48 loc) · 1.38 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
47
48
49
50
/*
* @Author: shiconghua
* @Alias: LGD.HuaFEEng
* @Date: 2021-09-01 23:25:59
* @LastEditTime: 2021-09-09 23:41:53
* @LastEditors: shiconghua
* @Description: commitlint 配置文件
* @FilePath: \lgd-utils\commitlint.config.js
*/
const czConfig = require('./.cz-config.js')
module.exports = {
extends: ['@commitlint/config-lerna-scopes', 'gitmoji'],
// parserPreset: {
// parserOpts: {
// headerPattern: /^(:\w*:)(?:\((.*?)\))?\s((?:.*(?=\())|.*)(?:\(#(\d*)\))?/,
// headerCorrespondence: ['type', 'scope', 'subject', 'ticket'],
// },
// },
/*
* Any rules defined here will override rules from @commitlint/config-conventional
*/
rules: {
// 'type-enum': [
// 1,
// 'always',
// ['docs', 'build', 'chore', 'ci', 'feat', 'fix', 'init', 'perf', 'refactor', 'revert', 'style', 'test'],
// ],
'type-enum': [
1,
'always',
czConfig.types
.map((v) => {
const valueMatches = v.value.match(/^\:\w+\:\s(\w+)$/)
if (valueMatches && valueMatches[1]) return valueMatches[1]
return null
})
.filter(Boolean),
],
// lerna version 时关闭一些校验,只 warn
...(process.env.GIT_COMMIT_TYPE === 'CZ'
? null
: {
'start-with-gitmoji': [1, 'always'],
'subject-empty': [1, 'always'],
'type-empty': [1, 'always'],
}),
},
}