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
Hello, it would be great if we could have more control over plain object formatting.
Right now, any object, even the ones with only one parameter gets expanded. For example:
varobject={id: 10};
Ends up transformed into:
varobject={id: 10};
I personally don't think expanding every object is a good thing, not every object is going to be complex, specially plain javascript objects, so this formatting rule often becomes a minor annoyance that adds more lines to your source code.
Additionally (but maybe out of the scope of this feature request), this causes problems with a few javascript features of ES6 ( #511, #382 ), making the code seem ugly.
The internet is full of examples where plain objects are used inline, like this snippet from Node's about page:
I think most of these issues could be solved if we had ways to tell jsbeautifier what to do about small plain objects ( maybe {name:'hello'} -> { name: 'hello' }) instead of using the same behavior of function blocks.
The text was updated successfully, but these errors were encountered:
You are not alone in wanting this. See #315
I just updated that issue's title to include the word "inline".
But thank you for taking the time to submit a full and well-reasoned feature request. 😄
Hello, it would be great if we could have more control over plain object formatting.
Right now, any object, even the ones with only one parameter gets expanded. For example:
Ends up transformed into:
I personally don't think expanding every object is a good thing, not every object is going to be complex, specially plain javascript objects, so this formatting rule often becomes a minor annoyance that adds more lines to your source code.
Additionally (but maybe out of the scope of this feature request), this causes problems with a few javascript features of ES6 ( #511, #382 ), making the code seem ugly.
The internet is full of examples where plain objects are used inline, like this snippet from Node's about page:
I think most of these issues could be solved if we had ways to tell jsbeautifier what to do about small plain objects ( maybe
{name:'hello'}
->{ name: 'hello' }
) instead of using the same behavior of function blocks.The text was updated successfully, but these errors were encountered: