You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

VS Code中ESLint扩展间歇性提示无法格式化JavaScript文件问题求助

VS Code ESLint 间歇性无法格式化JavaScript文件问题

保存文件时未触发自动格式化,状态栏弹出报错提示:Extension 'eslint' is configured as formatter but it cannot format 'JavaScript'-files
报错截图
该问题为偶发,此前运行正常,MBP设备崩溃重启后出现,历史上曾出现过同类问题但修复方案已遗忘,目前未在公开搜索渠道找到该报错的相关反馈。
项目为复杂度较高的Vue应用,基于预置模板搭建。


相关配置信息

项目依赖(package.json)

"@vue/cli-plugin-eslint": "^4.5.13",
"babel-eslint": "^10.1.0",
"eslint": "^7.31.0",
"eslint-plugin-import": "^2.23.4",
"eslint-plugin-vue": "^7.14.0"

VS Code 工作区配置

"editor.codeLens": true,
"eslint.format.enable": true,
"editor.codeActionsOnSave": {
  "source.fixAll.eslint": true,
},
"[javascript]": {
    "editor.defaultFormatter": "dbaeumer.vscode-eslint"
},
"[vue]": {
    "editor.defaultFormatter": "dbaeumer.vscode-eslint"
},
"eslint.validate": [
    "javascript"
],
"debug.javascript.usePreview": true,
"debug.javascript.usePreviewAutoAttach": true,
"[jsonc]": {
    "editor.defaultFormatter": "dbaeumer.vscode-eslint"
}

已知线索

  • 同类报错的可能诱因包括ESLint服务重启、扩展宿主负载过高
  • 项目中绝大多数文件可正常格式化,仅名为eslint.js的构建流程文件持续触发报错:该文件功能为运行ESLint,推测保存该文件时会触发ESLint运行/重载,与VS Code ESLint扩展的调用请求发生冲突导致报错。

内容的提问来源于stack exchange,提问作者Steve Bennett

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.09.29 00:45:02