W3cubDocs

/ESLint

disallow unnecessary semicolons (no-extra-semi)

The "extends": "eslint:recommended" property in a configuration file enables this rule.

The --fix option on the command line can automatically fix some of the problems reported by this rule.

Typing mistakes and misunderstandings about where semicolons are required can lead to semicolons that are unnecessary. While not technically an error, extra semicolons can cause confusion when reading code.

Rule Details

This rule disallows unnecessary semicolons.

Examples of incorrect code for this rule:

/*eslint no-extra-semi: "error"*/

var x = 5;;

function foo() {
    // code
};

Examples of correct code for this rule:

/*eslint no-extra-semi: "error"*/

var x = 5;

var foo = function() {
    // code
};

When Not To Use It

If you intentionally use extra semicolons then you can disable this rule.

Version

This rule was introduced in ESLint 0.0.9.

Resources

© JS Foundation and other contributors
Licensed under the MIT License.
https://eslint.org/docs/rules/no-extra-semi