简体   繁体   English

eslint 规则数组中的数字是什么意思?

[英]What does the number in eslint rule arrays mean?

I'm totally new to eslint configurations.我对 eslint 配置完全陌生。 I'm using tslint for typescript for quite a while now so I'm familiar with the concept.我在打字稿中使用 tslint 已经有一段时间了,所以我熟悉这个概念。

eslint uses for many rules a syntax like eslint 对许多规则使用了类似的语法

"no-cond-assign": [2, "always"]

or just要不就

"no-constant-condition": 2

What does the number mean?数字是什么意思? The documentation is pretty huge and I'm not able to google or find it in the docs on the fly文档非常庞大,我无法使用谷歌搜索或在文档中即时找到它

I've found it myself by using another number than 0,1 or 2. I defines the severity of a rule.我自己通过使用 0,1 或 2 以外的其他数字找到了它。我定义了规则的严重性。

Severity should be one of the following: 0 = off, 1 = warning, 2 = error (you passed "3").

Documentation: https://eslint.org/docs/user-guide/configuring/rules文档: https : //eslint.org/docs/user-guide/configuring/rules

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM