eslint-禁用错误通知 [英] eslint - disable error notification

查看:90
本文介绍了eslint-禁用错误通知的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在用方括号编码,并且已经安装了eslint。 Eslint不断告诉我某些函数和var已定义但从未使用过。我认为这是因为我正在使用链接到html文档的外部js文件。我的问题是如何禁用此错误,或告诉eslint不通知我该错误?

I'm coding with brackets and I have eslint installed. Eslint keeps telling me that some functions and var's are defined but never used. I think it is because I'm using an external js file which I linked to my html document. My question is how can I disable this error, or tell eslint to not inform me of this error?

推荐答案

有几种方法可以实现此目的。您可以通过在源代码中粘贴以下行来内联禁用它:

There are several ways to achieve this. You can disable it inline, by pasting this line in your source:

/*eslint-disable no-unused-vars*/

或者,如果您使用的是.eslintrc文件,则可以将其添加到您的规则块中:

or if you're using .eslintrc file, you can add this to your rules block:

"no-unused-vars": ["off", { "vars": "all", "args": "after-used", "ignoreRestSiblings": false }]

这篇关于eslint-禁用错误通知的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