javascriptjshinteslint

Turning off eslint rule for a specific line


In order to turn off linting rule for a particular line in JSHint we use the following rule:

/* jshint ignore:start*/
$scope.someVar = ConstructorFunction();
/* jshint ignore:end */

I have been trying to locate the equivalent of the above for eslint.


Solution

  • To disable next line:

    // eslint-disable-next-line no-use-before-define
    var thing = new Thing();
    

    Or use the single line syntax:

    var thing = new Thing(); // eslint-disable-line no-use-before-define
    

    See the eslint docs


    Thanks to KhalilRavanna comment

    if you don't care about specificity you can just do //eslint-disable-line and it appears to disable all rules for the given line

    var thing = new Thing() // eslint-disable-line