-
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcommitlint.config.mjs
More file actions
37 lines (34 loc) · 963 Bytes
/
Copy pathcommitlint.config.mjs
File metadata and controls
37 lines (34 loc) · 963 Bytes
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
import { readdirSync } from 'node:fs';
import { dirname, join } from 'node:path';
import { fileURLToPath } from 'node:url';
const root = dirname(fileURLToPath(import.meta.url));
/** Directory names one level under `path`, relative to the repo root. */
const dirs = path =>
readdirSync(join(root, path), { withFileTypes: true })
.filter(entry => entry.isDirectory())
.map(entry => entry.name);
export default {
extends: ['@commitlint/config-conventional'],
rules: {
'body-leading-blank': [2, 'always'],
'footer-leading-blank': [2, 'always'],
'scope-enum': [
2,
'always',
[
// One scope per package and project, derived from the tree so the list
// can never go stale.
...dirs('libs/ui'),
...dirs('libs'),
...dirs('apps'),
// Cross-cutting scopes.
'storybook',
'repo',
'release',
'docs',
'deps',
'ci'
]
]
}
};