1
1
/** @type {import('dependency-cruiser').IConfiguration } */
2
2
3
- const applicationLayerPaths = [
4
- 'application' ,
3
+ const apiLayerPaths = [
5
4
'controller' ,
6
5
'dtos' ,
7
6
'request' ,
8
7
'response' ,
9
8
'dto\\.ts$' ,
10
9
'controller\\.ts$' ,
11
10
'resolver\\.ts$' ,
12
- '\\.service\\.ts$' ,
13
11
] ;
14
12
13
+ const applicationLayerPaths = [ 'application' , '\\.service\\.ts$' ] ;
14
+
15
15
const infrastructureLayerPaths = [
16
16
'infrastructure' ,
17
17
'infra' ,
@@ -30,14 +30,23 @@ const domainLayerPaths = [
30
30
module . exports = {
31
31
forbidden : [
32
32
/* user defined rules */
33
+ {
34
+ name : 'no-domain-to-api-deps' ,
35
+ comment : 'Domain layer cannot depend on api layer' ,
36
+ severity : 'error' ,
37
+ from : { path : domainLayerPaths } ,
38
+ to : {
39
+ path : apiLayerPaths ,
40
+ } ,
41
+ } ,
33
42
{
34
43
name : 'no-domain-to-app-deps' ,
35
44
comment : 'Domain layer cannot depend on application layer' ,
36
45
severity : 'error' ,
37
46
from : { path : domainLayerPaths } ,
38
47
to : {
39
48
path : applicationLayerPaths ,
40
- pathNot : [ 'AppRequestContext\\.ts$ ' ] ,
49
+ pathNot : [ 'AppRequestContext\\.ts' ] ,
41
50
} ,
42
51
} ,
43
52
{
@@ -51,18 +60,17 @@ module.exports = {
51
60
} ,
52
61
} ,
53
62
{
54
- name : 'no-infra-to-app -deps' ,
55
- comment : 'Infrastructure layer cannot depend on application layer' ,
63
+ name : 'no-infra-to-api -deps' ,
64
+ comment : 'Infrastructure layer cannot depend on api layer' ,
56
65
severity : 'error' ,
57
66
from : { path : infrastructureLayerPaths } ,
58
67
to : {
59
- path : applicationLayerPaths ,
60
- pathNot : [ 'AppRequestContext\\.ts$' ] ,
68
+ path : apiLayerPaths ,
61
69
} ,
62
70
} ,
63
71
{
64
- name : 'query-deps' ,
65
- comment : 'Commands and Queries cannot depend on application layer' ,
72
+ name : 'no-command- query-to-api -deps' ,
73
+ comment : 'Commands and Queries cannot depend on api layer' ,
66
74
severity : 'error' ,
67
75
from : {
68
76
path : [
@@ -73,23 +81,22 @@ module.exports = {
73
81
] ,
74
82
} ,
75
83
to : {
76
- path : applicationLayerPaths ,
77
- pathNot : [ 'AppRequestContext\\.ts$' ] ,
84
+ path : apiLayerPaths ,
78
85
} ,
79
86
} ,
80
87
81
88
/* rules from the 'recommended' preset: */
82
- {
83
- name : 'no-circular' ,
84
- severity : 'warn' ,
85
- comment :
86
- 'This dependency is part of a circular relationship. You might want to revise ' +
87
- 'your solution (i.e. use dependency inversion, make sure the modules have a single responsibility) ' ,
88
- from : { } ,
89
- to : {
90
- circular : true ,
91
- } ,
92
- } ,
89
+ // {
90
+ // name: 'no-circular',
91
+ // severity: 'warn',
92
+ // comment:
93
+ // 'This dependency is part of a circular relationship. You might want to revise ' +
94
+ // 'your solution (i.e. use dependency inversion, make sure the modules have a single responsibility) ',
95
+ // from: {},
96
+ // to: {
97
+ // circular: true,
98
+ // },
99
+ // },
93
100
{
94
101
name : 'no-orphans' ,
95
102
comment :
@@ -98,7 +105,7 @@ module.exports = {
98
105
'add an exception for it in your dependency-cruiser configuration. By default ' +
99
106
'this rule does not scrutinize dot-files (e.g. .eslintrc.js), TypeScript declaration ' +
100
107
'files (.d.ts), tsconfig.json and some of the babel and webpack configs.' ,
101
- severity : 'warn ' ,
108
+ severity : 'error ' ,
102
109
from : {
103
110
orphan : true ,
104
111
pathNot : [
@@ -115,7 +122,7 @@ module.exports = {
115
122
comment :
116
123
'A module depends on a node core module that has been deprecated. Find an alternative - these are ' +
117
124
"bound to exist - node doesn't deprecate lightly." ,
118
- severity : 'warn ' ,
125
+ severity : 'error ' ,
119
126
from : { } ,
120
127
to : {
121
128
dependencyTypes : [ 'core' ] ,
@@ -148,7 +155,7 @@ module.exports = {
148
155
comment :
149
156
'This module uses a (version of an) npm module that has been deprecated. Either upgrade to a later ' +
150
157
'version of that module, or find an alternative. Deprecated modules are a security risk.' ,
151
- severity : 'warn ' ,
158
+ severity : 'error ' ,
152
159
from : { } ,
153
160
to : {
154
161
dependencyTypes : [ 'deprecated' ] ,
@@ -184,7 +191,7 @@ module.exports = {
184
191
"Likely this module depends on an external ('npm') package that occurs more than once " +
185
192
'in your package.json i.e. bot as a devDependencies and in dependencies. This will cause ' +
186
193
'maintenance problems later on.' ,
187
- severity : 'warn ' ,
194
+ severity : 'error ' ,
188
195
from : { } ,
189
196
to : {
190
197
moreThanOneDependencyType : true ,
@@ -260,7 +267,7 @@ module.exports = {
260
267
'in your package.json. This makes sense if your package is e.g. a plugin, but in ' +
261
268
'other cases - maybe not so much. If the use of a peer dependency is intentional ' +
262
269
'add an exception to your dependency-cruiser configuration.' ,
263
- severity : 'warn ' ,
270
+ severity : 'error ' ,
264
271
from : { } ,
265
272
to : {
266
273
dependencyTypes : [ 'npm-peer' ] ,
0 commit comments