-
Notifications
You must be signed in to change notification settings - Fork 148
Expand file tree
/
Copy pathcommitlint.config.js
More file actions
67 lines (62 loc) · 2.34 KB
/
Copy pathcommitlint.config.js
File metadata and controls
67 lines (62 loc) · 2.34 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
const Configuration = {
extends: ['@commitlint/config-conventional'],
rules: {
'scope-enum': [
2,
'always',
[
'core',
'platform',
'docs',
'e2e',
'release',
'deps',
'deps-dev',
'changelog',
'ci',
'cx',
'btp',
'cdk',
'shared',
'i18n',
'datetime-adapter',
'moment-adapter',
'ui5',
'mcp',
'skills'
]
],
'body-max-line-length': [2, 'always', 400],
'footer-max-line-length': [2, 'always', 400],
'header-max-length': [2, 'always', 400],
'breaking-change-footer-format': [2, 'always']
},
plugins: [
{
rules: {
'breaking-change-footer-format': (parsed) => {
const { body, footer } = parsed;
const fullText = [body, footer].filter(Boolean).join('\n');
// Catch typo variants like pluralization, separators, casing, spacing, and markdown list prefixes.
const candidateFooterPattern = /^[ \t>*-]*breaking[ \t_-]*changes?[ \t]*:/im;
const candidateFooterTokenPattern = /breaking[ \t_-]*changes?[ \t]*:/i;
for (const line of fullText.split(/\r?\n/)) {
if (!candidateFooterPattern.test(line)) {
continue;
}
const token = line.match(candidateFooterTokenPattern)?.[0] ?? line.trim();
if (line !== 'BREAKING CHANGE:' && !line.startsWith('BREAKING CHANGE: ')) {
return [
false,
`Breaking change footer contains "${token}" but must use "BREAKING CHANGE:" exactly (singular, uppercase, one space, no prefix). ` +
`The conventional-commits parser requires this exact format for version bumping.`
];
}
}
return [true];
}
}
}
]
};
module.exports = Configuration;