News for hackers. Stuff that matters.
Re:Prettier 2.0 – Opinionated JavaScript formatter by Groxx on Sunday March 22, 2020 @06:39PM (#22659438)
>Before version 2.0, Prettier was avoiding trailing commas by default where possible. This made the resulting JavaScript compatible with now very old environments such as IE8, but implied some missed opportunities.

Seems like a pretty good reason to change that one at least, since it seems to imply they've wanted trailing commas but didn't do it for compatibility reasons.

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.
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.
Re:Prettier 2.0 – Opinionated JavaScript formatter by tobr on Monday March 23, 2020 @03:56AM (#22662003)
That’s not going to work with object keys anyway, which need to be quoted in JSON. You can’t even configure Prettier to do that unless your keys are invalid JS identifiers.