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
Type: object

A set of properties describing what dependencies are forbidden and what dependencies are allowed + options on how to cruise through the code

Properties

$schema string

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.

allowedSeverity string

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.

Values: "error" "warn" "info" "ignore"

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

options object

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

affected string | boolean

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

knownViolations ViolationType[]

A list of violations found in the dependencies. The dependencies themselves also contain this information, this summary is here for convenience.

collapse string | integer

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.

maxDepth integer

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.

min=0max=99
moduleSystems ModuleSystemType[]

List of module systems to cruise. Defaults to [amd, cjs, es6]

detectJSDocImports boolean

When true, dependency-cruiser will detect dependencies in JSDoc-style import statements. Implies "parser": "tsc". Defaults to false.

detectProcessBuiltinModuleCalls boolean

When true, dependency-cruiser will detect calls to process.getBuiltinModule/ globalThis.process.getBuiltinModule imports. Defaults to false.

prefix string
suffix string
preserveSymlinks boolean

if true leave symlinks untouched, otherwise use the realpath. Defaults to false (which is also nodejs's default behavior since version 6)

combinedDependencies boolean

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 object

TypeScript project file ('tsconfig.json') to use for (1) compilation and (2) resolution (e.g. with the paths property)

1 nested properties
fileName string

The TypeScript project file to use. The fileName is relative to dependency-cruiser's current working directory. When not provided defaults to './tsconfig.json'.

tsPreCompilationDeps boolean | string

if true detect dependencies that only exist before typescript-to-javascript compilation.

extraExtensionsToScan string[]

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"]

externalModuleResolutionStrategy string

What external module resolution strategy to use. Defaults to 'node_modules' (not used anymore - module resolution strategy determination is automatic now)

Values: "node_modules" "yarn-pnp"
builtInModules object

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
override string[]

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.

add string[]

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.

forceDeriveDependents boolean

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.

webpackConfig object

Webpack configuration file to use to get resolve options from

3 nested properties
fileName string

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 object | string

Environment to pass if your config file returns a function

arguments object

Arguments to pass if your config file returns a function. E.g. {mode: 'production'} if you want to use webpack 4's 'mode' feature

enhancedResolveOptions object

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
exportsFields string[]

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).

conditionNames string[]

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

extensions string[]

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.

mainFields string[]

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']

mainFiles array

A list of files to consider 'main' files, defaults to ['index']. Only set this when you have really special needs that warrant it.

aliasFields string[]

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).

cachedInputFileSystem object

Options to pass to the resolver (webpack's 'enhanced resolve') regarding caching.

1 nested properties
cacheDuration integer

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.

min=0max=1800000
babelConfig object

Babel configuration (e.g. '.babelrc.json') to use.

1 nested properties
fileName string

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.

parser string

overrides the parser dependency-cruiser will use - EXPERIMENTAL. The use of 'swc' as a parser here is deprecated.

Values: "acorn" "tsc" "swc"
exoticRequireStrings string[]

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

reporterOptions object

Options to tweak the output of reporters

9 nested properties
anon object

Options to tweak the output of the anonymous reporter

1 nested properties
wordlist string[]

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

archi object

Options to tweak the output of the dot reporters

4 nested properties
collapsePattern string | string[]
filters object

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)

showMetrics boolean

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

theme object

A bunch of criteria to conditionally theme the dot output

dot object

Options to tweak the output of the dot reporters

4 nested properties
collapsePattern string | string[]
filters object

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)

showMetrics boolean

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

theme object

A bunch of criteria to conditionally theme the dot output

ddot object

Options to tweak the output of the dot reporters

4 nested properties
collapsePattern string | string[]
filters object

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)

showMetrics boolean

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

theme object

A bunch of criteria to conditionally theme the dot output

flat object

Options to tweak the output of the dot reporters

4 nested properties
collapsePattern string | string[]
filters object

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)

showMetrics boolean

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

theme object

A bunch of criteria to conditionally theme the dot output

markdown object

Options to show and hide sections of the markdown reporter and to provide alternate boilerplate text

16 nested properties
showTitle boolean

