- Adds a circular dependency check to the arsenal of dependency-cruiser validations (#5) - see below for an exposition.
- Adds the circular check to the
--init-rules
configuration with a warning level. - ⬆️ various dependencies to latest versions
Usage
- Add a rule to your .dependency-cruiser.json like this:
{
"name": "no-circular",
"severity": "warn",
"comment": "Warn in case there's circular dependencies",
"from": {},
"to": { "circular": true }
}
For each dependency this will answer the question: When I follow this dependency, will I end up with myself? and hoist a warning flag when it is.
- Run dependency-cruiser
depcruise -v -- src
Detecting circular dependencies is heavy work. Especially on larger code bases (thousands of files in one dependency graph) you might notice an impact on the performance when you add a rule that checks for circular dependencies.
Example: the coffee-script compiler source
Running with this rule e.g. against the coffeescript transpiler code base will yield
warn no-circular: coffee-script.coffee → register.coffee
warn no-circular: register.coffee → coffee-script.coffee
✖ 2 dependency violations (0 errors, 2 warnings). 23 modules cruised.
or, rendered as a graph (depcruise -v -x node_modules -T dot src | dot -T svg > coffee-deps.svg
)