-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcommitlint.config.js
More file actions
29 lines (27 loc) · 990 Bytes
/
commitlint.config.js
File metadata and controls
29 lines (27 loc) · 990 Bytes
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
module.exports = {
extends: ['@commitlint/config-conventional'],
rules: {
'jira-issue-rule': [2, 'always'],
'header-max-length': [1, 'always', 256],
'subject-case': [0, 'never'],
'body-case': [0, 'never'],
},
plugins: [
{
rules: {
'jira-issue-rule': ({ scope, header }) => {
const jiraRegex = /(PF-\d{4,5})/;
const allowedTypes = ['feat','fix','refactor', 'chore', 'style', 'test', 'docs'];
const type = header.split('(')[0].split(':')[0];
if (allowedTypes.includes(type)) {
return [true];
}
return [
jiraRegex.test(scope),
`Commit message must reference a Jira issue (e.g., PF-XXXX or PF-XXXXX) in scope for types like feat or fix`,
];
},
},
},
],
};