Closed PhilippSoehnlein closed 10 years ago
The following code breaks when using esformatter-semicolons:
for (var i = 0; i < 10; i++) { }
esformatter-semicolons adds an additional semicolon and ends up with:
for (var i = 0;; i < 10; i++) { }
If the var keyword is moved out of the for loop everything seems fine:
var
for
var i; for (i = 0; i < 10; i++) { }
I know the original example is considered bad style because of JavaScript's function scope, but sometimes people declare loop variables this way…
The bug appears independently of the config file, I tried with a full blown config file and with the minimum config file:
{ "plugins": [ "esformatter-semicolons" ] }
@PhilippSoehnlein Thanks for reporting this. I'll fix it in the next few hours.
Fixed. See https://github.com/bulyshko/esformatter-semicolons/commit/69e3f8d44e4ca504585bed9b6769a36bf3760e09
The following code breaks when using esformatter-semicolons:
esformatter-semicolons adds an additional semicolon and ends up with:
If the
var
keyword is moved out of thefor
loop everything seems fine:I know the original example is considered bad style because of JavaScript's function scope, but sometimes people declare loop variables this way…
The bug appears independently of the config file, I tried with a full blown config file and with the minimum config file: