-
Notifications
You must be signed in to change notification settings - Fork 325
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
vscode-eslint not working with eslint-import-resolver-typescript@2.0.0 #944
Comments
@MicrochipQ since you run eslint in the terminal in certain directories (you do a cd into Please ping if this doesn't help fixing the issue. |
@dbaeumer I just tried it now
But none of them worked |
@dbaeumer No more solutions to this problem? |
Actually this is very wired. I check the extension code and it correctly sets the cwd to either |
All I can suggest for now to use relative imports |
In my real project without aliases, relative hell happens |
But why is the previous version of eslint-import-resolver-typescript working fine? |
I think it is a combination of may things:
If I remove the lerna linking setup and install the npm packages locally to one and two everything works fine. May be the new version of |
I removed Lerna but still does not work |
Yarn Workspaces linking node_modules without Lerna |
But if I disable Yarn Workspaces then it works. However I cannot give up Yarn Workspaces in my project, I don't want to duplicate dependencies between several packages |
Sorry, you are correct. It was yarn workspace not Lerna. Since everything worked before you move to |
Yeah, but how can I change cwd in the |
When I use Yarn Workspaces, |
And if I open this project in WebStorm, ESLint works fine |
The ESLint extension does this automatically for every working directory.
To my knowledge WebStorm runs a new process for every validation. You can to that as well in VS Code using tasks and a task runner that supports watches (like gulp). However this is not very battery friendly. I think that the underlying problem here is |
I tested a little bit more and I still think this is a problem with the "parserOptions": {
"ecmaVersion": 2018,
"sourceType": "module",
"project": "packages/one/tsconfig.json",
"tsconfigRootDir": "."
} an run the eslint in the terminal from the workspace folder. You get
So the fact that these modules are linked make it even fail in the terminal. I really suggest you ask the owner of |
The actual problem is here since the extension does cache a mapper but only once for the current cwd which results in problem when reused from different directories (https://github.com/alexgorbatchev/eslint-import-resolver-typescript/blob/master/src/index.ts#L148) |
I tried to play with the
May be you have more luck with the setting since this seems to be a way to let the import resolve know which directories to look into. |
One setup that seems to work is the following
|
I cannot send this issue to the owner of |
With this change, it reproduces even on v1.1.1, but the problem should only be in v2.0.0 |
I have the same problem. Had to revert to v1.1.1 also. |
vscode-eslint works with eslint-import-resolver-typescript@1.1.1, but does not work with eslint-import-resolver-typescript@2.0.0
ESLint CLI works fine.
Steps to reproduction:
yarn install
/Users/microchipq/wa-eslint-import-error
with/home/USER/wa-eslint-import-error
)JS/TS language features
Unable to resolve path to module '~/module'. eslint (import/no-unresolved)
two,
and then inone
, then an error may occur in theone
workspaceRepo: https://github.com/MicrochipQ/wa-eslint-import-error
vscode-eslint version: 2.1.3
VS Code:
The text was updated successfully, but these errors were encountered: