Disable ESLint Rule By Comment Generator

Want to ignore ESLint rules by file? current line? next line? by a single ESLint rule? by multiple ESLint rules?
This is a generator for those of us who don't want to remember the rules.
I want to ignore an ESLint rule by...
Pick some rules to ignore...
accessor-pairs
array-bracket-newline
array-bracket-spacing
array-callback-return
array-element-newline
arrow-body-style
arrow-parens
arrow-spacing
block-scoped-var
block-spacing
brace-style
callback-return
camelcase
capitalized-comments
class-methods-use-this
comma-dangle
comma-spacing
comma-style
complexity
computed-property-spacing
consistent-return
consistent-this
constructor-super
curly
default-case
default-param-last
dot-location
dot-notation
eol-last
eqeqeq
for-direction
func-call-spacing
func-name-matching
func-names
func-style
function-call-argument-newline
function-paren-newline
generator-star-spacing
getter-return
global-require
grouped-accessor-pairs
guard-for-in
handle-callback-err
id-blacklist
id-length
id-match
implicit-arrow-linebreak
indent-legacy
indent
init-declarations
jsx-quotes
key-spacing
keyword-spacing
line-comment-position
linebreak-style
lines-around-comment
lines-around-directive
lines-between-class-members
max-classes-per-file
max-depth
max-len
max-lines-per-function
max-lines
max-nested-callbacks
max-params
max-statements-per-line
max-statements
multiline-comment-style
multiline-ternary
new-cap
new-parens
newline-after-var
newline-before-return
newline-per-chained-call
no-alert
no-array-constructor
no-async-promise-executor
no-await-in-loop
no-bitwise
no-buffer-constructor
no-caller
no-case-declarations
no-catch-shadow
no-class-assign
no-compare-neg-zero
no-cond-assign
no-confusing-arrow
no-console
no-const-assign
no-constant-condition
no-constructor-return
no-continue
no-control-regex
no-debugger
no-delete-var
no-div-regex
no-dupe-args
no-dupe-class-members
no-dupe-else-if
no-dupe-keys
no-duplicate-case
no-duplicate-imports
no-else-return
no-empty-character-class
no-empty-function
no-empty-pattern
no-empty
no-eq-null
no-eval
no-ex-assign
no-extend-native
no-extra-bind
no-extra-boolean-cast
no-extra-label
no-extra-parens
no-extra-semi
no-fallthrough
no-floating-decimal
no-func-assign
no-global-assign
no-implicit-coercion
no-implicit-globals
no-implied-eval
no-import-assign
no-inline-comments
no-inner-declarations
no-invalid-regexp
no-invalid-this
no-irregular-whitespace
no-iterator
no-label-var
no-labels
no-lone-blocks
no-lonely-if
no-loop-func
no-magic-numbers
no-misleading-character-class
no-mixed-operators
no-mixed-requires
no-mixed-spaces-and-tabs
no-multi-assign
no-multi-spaces
no-multi-str
no-multiple-empty-lines
no-native-reassign
no-negated-condition
no-negated-in-lhs
no-nested-ternary
no-new-func
no-new-object
no-new-require
no-new-symbol
no-new-wrappers
no-new
no-obj-calls
no-octal-escape
no-octal
no-param-reassign
no-path-concat
no-plusplus
no-process-env
no-process-exit
no-proto
no-prototype-builtins
no-redeclare
no-regex-spaces
no-restricted-globals
no-restricted-imports
no-restricted-modules
no-restricted-properties
no-restricted-syntax
no-return-assign
no-return-await
no-script-url
no-self-assign
no-self-compare
no-sequences
no-setter-return
no-shadow-restricted-names
no-shadow
no-spaced-func
no-sparse-arrays
no-sync
no-tabs
no-template-curly-in-string
no-ternary
no-this-before-super
no-throw-literal
no-trailing-spaces
no-undef-init
no-undef
no-undefined
no-underscore-dangle
no-unexpected-multiline
no-unmodified-loop-condition
no-unneeded-ternary
no-unreachable
no-unsafe-finally
no-unsafe-negation
no-unused-expressions
no-unused-labels
no-unused-vars
no-use-before-define
no-useless-call
no-useless-catch
no-useless-computed-key
no-useless-concat
no-useless-constructor
no-useless-escape
no-useless-rename
no-useless-return
no-var
no-void
no-warning-comments
no-whitespace-before-property
no-with
nonblock-statement-body-position
object-curly-newline
object-curly-spacing
object-property-newline
object-shorthand
one-var-declaration-per-line
one-var
operator-assignment
operator-linebreak
padded-blocks
padding-line-between-statements
prefer-arrow-callback
prefer-const
prefer-destructuring
prefer-exponentiation-operator
prefer-named-capture-group
prefer-numeric-literals
prefer-object-spread
prefer-promise-reject-errors
prefer-reflect
prefer-regex-literals
prefer-rest-params
prefer-spread
prefer-template
quote-props
quotes
radix
require-atomic-updates
require-await
require-jsdoc
require-unicode-regexp
require-yield
rest-spread-spacing
semi-spacing
semi-style
semi
sort-imports
sort-keys
sort-vars
space-before-blocks
space-before-function-paren
space-in-parens
space-infix-ops
space-unary-ops
spaced-comment
strict
switch-colon-spacing
symbol-description
template-curly-spacing
template-tag-spacing
unicode-bom
use-isnan
valid-jsdoc
valid-typeof
vars-on-top
wrap-iife
wrap-regex
yield-star-spacing
yoda
Add this to the top of your file:
/* eslint-disable */

