Skip to content
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

cannot lint with @typescript-eslint/parser on remote #1179

Closed
Neurrone opened this issue Feb 11, 2021 · 9 comments
Closed

cannot lint with @typescript-eslint/parser on remote #1179

Neurrone opened this issue Feb 11, 2021 · 9 comments
Labels
info-needed Issue requires more information from poster

Comments

@Neurrone
Copy link

I'm experiencing the same problem as described in #1075.

When running eslint in the terminal, I'm able to lint typescript files without any issues. However, it doesn't work with the vs code plugin and displays the following error: "The file does not match your project config"

Is there any way that I can see what the project config the extension is using?

@dbaeumer
Copy link
Member

@Neurrone very hard to tell without reproducible steps. Can you please provide me with a GitHub repository I can clone that demos what you are experiencing.

@dbaeumer dbaeumer added the info-needed Issue requires more information from poster label Feb 12, 2021
@Neurrone
Copy link
Author

I'm attempting to create a minimal reproduceable example.

On this repository, I have it in a WSL2 instance and have it opened in Vs Code.

I get the following error when opening index.ts:

Error: ESLint: Failed to load plugin '@typescript-eslint' declared in '.eslintrc.js': File URL path must be absolute Referenced from: \\wsl$\Ubuntu\home\dickson\source\vscode-eslint-issue\.eslintrc.js. Please see the 'ESLint' output channel for details.

Here's the error in the logs:

[Info  - 2:30:09 pm] ESLint server running in node v12.18.3
[Info  - 2:30:09 pm] ESLint server is running.
[Info  - 2:30:14 pm] ESLint library loaded from: \\wsl$\Ubuntu\home\dickson\source\vscode-eslint-issue\node_modules\eslint\lib\api.js
[Error - 2:30:18 pm] ESLint stack trace:
[Error - 2:30:18 pm] TypeError [ERR_INVALID_FILE_URL_PATH]: File URL path must be absolute
    at getPathFromURLWin32 (internal/url.js:1323:11)
    at fileURLToPath (internal/url.js:1353:22)
    at resolveExportsTarget (internal/modules/cjs/loader.js:554:14)
    at resolveExportsTarget (internal/modules/cjs/loader.js:595:20)
    at applyExports (internal/modules/cjs/loader.js:460:14)
    at resolveExports (internal/modules/cjs/loader.js:513:23)
    at Function.Module._findPath (internal/modules/cjs/loader.js:641:31)
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:1006:27)
    at Module._load (internal/modules/cjs/loader.js:895:27)
    at Function.f._load (electron/js2c/asar_bundle.js:5:12738)

Running npm run lint in the terminal works.

@dbaeumer
Copy link
Member

How do you open VS Code since the path looks absolutely strange. Can you try to do the following:

  • open Ubuntu terminal
  • cd home/dickson/source/vscode-eslint-issue
  • open VS Code via code .

This will start VS Code in a special WSL mode and the path the eslint library is loaded from will be home/dickson/source/vscode-eslint-issue/node_modules/eslint/lib/api.js

You shouldn't start VS Code normally on a mounted Linux drive (e.g. \wsl$\Ubuntu) since it will try to load Linux code into a Windows Node runtime and will confuse pathes.

@dbaeumer
Copy link
Member

Please ping if this doesn't help.

@Neurrone
Copy link
Author

I'm using code-insiders, and open it by using code-insiders .. I also have the remote development extensions installed.

Based on the path, its being accessed via the WSL$ network drive that you can use in windows explorer to view the contents of the WSL distribution.

@Neurrone
Copy link
Author

Oh, I also forgot to mention that the contents of my repositories live in the WSL2 ext4 filesystem, not the normal windows filesystem for convenience and massive performance improvements when working in WSL2.

@dbaeumer
Copy link
Member

@Neurrone Yes, having your wworkspace on the WSL2 ext4 file system is exactly how this should be used. However VS Code's extension host doesn't seem to run in the WSL environment since it tries to access the file system via a Windows Network Path (e.g. `\wsl$\Ubuntu\home\dickson\source\vscode-eslint-issue\node_modules\eslint\lib\api.js). Can you provide me with a screen cast showing how you start VS Code?

@Neurrone
Copy link
Author

I realized I didn't install all the extensions in the remote containers pack, and I was also missing the remote WSL extension.

After ensuring that I was correctly running in the WSL instance of vs code server, everything's working perfectly.

Sorry for the false alarm

@dbaeumer
Copy link
Member

No problem.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
info-needed Issue requires more information from poster
Projects
None yet
Development

No branches or pull requests

2 participants