Closed uloco closed 8 years ago
I set the property SingleVariableDeclaration
to 1
and now it works for me. Is this intended behaviour? What is the purpose of this property?
Another problem with this option, now other assignments like this one fail:
Input (and expected behaviour would be not touching this one)
var foo = {
a: 'a',
b: 'b'
}
Output
var foo = {
a: 'a',
b: 'b'
}
this is supposed to work fine with the default settings, see #212 and also https://github.com/millermedeiros/esformatter/blob/master/test/compare/default/binary_expression-out.js - maybe something else around it (before or after) is removing the indent.
Try it here: http://lloiser.github.io/esformatter-visualize/ It does strip the indent away, when preset is set to default. There is nothing left I can try...
esformatter-visualize is using a really old version of esformatter (0.4.3) - this should definitely work in the latest version (0.9.2).
I never really got the time to create a proper example page (like esformatter-visualize) and keep it in sync with latest esformatter version..
I tried it again and you are right, multiline String
assignments work fine.
The problem occurs with multiline variable
declarations, starting on the new line with a variable, like so:
Input
var foo = bar + baz +
barbaz;
Output
var foo = bar + baz +
barbaz;
If my line is longer than 100 chars, I wrap the code manually like this:
This should stay as it is, but esformatter strips the indent like the following:
Even when I place the plus sign on the second line, it won't be indented.
My .esformatter file: