Solve the problem of “error empty block statement no empty” in the console (Vue project)
This problem is caused by the code space in the page, and the specific reason is the eslint verification
Solution
The first step is to add in package. JSON
{
"name": "system",
"version": "0.1.0",
"private": true,
"eslintConfig": {
"plugins": ["example"],
"env": {
"example/custom": true
}
},
}
The second step is to add an independent configuration file. Eslintrc. JS in the root directory of the project
module.exports = {
root: true,
env: {
node: true
},
'extends': [
'plugin:vue/essential',
'eslint:recommended'
],
parserOptions: {
parser: 'babel-eslint'
},
rules: {
'no-console': process.env.NODE_ENV === 'production' ?'warn' : 'off',
'no-debugger': process.env.NODE_ENV === 'production' ?'warn' : 'off'
}
}
The third step is to create vue.config.js in the project root directory
module.exports = {
devServer: {
overlay: {
warnings: false,
errors: false
}
}
}