首先需要找到setting.json设置文件
然后把这段代码放进setting.json中重启vscode即可
之前做的项目其实都没有设置eslint,然后现在的项目需要eslint规范代码,然后就有问题了,一直在警告规范不过关啊,尤其用echarts的数据粘贴过来的简直巨坑,只能使用单引号,不需要分号,方法的括号前后都要有一个空格,可气的是vscode的自动格式快捷键跟eslint是相悖的,自己会补充分号在里边,我一个一个删啊,觉得自己傻透了,不过后来好了网上查到了一个方法
然后把这段代码放进setting.json中重启vscode即可
{
"editor.tabSize": 2,
"files.associations": {
"*.vue": "vue"
},
"eslint.autoFixOnSave": true,
"eslint.options": {
"extensions": [
".js",
".vue"
]
},
"eslint.validate": [
"javascript",{
"language": "vue",
"autoFix": true
},"html",
"vue"
],
"search.exclude": {
"**/node_modules": true,
"**/bower_components": true,
"**/dist": true
},
"emmet.syntaxProfiles": {
"javascript": "jsx",
"vue": "html",
"vue-html": "html"
},
"git.confirmSync": false,
"window.zoomLevel": 0,
"editor.renderWhitespace": "boundary",
"editor.cursorBlinking": "smooth",
"editor.minimap.enabled": true,
"editor.minimap.renderCharacters": false,
"editor.fontFamily": "'Droid Sans Mono', 'Courier New', monospace, 'Droid Sans Fallback'",
"window.title": "${dirty}${activeEditorMedium}${separator}${rootName}",
"editor.codeLens": true,
"editor.snippetSuggestions": "top",
}