第一步安装ESLint插件
在vscode左侧边栏上点击扩展,然后输入eslint,下边就会出现eslint插件,点击安装即可。
第二步设置setting.json
具体步骤:文件—首选项–设置—在里边对eslint进行配置:
/配置eslint
"eslint.autoFixOnSave": true,
"files.autoSave":"off",
"eslint.validate": [
"javascript",
"javascriptreact",
"html",
{ "language": "vue", "autoFix": true }
],
"eslint.options": {
"plugins": ["html"]
},
//为了符合eslint的两个空格间隔原则
"editor.detectIndentation": false,
"editor.tabSize": 2,
配置完成之后的setting.json: