-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcommitlint.config.js
More file actions
60 lines (56 loc) · 1.62 KB
/
commitlint.config.js
File metadata and controls
60 lines (56 loc) · 1.62 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
module.exports = {
extends: ['@commitlint/config-conventional'],
rules: {
// Disable default rules that conflict with emoji format
'subject-empty': [0],
'type-empty': [0],
'type-enum': [
2,
'always',
[
'feat', // New features
'fix', // Bug fixes
'style', // UI/styling changes
'refactor', // Code refactoring
'perf', // Performance improvements
'test', // Tests
'docs', // Documentation
'chore', // Build/tooling
'deploy', // Deployment
'enhance', // Enhancements
],
],
'subject-min-length': [2, 'always', 1],
'subject-max-length': [2, 'always', 100],
'subject-case': [0],
'header-max-length': [2, 'always', 120],
// Custom rule to allow any emoji at the start
'header-pattern': [
2,
'always',
/^([\p{Emoji}][\u200D\uFE0F]* )?(feat|fix|style|refactor|perf|test|docs|chore|deploy|enhance)(\(.+\))?: .+$/u,
],
},
plugins: [
{
rules: {
'header-pattern'({header}) {
const pattern = /^([\p{Emoji}][\u200D\uFE0F]* )?(feat|fix|style|refactor|perf|test|docs|chore|deploy|enhance)(\(.+\))?: .+$/u;
if (!pattern.test(header)) {
return [
false,
`Header must match format: [emoji] <type>[(scope)]: <description>
Valid types: feat, fix, style, refactor, perf, test, docs, chore, deploy, enhance
Examples:
feat: add new feature
fix: resolve bug in component
chore: update dependencies
chore(deps): update dependency xyz`,
];
}
return [true];
},
},
},
],
};