gpt4 book ai didi

javascript - 是否有任何语法可以向 eslint-disable-line 注释添加附加信息?

转载 作者:行者123 更新时间:2023-12-05 00:25:10 27 4
gpt4 key购买 nike

给出这样的评论:

  i++; // eslint-disable-line no-plusplus
是否有任何语法我们可以在同一行添加说明或解释为什么我们禁用规则,而不会触发 ESLint 提示没有名为“--our description”的规则?
  i++; // eslint-disable-line no-plusplus - our description
在这个简单的例子中,使用 // eslint-disable-next-line 就足够简单了。 - 但是在您有多行可能会更改顺序的情况下,例如对象键或导入语句(如果使用自动字母排序),那么它就会崩溃。
是否有任何支持的方法来实现这一目标?

最佳答案

您可以添加两个破折号 -- .根据 using configuration comments 上的文档:

Configuration comments can include descriptions to explain why the comment is necessary. The description must occur after the configuration and is separated from the configuration by two or more consecutive - characters. For example:

/* eslint eqeqeq: "off", curly: "error" -- Here's a description  */

进一步阅读 : 于 2019 年 9 月通过 New: Description in directive comments 添加

关于javascript - 是否有任何语法可以向 eslint-disable-line 注释添加附加信息?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/67962860/

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