eslint-import-resolver-typescript icon indicating copy to clipboard operation
eslint-import-resolver-typescript copied to clipboard

Unexpected error import/no-extraneous-dependencies

Open ken1987 opened this issue 2 years ago • 4 comments

Details

It is possible to infer the workspace based on the second parameter file in getMappedPath. Once the workspace is inferred, the paths collection will never exceed two paths. This modification can help resolve the issue.

pr: https://github.com/ken1987/eslint-import-resolver-typescript/commit/d1f85ddf345a62329739fae6989d4b160848460f

ken1987 avatar Oct 05 '23 02:10 ken1987

Can you please raise a PR instead?

JounQin avatar Oct 05 '23 13:10 JounQin

Is there any workaround until it's fixed?

woodreamz avatar Oct 13 '23 16:10 woodreamz

Can anyone provide an online runnable reproduction? I don't quite understand what's the issue here.

JounQin avatar Dec 06 '23 15:12 JounQin

@JounQin This repo might reproduce the issue. I'm not sure if that's the same cause from them, but for me it's not clear if the behavior is intentional or not.

To reproduce:

  • Open website/index.ts and initially there will be no issues
  • Add a package.json under website (touch ./website/package.json)
  • Two things will change:
  1. import { one } from '@common' will now be placed on the top by ESlint as it's not read as an internal module, but rather as an external/extraneous
  2. import { one } from '@common' will get an ESLint error (tests is the name defined on root package.json file):

image

https://github.com/guilhermetod/eslint-resolver-issue

guilhermetod avatar Apr 30 '24 17:04 guilhermetod

Same issue 😥 Any update?

carlocorradini avatar Feb 11 '25 13:02 carlocorradini

I've found a working solution! Tomorrow I'll create a PR 🥳

carlocorradini avatar Feb 11 '25 19:02 carlocorradini

If anyone is interested, I've created PR #345

carlocorradini avatar Feb 12 '25 18:02 carlocorradini