-
Notifications
You must be signed in to change notification settings - Fork 151
/
commitlint.config.js
74 lines (67 loc) · 1.42 KB
/
commitlint.config.js
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
69
70
71
72
73
74
const fg = require("fast-glob");
function fetchComponentDirs() {
function filterOut(result, dirent) {
const name = dirent.split("/").pop();
if (name[0] === name[0].toUpperCase() || name.startsWith("use")) {
return [...result, name];
}
return result;
}
const dirs = fg.sync("./packages/orbit-components/src/**/*", {
onlyDirectories: true,
absolute: false,
ignore: [
"**/__tests__/",
"**/__test__/",
"**/__snapshots__/",
"**/__fixtures__/",
"**/__generated__/",
"**/__stories__/",
"**/__typetests__/",
"**/utils/",
"**/data/",
"**/common/",
"**/helpers/",
"**/*.tsx-snapshots/",
],
});
const whiteListedDirs = [
"tokens",
"docs",
"hooks",
"eslint-plugin",
"babel-plugin",
"themer",
"examples",
"icons",
"tracking",
"tailwind",
];
return dirs.reduce(filterOut, whiteListedDirs);
}
module.exports = {
extends: [require.resolve("@commitlint/config-conventional")],
rules: {
"scope-case": [0],
"scope-enum": [2, "always", fetchComponentDirs()],
"footer-max-line-length": [2, "always", 150],
"type-enum": [
2,
"always",
[
"build",
"chore",
"ci",
"docs",
"feat",
"fix",
"perf",
"refactor",
"revert",
"style",
"test",
"improve",
],
],
},
};