Whether or not to show a title in the report. Defaults to true.

title string

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.

showSummary boolean

Whether or not to show a summary in the report. Defaults to true.

showSummaryHeader boolean

Whether or not to give the summary a header. Defaults to true.

summaryHeader string

The text to show as a header on top of the summary. E.g. '### Summary'. When left out shows a default value.

showStatsSummary boolean

Whether or not to show high level stats in the summary. Defaults to true.

showRulesSummary boolean

Whether or not to show a list of violated rules in the summary. Defaults to true.

includeIgnoredInSummary boolean

Whether or not to show rules in the list of rules for which all violations are ignored. Defaults to true.

showDetails boolean

Whether or not to show a detailed list of violations. Defaults to true.

includeIgnoredInDetails boolean

Whether or not to show ignored violations in the detailed list. Defaults to true.

showDetailsHeader boolean

Whether or not to give the detailed list of violations a header. Defaults to true.

detailsHeader string

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.

collapseDetails boolean

Whether or not to collapse the list of violations in a

block. Defaults to true.

collapsedMessage string

The text to in the

section of the
block. E.g. 'click to see all violations'. When left out shows a default value.

noViolationsMessage string

The text to show when no violations were found. E.g. 'No violations found'. When left out shows a default value.

showFooter boolean

Whether or not to show a footer (with version & run date) at the bottom of the report. Defaults to true

metrics object

Options to tweak the output of the metrics reporter

3 nested properties
orderBy string

By what attribute (in addition to the names of the folders/ modules) to order the metrics by. Defaults to 'instability'.

Values: "instability" "moduleCount" "afferentCouplings" "efferentCouplings" "name" "size" "topLevelStatementCount"
hideModules boolean

When true hides module metrics from the report. Defaults to false

hideFolders boolean

When true hides folder metrics from the report. Defaults to false

mermaid object

Options to tweak the output of the mermaid reporters

1 nested properties
minify boolean

Whether or not to compresses the output text. Defaults to true.

text object

Options that influence rendition of the text reporter

1 nested properties
highlightFocused boolean

Whether or not to highlight modules that are focused with the --focus command line option (/ general option). Defaults to false

progress object

How dependency-cruiser shows progress. Defaults to 'none'.

2 nested properties
type string
Values: "cli-feedback" "performance-log" "ndjson" "none"
maximumLevel number

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).

Values: -1 40 50 60 70 80 99
metrics boolean

When this flag is set to true, dependency-cruiser will calculate (stability) metrics for all modules and folders. Defaults to false.

experimentalStats boolean

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.

skipAnalysisNotInRules boolean

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.

baseDir string

The directory dependency-cruiser should run its cruise from. Defaults to the current working directory.

cache boolean | string | CacheOptionsType
  • 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/'

extends string | string[]

A configuration (or an array of configurations) this configuration uses as a base

Definitions

RuleSetType object

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.

allowedSeverity string

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.

Values: "error" "warn" "info" "ignore"

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

AllowedRuleType RegularAllowedRuleType | ReachabilityAllowedRuleType
RegularAllowedRuleType object
from object required

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
path string | string[]
pathNot string | string[]
orphan boolean

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.

to object required

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
path string | string[]
pathNot string | string[]
couldNotResolve boolean

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 boolean

Whether or not to match when following to the to will ultimately end up in the from.

dynamic boolean

Whether or not to match when the dependency is a dynamic one.

exoticallyRequired boolean

Whether or not to match when the dependency is exotically required.

exoticRequire string | string[]
exoticRequireNot string | string[]
preCompilationOnly boolean

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 DependencyTypeType[]

Whether or not to match modules of any of these types (leaving out matches any of them)

dependencyTypesNot DependencyTypeType[]

Whether or not to match modules NOT of any of these types (leaving out matches none of them)

moreThanOneDependencyType boolean

If true matches dependencies with more than one dependency type (e.g. defined in both npm and npm-dev)

license string | string[]
licenseNot string | string[]
via REAsStringsType | object
viaOnly REAsStringsType | object
viaNot string | string[]
viaSomeNot string | string[]
moreUnstable boolean

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.

ancestor boolean

