如何禁用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
相关产品推荐
相关产品推荐

