-
Notifications
You must be signed in to change notification settings - Fork 975
Expand file tree
/
Copy pathcommitlint.config.js
More file actions
56 lines (49 loc) · 1.55 KB
/
commitlint.config.js
File metadata and controls
56 lines (49 loc) · 1.55 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
module.exports = {
plugins: [
{
rules: {
'core-lightning': ({ type }) => {
// Allow standard Core Lightning types
const standardTypes = [
// Daemons
'channeld', 'closingd', 'connectd', 'gossipd', 'hsmd', 'lightningd', 'onchaind',
'openingd',
// Related
'bitcoin', 'cli', 'cln-grpc', 'cln-rpc', 'db', 'wallet', 'wire',
// Others
'ci', 'common', 'contrib', 'devtools', 'docs', 'docker', 'github', 'global',
'meta', 'nit', 'nix', 'release', 'script', 'tests',
];
// Extensions
const extensions = ['plugin-', 'pyln-', 'tool-']
if (type) {
for (const prefix of extensions) {
if (type.startsWith(prefix)) {
return [true];
}
}
}
// Otherwise, must be a standard type
if (standardTypes.includes(type)) {
return [true];
}
return [
false,
`Type must be one of [${standardTypes.join(', ')}] or match patterns [${extensions.join(', ')}]`
];
},
},
},
],
rules: {
// Disable the default type-enum rule since we're using custom validation
'type-enum': [0],
// Enable our custom rule
'core-lightning': [2, 'always'],
// Keep other standard rules
'type-case': [2, 'always', 'lower-case'],
'type-empty': [2, 'never'],
'subject-empty': [2, 'never'],
'subject-case': [2, 'never', ['upper-case']],
},
};