Extension 'ESlint' cannot format file 'index.ts' caused by probing failure
See original GitHub issueI encountered the problem Extension 'ESlint' cannot format file 'index.ts'
while trying to format my TypeScript code in a Vue project. Here is the snapshot:
And here is my settings.json
in the workspace:
"eslint.format.enable": true,
"editor.codeActionsOnSave": {
"source.fixAll.eslint": true
},
"[typescript]": {
"editor.defaultFormatter": "dbaeumer.vscode-eslint"
}
Then, I try to turn on the trace log of plugin with "eslint.trace.server": "verbose"
. The plugin gives the following output:
[Info - 下午10:17:00] ESLint library loaded from: D:\code\web\***\node_modules\eslint\lib\api.js
[Trace - 下午10:17:01] Received request 'eslint/probeFailed - (4)'.
Params: {
"textDocument": {
"uri": "file:///d%3A/code/web/***/src/backend/index.ts"
}
}
[Trace - 下午10:17:01] Sending notification 'textDocument/didClose'.
Params: {
"textDocument": {
"uri": "file:///d%3A/code/web/***/src/backend/index.ts"
}
}
[Trace - 下午10:17:01] Sending response 'eslint/probeFailed - (4)'. Processing request took 0ms
No result returned.
It seems that probing failure causes the problem. So, I use the settings "eslint.validate": ["typescript"]
to enforce validating of TypeScript. Finally, the problem got solved, and soon it is available to format my TypeScript code with ESLint.
The question has been reported for multiple times (#1086, #850, #951), is it a bug or feature?
The following information may be useful:
- The project is generated by @vue/cli v4
- Problem can be reproduced on any kinds of TypeScript file, even a Hello World
- The
.ts
file can be fixed byeslint --fix index.ts
- OS System: Windows 10 20H2
- Node: v14 globally installed, v12 used by VSCode
- VSCode version: v1.52.1
- Extension version: v2.1.14
Thank you for help!
Issue Analytics
- State:
- Created 3 years ago
- Reactions:2
- Comments:9 (4 by maintainers)
Top Results From Across the Web
Extension 'eslint' is configured as formatter but it cannot format ...
This issue regarding TypeScript gives some hints. It seems this error can result when the ESLint server is restarting or the extension host...
Read more >Extension 'ESlint' cannot format file 'index.ts' caused by probing failure
I encountered the problem Extension 'ESlint' cannot format file 'index.ts' while trying to format my TypeScript code in a Vue project. Here is...
Read more >jsEnable": true ). eslint - ADocLib
I encountered the problem Extension 'ESlint' cannot format file 'index.ts' while trying to format my TypeScript code in a Vue project. Here is...
Read more >VS Code ESLint extension - Visual Studio Marketplace
Integrates ESLint into VS Code. If you are new to ESLint check the documentation. The extension uses the ESLint library installed in the...
Read more >ESLint not working in VSCode? Help build a troubleshooting ...
Since .eslintrc configuration files automatically extend configuration files in higher directories, this can cause weird issues. Make sure you ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
@jamiehaywood great that you figured it out. I agree ESLint can be confusing especially you need some configuration to validate anything other than js.
Looking forward to your PR. I will close the issue
@maximumstock can you please provide me with a GitHub repository I can clone that demos what you are experiencing.
I had this issue just now, same error, not vue or anything, just a typescript project with no TSX files.
I nuked my
node_modules
, rannpm install
, thenshift+cmd+p: Reload window
/ restart vscode, and that fixed it for me. I didn’t update the eslint.validate setting.Not the solution we need, but perhaps the one that we deserve.