patternjavascriptCritical
Turning off an ESLint rule for a specific line
Viewed 0 times
lineturningruleforoffspecificeslint
Problem
In order to turn off a linting rule for a particular line in JSHint, we use the following rule:
Is there an equivalent of the above for ESLint?
/* jshint ignore:start*/
$scope.someVar = ConstructorFunction();
/* jshint ignore:end */Is there an equivalent of the above for ESLint?
Solution
To disable the next line:
Or use the single line syntax:
See the ESLint documentation.
Thanks to KhalilRavanna's 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
// 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-defineSee the ESLint documentation.
Thanks to KhalilRavanna's 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-lineCode Snippets
// eslint-disable-next-line no-use-before-define
var thing = new Thing();var thing = new Thing(); // eslint-disable-line no-use-before-definevar thing = new Thing() // eslint-disable-lineContext
Stack Overflow Q#27732209, score: 3235
Revisions (0)
No revisions yet.