在我们开发过程中代码还没写完,不小按下保存或者定义了一个变量没有使用就报错这种问题我们应该怎么解决这种问题了。


解决方法
1 ,找到eslintrc文件。
2,在 rules 选项中 添加“"no-unused-vars”:‘off’ 配置
注意:改变了eslintrc文件中的配置,一定要重启项目才能生效
module.exports = {
root: true,
env: {
node: true
},
'extends': [
'plugin:vue/essential',
'eslint:recommended'
],
parserOptions: {
parser: 'babel-eslint'
},
rules: {
'no-console': 'off',
'no-debugger': 'off',
"no-irregular-whitespace": "off", //这禁止掉 空格报错检查
"no-unused-vars": 'off'
}
}
看下面结果,就不会报错了

网友评论