简体   繁体   English

ESLInt插件和ESLInt规则有什么区别? 要创建自定义规则,我们是否必须首先创建自己的插件?

[英]What's the difference between an ESLInt plugin and an ESLInt rule? To create a customized rule, do we have to create our own plugin first?

Could someone explain the difference between an ESLInt plugin and an ESLInt rule. 有人可以解释一下ESLInt插件和ESLInt规则之间的区别。 I did my research on https://eslint.org/docs/developer-guide/working-with-plugins#working-with-plugins and it seems like a plugin is a collection of rules. 我在https://eslint.org/docs/developer-guide/working-with-plugins#working-with-plugins上进行了研究,似乎插件是规则的集合。 It says 它说

Plugins can expose additional rules for use in ESLint

However I wonder does this imply that plugins can have other usage, other than storing a bunch of rules? 但是我想知道这是否意味着插件除了存储一堆规则外还能有其他用途?

Also if I were to write my own ESLint rule, do I need to first create my own ESLint plugin? 另外,如果我要编写自己的ESLint规则,是否需要首先创建自己的ESLint插件? I suppose I cannot just modify any existing ESLint rules on any existing ESLint plugins right? 我想我不能只修改任何现有ESLint插件上的任何现有ESLint规则,对吗?

I mean what else do you want to do besides store things related to eslint? 我的意思是,除了存储与eslint有关的东西外,您还想做什么?

You can configure rules, environments, configs, and pre-processors in them. 您可以在其中配置规则,环境,配置和预处理程序。

The term plugin in this context is typically reserved for eslint rules, however you can also extend a plugin ( https://github.com/airbnb/javascript/blob/master/packages/eslint-config-airbnb/.eslintrc ) and configure additional rules that override it. 在这种情况下,术语插件通常是为eslint规则保留的,但是您也可以扩展插件( https://github.com/airbnb/javascript/blob/master/packages/eslint-config-airbnb/.eslintrc )并进行配置覆盖它的其他规则。

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

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