Turning off eslint rule for a specific line Turning off eslint rule for a specific line javascript javascript

Turning off eslint rule for a specific line


To disable next line:

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

Or use the single line syntax:

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

See the eslint docs


You can use the following

/*eslint-disable *///suppress all warnings between commentsalert('foo');/*eslint-enable */

Which is slightly buried the "configuring rules" section of the docs;

To disable a warning for an entire file, you can include a comment at the top of the file e.g.

/*eslint eqeqeq:0*/

Update

ESlint has now been updated with a better way disable a single line, see @goofballLogic's excellent answer.


You can also disable a specific rule/rules (rather than all) by specifying them in the enable (open) and disable (close) blocks:

/* eslint-disable no-alert, no-console */alert('foo');console.log('bar');/* eslint-enable no-alert */

via @goofballMagic's link above: http://eslint.org/docs/user-guide/configuring.html#configuring-rules