ESLint-需要let或const而不是var(no-var) [英] ESLint - require let or const instead of var (no-var)
本文介绍了ESLint-需要let或const而不是var(no-var)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如何在ESlint上禁用阻止使用var并鼓励使用const或let的规则?
How to disable the rule of discouraging the use of var and encouraging the use of const or let instead on ESlint?
推荐答案
在您的 package.json
中(假设您就是使用),包括:
In your package.json
(assuming that is what you are using), include:
"eslintConfig": {
"rules": {
"no-var": 0
}
}
如果您不使用 package.json
,则可以在 .eslintrc.js
,或者在每个文件的基础上,在文件顶部添加注释 / * eslint no-var:0 * /
。
If you're not using package.json
, you can set the the same in an .eslintrc.js
, or, on a per-file basis, include a comment at the top of the file /* eslint no-var: 0 */
.
所有这些都来自 ESlint配置文档。
这篇关于ESLint-需要let或const而不是var(no-var)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文