When set to true, matches when the dependency is in a folder above the folder of the module.

comment string
scope string

What to apply the rule to - modules (the default) or folders. Currently ignored for 'allowed' rules, defaulting to 'module'

Values: "module" "folder"
ReachabilityAllowedRuleType object
from object required

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
path string | string[]
pathNot string | string[]
to object required

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
reachable boolean required

Whether or not to match modules that aren't reachable from the from part of the rule.

path string | string[]
pathNot string | string[]
comment string
scope string

What to apply the rule to - modules (the default) or folders. Currently ignored for 'allowed' rules, defaulting to 'module'

Values: "module" "folder"
ForbiddenRuleType RegularForbiddenRuleType | ReachabilityForbiddenRuleType | DependentsForbiddenRuleType
RegularForbiddenRuleType object
from object required

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
path string | string[]
pathNot string | string[]
orphan boolean

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.

to object required

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
path string | string[]
pathNot string | string[]
couldNotResolve boolean

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 boolean

Whether or not to match when following to the to will ultimately end up in the from.

dynamic boolean

Whether or not to match when the dependency is a dynamic one.

exoticallyRequired boolean

Whether or not to match when the dependency is exotically required.

exoticRequire string | string[]
exoticRequireNot string | string[]
preCompilationOnly boolean

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 DependencyTypeType[]

Whether or not to match modules of any of these types (leaving out matches any of them)

dependencyTypesNot DependencyTypeType[]

Whether or not to match modules NOT of any of these types (leaving out matches none of them)

moreThanOneDependencyType boolean

If true matches dependencies with more than one dependency type (e.g. defined in both npm and npm-dev)

license string | string[]
licenseNot string | string[]
via REAsStringsType | object
viaOnly REAsStringsType | object
viaNot string | string[]
viaSomeNot string | string[]
moreUnstable boolean

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.

ancestor boolean

When set to true, matches when the dependency is in a folder above the folder of the module.

name string

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 string

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.

Values: "error" "warn" "info" "ignore"
scope string

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).

Values: "module" "folder"
comment string

You can use this field to document why the rule is there.

DependentsForbiddenRuleType object
module object required

Criteria to select the module(s) this restriction should apply to

4 nested properties
path string | string[]
pathNot string | string[]
numberOfDependentsLessThan integer

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.

min=0max=100
numberOfDependentsMoreThan integer

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.

min=0max=100
from object required

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
path string | string[]
pathNot string | string[]
name string
severity string

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.

Values: "error" "warn" "info" "ignore"
scope string

What to apply the rule to - modules (the default) or folders. Currently ignored for DependentsForbiddenRules, defaulting to 'module'

Values: "module" "folder"
comment string
ReachabilityForbiddenRuleType object
from object required

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
path string | string[]
pathNot string | string[]
to object required

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
reachable boolean required

Whether or not to match modules that aren't reachable from the from part of the rule.

path string | string[]
pathNot string | string[]
name string
severity string

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.

Values: "error" "warn" "info" "ignore"
scope string

What to apply the rule to - modules (the default) or folders. Currently ignored for ReachabilityForbiddenRules, defaulting to 'module'

Values: "module" "folder"
comment string
RequiredRuleType object
module object required

Criteria to select the module(s) this restriction should apply to

2 nested properties
path string | string[]
pathNot string | string[]
to object required

Criteria for modules the associated module must depend on.

2 nested properties
path string | string[]
reachable boolean

Whether or not to match transitive ('indirect') dependencies as well as direct ones.

name string
severity string

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.

Values: "error" "warn" "info" "ignore"
scope string

What to apply the rule to - modules (the default) or folders. Currently ignored for RequiredRules, defaulting to 'module'

Values: "module" "folder"
comment string
MiniDependencyRestrictionType REAsStringsType | object
FromRestrictionType object

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.

path string | string[]
pathNot string | string[]
orphan boolean

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 object

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.

path string | string[]
pathNot string | string[]
ToRestrictionType object

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.

path string | string[]
pathNot string | string[]
couldNotResolve boolean

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 boolean

Whether or not to match when following to the to will ultimately end up in the from.

