-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add setting to specify external modules by package name pattern #1510
Comments
Appreciate this. I'd suggest adding a field for internal module patterns as well. I'm using tilde-led aliases for paths, and it'd be nice not to treat them as unknowns. |
I'm also want this feature. Some of my dependencies resolved as symlinks with different paths between every launch. |
Made a PR ^. Tests included. Please look at it. |
I'm proposing a new setting to specify external modules by a package name pattern to satisfy the following use case:
We have a monorepo consisting of multiple packages that depend on each other. We'd like to enforce that every package that is imported by another package in the same repository is listed as a dependency in package.json. We want to use the import/no-extraneous-dependencies rule to enforce this, however, we can't specify that each package in the monorepo is an external dependency because:
In the past, our packages were scoped which resulted in them being treated as external modules because of #1293. However, since that has been fixed we now run into this problem.
The existing
import/external-module-folders
setting isn't sufficient for us because:Instead, a new
import/external-module-patterns
setting that allowed one to specify an array of string/regex patterns to match against package names, could be used to match all of our packages as external since they all share a common scope.A second option could be to add some further metadata in the returned value from custom resolvers to specify whether a module is external or not.
Alternatively, it would be worth revisiting the decision made in #943 to only report errors for dependencies that can be resolved and provide a config option to opt-in to reporting errors for unresolved dependencies. As then, we would no longer need to mark our modules as external and would just remove our custom resolver altogether so that they are always unresolved and therefore marked as external.
The text was updated successfully, but these errors were encountered: