1.安裝包:
"eslint":"^4.19.1",
"eslint-friendly-formatter":"^4.0.1",
"eslint-loader":"^2.0.0",
"eslint-plugin-html":"^4.0.3",
添加.eslintrc.js 文件,用于校驗(yàn)代碼
2. 需要插件:eslint??
? vetur :? HTML格式化代碼縮進(jìn)
3.vscode設(shè)置:
{
? "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"
},
"[vue]": {},
}