Skip to content

Instantly share code, notes, and snippets.

@dotherightthing
Last active September 4, 2019 04:33
Show Gist options
  • Save dotherightthing/51b90143a3212403584ea1d066b46690 to your computer and use it in GitHub Desktop.
Save dotherightthing/51b90143a3212403584ea1d066b46690 to your computer and use it in GitHub Desktop.
[Disable ESLint] Disable ESLint rules using comments #linters #js

Disable ESLint rules using comments

See https://eslint.org/docs/user-guide/configuring

Example 1: Line

Disable rule "Unexpected var, use let or const instead".

var foo = "bar"; // eslint-disable-line no-var

Example 2: Next Line

Disable rule "Identifier wpdtrt_map_ui is not in camel case".

Note: This doesn't seem to work, perhaps the PR wasn't accepted.

// eslint-disable-next-line camelcase
const config = wpdtrt_map_config;

Example 3: Block

Disable rule "Strings must use doublequote".

/* eslint-disable quotes */
const bar = 'baz';
/* eslint-enable quotes */

Example 4: All

Disable all rule checking from this point onwards.

/* eslint-disable */
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment