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

如何禁用VSCode中ESLint警告但保留格式化功能?

解决VSCode中ESLint警告与格式化冲突的问题

方案1:保留ESLint格式化,仅移除警告类红色下划线

在VSCode的settings.json中配置以下内容:

{
  "eslint.enable": true,
  "eslint.quiet": true,
  "editor.codeActionsOnSave": {
    "source.fixAll.eslint": true
  },
  "eslint.format.enable": true,
  "editor.defaultFormatter": "dbaeumer.vscode-eslint"
}
  • eslint.quiet: 只让ESLint报告错误,忽略所有警告,直接消除警告类的红色下划线
  • editor.codeActionsOnSave: 开启保存时自动用ESLint修复代码的功能
  • eslint.format.enable: 允许ESLint承担代码格式化任务
  • editor.defaultFormatter: 将ESLint设置为TS代码的默认格式化工具

方案2:完全屏蔽所有ESLint提示,保留格式化

如果需要彻底隐藏ESLint的所有诊断提示(包括错误),可在上述配置基础上添加:

"diagnostic.enable": false,
"editor.showDiagnostics": "never"

注意:此配置会屏蔽VSCode中所有插件的诊断提示,不止ESLint,按需使用。

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

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.08.22 15:24:16