-
Notifications
You must be signed in to change notification settings - Fork 58
/
.dependency-cruiser.js
99 lines (97 loc) · 2 KB
/
.dependency-cruiser.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
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
/** @type import("dependency-cruiser").IConfiguration */
module.exports = {
forbidden: [
{
name: "no-circular",
severity: "error",
from: {},
to: {
circular: true,
},
},
{
name: "api-only-depends-on-api-and-utils",
severity: "error",
from: {
path: "^src/api/(?!index)",
},
to: {
pathNot: "^src/(api/(?!index)|utils)",
},
},
{
name: "api/index-only-depends-on-api",
severity: "error",
from: {
path: "^src/api/index",
},
to: {
pathNot: "^src/api",
},
},
{
name: "only-api-depends-on-api",
severity: "error",
from: {
pathNot: "^src/api",
},
to: {
path: "^src/api/(?!index)",
},
},
{
name: "commands-do-not-depend-on-each-other",
severity: "error",
from: {
path: "^src/commands(?!/load-all)",
},
to: {
path: "^src/commands",
},
},
{
name: "utils-only-depends-on-utils",
severity: "error",
from: {
path: "^src/utils",
},
to: {
pathNot: "^src/(utils|state/recorder)", // exception for state/recorder.ts
},
},
{
name: "only-tests-depend-on-tests",
severity: "error",
from: {
pathNot: "^test",
},
to: {
path: "^test",
},
},
{
name: "no-orphans",
severity: "warn",
from: {
orphan: true,
pathNot: [
"(^|/)\\.[^/]+\\.(js|cjs|mjs|ts|json)$", // dot files
"\\.d\\.ts$", // TypeScript declaration files
"(^|/)tsconfig\\.json$", // TypeScript config
"meta\\.ts$|\\.build\\.ts$", // build files
],
},
to: {},
},
],
options: {
exclude : {
path: "\\.build\\.ts$",
},
includeOnly : "^src",
tsConfig: {
fileName: "tsconfig.json",
},
tsPreCompilationDeps: false,
},
};