全局安装eslint
看控制台输出什么错
报的错千奇百怪的,不过百度后很好解决,下面附上我的eslint配置
{
“editor.tabSize”: 2,
"prettier.singleQuote": true,
"prettier.semi": false, //分号结尾
"prettier.useTabs": true,
"prettier.vueIndentScriptAndStyle": true, // 视区宽度 换行
"prettier.arrowParens": "avoid", // (x) => {} 箭头函数参数只有一个是否要有小括号。avoid:省略括号
"vetur.format.defaultFormatter.html": "prettier",
"vetur.format.defaultFormatterOptions": {
"js-beautify-html": {
// force-aligned | force-expand-multiline
"wrap_attributes": "force-aligned" // - auto: 仅在超出行长度时才对属性进行换行。 // - force: 对除第一个属性外的其他每个属性进行换行。 // - force-aligned: 对除第一个属性外的其他每个属性进行换行,并保持对齐。 // - force-expand-multiline: 对每个属性进行换行。 // - aligned-multiple: 当超出折行长度时,将属性进行垂直对齐。
},
"prettyhtml": {
"printWidth": 100,
"singleQuote": false,
"wrapAttributes": true,
"sortAttributes": true
},
"prettier": {
"semi": false,
"singleQuote": true
}
},
"emmet.syntaxProfiles": {
"vue-html": "html",
"vue": "html"
},
"vetur.validation.template": false,
"eslint.options": {
"plugins": ["html"]
},
"eslint.nodePath": "D:\\Program Files\\nodejs\\node_global\\node_modules",
"eslint.validate": ["javascript", "javascriptreact", "vue", "html"],
"explorer.confirmDelete": false,
"editor.codeActionsOnSave": {
"source.fixAll.eslint": true
},
"[jsonc]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
"[vue]": {
"editor.defaultFormatter": "octref.vetur"
},
"[javascript]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
"[html]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
"[json]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
"git.suggestSmartCommit": false,
// "workbench.colorTheme": "SynthWave '84",
// "workbench.preferredDarkColorTheme": "SynthWave '84",
// "workbench.iconTheme": "material-icon-theme",
"window.zoomLevel": 1.2,
// "workbench.startupEditor": "newUntitledFile"
}