-
Notifications
You must be signed in to change notification settings - Fork 17
/
Copy pathcommitlint.config.js
52 lines (52 loc) · 1.48 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
51
52
module.exports = {
extends: ['@commitlint/config-conventional'],
rules: {
'references-empty': [2, 'never'],
'custom-rule-issue-number': [2, 'always'],
'type-enum': [
2,
'always',
['build', 'chore', 'ci', 'fmt', 'docs', 'feat', 'fix', 'perf', 'refactor', 'revert', 'style', 'test'],
],
'scope-enum': [0], // Отключаем стандартное правило
'custom-scope-enum': [2, 'always'], // Включаем наше правило
},
plugins: [
{
rules: {
'custom-rule-issue-number': ({ header }) => {
const pattern = /#\d+/;
return [
pattern.test(header),
'commit message must contain an issue number like #123 or #000 if internal',
];
},
'custom-scope-enum': ({ scope }) => {
const scopes = [
'chore',
'components',
'helpers',
'core',
'ci',
'icons',
'addons',
'icons-loader',
'flag-icons',
'doc',
'charts',
'i18n',
'nxmv',
'nx-plugin',
'schematics',
'theme',
];
const scopePattern = new RegExp(`^(${scopes.join('|')})(/[a-zA-Z0-9-]+)?$`);
return [
scopePattern.test(scope),
`scope must be one of ${scopes.join(', ')} or a subscope like component/input-number`,
];
},
},
},
],
};