Vuejs2 如何在@vue/cli中添加tno未使用的VAR错误
在@vue/cli 4.0.5应用程序中,我不想添加任何未使用的vars错误(应用程序内和phpstorm中) 我在.eslintrc.js中添加了此选项,其中包含:Vuejs2 如何在@vue/cli中添加tno未使用的VAR错误,vuejs2,eslint,Vuejs2,Eslint,在@vue/cli 4.0.5应用程序中,我不想添加任何未使用的vars错误(应用程序内和phpstorm中) 我在.eslintrc.js中添加了此选项,其中包含: module.exports = { root: true, env: { node: true }, 'extends': [ 'plugin:vue/essential', 'eslint:recommended' ], rules: { 'no-console': 'e
module.exports = {
root: true,
env: {
node: true
},
'extends': [
'plugin:vue/essential',
'eslint:recommended'
],
rules: {
'no-console': 'error',
'no-debugger': 'error',
"no-unused-vars": "error",
'no-undef': "error",
},
parserOptions: {
parser: 'babel-eslint'
}
}
但在我重新启动服务器时,我看不到未使用的vars错误事件
还有其他选择吗
谢谢 我不知道您的配置是如何设置的,但您始终可以在package.json文件中添加eslintConfig,如下所示:
"eslintConfig": {
"root": true,
"env": {
"node": true
},
"rules": {
"no-unused-vars": "error"
}
}
它对.eslintrc.js保持不变没有帮助。我必须删除.eslintrc.js吗?@mstdmstd根据官方的eslint文档,您只需将上面的代码保留在package.json中并删除文件“.eslintrc.js”。这将使package.json上的“eslintConfig”成为默认的eslint配置程序。删除.eslintrc.js没有帮助。在检查项目时,我看到节点_模块中有很多package.json和eslintConfig参数。我可以全部覆盖它们吗?不,你不应该在node_模块内更改任何内容;请上传你的项目在这里,这样我可以复制代码,看看有什么错。