Re:Prettier 2.0 – Opinionated JavaScript formatter
by davidmurdoch on Sunday March 22, 2020 @09:39PM
(#22660496)
I find trailing commas annoying because every once in a while I need to copy some object to use as JSON and... it doesn't work since JSON doesn't support trailing commas.
[ Parent
| on HN ]
Re:Prettier 2.0 – Opinionated JavaScript formatter
by j-f1 on Monday March 23, 2020 @08:13AM
(#22663250)
Fortunately, if you use Prettier to format your JSON files too, it’ll quote unquoted properties and remove trailing commas:
https://prettier.io/playground/#N4Igxg9gdgLgprEAuEwA6UAEmDOE...
Re:Prettier 2.0 – Opinionated JavaScript formatter
by amarshall on Monday March 23, 2020 @12:11AM
(#22661193)
To be fair, that's more of a JSON problem than a JS one. FWIW, JSON is also missing quote-less keys, object literal shorthand, non-decimal numbers, values that are non-simple literals, and probably a bunch else from JS object syntax.
Just `JSON.stringify` whatever object it is instead.
Re:Prettier 2.0 – Opinionated JavaScript formatter
by Groxx on Monday March 23, 2020 @12:45AM
(#22661336)
No comments either, which is one major reason I strongly oppose JSON as a config-file language :|
Re:Prettier 2.0 – Opinionated JavaScript formatter
by davidmurdoch on Sunday March 22, 2020 @11:03PM
(#22660880)
Why the down vote? Prettier calls itself "an opinionated JavaScript formatter". It _had_ an opinion that I agreed with, and now it doesn't. I just offered a perspective on why I don't agree.