-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathcommitlint.config.js
More file actions
67 lines (61 loc) · 1.54 KB
/
commitlint.config.js
File metadata and controls
67 lines (61 loc) · 1.54 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
module.exports = {
parserPreset: {
parserOpts: {
headerPattern: /^(\w*):\s(?:(PD-\d+)\s)?([^\[].+)$/,
headerCorrespondence: ['prefix', 'issueId', 'subject'],
referenceActions: null,
},
},
plugins: [
{
rules: {
'header-match-pattern': parsed => {
const { prefix, issueId, subject } = parsed
if (prefix === null && issueId === null && subject === null) {
return [
false,
"Header must be in format 'Feat: PD-0000 Description' or 'Feat: Description'",
]
}
return [true, '']
},
'prefix-pattern': (parsed, _when, prefixes) => {
const { prefix } = parsed
if (prefix && !prefixes.includes(prefix)) {
return [false, `Prefix must be one of: [${prefixes.join(', ')}]`]
}
return [true, '']
},
'issue-id-pattern': parsed => {
const { subject } = parsed
if (subject && subject.includes('PD-')) {
return [
false,
`IssueId must come before description: Feat: PD-0000 Description`,
]
}
return [true, '']
},
},
},
],
rules: {
'header-match-pattern': [2, 'always'],
'prefix-pattern': [
2,
'always',
[
'Feat',
'Fix',
'Design',
'Refactor',
'Test',
'Comment',
'Delete',
'Rename',
'Chore',
],
],
'issue-id-pattern': [2, 'always'],
},
}