import-js / eslint-plugin-import

ESLint plugin with rules that help validate proper imports.
MIT License
5.56k stars 1.57k forks source link

`import/no-extraneous-dependencies` more compatible when user pass not exist paths #1959

Open Edge00 opened 3 years ago

Edge00 commented 3 years ago

Scenario:

'import/no-extraneous-dependencies': [
  'error',
  {
    packageDir: [
      __dirname,
      'node_modules/module-exist',
      'node_modules/module-not-exist',
    ],
  },
]

If there is a module module-not-exist that's not installed in node_modules. Even if module-exist did add some dependencies. The lint won't apply dependencies in module-exist.

I think this rule can be more compatible. If packageContent have add some dependencies. These dependencies should be applied.

Like our team is maintaining a shared .eslintrc file and some dependencies is not required in particular projects. We hope that users don't need to change the .eslintrc file when they add a new dependency.

ljharb commented 3 years ago

I'm not sure what you're asking. What do you expect to happen, and what's happening now?

Edge00 commented 3 years ago

@ljharb You can view this PR https://github.com/benmosher/eslint-plugin-import/pull/1954