gpt4 book ai didi

eslint - 如何禁用 "definition for rule ' 自定义规则“未找到”错误?

转载 作者:行者123 更新时间:2023-12-05 03:48:01 25 4
gpt4 key购买 nike

由于我无法控制的原因,我维护的代码库在具有两个不同规则集的两个不同环境中被检查。其中一个环境有规则,另一个没有。由于 “未找到规则 '{custom_rule}' 的定义” 错误,第二个构建失败。

同样,出于我无法控制的原因,我无法合并规则集。如何在 ESLint 上禁用这些“未找到定义”错误,以便我的构建成功?

编辑:澄清一下,我有这样的东西:

11 ...
12 // eslint-disable-next-line custom-rule
13 var thing = new Thing();
14 ...

错误如下:

12:3 error  Definition for rule 'custom-rule' was not found  fb-www/extra-arrow-initializer

最佳答案

我在 ESLint Discord 服务器上询问了这个问题,并从 Nicholas Zakas 那里得到了这个答案。我假设这是最终答案,因为作为原作者和主要贡献者,如果有其他选择,我想 Nicholas 会知道。

他建议我为这些规则名称创建虚拟规则;

@keved I’m not sure there’s much else to be done. You’re referencing a rule that doesn’t exist, which is an error. The only other thing I can think of is to create a dummy plugin in your repo that is only referenced during the Travis build. As long as a rule exists with the given name, you’ll avoid the error. The rule doesn’t actually have to do anything so you could just have one dummy rule and assign it to every rule name.

screenshot of the answer in discord

关于eslint - 如何禁用 "definition for rule ' 自定义规则“未找到”错误?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/64614131/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com