import-js / eslint-plugin-import

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

No longer resolves any dependency #2867

Open pjg opened 1 year ago

pjg commented 1 year ago

The ESLint error is as follows for every single dependency in any of my JS/JSX files:

Unable to resolve path to module 'prop-types'. (eslint import/no-unresolved) ...
Unable to resolve path to module 'styled-components'. (eslint import/no-unresolved) ...
Unable to resolve path to module '../conf'. (eslint import/no-unresolved) ...

Downgrading to v0.13.4 fixes things for me. I have a fairly standard config, nothing specific defined/configured for the import plugin specifically.

I suspect it's something to do with the switch to "resolve": "^2.0.0-next.4",.

Possibly related: https://github.com/import-js/eslint-plugin-import/issues/2859

ljharb commented 1 year ago

You're talking about eslint-import-resolver-webpack? Can you confirm that it's breaking for you in v0.13.7?

How are you installing packages - npm, or something else?

pjg commented 1 year ago

Yes, sorry, I meant eslint-import-resolver-webpack. It breaks for me in any version higher than 0.13.4 (so still in v0.13.7). It marks every single "import" as unresolvable for me. I'm using npm with lockFile version 3. Now that I think of it, the issue might be my package-lock.json version.

ljharb commented 1 year ago

I wouldn't expect the lockfile version to matter; that just tells npm what metadata is stored in the lockfile.

Are you getting these errors on the command line, or in your editor? If the latter, did you open it at the root of the repo?

pjg commented 1 year ago

I'm getting those errors both from the command line and in my editor. I downgraded the lockFile to version 2, but that did not help things in 0.13.7.

ljharb commented 1 year ago

Is prop-types, eg, installed in node_modules/prop-types?

pjg commented 1 year ago

Yes it is.

ljharb commented 1 year ago

and you're running the linter from the root of the repo, where your package.json and eslint config and node_modules all are?

(thanks for bearing with me; i'm not sure why this would be happening since resolve v2 and v1 largely work the same)

pjg commented 1 year ago

and you're running the linter from the root of the repo, where your package.json and eslint config and node_modules all are?

Yes, I am. I think I should probably prepare a minimal reproducible testcase. Or maybe start with disabling other eslint plugins, and seeing what that does...

ljharb commented 1 year ago

That’d be great!