是否有任何语法可以将附加信息添加到 eslint-disable-line 注释中?
Is there any syntax to add additional info to an eslint-disable-line comment?
给出这样的评论:
i++; // eslint-disable-line no-plusplus
是否有任何语法我们可以在同一行添加描述或解释为什么我们要禁用规则,而不会触发 ESLint 抱怨没有名为“-- 我们的描述”的规则?
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
添加
给出这样的评论:
i++; // eslint-disable-line no-plusplus
是否有任何语法我们可以在同一行添加描述或解释为什么我们要禁用规则,而不会触发 ESLint 抱怨没有名为“-- 我们的描述”的规则?
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
添加