dynamic boolean

Whether or not to match when the dependency is a dynamic one.

exoticallyRequired boolean

Whether or not to match when the dependency is exotically required.

exoticRequire string | string[]
exoticRequireNot string | string[]
preCompilationOnly boolean

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 DependencyTypeType[]

Whether or not to match modules of any of these types (leaving out matches any of them)

dependencyTypesNot DependencyTypeType[]

Whether or not to match modules NOT of any of these types (leaving out matches none of them)

moreThanOneDependencyType boolean

If true matches dependencies with more than one dependency type (e.g. defined in both npm and npm-dev)

license string | string[]
licenseNot string | string[]
via REAsStringsType | object
viaOnly REAsStringsType | object
viaNot string | string[]
viaSomeNot string | string[]
moreUnstable boolean

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.

ancestor boolean

When set to true, matches when the dependency is in a folder above the folder of the module.

DependentsModuleRestrictionType object

Criteria to select the module(s) this restriction should apply to

path string | string[]
pathNot string | string[]
numberOfDependentsLessThan integer

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.

min=0max=100
numberOfDependentsMoreThan integer

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.

min=0max=100
DependentsFromRestrictionType object

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.

path string | string[]
pathNot string | string[]
ReachabilityToRestrictionType object

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.

reachable boolean required

Whether or not to match modules that aren't reachable from the from part of the rule.

path string | string[]
pathNot string | string[]
RequiredModuleRestrictionType object

Criteria to select the module(s) this restriction should apply to

path string | string[]
pathNot string | string[]
RequiredToRestrictionType object

Criteria for modules the associated module must depend on.

path string | string[]
reachable boolean

Whether or not to match transitive ('indirect') dependencies as well as direct ones.

DependencyTypeType string
REAsStringsType string | string[]
SeverityType string

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.

OptionsType object

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

affected string | boolean

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

knownViolations ViolationType[]

A list of violations found in the dependencies. The dependencies themselves also contain this information, this summary is here for convenience.

collapse string | integer

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.

maxDepth integer

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.

min=0max=99
moduleSystems ModuleSystemType[]

List of module systems to cruise. Defaults to [amd, cjs, es6]

detectJSDocImports boolean

When true, dependency-cruiser will detect dependencies in JSDoc-style import statements. Implies "parser": "tsc". Defaults to false.

detectProcessBuiltinModuleCalls boolean

When true, dependency-cruiser will detect calls to process.getBuiltinModule/ globalThis.process.getBuiltinModule imports. Defaults to false.

prefix string
suffix string
preserveSymlinks boolean

if true leave symlinks untouched, otherwise use the realpath. Defaults to false (which is also nodejs's default behavior since version 6)

combinedDependencies boolean

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 object

TypeScript project file ('tsconfig.json') to use for (1) compilation and (2) resolution (e.g. with the paths property)

1 nested properties
fileName string

The TypeScript project file to use. The fileName is relative to dependency-cruiser's current working directory. When not provided defaults to './tsconfig.json'.

tsPreCompilationDeps boolean | string

if true detect dependencies that only exist before typescript-to-javascript compilation.

extraExtensionsToScan string[]

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"]

externalModuleResolutionStrategy string

What external module resolution strategy to use. Defaults to 'node_modules' (not used anymore - module resolution strategy determination is automatic now)

Values: "node_modules" "yarn-pnp"
builtInModules object

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
override string[]

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.

add string[]

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.

forceDeriveDependents boolean

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.

webpackConfig object

Webpack configuration file to use to get resolve options from

3 nested properties
fileName string

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 object | string

Environment to pass if your config file returns a function

arguments object

Arguments to pass if your config file returns a function. E.g. {mode: 'production'} if you want to use webpack 4's 'mode' feature

enhancedResolveOptions object

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
exportsFields string[]

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).

conditionNames string[]

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

extensions string[]

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.

mainFields string[]

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']

mainFiles array

A list of files to consider 'main' files, defaults to ['index']. Only set this when you have really special needs that warrant it.

aliasFields string[]

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).

cachedInputFileSystem object

