eslint-plugin-import-x
eslint-plugin-import-x copied to clipboard
no-extraneous-dependencies option: transitiveDependencies
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.