Making all plugin specific rules strict

你说的曾经没有我的故事 提交于 2019-12-14 04:10:55

问题


In eslint.json configuration, ESLint allows to configure rule strictness using the following logic:

  • 0 - "off"
  • 1 - "warning"
  • 2 - "error"

Example:

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

Question: Is it possible to make all plugin-specific rules strict (code 2)?

In this case, we want all rules coming from jasmine (eslint-plugin-jasmine plugin) produce an error if there is a violation.

I've tried to specify "jasmine/*": 2 and "jasmine": 2, but both failed with a "definition for rule ... not found" error.


回答1:


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.



来源:https://stackoverflow.com/questions/36237874/making-all-plugin-specific-rules-strict

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!