javascriptreactjseslinteslint-config-airbnb

ES-Lint Rule or Plugin to identify the commented code


I'm trying to find the rules or plugins of ES-Lint to identify the commented code so that I can remove that unnecessary code and clean my repository.

I would like to identify the multiline as well as single line code:

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

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

I have tried with below rules Bt it is not identifying the above kind of code :

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

Solution

  • So I found the way to consider the code commented rule for Sonar. It is just a matter of Quality Profile.I had set the DEFAULT profile to sonar-way but it has only 100 rules specified.

    While the other profile available for JAVASCRIPT is Sonar way Recommended which has 148 rules and it also includes the rule to identify the code commented.

    So switching the default profile to Sonar Way Recommended had the default rule to identify the commented code for multi-line or single line code.

    enter image description here