严格限制所有插件特定规则 [英] Making all plugin specific rules strict
问题描述
在 eslint.json
配置中, ESLint
允许使用以下逻辑配置规则严格性:
In eslint.json
configuration, ESLint
allows to configure rule strictness using the following logic:
- 0 - 关闭
- 1 - 警告
- 2 - 错误
示例:
{
"rules": {
"jasmine/valid-expect": 2,
"eqeqeq": [2, "smart"]
}
}
问题:是否可以严格执行所有插件特定的规则(代码2)?
Question: Is it possible to make all plugin-specific rules strict (code 2)?
在这种情况下,我们希望所有规则都来自 jasmine
( eslint-plugin-jasmine
插件)如果存在违规,则会产生错误。
In this case, we want all rules coming from jasmine
(eslint-plugin-jasmine
plugin) produce an error if there is a violation.
我试图指定jasmine / *:2
和jasmine :2
,但都失败了规则定义...未找到错误。
I've tried to specify "jasmine/*": 2
and "jasmine": 2
, but both failed with a "definition for rule ... not found" error.
推荐答案
ESLint在配置中不支持通配符。但是,您可以请求插件创建者在其插件中添加可共享配置( http://eslint.org/docs/developer-guide/working-with-plugins#configs-in-plugins )之后你可以添加 extends:plugin:jasmine / all
进入你的配置文件,使用插件提供的config 所有
。
ESLint doesn't have support for wildcards in configuration. However, you can request that plugin creator adds a shareable config into their plugin (http://eslint.org/docs/developer-guide/working-with-plugins#configs-in-plugins) after that you can just add extends: plugin:jasmine/all
into your config file to use config all
provided by plugin.
这篇关于严格限制所有插件特定规则的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!