nrwl / nx

Smart Monorepos · Fast CI
https://nx.dev
MIT License
22.57k stars 2.25k forks source link

VSCode ESLint extension not working with @nx/eslint-plugin #22255

Open vire opened 3 months ago

vire commented 3 months ago

Current Behavior

ESLint is not working in VSCode - the ESLint vscode extension (with debug enabled) output shows

2024-03-10T18:43:20.980Z eslintrc:config-array-factory Failed to load plugin '@nx' declared in 'apps/<redacted>/.eslintrc.json'.
[Error - 19:43:20] Calculating config file for file:///<redacted>/my-file.tsx) failed.
TypeError [ERR_INVALID_URL_SCHEME]: The URL must be of scheme file
    at new NodeError (node:internal/errors:405:5)
    at fileURLToPath (node:internal/url:1479:11)
    at finalizeResolution (node:internal/modules/esm/resolve:328:42)
    at moduleResolve (node:internal/modules/esm/resolve:980:10)
    at defaultResolve (node:internal/modules/esm/resolve:1193:11)
    at nextResolve (node:internal/modules/esm/hooks:864:28)
    at Hooks.resolve (node:internal/modules/esm/hooks:302:30)
    at ModuleLoader.resolve (node:internal/modules/esm/loader:365:35)
    at ModuleLoader.getModuleJob (node:internal/modules/esm/loader:249:38)
    at ModuleLoader.import (node:internal/modules/esm/loader:335:34)
[Error - 19:43:21] Server process exited with code 0.

Expected Behavior

The VSCode extension work with @nx17 as expected

GitHub Repo

No response

Steps to Reproduce

  1. I did yarn nx migrate latest // installed 18.0.6
  2. I did reload VSCode
  3. When I open any file in my project VSCode ESLint is not working and the "output" tab shows the error message

Nx Report

NX   Report complete - copy this into the issue template

Node   : 18.19.0
OS     : darwin-arm64
yarn   : 4.1.0 / nodeLinker: pnp

nx                 : 18.0.6
@nx/js             : 18.0.6
@nx/jest           : 18.0.6
@nx/eslint         : 18.0.6
@nx/workspace      : 18.0.6
@nx/cypress        : 18.0.6
@nx/devkit         : 18.0.6
@nx/esbuild        : 18.0.6
@nx/eslint-plugin  : 18.0.6
@nx/next           : 18.0.6
@nx/node           : 18.0.6
@nx/plugin         : 18.0.6
@nx/react          : 18.0.6
@nx/storybook      : 18.0.6
@nrwl/tao          : 18.0.6
@nx/web            : 18.0.6
typescript         : 5.3.3
---------------------------------------

### Failure Logs

```shell
2024-03-11T09:13:20.453Z eslintrc:config-array-factory Loading plugin "@nx" from /<redacted>/.eslintrc.json
2024-03-11T09:13:20.455Z eslintrc:config-array-factory Loaded: @nx/eslint-plugin@18.0.6 (/<redacted>/.yarn/__virtual__/@nx-eslint-plugin-virtual-96aab95ebc/0/cache/@nx-eslint-plugin-npm-18.0.6-43b87d235b-5e110e2928.zip/node_modules/@nx/eslint-plugin/src/index.js)
2024-03-11T09:13:20.467Z eslintrc:config-array-factory Failed to load plugin '@nx' declared in 'apps/landing/.eslintrc.json'.
[Error - 10:13:20] Calculating config file for file:///Users/vire/<redacted>/my-file.tsx) failed.
TypeError [ERR_INVALID_URL_SCHEME]: The URL must be of scheme file
    at new NodeError (node:internal/errors:405:5)
    at fileURLToPath (node:internal/url:1479:11)
    at finalizeResolution (node:internal/modules/esm/resolve:328:42)
    at moduleResolve (node:internal/modules/esm/resolve:980:10)
    at defaultResolve (node:internal/modules/esm/resolve:1193:11)
    at nextResolve (node:internal/modules/esm/hooks:864:28)
    at Hooks.resolve (node:internal/modules/esm/hooks:302:30)
    at ModuleLoader.resolve (node:internal/modules/esm/loader:365:35)
    at ModuleLoader.getModuleJob (node:internal/modules/esm/loader:249:38)
    at ModuleLoader.import (node:internal/modules/esm/loader:335:34)


### Package Manager Version

_No response_

### Operating System

- [X] macOS
- [ ] Linux
- [ ] Windows
- [ ] Other (Please specify)

### Additional Information

_No response_
leosvelperez commented 3 weeks ago

Thanks for reporting this!

I couldn't reproduce the issue with the information provided. Please provide a repo where the issue can be reproduced, and also provide the output of the following:

code -v
code --list-extensions --show-versions

The relevant extension we need to see the version has the id dbaeumer.vscode-eslint.

github-actions[bot] commented 2 weeks ago

This issue has been automatically marked as stale because no reproduction was provided within 7 days. Please help us help you. Providing a repository exhibiting the issue helps us diagnose and fix the issue. Any time that we spend reproducing this issue is time taken away from addressing this issue and other issues. This issue will be closed in 21 days if a reproduction is not provided. If a reproduction has been provided, please reply to keep it active. Thanks for being a part of the Nx community! 🙏

ericmesmo commented 4 days ago

Thanks for reporting this!

I couldn't reproduce the issue with the information provided. Please provide a repo where the issue can be reproduced, and also provide the output of the following:

code -v
code --list-extensions --show-versions

The relevant extension we need to see the version has the id dbaeumer.vscode-eslint.

➜ code-insiders -v 1.91.0-insider 524d1ecedd33104381e7e0a6715c13813128f89c x64

➜ code-insiders --list-extensions --show-versions adpyke.codesnap@1.3.4 bradlc.vscode-tailwindcss@0.11.76 dbaeumer.vscode-eslint@3.0.10 dotenv.dotenv-vscode@0.28.1 esbenp.prettier-vscode@10.4.0 github.copilot@1.206.0 github.copilot-chat@0.17.2024062401 miguelsolorio.fluent-icons@0.0.18 miguelsolorio.min-theme@1.5.0 miguelsolorio.symbols@0.0.18 ms-azuretools.vscode-docker@1.29.1 pkief.material-icon-theme@5.4.2 prisma.prisma@5.15.0

I'm facing the same error.

@vire , were you able to find any solution?