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

Bug: In VSCode, when an incorrect config breaks the ESLint server, the "Restart ESLint Server" command does not work #1873

Open
1 task
ppseprus opened this issue Jun 17, 2024 · 0 comments
Labels
bug Issue identified by VS Code Team member as probable bug
Milestone

Comments

@ppseprus
Copy link

Environment

Node version: 20.12.2
npm version: 10.5.2
Local ESLint version: 9.5.0
VSCode extension version: 2.4.4
Global ESLint version: none
VSCode version: 1.90.1
Operating System: macOS Sonoma 14.5 (23F79)

What parser are you using?

Default (Espree)

What did you do?

Configuration
// eslint.config.js
export default [{
  rules: {
    "no-unused-vars": "error",
  }
}]

Steps to Reproduce

  1. Using the above minimal config, have the ESLint server up and running in VSCode
[Info  - 10:43:36 PM] ESLint server is starting.
[Info  - 10:43:37 PM] ESLint server running in node v20.9.0
[Info  - 10:43:37 PM] ESLint server is running.
[Info  - 10:43:37 PM] ESLint library loaded from: /Users/[...]/node_modules/eslint/lib/api.js
  1. Break the config by misconfiguring it (eg. add ignore instead of ignores) and hit save
[Error - 10:47:47 PM] An unexpected error occurred:
[Error - 10:47:47 PM] ConfigError: Config (unnamed): Unexpected key "ignore" found.
  1. Remove / fix the incorrect and hit save
  2. Open the Command Palette (cmd + shift + P) and select "ESLint: Restart ESLint Server"
  3. Open the Command Palette (cmd + shift + P) and select "ESLint: Show Output Channel"

What did you expect to happen?

The ESLint plugin to restart and work correctly.

What actually happened?

After the restart, the ESLint server exits.

...
[Error - 10:49:40 PM] Server process exited with code 0.

The developer has to reload VSCode to get it working again.

Link to Minimal Reproducible Example

https://github.com/ppseprus/vscode-eslint-bug

Participation

  • I am willing to submit a pull request for this issue.

Additional comments

The same thing happens, when the config is provided via a *.json file and there's a trailing comma at the last line. Incorrectly formatted *.json breaks the server and the restart does not seem to work event after the issue is fixed.

@dbaeumer dbaeumer added the bug Issue identified by VS Code Team member as probable bug label Jun 18, 2024
@dbaeumer dbaeumer added this to the Next milestone Jun 18, 2024
@dbaeumer dbaeumer modified the milestones: Next, On Deck Jul 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Issue identified by VS Code Team member as probable bug
Projects
None yet
Development

No branches or pull requests

2 participants