Options to pass to the resolver (webpack's 'enhanced resolve') regarding caching.

1 nested properties
cacheDuration integer

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.

min=0max=1800000
babelConfig object

Babel configuration (e.g. '.babelrc.json') to use.

1 nested properties
fileName string

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.

parser string

overrides the parser dependency-cruiser will use - EXPERIMENTAL. The use of 'swc' as a parser here is deprecated.

Values: "acorn" "tsc" "swc"
exoticRequireStrings string[]

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

reporterOptions object

Options to tweak the output of reporters

9 nested properties
anon object

Options to tweak the output of the anonymous reporter

1 nested properties
wordlist string[]

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

archi object

Options to tweak the output of the dot reporters

4 nested properties
collapsePattern string | string[]
filters object

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)

showMetrics boolean

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

theme object

A bunch of criteria to conditionally theme the dot output

dot object

Options to tweak the output of the dot reporters

4 nested properties
collapsePattern string | string[]
filters object

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)

showMetrics boolean

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

theme object

A bunch of criteria to conditionally theme the dot output

ddot object

Options to tweak the output of the dot reporters

4 nested properties
collapsePattern string | string[]
filters object

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)

showMetrics boolean

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

theme object

A bunch of criteria to conditionally theme the dot output

flat object

Options to tweak the output of the dot reporters

4 nested properties
collapsePattern string | string[]
filters object

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)

showMetrics boolean

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

theme object

A bunch of criteria to conditionally theme the dot output

markdown object

Options to show and hide sections of the markdown reporter and to provide alternate boilerplate text

16 nested properties
showTitle boolean

Whether or not to show a title in the report. Defaults to true.

title string

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.

showSummary boolean

Whether or not to show a summary in the report. Defaults to true.

showSummaryHeader boolean

Whether or not to give the summary a header. Defaults to true.

summaryHeader string

The text to show as a header on top of the summary. E.g. '### Summary'. When left out shows a default value.

showStatsSummary boolean

Whether or not to show high level stats in the summary. Defaults to true.

showRulesSummary boolean

Whether or not to show a list of violated rules in the summary. Defaults to true.

includeIgnoredInSummary boolean

Whether or not to show rules in the list of rules for which all violations are ignored. Defaults to true.

showDetails boolean

Whether or not to show a detailed list of violations. Defaults to true.

includeIgnoredInDetails boolean

Whether or not to show ignored violations in the detailed list. Defaults to true.

showDetailsHeader boolean

Whether or not to give the detailed list of violations a header. Defaults to true.

detailsHeader string

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.

collapseDetails boolean

Whether or not to collapse the list of violations in a

block. Defaults to true.

collapsedMessage string

The text to in the

section of the
block. E.g. 'click to see all violations'. When left out shows a default value.

noViolationsMessage string

The text to show when no violations were found. E.g. 'No violations found'. When left out shows a default value.

showFooter boolean

Whether or not to show a footer (with version & run date) at the bottom of the report. Defaults to true

metrics object

Options to tweak the output of the metrics reporter

3 nested properties
orderBy string

By what attribute (in addition to the names of the folders/ modules) to order the metrics by. Defaults to 'instability'.

Values: "instability" "moduleCount" "afferentCouplings" "efferentCouplings" "name" "size" "topLevelStatementCount"
hideModules boolean

When true hides module metrics from the report. Defaults to false

hideFolders boolean

When true hides folder metrics from the report. Defaults to false

mermaid object

Options to tweak the output of the mermaid reporters

1 nested properties
minify boolean

Whether or not to compresses the output text. Defaults to true.

text object

Options that influence rendition of the text reporter

1 nested properties
highlightFocused boolean

Whether or not to highlight modules that are focused with the --focus command line option (/ general option). Defaults to false

progress object

How dependency-cruiser shows progress. Defaults to 'none'.

2 nested properties
type string
Values: "cli-feedback" "performance-log" "ndjson" "none"
maximumLevel number

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).

Values: -1 40 50 60 70 80 99
metrics boolean

When this flag is set to true, dependency-cruiser will calculate (stability) metrics for all modules and folders. Defaults to false.

experimentalStats boolean

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.

