forked from sverweij/dependency-cruiser
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathconfig-schema.json
403 lines (403 loc) · 15.5 KB
/
config-schema.json
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
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
{
"$schema": "http://json-schema.org/draft-07/schema#",
"$id": "https://dependency-cruiser.js.org/config-schema",
"title": "dependency-cruiser configuration",
"description": "A set of properties describing what dependencies are forbidden and what dependencies are allowed.",
"type": "object",
"additionalProperties": false,
"properties": {
"extends": {
"description": "A configuration this configuration uses as a base",
"oneOf": [
{
"type": "string"
},
{
"type": "array",
"description": "A list of rules that describe dependencies that are allowed. dependency-cruiser will emit the warning message 'not-in-allowed' for each dependency that does not at least meet one of them.",
"items": {
"type": "string"
}
}
]
},
"forbidden": {
"type": "array",
"description": "A list of rules that describe dependencies that are not allowed. dependency-cruiser will emit a separate error (warning/ informational) messages for each violated rule.",
"items": {
"$ref": "#/definitions/ForbiddenRuleType"
}
},
"allowed": {
"type": "array",
"description": "A list of rules that describe dependencies that are allowed. dependency-cruiser will emit the warning message 'not-in-allowed' for each dependency that does not at least meet one of them.",
"items": {
"$ref": "#/definitions/AllowedRuleType"
}
},
"allowedSeverity": {
"$ref": "#/definitions/SeverityType",
"description": "Severity to use when a dependency is not in the 'allowed' set of rules. Defaults to 'warn'"
},
"options": {
"type": "object",
"description": "Runtime configuration options",
"additionalProperties": false,
"properties": {
"doNotFollow": {
"oneOf": [
{
"type": "string",
"description": "a regular expression for modules to include, but not follow further"
},
{
"type": "object",
"description": "Criteria for modules to include, but not to follow further",
"additionalProperties": false,
"properties": {
"path": {
"type": "string",
"description": "a regular expression for modules to include, but not follow further"
},
"dependencyTypes": {
"type": "array",
"description": "an array of dependency types to include, but not follow further",
"items": { "$ref": "#/definitions/DependencyType" }
}
}
}
]
},
"exclude": {
"oneOf": [
{
"type": "string",
"description": "a regular expression for modules to exclude from being cruised"
},
{
"type": "object",
"description": "Criteria for dependencies to exclude",
"additionalProperties": false,
"properties": {
"path": {
"type": "string",
"description": "a regular expression for modules to exclude from being cruised"
},
"dynamic": {
"type": "boolean",
"description": "a boolean indicating whether or not to exclude dynamic dependencies"
}
}
}
]
},
"includeOnly": {
"type": "string",
"description": "a regular expression for modules to cruise; anything outside it will be skipped"
},
"maxDepth": {
"type": "number",
"minimum": 0,
"maximum": 99,
"description": "The maximum cruise depth specified. 0 means no maximum specified"
},
"moduleSystems": {
"type": "array",
"description": "list of module systems to cruise. Defaults to [amd, cjs, es6]",
"items": {
"type": "string",
"enum": ["amd", "cjs", "es6", "tsd"]
}
},
"prefix": {
"type": "string"
},
"preserveSymlinks": {
"type": "boolean",
"description": "if true leave symlinks untouched, otherwise use the realpath. Defaults to `false` (which is also nodejs's default behavior since version 6)"
},
"combinedDependencies": {
"type": "boolean",
"description": "if true combines the package.jsons found from the module up to the base folder the cruise is initiated from. Useful for how (some) mono-repos manage dependencies & dependency definitions. Defaults to `false`."
},
"tsConfig": {
"type": "object",
"additionalProperties": false,
"description": "Typescript project file ('tsconfig.json') to use for (1) compilation and (2) resolution (e.g. with the paths property)",
"properties": {
"fileName": {
"description": "The typescript project file to use. The fileName is relative to dependency-cruiser's current working directory. When not provided defaults to './tsconfig.json'.",
"type": "string"
}
}
},
"tsPreCompilationDeps": {
"description": "if true detect dependencies that only exist before typescript-to-javascript compilation.",
"oneOf": [
{ "type": "boolean" },
{ "type": "string", "enum": ["specify"] }
]
},
"externalModuleResolutionStrategy": {
"type": "string",
"description": "What external module resolution strategy to use. Defaults to 'node_modules'",
"enum": ["node_modules", "yarn-pnp"]
},
"webpackConfig": {
"type": "object",
"additionalProperties": false,
"description": "Webpack configuration to use to get resolve options from",
"properties": {
"fileName": {
"type": "string",
"description": "The webpack conf file to use (typically something like 'webpack.conf.js'). The fileName is relative to dependency-cruiser's current working directory. When not provided defaults to './webpack.conf.js'."
},
"env": {
"description": "Environment to pass if your config file returns a function",
"oneOf": [
{
"type": "object"
},
{
"type": "string"
}
]
},
"arguments": {
"type": "object",
"description": "Arguments to pass if your config file returns a function. E.g. {mode: 'production'} if you want to use webpack 4's 'mode' feature"
}
}
},
"exoticRequireStrings": {
"type": "array",
"description": "List of strings you have in use in addition to cjs/ es6 requires & imports to declare module dependencies. Use this e.g. if you've redeclared require (`const want = require`), use a require-wrapper (like semver-try-require) or use window.require as a hack to workaround something",
"items": {
"type": "string"
}
}
}
}
},
"definitions": {
"AllowedRuleType": {
"oneOf": [
{ "$ref": "#/definitions/RegularAllowedRuleType" },
{ "$ref": "#/definitions/ReachabilityAllowedRuleType" }
]
},
"RegularAllowedRuleType": {
"type": "object",
"required": ["from", "to"],
"additionalProperties": false,
"properties": {
"comment": {
"type": "string"
},
"from": {
"$ref": "#/definitions/FromRestrictionType"
},
"to": {
"$ref": "#/definitions/ToRestrictionType"
}
}
},
"ReachabilityAllowedRuleType": {
"type": "object",
"required": ["from", "to"],
"additionalProperties": false,
"properties": {
"comment": {
"type": "string"
},
"from": {
"$ref": "#/definitions/ReachabilityFromRestrictionType"
},
"to": {
"$ref": "#/definitions/ReachabilityToRestrictionType"
}
}
},
"ForbiddenRuleType": {
"oneOf": [
{ "$ref": "#/definitions/RegularForbiddenRuleType" },
{ "$ref": "#/definitions/ReachabilityForbiddenRuleType" }
]
},
"RegularForbiddenRuleType": {
"type": "object",
"required": ["from", "to"],
"additionalProperties": false,
"properties": {
"name": {
"type": "string",
"description": "A short name for the rule - will appear in reporters to enable customers to quickly identify a violated rule. Try to keep them short, eslint style. E.g. 'not-to-core' for a rule forbidding dependencies on core modules, or 'not-to-unresolvable' for one that prevents dependencies on modules that probably don't exist."
},
"severity": { "$ref": "#/definitions/SeverityType" },
"comment": {
"type": "string",
"description": "You can use this field to document why the rule is there."
},
"from": {
"$ref": "#/definitions/FromRestrictionType"
},
"to": {
"$ref": "#/definitions/ToRestrictionType"
}
}
},
"ReachabilityForbiddenRuleType": {
"type": "object",
"required": ["from", "to"],
"additionalProperties": false,
"properties": {
"name": {
"type": "string"
},
"severity": { "$ref": "#/definitions/SeverityType" },
"comment": {
"type": "string"
},
"from": {
"$ref": "#/definitions/ReachabilityFromRestrictionType"
},
"to": {
"$ref": "#/definitions/ReachabilityToRestrictionType"
}
}
},
"FromRestrictionType": {
"type": "object",
"description": "Criteria an end of a dependency should match to be caught by this rule. Leave it empty if you want any module to be matched.",
"additionalProperties": false,
"properties": {
"path": {
"type": "string",
"description": "A regular expression an end of a dependency should match to be catched by this rule."
},
"pathNot": {
"type": "string",
"description": "A regular expression an end of a dependency should NOT match to be catched by this rule."
},
"orphan": {
"type": "boolean",
"description": "Whether or not to match when the module is an orphan (= has no incoming or outgoing dependencies). When this property it is part of a rule, dependency-cruiser will ignore the 'to' part."
}
}
},
"ReachabilityFromRestrictionType": {
"type": "object",
"description": "Criteria an end of a dependency should match to be caught by this rule. Leave it empty if you want any module to be matched.",
"additionalProperties": false,
"properties": {
"path": {
"type": "string",
"description": "A regular expression an end of a dependency should match to be catched by this rule."
},
"pathNot": {
"type": "string",
"description": "A regular expression an end of a dependency should NOT match to be catched by this rule."
}
}
},
"ToRestrictionType": {
"type": "object",
"description": "Criteria the 'to' end of a dependency should match to be caught by this rule. Leave it empty if you want any module to be matched.",
"additionalProperties": false,
"properties": {
"path": {
"type": "string",
"description": "A regular expression an end of a dependency should match to be catched by this rule."
},
"pathNot": {
"type": "string",
"description": "A regular expression an end of a dependency should NOT match to be catched by this rule."
},
"couldNotResolve": {
"type": "boolean",
"description": "Whether or not to match modules dependency-cruiser could not resolve (and probably aren't on disk). For this one too: leave out if you don't care either way."
},
"circular": {
"type": "boolean",
"description": "Whether or not to match when following to the to will ultimately end up in the from."
},
"dynamic": {
"type": "boolean",
"description": "Whether or not to match when the dependency is a dynamic one."
},
"exoticRequire": {
"type": "string",
"description": "A regular expression to match against any 'exotic' require strings"
},
"exoticRequireNot": {
"type": "string",
"description": "A regular expression to match against any 'exotic' require strings - when it should NOT be caught by the rule"
},
"preCompilationOnly": {
"type": "boolean",
"description": "true if this dependency only exists before compilation (like type only imports), false in all other cases. Only returned when the tsPreCompilationDeps is set to 'specify'."
},
"dependencyTypes": {
"type": "array",
"description": "Whether or not to match modules of any of these types (leaving out matches any of them)",
"items": { "$ref": "#/definitions/DependencyType" }
},
"moreThanOneDependencyType": {
"type": "boolean",
"description": "If true matches dependencies with more than one dependency type (e.g. defined in _both_ npm and npm-dev)"
},
"license": {
"type": "string",
"description": "Whether or not to match modules that were released under one of the mentioned licenses. E.g. to flag GPL-1.0, GPL-2.0 licensed modules (e.g. because your app is not compatible with the GPL) use \"GPL\""
},
"licenseNot": {
"type": "string",
"description": "Whether or not to match modules that were NOT released under one of the mentioned licenses. E.g. to flag everyting non MIT use \"MIT\" here"
}
}
},
"ReachabilityToRestrictionType": {
"description": "Criteria the 'to' end of a dependency should match to be caught by this rule. Leave it empty if you want any module to be matched.",
"required": ["reachable"],
"additionalProperties": false,
"properties": {
"path": {
"type": "string",
"description": "A regular expression an end of a dependency should match to be catched by this rule."
},
"pathNot": {
"type": "string",
"description": "A regular expression an end of a dependency should NOT match to be catched by this rule."
},
"reachable": {
"type": "boolean",
"description": "Whether or not to match modules that aren't reachable from the from part of the rule."
}
}
},
"SeverityType": {
"type": "string",
"description": "How severe a violation of a rule is. The 'error' severity will make some reporters return a non-zero exit code, so if you want e.g. a build to stop when there's a rule violated: use that.",
"enum": ["error", "warn", "info", "ignore"]
},
"DependencyType": {
"type": "string",
"enum": [
"aliased",
"core",
"deprecated",
"local",
"localmodule",
"npm",
"npm-bundled",
"npm-dev",
"npm-no-pkg",
"npm-optional",
"npm-peer",
"npm-unknown",
"undetermined",
"unknown"
]
}
}
}