Ignore ESLint rules for file

In general, using file level eslint-disable is an indicator that the code needs to be fixed rather than ignored, but there are definitely times when using eslint-disable at the file level is necessary.

Ignore all rules for a file

Syntax: /* eslint-disable */
Example:
/* eslint-disable */

Ignore single rule for a file

Syntax: /* eslint-disable <rule> */
Example (using no-unused-vars):
/* eslint-disable no-unused-vars */
var myObj = {};

Ignore multiples rules for a file

Syntax: /* eslint-disable <rule>, <rule>, <rule> */
Example (using no-unused-vars and no-shadow):
/* eslint-disable no-unused-vars, no-shadow */
var myObj = { old: "thing" };

function myFunc() {
 var myObj = { new: "thing" };
}
Pick some rules to ignore...
accessor-pairs
array-bracket-newline
array-bracket-spacing
array-callback-return
array-element-newline
arrow-body-style
arrow-parens
arrow-spacing
block-scoped-var
block-spacing
brace-style
callback-return
camelcase
capitalized-comments
class-methods-use-this
comma-dangle
comma-spacing
comma-style
complexity
computed-property-spacing
consistent-return
consistent-this
constructor-super
curly
default-case
default-param-last
dot-location
dot-notation
eol-last
eqeqeq
for-direction
func-call-spacing
func-name-matching
func-names
func-style
function-call-argument-newline
function-paren-newline
generator-star-spacing
getter-return
global-require
grouped-accessor-pairs
guard-for-in
handle-callback-err
id-blacklist
id-length
id-match
implicit-arrow-linebreak
indent-legacy
indent
init-declarations
jsx-quotes
key-spacing
keyword-spacing
line-comment-position
linebreak-style
lines-around-comment
lines-around-directive
lines-between-class-members
max-classes-per-file
max-depth
max-len
max-lines-per-function
max-lines
max-nested-callbacks
max-params
max-statements-per-line
max-statements
multiline-comment-style
multiline-ternary
new-cap
new-parens
newline-after-var
newline-before-return
newline-per-chained-call
no-alert
no-array-constructor
no-async-promise-executor
no-await-in-loop
no-bitwise
no-buffer-constructor
no-caller
no-case-declarations
no-catch-shadow
no-class-assign
no-compare-neg-zero
no-cond-assign
no-confusing-arrow
no-console
no-const-assign
no-constant-condition
no-constructor-return
no-continue
no-control-regex
no-debugger
no-delete-var
no-div-regex
no-dupe-args
no-dupe-class-members
no-dupe-else-if
no-dupe-keys
no-duplicate-case
no-duplicate-imports
no-else-return
no-empty-character-class
no-empty-function
no-empty-pattern
no-empty
no-eq-null
no-eval
no-ex-assign
no-extend-native
no-extra-bind
no-extra-boolean-cast
no-extra-label
no-extra-parens
no-extra-semi
no-fallthrough
no-floating-decimal
no-func-assign
no-global-assign
no-implicit-coercion
no-implicit-globals
no-implied-eval
no-import-assign
no-inline-comments
no-inner-declarations
no-invalid-regexp
no-invalid-this
no-irregular-whitespace
no-iterator
no-label-var
no-labels
no-lone-blocks
no-lonely-if
no-loop-func
no-magic-numbers
no-misleading-character-class
no-mixed-operators
no-mixed-requires
no-mixed-spaces-and-tabs
no-multi-assign
no-multi-spaces
no-multi-str
no-multiple-empty-lines
no-native-reassign
no-negated-condition
no-negated-in-lhs
no-nested-ternary
no-new-func
no-new-object
no-new-require
no-new-symbol
no-new-wrappers
no-new
no-obj-calls
no-octal-escape
no-octal
no-param-reassign
no-path-concat
no-plusplus
no-process-env
no-process-exit
no-proto
no-prototype-builtins
no-redeclare
no-regex-spaces
no-restricted-globals
no-restricted-imports
no-restricted-modules
no-restricted-properties
no-restricted-syntax
no-return-assign
no-return-await
no-script-url
no-self-assign
no-self-compare
no-sequences
no-setter-return
no-shadow-restricted-names
no-shadow
no-spaced-func
no-sparse-arrays
no-sync
no-tabs
no-template-curly-in-string
no-ternary
no-this-before-super
no-throw-literal
no-trailing-spaces
no-undef-init
no-undef
no-undefined
no-underscore-dangle
no-unexpected-multiline
no-unmodified-loop-condition
no-unneeded-ternary
no-unreachable
no-unsafe-finally
no-unsafe-negation
no-unused-expressions
no-unused-labels
no-unused-vars
no-use-before-define
no-useless-call
no-useless-catch
no-useless-computed-key
no-useless-concat
no-useless-constructor
no-useless-escape
no-useless-rename
no-useless-return
no-var
no-void
no-warning-comments
no-whitespace-before-property
no-with
nonblock-statement-body-position
object-curly-newline
object-curly-spacing
object-property-newline
object-shorthand
one-var-declaration-per-line
one-var
operator-assignment
operator-linebreak
padded-blocks
padding-line-between-statements
prefer-arrow-callback
prefer-const
prefer-destructuring
prefer-exponentiation-operator
prefer-named-capture-group
prefer-numeric-literals
prefer-object-spread
prefer-promise-reject-errors
prefer-reflect
prefer-regex-literals
prefer-rest-params
prefer-spread
prefer-template
quote-props
quotes
radix
require-atomic-updates
require-await
require-jsdoc
require-unicode-regexp
require-yield
rest-spread-spacing
semi-spacing
semi-style
semi
sort-imports
sort-keys
sort-vars
space-before-blocks
space-before-function-paren
space-in-parens
space-infix-ops
space-unary-ops
spaced-comment
strict
switch-colon-spacing
symbol-description
template-curly-spacing
template-tag-spacing
unicode-bom
use-isnan
valid-jsdoc
valid-typeof
vars-on-top
wrap-iife
wrap-regex
yield-star-spacing
yoda
Add this around the code you want to ignore:
/* eslint-disable */
/* code to ignore here */
/* eslint-enable */

