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

Har*_*hal 7 javascript reactjs eslint eslint-config-airbnb

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

我想识别多行和单行代码:

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

//import NotificationsSettings from './containers/notifications-settings';
Run Code Online (Sandbox Code Playgroud)

我尝试过使用以下规则,但它无法识别上述类型的代码:

"rules": {
        "no-warning-comments": [1, { "terms": ["todo", "fixme", "xxx"], "location": "anywhere" }],
        "spaced-comment": ["error", "always", { "exceptions": ["-", "+"] }]
    }
Run Code Online (Sandbox Code Playgroud)

Har*_*hal 0

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

JAVASCRIPT 可用的另一个配置文件是Sonar wayRecommended,它有 148 条规则,还包括用于识别注释代码的规则。

因此,将默认配置文件切换为Sonar WayRecommended具有默认规则来识别多行或单行代码的注释代码。

在此输入图像描述