skipAnalysisNotInRules boolean

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.

baseDir string

The directory dependency-cruiser should run its cruise from. Defaults to the current working directory.

cache boolean | string | CacheOptionsType
  • 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/'

ModuleSystemType string
ModuleSystemsType ModuleSystemType[]

List of module systems to cruise. Defaults to [amd, cjs, es6]

CompoundExcludeType object

Criteria for dependencies to exclude

path string | string[]
dynamic boolean

a boolean indicating whether or not to exclude dynamic dependencies

CompoundDoNotFollowType object

Criteria for modules to include, but not to follow further

path string | string[]
dependencyTypes DependencyTypeType[]

an array of dependency types to include, but not follow further

CompoundIncludeOnlyType object

Criteria for modules to only include

path string | string[]
CompoundFocusType object

Criteria for modules to 'focus' on

path string | string[]
depth number

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.

min=1max=4
CompoundReachesType object
path string | string[]
CompoundHighlightType object
path string | string[]
ReporterOptionsType object

Options to tweak the output of reporters

anon object

Options to tweak the output of the anonymous reporter

1 nested properties
wordlist string[]

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

archi object

Options to tweak the output of the dot reporters

4 nested properties
collapsePattern string | string[]
filters object

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
exclude object

Criteria for dependencies to exclude

includeOnly object

Criteria for modules to only include

focus object

Criteria for modules to 'focus' on

reaches object
showMetrics boolean

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

theme object

A bunch of criteria to conditionally theme the dot output

6 nested properties
replace boolean

If passed with the value 'true', the passed theme replaces the default one. In all other cases it extends the default theme.

graph object

Name- value pairs of GraphViz dot (global) attributes.

node object

Name- value pairs of GraphViz dot node attributes.

edge object

Name- value pairs of GraphViz dot edge attributes.

dependencies DotThemeEntryType[]
dot object

Options to tweak the output of the dot reporters

4 nested properties
collapsePattern string | string[]
filters object

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
exclude object

Criteria for dependencies to exclude

includeOnly object

Criteria for modules to only include

focus object

Criteria for modules to 'focus' on

reaches object
showMetrics boolean

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

theme object

A bunch of criteria to conditionally theme the dot output

6 nested properties
replace boolean

If passed with the value 'true', the passed theme replaces the default one. In all other cases it extends the default theme.

graph object

Name- value pairs of GraphViz dot (global) attributes.

node object

Name- value pairs of GraphViz dot node attributes.

edge object

Name- value pairs of GraphViz dot edge attributes.

dependencies DotThemeEntryType[]
ddot object

Options to tweak the output of the dot reporters

4 nested properties
collapsePattern string | string[]
filters object

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
exclude object

Criteria for dependencies to exclude

includeOnly object

Criteria for modules to only include

focus object

Criteria for modules to 'focus' on

reaches object
showMetrics boolean

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

theme object

A bunch of criteria to conditionally theme the dot output

6 nested properties
replace boolean

If passed with the value 'true', the passed theme replaces the default one. In all other cases it extends the default theme.

graph object

Name- value pairs of GraphViz dot (global) attributes.

node object

Name- value pairs of GraphViz dot node attributes.

edge object

Name- value pairs of GraphViz dot edge attributes.

dependencies DotThemeEntryType[]
flat object

Options to tweak the output of the dot reporters

4 nested properties
collapsePattern string | string[]
filters object

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
exclude object

Criteria for dependencies to exclude

includeOnly object

Criteria for modules to only include

focus object

Criteria for modules to 'focus' on

reaches object
showMetrics boolean

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

theme object

A bunch of criteria to conditionally theme the dot output

6 nested properties
replace boolean

If passed with the value 'true', the passed theme replaces the default one. In all other cases it extends the default theme.

graph object

Name- value pairs of GraphViz dot (global) attributes.

node object

Name- value pairs of GraphViz dot node attributes.

edge object

Name- value pairs of GraphViz dot edge attributes.

dependencies DotThemeEntryType[]
markdown object

Options to show and hide sections of the markdown reporter and to provide alternate boilerplate text

