-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcommitlint.config.mjs
60 lines (57 loc) · 1.15 KB
/
commitlint.config.mjs
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
const emojis = [
'♻️',
'⚡️',
'✅',
'✏️',
'✨',
'❤️',
'⬆️',
'⬇️',
'⭐️',
'🌈',
'🎁',
'🎉',
'🏆',
'🐞',
'👌',
'📓',
'📝',
'📦',
'🔀',
'🔖',
'🚀',
'🚧',
'🚨',
'🛠️',
];
const includeEmojis = new RegExp(`[${emojis.join('')}]`, 'g');
const config = {
extends: ['@commitlint/config-conventional'],
plugins: [
{
rules: {
'header-match-team-pattern': (parsed) => {
const { subject } = parsed;
if (includeEmojis.test(subject) === false) {
return [false, 'subject should include one of [' + emojis.join(', ') + ']'];
}
return [true, ''];
},
},
},
],
/*
* Any rules defined here will override rules from @commitlint/config-conventional
*/
rules: {
'scope-case': [0, 'always', 'lower-case'],
'subject-case': [0, 'always', 'lower-case'],
'header-match-team-pattern': [2, 'always'],
'type-enum': [
2,
'always',
['add', 'adopt', 'build', 'chore', 'docs', 'feat', 'fix', 'refactor', 'remove', 'style'],
],
},
};
module.exports = config;