You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
which is not what one would expect rewriting the code. That's a small, innocent literal array. And yet I see no way to make escodegen output such lists as [1, 2]. Could you add it as a default behaviour and an option, please?
The text was updated successfully, but these errors were encountered:
Yes, this can be done by determining the formatting based on the size/content of the generated source text for each element. Should be pretty easy. PRs welcome.
+1
In the ArrayExpression case,
changing from multiline = expr.elements.length > 1;
to multiline = expr.elements.length > 10 && expr.elements[0].type !== Syntax.Literal;
should make literals a bit prettier. Literal arrays are much more likely to be homogeneous than arrays of reference types; if the first element is a literal, the rest are likely to follow. The 10 is completely arbitrary though; could be an option.
This is quite minor though. Should I open a PR?
get rewritten into
which is not what one would expect rewriting the code. That's a small, innocent literal array. And yet I see no way to make
escodegen
output such lists as[1, 2]
. Could you add it as a default behaviour and an option, please?The text was updated successfully, but these errors were encountered: