Skip to content
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

no-extraneous-dependencies option: transitiveDependencies #158

Open
Zamiell opened this issue Sep 10, 2024 · 0 comments
Open

no-extraneous-dependencies option: transitiveDependencies #158

Zamiell opened this issue Sep 10, 2024 · 0 comments

Comments

@Zamiell
Copy link

Zamiell commented Sep 10, 2024

I use a meta-package to easily install other packages. For example, "foo-metapackage" depends on "foo-1", "foo-2", and "foo-3". So, instead of projects having to depend on "foo-1", "foo-2", and "foo-3", they can instead clean up their "package.json" file by simply depending on "foo-metapackage".

However, meta-packages don't play well with the "no-extraneous-dependencies" rule, because it does not consider transitive dependencies as legitimate. I think that default behavior is fine, but I would also like the ability to specify that certain packages come from other packages. For example:

      "import-x/no-extraneous-dependencies": [
        "warn",
        {
          transitiveDependencies: {
            "foo-metapackage": ["foo-1", "foo-2", "foo-3"],
          },
        },

With this hypothetical config, as long as this rule detects that "foo-metapackage" exists in the "package.json" file, then it would no longer warn about imports coming from"foo-1"

I can see about doing a PR if you think this is a valuable addition.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant