-
-
Notifications
You must be signed in to change notification settings - Fork 69
@types packages are resolved instead of the actual package #265
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
Comments
Have you tried |
What should the effect of that on resolving |
This resolver
If you have even further issue, please provide a minimal but runnable online reproduction instead. |
That's the opposite of what I'm trying to describe here. Apologies that I didn't explain it clearly. This issue:
Here's a repro: https://stackblitz.com/edit/stackblitz-starters-fshhsu |
You didn't enable |
Tried it and it didn't help (as mentioned in #265 (comment)). I don't see how it would help. Seems like it does the opposite of what we need to resolve this issue (see #265 (comment)). |
Please provide a runnable reproduction then. A git repository. |
@JounQin #265 (comment) has a link to a runnable reproduction in it. |
What are you confused about? I'll try to help make it more clear or work through issues. index.ts has instructions how to reproduce. |
|
This isn't completed.
|
Can you set |
Actually, I was thinking about this wrong. You're right that there's not an issue. I just realized a couple things:
So there's no issue here. Thanks for helping me figure this out. |
Possibly the cause of import-js/eslint-plugin-import#2168.
The issue
The
resolve
function returns the@types/
package associated with a module, if present. This causes issues with lint rules (specificallyimport/no-extraneous-dependencies
).For example, if we have this scenario:
uuid
(for example. It also is the same with other deps)uuid
and@types/uuid
in my node_modules as a transitive dependencies.node_modules/@types/uuid
as the resolved path foruuid
import/no-extraneous-dependencies
will report that I need to install@types/uuid
But that's wrong! Really I need to install
uuid
Why this happens
I think this code is resulting in
@types
packages being resolved when present.eslint-import-resolver-typescript/src/index.ts
Lines 194 to 209 in acaaddd
Possible fix
For
import/no-extraneous-dependencies
, I think@types/
packages should never be resolved, because what we care about is that the actual package is installed, not its types. Presumably tsc will tell us if we don't have the types installed.However, I'm not sure how the resolved paths are used by other rules.
The text was updated successfully, but these errors were encountered: