vscode里打开 文件>首选项 > 设置, 在用户设置setting.json里面:能够这样设置javascript
{ //配置eslint "eslint.autoFixOnSave": true, "files.autoSave":"off", "eslint.validate": [ "javascript", "javascriptreact", "html", { "language": "vue", "autoFix": true } ], "eslint.options": { "plugins": ["html"] }, //为了符合eslint的两个空格间隔原则 "editor.tabSize": 2 }
这样每次保存文件(ctrl+s)时,eslint插件会自动对当前文件进行eslint语法修正!html