前提,你已经安装了eslint和配置了eslint,下面的代码配置才会生效
// ----配置vscode检验规则 start
"editor.tabSize": 2,
"eslint.autoFixOnSave": true,
"eslint.validate": [
"javascript",
"javascriptreact",
{
"language": "html",
"autoFix": true
},
{
"language": "vue",
"autoFix": true
}
],
"editor.renderWhitespace": "boundary",
"editor.cursorBlinking": "smooth",
"editor.minimap.enabled": true,
"editor.minimap.renderCharacters": false,
"window.title": "${dirty}${activeEditorMedium}${separator}${rootName}",
"editor.codeLens": true,
"editor.snippetSuggestions": "top"
// ----配置vscode检验规则 end
复制代码
达到以下效果:
1、es语法校验
2、格式化错误的语法
3、清晰的背景配置...,有助于代码中空格的查看
复制代码