Unexpected error import/no-extraneous-dependencies
It is possible to infer the workspace based on the second parameter
fileingetMappedPath. 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
Can you please raise a PR instead?
Is there any workaround until it's fixed?
Can anyone provide an online runnable reproduction? I don't quite understand what's the issue here.
@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.tsand initially there will be no issues - Add a package.json under
website(touch ./website/package.json) - Two things will change:
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/extraneousimport { one } from '@common'will get an ESLint error (tests is the name defined on rootpackage.jsonfile):
https://github.com/guilhermetod/eslint-resolver-issue
Same issue 😥 Any update?
I've found a working solution! Tomorrow I'll create a PR 🥳
If anyone is interested, I've created PR #345