Ignore ESLint rules in a block of code

Sometimes you may want to ignore a rule inside of a block of code and re-enable outside of it.

Ignore all rules for a block of code

Syntax: /* eslint-disable */ /* ...block of code... */ /* eslint-enable */
Example:
var myObj = { old: "thing" };

/* eslint-disable */
function myFunc() {
 var myObj = { new: "thing" };
}

function myFunc2() {
 var myObj = { new: "thing" };
}
/* eslint-enable */

Ignore single rule for a block of code

Syntax: /* eslint-disable <rule> */ /* ...block of code... */ /* eslint-enable <rule> */
Example (using no-shadow):
var myObj = { old: "thing" };

/* eslint-disable no-shadow */
function myFunc() {
 var myObj = { new: "thing" };
}

function myFunc2() {
 var myObj = { new: "thing" };
}
/* eslint-enable no-shadow */

Ignore multiples rules for a block of code

Syntax: /* eslint-disable <rule>, <rule>, <etc> */ /* ...block of code... */ /* eslint-enable <rule>, <rule>, <etc> */
Example (using no-unused-vars and no-shadow):
var myObj = { old: "thing" };

/* eslint-disable no-shadow, no-unused-vars */
function myFunc() {
 var myObj = { new: "thing" };
}

function myFunc2() {
 var myObj = { new: "thing" };
}
/* eslint-enable no-shadow, no-unused-vars */
Pick some rules to ignore...
accessor-pairs
array-bracket-newline
array-bracket-spacing
array-callback-return
array-element-newline
arrow-body-style
arrow-parens
arrow-spacing
block-scoped-var
block-spacing
brace-style
callback-return
camelcase
capitalized-comments
class-methods-use-this
comma-dangle
comma-spacing
comma-style
complexity
computed-property-spacing
consistent-return
consistent-this
constructor-super
curly
default-case
default-param-last
dot-location
dot-notation
eol-last
eqeqeq
for-direction
func-call-spacing
func-name-matching
func-names
func-style
function-call-argument-newline
function-paren-newline
generator-star-spacing
getter-return
global-require
grouped-accessor-pairs
guard-for-in
handle-callback-err
id-blacklist
id-length
id-match
implicit-arrow-linebreak
indent-legacy
indent
init-declarations
jsx-quotes
key-spacing
keyword-spacing
line-comment-position
linebreak-style
lines-around-comment
lines-around-directive
lines-between-class-members
max-classes-per-file
max-depth
max-len
max-lines-per-function
max-lines
max-nested-callbacks
max-params
max-statements-per-line
max-statements
multiline-comment-style
multiline-ternary
new-cap
new-parens
newline-after-var
newline-before-return
newline-per-chained-call
no-alert
no-array-constructor
no-async-promise-executor
no-await-in-loop
no-bitwise
no-buffer-constructor
no-caller
no-case-declarations
no-catch-shadow
no-class-assign
no-compare-neg-zero
no-cond-assign
no-confusing-arrow
no-console
no-const-assign
no-constant-condition
no-constructor-return
no-continue
no-control-regex
no-debugger
no-delete-var
no-div-regex
no-dupe-args
no-dupe-class-members
no-dupe-else-if
no-dupe-keys
no-duplicate-case
no-duplicate-imports
no-else-return
no-empty-character-class
no-empty-function
no-empty-pattern
no-empty
no-eq-null
no-eval
no-ex-assign
no-extend-native
no-extra-bind
no-extra-boolean-cast
no-extra-label
no-extra-parens
no-extra-semi
no-fallthrough
no-floating-decimal
no-func-assign
no-global-assign
no-implicit-coercion
no-implicit-globals
no-implied-eval
no-import-assign
no-inline-comments
no-inner-declarations
no-invalid-regexp
no-invalid-this
no-irregular-whitespace
no-iterator
no-label-var
no-labels
no-lone-blocks
no-lonely-if
no-loop-func
no-magic-numbers
no-misleading-character-class
no-mixed-operators
no-mixed-requires
no-mixed-spaces-and-tabs
no-multi-assign
no-multi-spaces
no-multi-str
no-multiple-empty-lines
no-native-reassign
no-negated-condition
no-negated-in-lhs
no-nested-ternary
no-new-func
no-new-object
no-new-require
no-new-symbol
no-new-wrappers
no-new
no-obj-calls
no-octal-escape
no-octal
no-param-reassign
no-path-concat
no-plusplus
no-process-env
no-process-exit
no-proto
no-prototype-builtins
no-redeclare
no-regex-spaces
no-restricted-globals
no-restricted-imports
no-restricted-modules
no-restricted-properties
no-restricted-syntax
no-return-assign
no-return-await
no-script-url
no-self-assign
no-self-compare
no-sequences
no-setter-return
no-shadow-restricted-names
no-shadow
no-spaced-func
no-sparse-arrays
no-sync
no-tabs
no-template-curly-in-string
no-ternary
no-this-before-super
no-throw-literal
no-trailing-spaces
no-undef-init
no-undef
no-undefined
no-underscore-dangle
no-unexpected-multiline
no-unmodified-loop-condition
no-unneeded-ternary
no-unreachable
no-unsafe-finally
no-unsafe-negation
no-unused-expressions
no-unused-labels
no-unused-vars
no-use-before-define
no-useless-call
no-useless-catch
no-useless-computed-key
no-useless-concat
no-useless-constructor
no-useless-escape
no-useless-rename
no-useless-return
no-var
no-void
no-warning-comments
no-whitespace-before-property
no-with
nonblock-statement-body-position
object-curly-newline
object-curly-spacing
object-property-newline
object-shorthand
one-var-declaration-per-line
one-var
operator-assignment
operator-linebreak
padded-blocks
padding-line-between-statements
prefer-arrow-callback
prefer-const
prefer-destructuring
prefer-exponentiation-operator
prefer-named-capture-group
prefer-numeric-literals
prefer-object-spread
prefer-promise-reject-errors
prefer-reflect
prefer-regex-literals
prefer-rest-params
prefer-spread
prefer-template
quote-props
quotes
radix
require-atomic-updates
require-await
require-jsdoc
require-unicode-regexp
require-yield
rest-spread-spacing
semi-spacing
semi-style
semi
sort-imports
sort-keys
sort-vars
space-before-blocks
space-before-function-paren
space-in-parens
space-infix-ops
space-unary-ops
spaced-comment
strict
switch-colon-spacing
symbol-description
template-curly-spacing
template-tag-spacing
unicode-bom
use-isnan
valid-jsdoc
valid-typeof
vars-on-top
wrap-iife
wrap-regex
yield-star-spacing
yoda
Add this above the line/block you want to ignore:
// eslint-disable-next-line