16 nested properties
showTitle boolean

Whether or not to show a title in the report. Defaults to true.

title string

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.

showSummary boolean

Whether or not to show a summary in the report. Defaults to true.

showSummaryHeader boolean

Whether or not to give the summary a header. Defaults to true.

summaryHeader string

The text to show as a header on top of the summary. E.g. '### Summary'. When left out shows a default value.

showStatsSummary boolean

Whether or not to show high level stats in the summary. Defaults to true.

showRulesSummary boolean

Whether or not to show a list of violated rules in the summary. Defaults to true.

includeIgnoredInSummary boolean

Whether or not to show rules in the list of rules for which all violations are ignored. Defaults to true.

showDetails boolean

Whether or not to show a detailed list of violations. Defaults to true.

includeIgnoredInDetails boolean

Whether or not to show ignored violations in the detailed list. Defaults to true.

showDetailsHeader boolean

Whether or not to give the detailed list of violations a header. Defaults to true.

detailsHeader string

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.

collapseDetails boolean

Whether or not to collapse the list of violations in a

block. Defaults to true.

collapsedMessage string

The text to in the

section of the
block. E.g. 'click to see all violations'. When left out shows a default value.

noViolationsMessage string

The text to show when no violations were found. E.g. 'No violations found'. When left out shows a default value.

showFooter boolean

Whether or not to show a footer (with version & run date) at the bottom of the report. Defaults to true

metrics object

Options to tweak the output of the metrics reporter

3 nested properties
orderBy string

By what attribute (in addition to the names of the folders/ modules) to order the metrics by. Defaults to 'instability'.

Values: "instability" "moduleCount" "afferentCouplings" "efferentCouplings" "name" "size" "topLevelStatementCount"
hideModules boolean

When true hides module metrics from the report. Defaults to false

hideFolders boolean

When true hides folder metrics from the report. Defaults to false

mermaid object

Options to tweak the output of the mermaid reporters

1 nested properties
minify boolean

Whether or not to compresses the output text. Defaults to true.

text object

Options that influence rendition of the text reporter

1 nested properties
highlightFocused boolean

Whether or not to highlight modules that are focused with the --focus command line option (/ general option). Defaults to false

AnonReporterOptionsType object

Options to tweak the output of the anonymous reporter

wordlist string[]

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

MetricsReporterOptionsType object

Options to tweak the output of the metrics reporter

orderBy string

By what attribute (in addition to the names of the folders/ modules) to order the metrics by. Defaults to 'instability'.

Values: "instability" "moduleCount" "afferentCouplings" "efferentCouplings" "name" "size" "topLevelStatementCount"
hideModules boolean

When true hides module metrics from the report. Defaults to false

hideFolders boolean

When true hides folder metrics from the report. Defaults to false

MarkdownReporterOptionsType object

Options to show and hide sections of the markdown reporter and to provide alternate boilerplate text

showTitle boolean

Whether or not to show a title in the report. Defaults to true.

title string

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.

showSummary boolean

Whether or not to show a summary in the report. Defaults to true.

showSummaryHeader boolean

Whether or not to give the summary a header. Defaults to true.

summaryHeader string

The text to show as a header on top of the summary. E.g. '### Summary'. When left out shows a default value.

showStatsSummary boolean

Whether or not to show high level stats in the summary. Defaults to true.

showRulesSummary boolean

Whether or not to show a list of violated rules in the summary. Defaults to true.

includeIgnoredInSummary boolean

Whether or not to show rules in the list of rules for which all violations are ignored. Defaults to true.

showDetails boolean

Whether or not to show a detailed list of violations. Defaults to true.

includeIgnoredInDetails boolean

Whether or not to show ignored violations in the detailed list. Defaults to true.

showDetailsHeader boolean

Whether or not to give the detailed list of violations a header. Defaults to true.

detailsHeader string

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.

collapseDetails boolean

Whether or not to collapse the list of violations in a

block. Defaults to true.

collapsedMessage string

The text to in the

section of the
block. E.g. 'click to see all violations'. When left out shows a default value.

noViolationsMessage string

The text to show when no violations were found. E.g. 'No violations found'. When left out shows a default value.

