Skip to content

Latest commit

 

History

History
56 lines (36 loc) · 830 Bytes

no-space-before-semi.md

File metadata and controls

56 lines (36 loc) · 830 Bytes
title related_rules
no-space-before-semi
semi
no-extra-semi

Disallows spaces before semicolons.

::: important This rule was removed in ESLint v1.0.0 and replaced by the semi-spacing rule. :::

JavaScript allows for placing unnecessary spaces between an expression and the closing semicolon.

Space issues can also cause code to look inconsistent and harder to read.

var thing = function () {
  var test = 12 ;
}  ;

Rule Details

This rule prevents the use of spaces before a semicolon in expressions.

Examples of incorrect code for this rule:

::: incorrect

var foo = "bar" ;

var foo = function() {} ;

var foo = function() {
} ;

var foo = 1 + 2 ;

:::

Examples of correct code for this rule:

::: correct

;(function(){}());

var foo = "bar";

:::