millermedeiros / esformatter

ECMAScript code beautifier/formatter
MIT License
970 stars 91 forks source link

Removes line break before 'else if' after statement #426

Closed larsch closed 8 years ago

larsch commented 8 years ago
if (foo)
   bar();
else if (baz)
   done();

Running esformatter elseif.js:

if (foo)
   bar();else if (baz)
   done();
$ esformatter -v
esformatter v0.9.3
millermedeiros commented 8 years ago

this is handled by https://github.com/millermedeiros/esformatter/blob/master/lib/hooks/IfStatement.js - probably caused because of _br.limitBefore(elseKeyword, 'ElseIfStatement'); (I did not test it tho..)

miguelmota commented 8 years ago

removing the line _br.limitBefore(elseKeyword, 'ElseIfStatement'); solves the issue