showFooter boolean

Whether or not to show a footer (with version & run date) at the bottom of the report. Defaults to true

MermaidReporterOptionsType object

Options to tweak the output of the mermaid reporters

minify boolean

Whether or not to compresses the output text. Defaults to true.

TextReporterOptionsType object

Options that influence rendition of the text reporter

highlightFocused boolean

Whether or not to highlight modules that are focused with the --focus command line option (/ general option). Defaults to false

DotReporterOptionsType object

Options to tweak the output of the dot reporters

collapsePattern string | string[]
filters object

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
exclude object

Criteria for dependencies to exclude

2 nested properties
path string | string[]
dynamic boolean

a boolean indicating whether or not to exclude dynamic dependencies

includeOnly object

Criteria for modules to only include

1 nested properties
path string | string[]
focus object

Criteria for modules to 'focus' on

2 nested properties
path string | string[]
depth number

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.

min=1max=4
reaches object
1 nested properties
path string | string[]
showMetrics boolean

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

theme object

A bunch of criteria to conditionally theme the dot output

6 nested properties
replace boolean

If passed with the value 'true', the passed theme replaces the default one. In all other cases it extends the default theme.

graph object

Name- value pairs of GraphViz dot (global) attributes.

node object

Name- value pairs of GraphViz dot node attributes.

edge object

Name- value pairs of GraphViz dot edge attributes.

dependencies DotThemeEntryType[]
DotThemeType object

A bunch of criteria to conditionally theme the dot output

replace boolean

If passed with the value 'true', the passed theme replaces the default one. In all other cases it extends the default theme.

graph object

Name- value pairs of GraphViz dot (global) attributes.

node object

Name- value pairs of GraphViz dot node attributes.

edge object

Name- value pairs of GraphViz dot edge attributes.

dependencies DotThemeEntryType[]
DotThemeArrayType DotThemeEntryType[]
DotThemeEntryType object
criteria object
attributes object
ReporterFiltersType object

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)

exclude object

Criteria for dependencies to exclude

2 nested properties
path string | string[]
dynamic boolean

a boolean indicating whether or not to exclude dynamic dependencies

includeOnly object

Criteria for modules to only include

1 nested properties
path string | string[]
focus object

Criteria for modules to 'focus' on

2 nested properties
path string | string[]
depth number

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.

min=1max=4
reaches object
1 nested properties
path string | string[]
ViolationsType ViolationType[]

A list of violations found in the dependencies. The dependencies themselves also contain this information, this summary is here for convenience.

ViolationType object
from string required
to string required
rule object required

If there was a rule violation (valid === false), this object contains the name of the rule and severity of violating it.

2 nested properties
name string required

The (short, eslint style) name of the violated rule. Typically something like 'no-core-punycode' or 'no-outside-deps'.

severity string required

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.

Values: "error" "warn" "info" "ignore"
type string
Values: "dependency" "module" "reachability" "cycle" "instability" "folder"

The circular path if the violation is about circularity

The path from the from to the to if the violation is transitive

metrics object
2 nested properties
from object required
1 nested properties
instability number required
to object required
1 nested properties
instability number required
comment string

Free format text you can e.g. use to explain why this violation can be ignored or is quarantined (only used in known-violations)

RuleSummaryType object

If there was a rule violation (valid === false), this object contains the name of the rule and severity of violating it.

name string required

The (short, eslint style) name of the violated rule. Typically something like 'no-core-punycode' or 'no-outside-deps'.

severity string required

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.

Values: "error" "warn" "info" "ignore"
ViolationTypeType string
MiniDependency object

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).

name string required

The name of the module

dependencyTypes DependencyTypeType[] required

The dependency types of the module relative to the previous module in the chain it is a part of (e.g. a cycle)

CacheOptionsType object
folder string

The folder to store the cache in. Defaults to node_modules/.cache/dependency-cruiser

strategy string

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'.

Values: "metadata" "content"
compress boolean

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.

Default: false
CacheStrategyType string

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'.

ExtendsType string | string[]

A configuration (or an array of configurations) this configuration uses as a base