-
Notifications
You must be signed in to change notification settings - Fork 9
Expand file tree
/
Copy pathcommitlint.config.cjs
More file actions
67 lines (54 loc) · 1.15 KB
/
Copy pathcommitlint.config.cjs
File metadata and controls
67 lines (54 loc) · 1.15 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 fs = require('node:fs');
const path = require('node:path');
const staticScopes = [
"ui",
"ux",
"layout",
"page",
"api",
"hooks",
"state",
"assets",
"config",
"deps",
"styles",
"tests",
"docs",
"core",
];
function loadDynamicScopes() {
try {
const p = path.join(__dirname, 'commitlint.scopes.json');
if (!fs.existsSync(p)) return [];
const data = JSON.parse(fs.readFileSync(p, 'utf8'));
if (Array.isArray(data)) return data.filter(Boolean);
} catch {}
return [];
}
const allScopes = Array.from(new Set([...staticScopes, ...loadDynamicScopes()])).sort();
module.exports = {
extends: ["@commitlint/config-conventional"],
rules: {
"type-enum": [
2,
"always",
[
"feat",
"fix",
"docs",
"style",
"refactor",
"perf",
"test",
"build",
"ci",
"chore",
"revert",
],
],
"scope-enum": [2, "always", allScopes],
"subject-case": [0],
"subject-full-stop": [2, "never"],
"header-max-length": [2, "always", 88],
},
};