【问题标题】:Making all plugin specific rules strict使所有插件特定规则严格
【发布时间】:2016-07-14 06:26:05
【问题描述】:

eslint.json 配置中,ESLint allows to configure 使用以下逻辑规则严格性:

  • 0 - “关闭”
  • 1 - “警告”
  • 2 - “错误”

例子:

{
  "rules": {
    "jasmine/valid-expect": 2,
    "eqeqeq": [2, "smart"]
  }
}

问题:是否可以使所有插件特定规则严格(代码 2)?

在这种情况下,我们希望来自 jasmine (eslint-plugin-jasmine plugin) 的所有规则在出现违规时产生错误。

我尝试指定 "jasmine/*": 2"jasmine": 2,但都失败并出现“未找到规则的定义”错误。

【问题讨论】:

    标签: javascript jasmine static-code-analysis eslint software-quality


    【解决方案1】:

    ESLint 不支持配置中的通配符。但是,您可以请求插件创建者将可共享的配置添加到他们的插件 (http://eslint.org/docs/developer-guide/working-with-plugins#configs-in-plugins) 中,然后您只需将 extends: plugin:jasmine/all 添加到配置文件中即可使用插件提供的配置 all

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2017-02-25
      • 1970-01-01
      • 2015-10-15
      • 2021-08-08
      • 1970-01-01
      • 2013-03-11
      • 1970-01-01
      相关资源
      最近更新 更多