Cause of the problem: the project uses eslint specification code, and your code violates the specification
The first scheme (recommended): format the code through the editor and unify the indentation method
The second method: turn off the verification of spaces and tabs by eslin
Vue version 3.0:
1, find build – & gt; webpack.base.config.js。 Comment or remove the reference to eslint loader.
{
test: /\.(js|vue)$/,
loader: 'eslint-loader',
enforce: 'pre',
include: [resolve('src'), resolve('test')],
options: {
formatter: require('eslint-friendly-formatter'),
emitWarning: !config.dev.showEslintErrorsInOverlay
}
}
2. Restart the project
Vue 3.0 +:
configure the rules of eslin in package.json. Eslintconfig
{
"name": "xxxx",
"version": "0.1.0",
"private": true,
"scripts": {
"serve": "vue-cli-service serve",
"build": "vue-cli-service build",
"lint": "vue-cli-service lint"
},
"dependencies": {
xxx
},
"devDependencies": {
xxx
},
"eslintConfig": {
"root": true,
"env": {
"node": true
},
"extends": [
"plugin:vue/essential",
"eslint:recommended"
],
"parserOptions": {
"parser": "babel-eslint"
},
"rules": {
"no-console": "off",
"no-debugger": "off",
"no-mixed-spaces-and-tabs": "off"
}
},
"browserslist": [
"> 1%",
"last 2 versions",
"not dead"
]
}
The third other method:
create a vue.config.js
module.exports = {
lintOnSave:false
}