Restrict importing specific packages
rclarey opened this issue · 2 comments
I am working in a monorepo with different "tiers" of packages and I want to restrict which tiers can import from which other tiers. E.g. core
packages cannot import from feature
packages.
I tried configuring the existing no-restricted-paths
rule for this, but I couldn't seem to get it to work since from
is of course treated as a path relative to basePath
so there is no way to get it to match a package name.
Is this something no-restricted-paths
should be able to do? If not should no-restricted-paths
be extended to allow this, or is a new rule better?
No, because other packages aren't relative paths.
Perhaps the https://github.com/import-js/eslint-plugin-import/blob/main/docs/rules/no-internal-modules.md rule would help, and you'd use overrides
to configure different sets of modules as "internal" for each group of packages?