Ignore ESLint rules for next line

Sometimes you may want to ignore a rule inside of a block of code and re-enable outside of it.

Ignore all rules for next line

Syntax: // eslint-disable-next-line
Example:
// eslint-disable-next-line
module.exports = () => {
 /* lots of code here, all covered under the eslint-disable comment */
};

Ignore single rule for next line

Syntax: // eslint-disable-next-line <rule>
Example (using no-unused-vars):
// eslint-disable-next-line no-unused-vars
module.exports = () => {
 /* lots of code here, all covered under the eslint-disable comment */
};

Ignore multiples rules for next line

Syntax: // eslint-disable-next-line <rule>, <rule>, <etc>
Example (using no-var and no-unused-vars):
// eslint-disable-next-line no-var, no-unused-vars
module.exports = () => {
 var myObj = {};
 /* lots of code here, all covered under the eslint-disable comment */
};
Pick some rules to ignore...
accessor-pairs
array-bracket-newline
array-bracket-spacing
array-callback-return
array-element-newline
arrow-body-style
arrow-parens
arrow-spacing
block-scoped-var
block-spacing
brace-style
callback-return
camelcase
capitalized-comments
class-methods-use-this
comma-dangle
comma-spacing
comma-style
complexity
computed-property-spacing
consistent-return
consistent-this
constructor-super
curly
default-case
default-param-last
dot-location
dot-notation
eol-last
eqeqeq
for-direction
func-call-spacing
func-name-matching
func-names
func-style
function-call-argument-newline
function-paren-newline
generator-star-spacing
getter-return
global-require
grouped-accessor-pairs
guard-for-in
handle-callback-err
id-blacklist
id-length
id-match
implicit-arrow-linebreak
indent-legacy
indent
init-declarations
jsx-quotes
key-spacing
keyword-spacing
line-comment-position
linebreak-style
lines-around-comment
lines-around-directive
lines-between-class-members
max-classes-per-file
max-depth
max-len
max-lines-per-function
max-lines
max-nested-callbacks
max-params
max-statements-per-line
max-statements
multiline-comment-style
multiline-ternary
new-cap
new-parens
newline-after-var
newline-before-return
newline-per-chained-call
no-alert
no-array-constructor
no-async-promise-executor
no-await-in-loop
no-bitwise
no-buffer-constructor
no-caller
no-case-declarations
no-catch-shadow
no-class-assign
no-compare-neg-zero
no-cond-assign
no-confusing-arrow
no-console
no-const-assign
no-constant-condition
no-constructor-return
no-continue
no-control-regex
no-debugger
no-delete-var
no-div-regex
no-dupe-args
no-dupe-class-members
no-dupe-else-if
no-dupe-keys
no-duplicate-case
no-duplicate-imports
no-else-return
no-empty-character-class
no-empty-function
no-empty-pattern
no-empty
no-eq-null
no-eval
no-ex-assign
no-extend-native
no-extra-bind
no-extra-boolean-cast
no-extra-label
no-extra-parens
no-extra-semi
no-fallthrough
no-floating-decimal
no-func-assign
no-global-assign
no-implicit-coercion
no-implicit-globals
no-implied-eval
no-import-assign
no-inline-comments
no-inner-declarations
no-invalid-regexp
no-invalid-this
no-irregular-whitespace
no-iterator
no-label-var
no-labels
no-lone-blocks
no-lonely-if
no-loop-func
no-magic-numbers
no-misleading-character-class
no-mixed-operators
no-mixed-requires
no-mixed-spaces-and-tabs
no-multi-assign
no-multi-spaces
no-multi-str
no-multiple-empty-lines
no-native-reassign
no-negated-condition
no-negated-in-lhs
no-nested-ternary
no-new-func
no-new-object
no-new-require
no-new-symbol
no-new-wrappers
no-new
no-obj-calls
no-octal-escape
no-octal
no-param-reassign
no-path-concat
no-plusplus
no-process-env
no-process-exit
no-proto
no-prototype-builtins
no-redeclare
no-regex-spaces
no-restricted-globals
no-restricted-imports
no-restricted-modules
no-restricted-properties
no-restricted-syntax
no-return-assign
no-return-await
no-script-url
no-self-assign
no-self-compare
no-sequences
no-setter-return
no-shadow-restricted-names
no-shadow
no-spaced-func
no-sparse-arrays
no-sync
no-tabs
no-template-curly-in-string
no-ternary
no-this-before-super
no-throw-literal
no-trailing-spaces
no-undef-init
no-undef
no-undefined
no-underscore-dangle
no-unexpected-multiline
no-unmodified-loop-condition
no-unneeded-ternary
no-unreachable
no-unsafe-finally
no-unsafe-negation
no-unused-expressions
no-unused-labels
no-unused-vars
no-use-before-define
no-useless-call
no-useless-catch
no-useless-computed-key
no-useless-concat
no-useless-constructor
no-useless-escape
no-useless-rename
no-useless-return
no-var
no-void
no-warning-comments
no-whitespace-before-property
no-with
nonblock-statement-body-position
object-curly-newline
object-curly-spacing
object-property-newline
object-shorthand
one-var-declaration-per-line
one-var
operator-assignment
operator-linebreak
padded-blocks
padding-line-between-statements
prefer-arrow-callback
prefer-const
prefer-destructuring
prefer-exponentiation-operator
prefer-named-capture-group
prefer-numeric-literals
prefer-object-spread
prefer-promise-reject-errors
prefer-reflect
prefer-regex-literals
prefer-rest-params
prefer-spread
prefer-template
quote-props
quotes
radix
require-atomic-updates
require-await
require-jsdoc
require-unicode-regexp
require-yield
rest-spread-spacing
semi-spacing
semi-style
semi
sort-imports
sort-keys
sort-vars
space-before-blocks
space-before-function-paren
space-in-parens
space-infix-ops
space-unary-ops
spaced-comment
strict
switch-colon-spacing
symbol-description
template-curly-spacing
template-tag-spacing
unicode-bom
use-isnan
valid-jsdoc
valid-typeof
vars-on-top
wrap-iife
wrap-regex
yield-star-spacing
yoda
Add this at the end of the line you want to ignore:
// eslint-disable-line

Ignore ESLint rules for current line

This is useful for ignoring rules for a single line. I find it useful because if code gets moved around, it guarantees that the eslint-disable comment is preserved with the code it's meant for.

Ignore all rules for current line

Syntax: /// eslint-disable-line
Example:
var myObj = {}; // eslint-disable-line

Ignore single rule for current line

Syntax: // eslint-disable-line <rule>
Example (using no-var):
var myObj = {}; // eslint-disable-line no-var

Ignore multiples rules for current line

Syntax: // eslint-disable-line <rule>, <rule>, <etc>
Example (using no-var and no-unused-vars):
var myObj = {}; //eslint-disable-line no-var, no-unused-vars