Description
Hello! Im having the following issue when using VSCode with Eslint and Import-x. I'm opening this issue here because this is the only package where the issue arises, all other work properly. If this is not correct, please let me know
I have monorepo setup with a shared config file. there, I have "bundles" of plugins that my apps and packages can use. The bundle that sets up this extension is the following:
import { createTypeScriptImportResolver } from 'eslint-import-resolver-typescript';
import { importX } from 'eslint-plugin-import-x';
import noRelativeImportPaths from 'eslint-plugin-no-relative-import-paths';
import tseslint from 'typescript-eslint';
export default tseslint.config(
importX.flatConfigs.recommended,
importX.flatConfigs.typescript,
{
settings: {
'import-x/resolver-next': [
createTypeScriptImportResolver({
project: [
'tsconfig.json',
'apps/*/tsconfig.json',
'packages/*/tsconfig.json',
],
alwaysTryTypes: true,
}),
],
},
},
{
rules: { //... },
},
);
This works well in the case I open just one app (lets say I open the workspace apps/my-app-1
directly instead of the root directory of the monorepo. However, when I open the root directory, i have the following behavior:
- I open a file inside
apps/my-app-1
, then the extension detects imports properly, without issues - After opening the previous file, I open any file in
apps/my-app-2
, then the extension fails to find the local aliased imports:
It seems to me like there's an issue with the path alias @/
that is not being updated when I change apps inside the monorepo, but I could be totally wrong.
I have created a small reproduction link, with instructions in the readme:
https://github.com/auirarrazaval/import-x-bug-no-unresolved-bug