Validate and visualize dependencies. Your rules. JavaScript, TypeScript, CoffeeScript. ES6, CommonJS, AMD.
MIT License
TL;DR: Not likely, if you only use the command line interface
When you have rules defined on dependency type type-only
or on the
aliased-*
ones, dependency-cruiser might start to report issues it didn't
in previous versions as it now more precisely detects those.
05d97951 feat!: restructures the via* sub-restrictions to also accept & validate against dependency types (BREAKING for API users) (#894). See rules-reference.md#circular for details.
via
, viaOnly
, viaNot
and viaSomeNot
, each of which would accept a regular expression (or an array of them) to match against the module names in the cycle.via
and viaOnly
each of which takes an object with the following properties:
path
: a regular expression (or an array of them) to match against the module names in the cycle.pathNot
: a regular expression (or an array of them) to match against the module names in the cycle.dependencyTypes
: an array of strings (dependency types) match against the dependency types in the cycle.dependencyTypesNot
: an array of strings (dependency types) match against the dependency types in the cycle.c6421e3c feat!: makes entries in 'cycle' contain more information (BREAKING for API users) (#888)
name
: the name of the moduledependencyTypes
: the types of dependency the module has with the previouse8cda75a feat!: makes entries in reachability via's contain more information (BREAKING for API users) (#895)
name
: the name of the moduledependencyTypes
: the types of dependency the module has with the previoustype-only
detection more precisealiased-*
dependencies and for testing the fixesIn addition to the dependency types dependency-cruiser already distinguished
(local, npm, npm-dev, core, type-only unknown, etc) this release adds a few
that enables rules (and styling) against a few more fine grained ones. E.g.
whether it's a triple slash reference, and if so, what kind (triple-slash-file-reference
,
triple-slash-type-reference
) whether the dependency is defined in a normal
import, in a dynamic one or instead by way of a (re-)export statement (import
,
dynamic-import
, export
). See rules-reference.md#dependencytypes-and-dependencytypesnot
for the entire list.
As asked in #695 dependency-cruiser now allows you to restrict cycles based on
the dependency types as well as the module names. See rules-reference.md#circular with
attributes in the via
and viaOnly
sub-restrictions.
// ...
// log an error for all circular dependencies which consist of only non-`type-only`
// dependencies, so e.g.
// violation : a -import-> b -import-> c -import-> a
// OK : a -import-> b -import,type-only-> c -import-> a
{
name: 'no-circular-at-runtime',
severity: 'error',
from: {
},
to: {
circular: true,
viaOnly: {
dependencyTypesNot: ['type-only']
}
}
},
// ...
The old notation for via
and viaOnly
still works, but is deprecated. To ensure
future working we've added these features to dependency-cruiser that guarantee
that the old notation will still work.
type-only
dependencies within the curly bracketsThis PR/ commit enables dependency-cruiser to detect type-only
dependencies
that are
// ...
import type { SomeType } from 'some-module' // was already detected
import { type SomeType } from 'some-module' // now also detected as type only
// ...
```