dependency-cruiser
dependency-cruiser copied to clipboard
Question: Restrict Imports Out of Directory Containing Config File
Summary
This is a little similar to #330, but I think it's more straightforward. Though I'm not much of a regex wizard, so I can't distinguish between this being impossible or just not clear to me.
I'd like to be able to restrict imports from going outside of the directory containing .dependency-cruiser.js
. Say I have the following situation:
module
|
\
submodule (containing .dependency-cruiser.js)
module
depends on submodule
, but nothing in submodule
should depend on module
or really anything outside submodule
. It's no problem if submodule
depends on children, grandchildren, etc.
Is there a way to accomplish this with regex?
Context
I'm working with some polyrepos. These repos are deployed as services. But some of these repos are submodules in other repos.
I'd like to prevent developers from importing outside the submodule, because the environment where the repo is used as a submodule doesn't match the repo's isolated deployment environment.
Environment
- Version used: 11.11.0
- Node version: 16.x
- Operating System and version: macOS Monterey 12.11
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs.
I'll assume this isn't possible—I'm using monorepo-cop
to meet this need for the moment.