Skip to content

Latest commit

 

History

History
50 lines (31 loc) · 798 Bytes

no-space-before-semi.md

File metadata and controls

50 lines (31 loc) · 798 Bytes
规则名 关联规则
no-space-before-semi
semi
no-extra-semi

Disallows spaces before semicolons.

(removed) This rule was removed in ESLint v1.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 ;
}  ;

规则详解

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

此规则的 错误 代码实例:

var foo = "bar" ;

var foo = function() {} ;

var foo = function() {
} ;

var foo = 1 + 2 ;

此规则的 正确 代码实例:

::: correct

;(function(){}());

var foo = "bar";