eslint disable rule code example

Example 1: disable eslint whole file

//add this block comment in the first line
//it must be a BLOCK comment!!!

/* eslint-disable */

Example 2: disable eslint for line

alert('foo'); // eslint-disable-line

// eslint-disable-next-line
alert('foo');

Example 3: disable eslint

/* eslint-disable */

Example 4: eslint disalbe check next line

const message = 'foo';
console.log(message); // eslint-disable-line no-console

// eslint-disable-next-line no-console
console.log(message);

Example 5: eslint disable

/* eslint-disable */

Example 6: eslint ignore file rule

/* eslint-disable no-alert, no-console */

alert('foo');
console.log('bar');

/* eslint-enable no-alert, no-console */