In my current TypeScript/Node.js project, we have implemented an internal cache module that we are progressively getting rid of.
To achieve that, I would like to progressively reduce the parts of the codebase that can import that module, directly or indirectly. And to be warned during development whenever we violate that rule.
Example:
users.ts
is allowed to importcache.ts
domain.ts
importsusers.ts
, but it’s not allowed to importcache.ts
(even thruusers.ts
), so we want to be warned about that.
Do you know a way to enforce that rule with TSC, Eslint, or another static code analysis tool?