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

import-x/no-extraneous-dependencies settings not applying to custom files #91

Open
ferferga opened this issue Jun 13, 2024 · 3 comments

Comments

@ferferga
Copy link

ferferga commented Jun 13, 2024

Steps to reproduce

  1. Set the rule with the following configuration:
      'import-x/no-extraneous-dependencies': [
        'error',
        {
          devDependencies: ['*.config.ts', 'scripts/**/*.ts'],
          optionalDependencies: false,
          peerDependencies: false,
          bundledDependencies: false
        }
      ],
  1. In test.config.ts file, import a dependency defined in devDependencies in package.json

What's expected?
No error is logged, since the file is allowed to import dependencies from devDependencies

What happens?
The rule reports an error

Additional context
Upstream doesn't have this issue, so switching back to the original plugin will demonstrate the expected behaviour of this rule.

@RobinTail
Copy link

Having the same issue. The rule stopped working for some reason, since I remember it did work.

@RobinTail
Copy link

RobinTail commented Jun 24, 2024

I managed to debug it to the return statement due to missing resolution.
The issue can be fixed by installing eslint-import-resolver-typescript and adding

    settings: {
      "import-x/resolver": {
        typescript: true,
        node: true,
      },
    },

to the ESLint configuration, exactly as recommended in the Readme.

However, the required package throws the following warning in yarn:

warning " > [email protected]" has unmet peer dependency "eslint-plugin-import@*".

So, it's not declared as a compatible one with the -x plugin.
Somehow it should be sorted out.

@RobinTail
Copy link

RobinTail commented Jun 24, 2024

Related issue regarding that warning message: import-js/eslint-import-resolver-typescript#293

Workaround: import-js/eslint-import-resolver-typescript#293 (comment)

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

2 participants