-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathcommitlint.config.cjs
More file actions
68 lines (62 loc) 路 1.48 KB
/
Copy pathcommitlint.config.cjs
File metadata and controls
68 lines (62 loc) 路 1.48 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
68
const { readdirSync } = require('node:fs');
// Derive scopes from the workspace layout so the list never drifts.
// Meta scopes that map to no directory are listed explicitly below.
const dirsIn = (rel) => {
try {
return readdirSync(`${__dirname}/${rel}`, { withFileTypes: true })
.filter((e) => e.isDirectory())
.map((e) => e.name);
} catch {
return [];
}
};
// Per-module layer dirs (clean-architecture) are not scopes - exclude them so only
// real sub-modules (eg engagement/chat -> `chat`, server/db -> `db`) surface.
const layerDirs = new Set([
'__tests__',
'adapters',
'contract',
'contracts',
'drizzle',
'migrations',
'plugin',
'react',
'router',
'schema',
'schemas',
'seed',
'service',
]);
// Sub-module dirs one level below `rel/*` (eg packages/core/src/engagement/chat -> `chat`).
const nestedDirsIn = (rel) =>
dirsIn(rel).flatMap((top) => dirsIn(`${rel}/${top}`).filter((sub) => !layerDirs.has(sub)));
const metaScopes = [
'agents',
'ci',
'clean-architecture',
'conventions',
'deps',
'hooks',
'release',
'repo',
'rules',
'scaffold',
'tooling',
'tsconfig',
];
const scopes = [
...new Set([
...dirsIn('packages'),
...dirsIn('packages/core/src'),
...nestedDirsIn('packages/core/src'),
...dirsIn('apps'),
...metaScopes,
]),
].sort();
module.exports = {
extends: ['@commitlint/config-conventional'],
rules: {
'scope-enum': [2, 'always', scopes],
'body-max-line-length': [0, 'always'],
},
};