Dependency cruiser
Configuration file for Dependency cruiser
| Type | object |
|---|---|
| File match |
dependency-cruiser.config.json
|
| Schema URL | https://catalog.lintel.tools/schemas/schemastore/dependency-cruiser/latest.json |
| Source | https://raw.githubusercontent.com/sverweij/dependency-cruiser/main/src/schema/configuration.schema.json |
Validate with Lintel
npx @lintel/lintel check
A set of properties describing what dependencies are forbidden and what dependencies are allowed + options on how to cruise through the code
Properties
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.
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.
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.
A list of rules that describe what dependencies modules must have. E.g. - every controller needs to (directly) depend on a base controller. - each source file should be the dependency of a spec file with the same base name
Runtime configuration options
35 nested properties
a regular expression for modules to include, but not follow further
a regular expression for modules to exclude from being cruised
a regular expression for modules to cruise; anything outside it will be skipped
dependency-cruiser will include modules matching this regular expression in its output, as well as their neighbours (direct dependencies and dependents)
dependency-cruiser will include modules matching this regular expression in its output, as well as any module that reaches them - either directly or via via
dependency-cruiser will mark modules that have changed since the specified revision (or 'main', when not specified) in its output, as well as any module that reaches them - either directly or via via. NOTE: this is currently a command line only option, so if you pass this to the API or in a configuration file it will be ignored.
dependency-cruiser will mark modules matching this regular expression as 'highlighted' in its output
A list of violations found in the dependencies. The dependencies themselves also contain this information, this summary is here for convenience.
Collapse a to a folder depth by passing a single digit (e.g. 2). When passed a regex collapses to that pattern E.g. ^packages/[^/]+/ would collapse to modules/ folders directly under your packages folder.
The maximum cruise depth specified. 0 means no maximum specified. While it might look attractive to regulate the size of the output, this is not the best option to do so. Filters (exclude, includeOnly, focus), the dot and archi reporter's collapsePattern and the collapse options offer better, more reliable and more understandable results.
List of module systems to cruise. Defaults to [amd, cjs, es6]
When true, dependency-cruiser will detect dependencies in JSDoc-style import statements. Implies "parser": "tsc". Defaults to false.
When true, dependency-cruiser will detect calls to process.getBuiltinModule/ globalThis.process.getBuiltinModule imports. Defaults to false.
if true leave symlinks untouched, otherwise use the realpath. Defaults to false (which is also nodejs's default behavior since version 6)
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.
TypeScript project file ('tsconfig.json') to use for (1) compilation and (2) resolution (e.g. with the paths property)
1 nested properties
The TypeScript project file to use. The fileName is relative to dependency-cruiser's current working directory. When not provided defaults to './tsconfig.json'.
if true detect dependencies that only exist before typescript-to-javascript compilation.
List of extensions to scan in addition to the extensions already covered by any available parser. Dependency-cruiser will consider files ending in these extensions but it will not examine its content or derive any of their dependencies Sample value: [".jpg", ".png", ".json"]
What external module resolution strategy to use. Defaults to 'node_modules' (not used anymore - module resolution strategy determination is automatic now)
Options to tweak what dependency-cruiser considers 'built-in' modules. If you're targeting nodejs, or don't use any built-in modules you can probably leave this alone.
2 nested properties
List of module names that are to be considered as 'built-in'. By default dependency-cruiser uses the list of built-ins from nodejs. If you code for another environment (e.g. the browser) and you use shims for nodejs builtins like 'path' from node_modules, you could pass an empty array here. If you want to just add a couple of extra built-ins to the default list, use the 'add' attribute instead.
List of module names that are to be considered as 'built-in' in addition to the default list of the environment you're currently in. Use this e.g. if you're writing electron code and want to add 'electron' as built-in.
Hasn't had any effect on dependency-cruiser's behaviour since a few major versions ago. If there's a need to manipulate this use the skipAnalysisNotInRules option in stead. Previously documented behaviour: When true includes de-normalized dependents in the cruise-result, even though there's no rule in the rule set that requires them. Defaults to false.
Webpack configuration file to use to get resolve options from
3 nested properties
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'.
Environment to pass if your config file returns a function
Arguments to pass if your config file returns a function. E.g. {mode: 'production'} if you want to use webpack 4's 'mode' feature
Options used in module resolution that for dependency-cruiser's use cannot go in a webpack config. For details please refer to the documentation of enhanced-resolve itself.
7 nested properties
List of strings to consider as 'exports' fields in package.json. Use ['exports'] when you use packages that use such a field and your environment supports it (e.g. node ^12.19 || >=14.7 or recent versions of webpack).
List of conditions to check for in the exports field. e.g. use ['imports'] if you're only interested in exposed es6 modules, ['require'] for commonjs, or all conditions at once (['import', 'require', 'node', 'default']) if anything goes for you. Only works when the 'exportsFields' array is non-empty
List of extensions to scan for when resolving. Typically you want to leave this alone as dependency-cruiser figures out what extensions to scan based on 1. what is available in your environment 2. in the order your environment (nodejs, typescript) applies the resolution itself. However, if you want it to scan less you can specify so with the extensions attribute. E.g. when you're 100% sure you only have typescript & json and nothing else you can pass ['.ts', '.json'] - which can lead to performance gains on systems with slow i/o (like ms-windows), especially when your tsconfig contains paths/ aliases.
A list of main fields in manifests (package.json s). Typically you'd want to keep leave this this on its default (['main']) , but if you e.g. use external packages that only expose types, and you still want references to these types to be resolved you could expand this to ['main', 'types', 'typings']
A list of files to consider 'main' files, defaults to ['index']. Only set this when you have really special needs that warrant it.
A list of alias fields in manifests (package.jsons). Specify a field, such as browser, to be parsed according to this specification. Also see resolve.alias in the webpack docs. Defaults to an empty array (don't use any alias fields).
Options to pass to the resolver (webpack's 'enhanced resolve') regarding caching.
1 nested properties
The number of milliseconds enhanced-resolve's cached file system should use for cache duration. Typically you won't have to touch this - the default works well for repos up to 5000 modules/ 20000 dependencies, and likely for numbers above as well. If you experience memory problems on a (humongous) repository you can use the cacheDuration attribute to tame enhanced-resolve's memory usage by lowering the cache duration trading off against some (for values over 1000ms) or significant (for values below 500ms) performance. Dependency-cruiser currently uses 4000ms, and in the past has used 1000ms - both with good results.
Babel configuration (e.g. '.babelrc.json') to use.
1 nested properties
The Babel configuration file to use. The fileName is relative to dependency-cruiser's current working directory. When not provided defaults to './.babelrc.json'. Dependency-cruiser currently supports only the json variant. Support for (js|cjs|mjs) variants and configuration in package.json might follow in future releases.
overrides the parser dependency-cruiser will use - EXPERIMENTAL. The use of 'swc' as a parser here is deprecated.
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 re-declared require (const want = require), use a require-wrapper (like semver-try-require) or use window.require as a hack to workaround something
Options to tweak the output of reporters
9 nested properties
Options to tweak the output of the anonymous reporter
1 nested properties
List of words to use to replace path elements of file names in the output with so the output isn't directly traceable to its intended purpose. When the list is exhausted, the anon reporter will use random strings patterned after the original file name in stead. The list is empty by default. Read more in https://github.com/sverweij/dependency-cruiser/blob/main/doc/cli.md#anon---obfuscated-json
Options to tweak the output of the dot reporters
4 nested properties
filters to apply to the reporter before rendering it (e.g. to leave out details from the graphical output that are not relevant for the goal of the report)
When passed the value 'true', shows instability metrics in the output if dependency-cruiser calculated them. Doesn't show them in all other cases. Defaults to false
A bunch of criteria to conditionally theme the dot output
Options to tweak the output of the dot reporters
4 nested properties
filters to apply to the reporter before rendering it (e.g. to leave out details from the graphical output that are not relevant for the goal of the report)
When passed the value 'true', shows instability metrics in the output if dependency-cruiser calculated them. Doesn't show them in all other cases. Defaults to false
A bunch of criteria to conditionally theme the dot output
Options to tweak the output of the dot reporters
4 nested properties
filters to apply to the reporter before rendering it (e.g. to leave out details from the graphical output that are not relevant for the goal of the report)
When passed the value 'true', shows instability metrics in the output if dependency-cruiser calculated them. Doesn't show them in all other cases. Defaults to false
A bunch of criteria to conditionally theme the dot output
Options to tweak the output of the dot reporters
4 nested properties
filters to apply to the reporter before rendering it (e.g. to leave out details from the graphical output that are not relevant for the goal of the report)
When passed the value 'true', shows instability metrics in the output if dependency-cruiser calculated them. Doesn't show them in all other cases. Defaults to false
A bunch of criteria to conditionally theme the dot output
Options to show and hide sections of the markdown reporter and to provide alternate boilerplate text
16 nested properties
Whether or not to show a title in the report. Defaults to true.
The text to show as a title of the report. E.g. '## dependency-cruiser forbidden dependency check - results'. When left out shows a default value.
Whether or not to show a summary in the report. Defaults to true.
Whether or not to give the summary a header. Defaults to true.
The text to show as a header on top of the summary. E.g. '### Summary'. When left out shows a default value.
Whether or not to show high level stats in the summary. Defaults to true.
Whether or not to show a list of violated rules in the summary. Defaults to true.
Whether or not to show rules in the list of rules for which all violations are ignored. Defaults to true.
Whether or not to show a detailed list of violations. Defaults to true.
Whether or not to show ignored violations in the detailed list. Defaults to true.
Whether or not to give the detailed list of violations a header. Defaults to true.
The text to show as a header on top of the detailed list of violations. E.g. '### All violations'. When left out shows a default value.
Whether or not to collapse the list of violations in a
The text to in the section of the
The text to show when no violations were found. E.g. 'No violations found'. When left out shows a default value.
Whether or not to show a footer (with version & run date) at the bottom of the report. Defaults to true
Options to tweak the output of the metrics reporter
3 nested properties
By what attribute (in addition to the names of the folders/ modules) to order the metrics by. Defaults to 'instability'.
When true hides module metrics from the report. Defaults to false
When true hides folder metrics from the report. Defaults to false
Options to tweak the output of the mermaid reporters
1 nested properties
Whether or not to compresses the output text. Defaults to true.
Options that influence rendition of the text reporter
1 nested properties
Whether or not to highlight modules that are focused with the --focus command line option (/ general option). Defaults to false
How dependency-cruiser shows progress. Defaults to 'none'.
2 nested properties
The maximum log level to emit messages at. Ranges from OFF (-1, don't show any messages), via SUMMARY (40), INFO (50), DEBUG (60) all the way to show ALL messages (99).
When this flag is set to true, dependency-cruiser will calculate (stability) metrics for all modules and folders. Defaults to false.
When this flag is set to true, dependency-cruiser will calculate some stats for each module. Has some performance impact. EXPERIMENTAL Will be renamed when the 'experimental' state is lifted. Defaults to false.
When this flag is set to true, dependency-cruiser will skip all analysis that don't serve a rule. E.g. if there's no 'circular' rule in the rule set it won't analyse cycles. This flag affects cycle, dependents and orphan analysis. If you have a rule set that doesn't use one of these features, switching it to true will make cruises faster. Defaults to false for backwards compatibility. For most uses of dependency-cruiser we recommend to switch this option to true, though.
The directory dependency-cruiser should run its cruise from. Defaults to the current working directory.
- false: don't use caching.
- true or empty object: use caching with the default settings
- a string (deprecated): cache in the folder denoted by the string & use the
default caching strategy. This is deprecated - instead pass a cache object
e.g.
{ folder: 'your/cache/location' }.
Defaults to false (no caching). When caching is switched on the default cache folder is 'node_modules/.cache/dependency-cruiser/'
A configuration (or an array of configurations) this configuration uses as a base
Definitions
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.
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.
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.
A list of rules that describe what dependencies modules must have. E.g. - every controller needs to (directly) depend on a base controller. - each source file should be the dependency of a spec file with the same base name
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.
3 nested properties
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.
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.
20 nested properties
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.
Whether or not to match when following to the to will ultimately end up in the from.
Whether or not to match when the dependency is a dynamic one.
Whether or not to match when the dependency is exotically required.
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'.
Whether or not to match modules of any of these types (leaving out matches any of them)
Whether or not to match modules NOT of any of these types (leaving out matches none of them)
If true matches dependencies with more than one dependency type (e.g. defined in both npm and npm-dev)
When set to true moreUnstable matches for any dependency that has a higher Instability than the module that depends on it. When set to false it matches when the opposite is true; the dependency has an equal or lower Instability. This attribute is useful when you want to check against Robert C. Martin's stable dependency principle. See online documentation for examples and details. Leave this out when you don't care either way.
When set to true, matches when the dependency is in a folder above the folder of the module.
What to apply the rule to - modules (the default) or folders. Currently ignored for 'allowed' rules, defaulting to 'module'
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.
2 nested properties
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.
3 nested properties
Whether or not to match modules that aren't reachable from the from part of the rule.
What to apply the rule to - modules (the default) or folders. Currently ignored for 'allowed' rules, defaulting to 'module'
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.
3 nested properties
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.
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.
20 nested properties
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.
Whether or not to match when following to the to will ultimately end up in the from.
Whether or not to match when the dependency is a dynamic one.
Whether or not to match when the dependency is exotically required.
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'.
Whether or not to match modules of any of these types (leaving out matches any of them)
Whether or not to match modules NOT of any of these types (leaving out matches none of them)
If true matches dependencies with more than one dependency type (e.g. defined in both npm and npm-dev)
When set to true moreUnstable matches for any dependency that has a higher Instability than the module that depends on it. When set to false it matches when the opposite is true; the dependency has an equal or lower Instability. This attribute is useful when you want to check against Robert C. Martin's stable dependency principle. See online documentation for examples and details. Leave this out when you don't care either way.
When set to true, matches when the dependency is in a folder above the folder of the module.
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.
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.
What to apply the rule to - modules (the default) or folders. Switching the scope to 'folder' can be useful in rules where this makes a difference like those regarding circular dependencies or instability. Only the to.moreUnstable, to.circular, and path (both from and to) attributes work at the moment. Other attributes will follow suit in later releases (depending on demand).
You can use this field to document why the rule is there.
Criteria to select the module(s) this restriction should apply to
4 nested properties
Matches when the number of times the 'to' module is used falls below (<) this number. Caveat: only works in concert with path and pathNot restrictions in the from and to parts of the rule; other conditions will be ignored. E.g. to flag modules that are used only once or not at all, use 2 here.
Matches when the number of times the 'to' module is used raises above (>) this number. Caveat: only works in concert with path and pathNot restrictions in the from and to parts of the rule; other conditions will be ignored. E.g. to flag modules that are used more than 10 times, use 10 here.
Criteria the dependents of the module should adhere to be caught by this rule rule. Leave it empty if you want any dependent to be matched.
2 nested properties
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.
What to apply the rule to - modules (the default) or folders. Currently ignored for DependentsForbiddenRules, defaulting to 'module'
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.
2 nested properties
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.
3 nested properties
Whether or not to match modules that aren't reachable from the from part of the rule.
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.
What to apply the rule to - modules (the default) or folders. Currently ignored for ReachabilityForbiddenRules, defaulting to 'module'
Criteria to select the module(s) this restriction should apply to
2 nested properties
Criteria for modules the associated module must depend on.
2 nested properties
Whether or not to match transitive ('indirect') dependencies as well as direct ones.
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.
What to apply the rule to - modules (the default) or folders. Currently ignored for RequiredRules, defaulting to 'module'
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.
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.
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.
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.
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.
Whether or not to match when following to the to will ultimately end up in the from.
Whether or not to match when the dependency is a dynamic one.
Whether or not to match when the dependency is exotically required.
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'.
Whether or not to match modules of any of these types (leaving out matches any of them)
Whether or not to match modules NOT of any of these types (leaving out matches none of them)
If true matches dependencies with more than one dependency type (e.g. defined in both npm and npm-dev)
When set to true moreUnstable matches for any dependency that has a higher Instability than the module that depends on it. When set to false it matches when the opposite is true; the dependency has an equal or lower Instability. This attribute is useful when you want to check against Robert C. Martin's stable dependency principle. See online documentation for examples and details. Leave this out when you don't care either way.
When set to true, matches when the dependency is in a folder above the folder of the module.
Criteria to select the module(s) this restriction should apply to
Matches when the number of times the 'to' module is used falls below (<) this number. Caveat: only works in concert with path and pathNot restrictions in the from and to parts of the rule; other conditions will be ignored. E.g. to flag modules that are used only once or not at all, use 2 here.
Matches when the number of times the 'to' module is used raises above (>) this number. Caveat: only works in concert with path and pathNot restrictions in the from and to parts of the rule; other conditions will be ignored. E.g. to flag modules that are used more than 10 times, use 10 here.
Criteria the dependents of the module should adhere to be caught by this rule rule. Leave it empty if you want any dependent to be matched.
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.
Whether or not to match modules that aren't reachable from the from part of the rule.
Criteria to select the module(s) this restriction should apply to
Criteria for modules the associated module must depend on.
Whether or not to match transitive ('indirect') dependencies as well as direct ones.
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.
Runtime configuration options
a regular expression for modules to include, but not follow further
a regular expression for modules to exclude from being cruised
a regular expression for modules to cruise; anything outside it will be skipped
dependency-cruiser will include modules matching this regular expression in its output, as well as their neighbours (direct dependencies and dependents)
dependency-cruiser will include modules matching this regular expression in its output, as well as any module that reaches them - either directly or via via
dependency-cruiser will mark modules that have changed since the specified revision (or 'main', when not specified) in its output, as well as any module that reaches them - either directly or via via. NOTE: this is currently a command line only option, so if you pass this to the API or in a configuration file it will be ignored.
dependency-cruiser will mark modules matching this regular expression as 'highlighted' in its output
A list of violations found in the dependencies. The dependencies themselves also contain this information, this summary is here for convenience.
Collapse a to a folder depth by passing a single digit (e.g. 2). When passed a regex collapses to that pattern E.g. ^packages/[^/]+/ would collapse to modules/ folders directly under your packages folder.
The maximum cruise depth specified. 0 means no maximum specified. While it might look attractive to regulate the size of the output, this is not the best option to do so. Filters (exclude, includeOnly, focus), the dot and archi reporter's collapsePattern and the collapse options offer better, more reliable and more understandable results.
List of module systems to cruise. Defaults to [amd, cjs, es6]
When true, dependency-cruiser will detect dependencies in JSDoc-style import statements. Implies "parser": "tsc". Defaults to false.
When true, dependency-cruiser will detect calls to process.getBuiltinModule/ globalThis.process.getBuiltinModule imports. Defaults to false.
if true leave symlinks untouched, otherwise use the realpath. Defaults to false (which is also nodejs's default behavior since version 6)
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.
TypeScript project file ('tsconfig.json') to use for (1) compilation and (2) resolution (e.g. with the paths property)
1 nested properties
The TypeScript project file to use. The fileName is relative to dependency-cruiser's current working directory. When not provided defaults to './tsconfig.json'.
if true detect dependencies that only exist before typescript-to-javascript compilation.
List of extensions to scan in addition to the extensions already covered by any available parser. Dependency-cruiser will consider files ending in these extensions but it will not examine its content or derive any of their dependencies Sample value: [".jpg", ".png", ".json"]
What external module resolution strategy to use. Defaults to 'node_modules' (not used anymore - module resolution strategy determination is automatic now)
Options to tweak what dependency-cruiser considers 'built-in' modules. If you're targeting nodejs, or don't use any built-in modules you can probably leave this alone.
2 nested properties
List of module names that are to be considered as 'built-in'. By default dependency-cruiser uses the list of built-ins from nodejs. If you code for another environment (e.g. the browser) and you use shims for nodejs builtins like 'path' from node_modules, you could pass an empty array here. If you want to just add a couple of extra built-ins to the default list, use the 'add' attribute instead.
List of module names that are to be considered as 'built-in' in addition to the default list of the environment you're currently in. Use this e.g. if you're writing electron code and want to add 'electron' as built-in.
Hasn't had any effect on dependency-cruiser's behaviour since a few major versions ago. If there's a need to manipulate this use the skipAnalysisNotInRules option in stead. Previously documented behaviour: When true includes de-normalized dependents in the cruise-result, even though there's no rule in the rule set that requires them. Defaults to false.
Webpack configuration file to use to get resolve options from
3 nested properties
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'.
Environment to pass if your config file returns a function
Arguments to pass if your config file returns a function. E.g. {mode: 'production'} if you want to use webpack 4's 'mode' feature
Options used in module resolution that for dependency-cruiser's use cannot go in a webpack config. For details please refer to the documentation of enhanced-resolve itself.
7 nested properties
List of strings to consider as 'exports' fields in package.json. Use ['exports'] when you use packages that use such a field and your environment supports it (e.g. node ^12.19 || >=14.7 or recent versions of webpack).
List of conditions to check for in the exports field. e.g. use ['imports'] if you're only interested in exposed es6 modules, ['require'] for commonjs, or all conditions at once (['import', 'require', 'node', 'default']) if anything goes for you. Only works when the 'exportsFields' array is non-empty
List of extensions to scan for when resolving. Typically you want to leave this alone as dependency-cruiser figures out what extensions to scan based on 1. what is available in your environment 2. in the order your environment (nodejs, typescript) applies the resolution itself. However, if you want it to scan less you can specify so with the extensions attribute. E.g. when you're 100% sure you only have typescript & json and nothing else you can pass ['.ts', '.json'] - which can lead to performance gains on systems with slow i/o (like ms-windows), especially when your tsconfig contains paths/ aliases.
A list of main fields in manifests (package.json s). Typically you'd want to keep leave this this on its default (['main']) , but if you e.g. use external packages that only expose types, and you still want references to these types to be resolved you could expand this to ['main', 'types', 'typings']
A list of files to consider 'main' files, defaults to ['index']. Only set this when you have really special needs that warrant it.
A list of alias fields in manifests (package.jsons). Specify a field, such as browser, to be parsed according to this specification. Also see resolve.alias in the webpack docs. Defaults to an empty array (don't use any alias fields).
Options to pass to the resolver (webpack's 'enhanced resolve') regarding caching.
1 nested properties
The number of milliseconds enhanced-resolve's cached file system should use for cache duration. Typically you won't have to touch this - the default works well for repos up to 5000 modules/ 20000 dependencies, and likely for numbers above as well. If you experience memory problems on a (humongous) repository you can use the cacheDuration attribute to tame enhanced-resolve's memory usage by lowering the cache duration trading off against some (for values over 1000ms) or significant (for values below 500ms) performance. Dependency-cruiser currently uses 4000ms, and in the past has used 1000ms - both with good results.
Babel configuration (e.g. '.babelrc.json') to use.
1 nested properties
The Babel configuration file to use. The fileName is relative to dependency-cruiser's current working directory. When not provided defaults to './.babelrc.json'. Dependency-cruiser currently supports only the json variant. Support for (js|cjs|mjs) variants and configuration in package.json might follow in future releases.
overrides the parser dependency-cruiser will use - EXPERIMENTAL. The use of 'swc' as a parser here is deprecated.
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 re-declared require (const want = require), use a require-wrapper (like semver-try-require) or use window.require as a hack to workaround something
Options to tweak the output of reporters
9 nested properties
Options to tweak the output of the anonymous reporter
1 nested properties
List of words to use to replace path elements of file names in the output with so the output isn't directly traceable to its intended purpose. When the list is exhausted, the anon reporter will use random strings patterned after the original file name in stead. The list is empty by default. Read more in https://github.com/sverweij/dependency-cruiser/blob/main/doc/cli.md#anon---obfuscated-json
Options to tweak the output of the dot reporters
4 nested properties
filters to apply to the reporter before rendering it (e.g. to leave out details from the graphical output that are not relevant for the goal of the report)
When passed the value 'true', shows instability metrics in the output if dependency-cruiser calculated them. Doesn't show them in all other cases. Defaults to false
A bunch of criteria to conditionally theme the dot output
Options to tweak the output of the dot reporters
4 nested properties
filters to apply to the reporter before rendering it (e.g. to leave out details from the graphical output that are not relevant for the goal of the report)
When passed the value 'true', shows instability metrics in the output if dependency-cruiser calculated them. Doesn't show them in all other cases. Defaults to false
A bunch of criteria to conditionally theme the dot output
Options to tweak the output of the dot reporters
4 nested properties
filters to apply to the reporter before rendering it (e.g. to leave out details from the graphical output that are not relevant for the goal of the report)
When passed the value 'true', shows instability metrics in the output if dependency-cruiser calculated them. Doesn't show them in all other cases. Defaults to false
A bunch of criteria to conditionally theme the dot output
Options to tweak the output of the dot reporters
4 nested properties
filters to apply to the reporter before rendering it (e.g. to leave out details from the graphical output that are not relevant for the goal of the report)
When passed the value 'true', shows instability metrics in the output if dependency-cruiser calculated them. Doesn't show them in all other cases. Defaults to false
A bunch of criteria to conditionally theme the dot output
Options to show and hide sections of the markdown reporter and to provide alternate boilerplate text
16 nested properties
Whether or not to show a title in the report. Defaults to true.
The text to show as a title of the report. E.g. '## dependency-cruiser forbidden dependency check - results'. When left out shows a default value.
Whether or not to show a summary in the report. Defaults to true.
Whether or not to give the summary a header. Defaults to true.
The text to show as a header on top of the summary. E.g. '### Summary'. When left out shows a default value.
Whether or not to show high level stats in the summary. Defaults to true.
Whether or not to show a list of violated rules in the summary. Defaults to true.
Whether or not to show rules in the list of rules for which all violations are ignored. Defaults to true.
Whether or not to show a detailed list of violations. Defaults to true.
Whether or not to show ignored violations in the detailed list. Defaults to true.
Whether or not to give the detailed list of violations a header. Defaults to true.
The text to show as a header on top of the detailed list of violations. E.g. '### All violations'. When left out shows a default value.
Whether or not to collapse the list of violations in a
The text to in the section of the
The text to show when no violations were found. E.g. 'No violations found'. When left out shows a default value.
Whether or not to show a footer (with version & run date) at the bottom of the report. Defaults to true
Options to tweak the output of the metrics reporter
3 nested properties
By what attribute (in addition to the names of the folders/ modules) to order the metrics by. Defaults to 'instability'.
When true hides module metrics from the report. Defaults to false
When true hides folder metrics from the report. Defaults to false
Options to tweak the output of the mermaid reporters
1 nested properties
Whether or not to compresses the output text. Defaults to true.
Options that influence rendition of the text reporter
1 nested properties
Whether or not to highlight modules that are focused with the --focus command line option (/ general option). Defaults to false
How dependency-cruiser shows progress. Defaults to 'none'.
2 nested properties
The maximum log level to emit messages at. Ranges from OFF (-1, don't show any messages), via SUMMARY (40), INFO (50), DEBUG (60) all the way to show ALL messages (99).
When this flag is set to true, dependency-cruiser will calculate (stability) metrics for all modules and folders. Defaults to false.
When this flag is set to true, dependency-cruiser will calculate some stats for each module. Has some performance impact. EXPERIMENTAL Will be renamed when the 'experimental' state is lifted. Defaults to false.
When this flag is set to true, dependency-cruiser will skip all analysis that don't serve a rule. E.g. if there's no 'circular' rule in the rule set it won't analyse cycles. This flag affects cycle, dependents and orphan analysis. If you have a rule set that doesn't use one of these features, switching it to true will make cruises faster. Defaults to false for backwards compatibility. For most uses of dependency-cruiser we recommend to switch this option to true, though.
The directory dependency-cruiser should run its cruise from. Defaults to the current working directory.
- false: don't use caching.
- true or empty object: use caching with the default settings
- a string (deprecated): cache in the folder denoted by the string & use the
default caching strategy. This is deprecated - instead pass a cache object
e.g.
{ folder: 'your/cache/location' }.
Defaults to false (no caching). When caching is switched on the default cache folder is 'node_modules/.cache/dependency-cruiser/'
List of module systems to cruise. Defaults to [amd, cjs, es6]
Criteria for dependencies to exclude
a boolean indicating whether or not to exclude dynamic dependencies
Criteria for modules to include, but not to follow further
an array of dependency types to include, but not follow further
Criteria for modules to only include
Criteria for modules to 'focus' on
by default 'focus' only inlcudes the direct neighbours of the focus'ed module(s). This property makes dependency-cruiser will also include neighbors of neighbors, up to the specified depth.
Options to tweak the output of reporters
Options to tweak the output of the anonymous reporter
1 nested properties
List of words to use to replace path elements of file names in the output with so the output isn't directly traceable to its intended purpose. When the list is exhausted, the anon reporter will use random strings patterned after the original file name in stead. The list is empty by default. Read more in https://github.com/sverweij/dependency-cruiser/blob/main/doc/cli.md#anon---obfuscated-json
Options to tweak the output of the dot reporters
4 nested properties
filters to apply to the reporter before rendering it (e.g. to leave out details from the graphical output that are not relevant for the goal of the report)
When passed the value 'true', shows instability metrics in the output if dependency-cruiser calculated them. Doesn't show them in all other cases. Defaults to false
A bunch of criteria to conditionally theme the dot output
6 nested properties
If passed with the value 'true', the passed theme replaces the default one. In all other cases it extends the default theme.
Name- value pairs of GraphViz dot (global) attributes.
Name- value pairs of GraphViz dot node attributes.
Name- value pairs of GraphViz dot edge attributes.
Options to tweak the output of the dot reporters
4 nested properties
filters to apply to the reporter before rendering it (e.g. to leave out details from the graphical output that are not relevant for the goal of the report)
When passed the value 'true', shows instability metrics in the output if dependency-cruiser calculated them. Doesn't show them in all other cases. Defaults to false
A bunch of criteria to conditionally theme the dot output
6 nested properties
If passed with the value 'true', the passed theme replaces the default one. In all other cases it extends the default theme.
Name- value pairs of GraphViz dot (global) attributes.
Name- value pairs of GraphViz dot node attributes.
Name- value pairs of GraphViz dot edge attributes.
Options to tweak the output of the dot reporters
4 nested properties
filters to apply to the reporter before rendering it (e.g. to leave out details from the graphical output that are not relevant for the goal of the report)
When passed the value 'true', shows instability metrics in the output if dependency-cruiser calculated them. Doesn't show them in all other cases. Defaults to false
A bunch of criteria to conditionally theme the dot output
6 nested properties
If passed with the value 'true', the passed theme replaces the default one. In all other cases it extends the default theme.
Name- value pairs of GraphViz dot (global) attributes.
Name- value pairs of GraphViz dot node attributes.
Name- value pairs of GraphViz dot edge attributes.
Options to tweak the output of the dot reporters
4 nested properties
filters to apply to the reporter before rendering it (e.g. to leave out details from the graphical output that are not relevant for the goal of the report)
When passed the value 'true', shows instability metrics in the output if dependency-cruiser calculated them. Doesn't show them in all other cases. Defaults to false
A bunch of criteria to conditionally theme the dot output
6 nested properties
If passed with the value 'true', the passed theme replaces the default one. In all other cases it extends the default theme.
Name- value pairs of GraphViz dot (global) attributes.
Name- value pairs of GraphViz dot node attributes.
Name- value pairs of GraphViz dot edge attributes.
Options to show and hide sections of the markdown reporter and to provide alternate boilerplate text
16 nested properties
Whether or not to show a title in the report. Defaults to true.
The text to show as a title of the report. E.g. '## dependency-cruiser forbidden dependency check - results'. When left out shows a default value.
Whether or not to show a summary in the report. Defaults to true.
Whether or not to give the summary a header. Defaults to true.
The text to show as a header on top of the summary. E.g. '### Summary'. When left out shows a default value.
Whether or not to show high level stats in the summary. Defaults to true.
Whether or not to show a list of violated rules in the summary. Defaults to true.
Whether or not to show rules in the list of rules for which all violations are ignored. Defaults to true.
Whether or not to show a detailed list of violations. Defaults to true.
Whether or not to show ignored violations in the detailed list. Defaults to true.
Whether or not to give the detailed list of violations a header. Defaults to true.
The text to show as a header on top of the detailed list of violations. E.g. '### All violations'. When left out shows a default value.
Whether or not to collapse the list of violations in a
The text to in the section of the
The text to show when no violations were found. E.g. 'No violations found'. When left out shows a default value.
Whether or not to show a footer (with version & run date) at the bottom of the report. Defaults to true
Options to tweak the output of the metrics reporter
3 nested properties
By what attribute (in addition to the names of the folders/ modules) to order the metrics by. Defaults to 'instability'.
When true hides module metrics from the report. Defaults to false
When true hides folder metrics from the report. Defaults to false
Options to tweak the output of the mermaid reporters
1 nested properties
Whether or not to compresses the output text. Defaults to true.
Options that influence rendition of the text reporter
1 nested properties
Whether or not to highlight modules that are focused with the --focus command line option (/ general option). Defaults to false
Options to tweak the output of the anonymous reporter
List of words to use to replace path elements of file names in the output with so the output isn't directly traceable to its intended purpose. When the list is exhausted, the anon reporter will use random strings patterned after the original file name in stead. The list is empty by default. Read more in https://github.com/sverweij/dependency-cruiser/blob/main/doc/cli.md#anon---obfuscated-json
Options to tweak the output of the metrics reporter
By what attribute (in addition to the names of the folders/ modules) to order the metrics by. Defaults to 'instability'.
When true hides module metrics from the report. Defaults to false
When true hides folder metrics from the report. Defaults to false
Options to show and hide sections of the markdown reporter and to provide alternate boilerplate text
Whether or not to show a title in the report. Defaults to true.
The text to show as a title of the report. E.g. '## dependency-cruiser forbidden dependency check - results'. When left out shows a default value.
Whether or not to show a summary in the report. Defaults to true.
Whether or not to give the summary a header. Defaults to true.
The text to show as a header on top of the summary. E.g. '### Summary'. When left out shows a default value.
Whether or not to show high level stats in the summary. Defaults to true.
Whether or not to show a list of violated rules in the summary. Defaults to true.
Whether or not to show rules in the list of rules for which all violations are ignored. Defaults to true.
Whether or not to show a detailed list of violations. Defaults to true.
Whether or not to show ignored violations in the detailed list. Defaults to true.
Whether or not to give the detailed list of violations a header. Defaults to true.
The text to show as a header on top of the detailed list of violations. E.g. '### All violations'. When left out shows a default value.
Whether or not to collapse the list of violations in a
The text to in the
The text to show when no violations were found. E.g. 'No violations found'. When left out shows a default value.
Whether or not to show a footer (with version & run date) at the bottom of the report. Defaults to true
Options to tweak the output of the mermaid reporters
Whether or not to compresses the output text. Defaults to true.
Options that influence rendition of the text reporter
Whether or not to highlight modules that are focused with the --focus command line option (/ general option). Defaults to false
Options to tweak the output of the dot reporters
filters to apply to the reporter before rendering it (e.g. to leave out details from the graphical output that are not relevant for the goal of the report)
4 nested properties
Criteria for dependencies to exclude
2 nested properties
a boolean indicating whether or not to exclude dynamic dependencies
Criteria for modules to 'focus' on
2 nested properties
by default 'focus' only inlcudes the direct neighbours of the focus'ed module(s). This property makes dependency-cruiser will also include neighbors of neighbors, up to the specified depth.
1 nested properties
When passed the value 'true', shows instability metrics in the output if dependency-cruiser calculated them. Doesn't show them in all other cases. Defaults to false
A bunch of criteria to conditionally theme the dot output
6 nested properties
If passed with the value 'true', the passed theme replaces the default one. In all other cases it extends the default theme.
Name- value pairs of GraphViz dot (global) attributes.
Name- value pairs of GraphViz dot node attributes.
Name- value pairs of GraphViz dot edge attributes.
A bunch of criteria to conditionally theme the dot output
If passed with the value 'true', the passed theme replaces the default one. In all other cases it extends the default theme.
Name- value pairs of GraphViz dot (global) attributes.
Name- value pairs of GraphViz dot node attributes.
Name- value pairs of GraphViz dot edge attributes.
filters to apply to the reporter before rendering it (e.g. to leave out details from the graphical output that are not relevant for the goal of the report)
Criteria for dependencies to exclude
2 nested properties
a boolean indicating whether or not to exclude dynamic dependencies
Criteria for modules to 'focus' on
2 nested properties
by default 'focus' only inlcudes the direct neighbours of the focus'ed module(s). This property makes dependency-cruiser will also include neighbors of neighbors, up to the specified depth.
1 nested properties
A list of violations found in the dependencies. The dependencies themselves also contain this information, this summary is here for convenience.
If there was a rule violation (valid === false), this object contains the name of the rule and severity of violating it.
2 nested properties
The (short, eslint style) name of the violated rule. Typically something like 'no-core-punycode' or 'no-outside-deps'.
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.
The circular path if the violation is about circularity
The path from the from to the to if the violation is transitive
2 nested properties
1 nested properties
1 nested properties
Free format text you can e.g. use to explain why this violation can be ignored or is quarantined (only used in known-violations)
If there was a rule violation (valid === false), this object contains the name of the rule and severity of violating it.
The (short, eslint style) name of the violated rule. Typically something like 'no-core-punycode' or 'no-outside-deps'.
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.
A small dependency object with the uniquely identifying name of the module +the dependency types it has relative to the previous module in the chain it is part of (e.g. a cycle).
The name of the module
The dependency types of the module relative to the previous module in the chain it is a part of (e.g. a cycle)
The folder to store the cache in. Defaults to node_modules/.cache/dependency-cruiser
The strategy to use for caching.
- 'metadata': use git metadata to detect changes;
- 'content': use (a checksum of) the contents of files to detect changes.
'content' is useful if you're not using git or work on partial clones (which is typical on CI's). Trade-of: the 'content' strategy is typically slower.
Defaults to 'metadata'.
Whether to compress the cache or not Setting this to true will adds a few ms to the execution time, but typically reduces the cache size by 80-90%.
Defaults to false.
The strategy to use for caching.
- 'metadata': use git metadata to detect changes;
- 'content': use (a checksum of) the contents of files to detect changes.
'content' is useful if you're not using git or work on partial clones (which is typical on CI's). Trade-of: the 'content' strategy is typically slower.
Defaults to 'metadata'.
A configuration (or an array of configurations) this configuration uses as a base