You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We have features/libraries in a modules/ folder. We'd like to allow a acyclic dependency graph between the modules while guarding against circular dependencies.
If a file in modules/a/ depends on a file in modules/b/, nothing in modules/b/ can depend on modules/a/.
I noticed that there's a scope option. But I'm unsure how would I configure the rule and I'm looking for some examples.
Context
The following rule configuration leaks outside the /modules/ folder causing them to be included in the "circular" detection. Example error caused by this: /module/a -> /common/ -> /api/ -> /views/ -> /module/a.
{name: 'no-circular-dependency-between-modules',comment:
'If a module A depends on module B, then '+'module B should not depend on module A',severity: 'error',from: {path: '/modules/([^/]+)'},to: {circular: true,},scope: "folder",},
What I'd love to get is some way to confine the scope to only circulars between the /module/ folders. The via examples look like they might provide a fix here, but I'm unsure if scope: "folder" supports via yet.
The full solution we are trying to implement is:
Forbid acyclic imports between modules
Forbid all imports between modules, unless explicitly allowed (a can import b)
Environment
Version used: latest
Node version: 18
The text was updated successfully, but these errors were encountered:
Summary
We have features/libraries in a
modules/
folder. We'd like to allow a acyclic dependency graph between the modules while guarding against circular dependencies.If a file in
modules/a/
depends on a file inmodules/b/
, nothing inmodules/b/
can depend onmodules/a/
.I noticed that there's a
scope
option. But I'm unsure how would I configure the rule and I'm looking for some examples.Context
The following rule configuration leaks outside the
/modules/
folder causing them to be included in the "circular" detection. Example error caused by this:/module/a
->/common/
->/api/
->/views/
->/module/a
.What I'd love to get is some way to confine the
scope
to only circulars between the/module/
folders. Thevia
examples look like they might provide a fix here, but I'm unsure ifscope: "folder"
supportsvia
yet.The full solution we are trying to implement is:
a
can importb
)Environment
The text was updated successfully, but these errors were encountered: