eslint babel-eslint 要装一起
npm install eslint babel-eslint -g
或是
npm install eslint babel-eslint -D
还要编写自己的eslinttrc.js
vscode
setting.json
{
"workbench.colorTheme": "Atom One Dark",
"workbench.iconTheme": "material-icon-theme",
"files.autoSave": "off",
"eslint.validate": [
"javascript",
"javascriptreact",
"vue-html",
{
"language": "vue",
"autoFix": true
}
],
"eslint.run": "onSave",
"eslint.autoFixOnSave": true,
"[html]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
"[javascript]": {
"editor.defaultFormatter": "vscode.typescript-language-features"
},
"editor.codeActionsOnSave": {
"source.fixAll.eslint": true
},
"[json]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
"[vue]": {
"editor.defaultFormatter": "octref.vetur"
}
}