ES-Lint规则或插件来标识注释的代码

问题描述

我正试图找到ES-Lint的规则或插件来识别注释的代码,以便删除不必要的代码并清理存储库。

我想识别多行以及单行代码:

/* import CreateIncentive from './containers/create-incentive';
import AffiliateFilters from './containers/affiliate-filters'; */

//import NotificationsSettings from './containers/notifications-settings';

我尝试使用以下规则,但不能识别上述代码:

"rules": {
        "no-warning-comments": [1,{ "terms": ["todo","fixme","xxx"],"location": "anywhere" }],"spaced-comment": ["error","always",{ "exceptions": ["-","+"] }]
    }

解决方法

也许您可以尝试使用no-inline-comments ESLint规则

https://eslint.org/docs/rules/no-inline-comments

,

因此,我找到了考虑Sonar的代码注释规则的方法。这只是 质量配置文件 的问题。我已将DEFAULT配置文件设置为声纳,但仅指定了100条规则。

可用于JAVASCRIPT的其他配置文件是 推荐的声纳方式 ,它具有148条规则,并且还包括识别注释代码的规则。

因此,将默认配置文件切换为 Sonar Way推荐 具有默认规则,以标识多行或单行代码的注释代码。

enter image description here

相关问答

错误1:Request method ‘DELETE‘ not supported 错误还原:...
错误1:启动docker镜像时报错:Error response from daemon:...
错误1:private field ‘xxx‘ is never assigned 按Alt...
报错如下,通过源不能下载,最后警告pip需升级版本 Requirem...