I'm still really hoping for Jinja2/Django template support: https://github.com/prettier/prettier/issues/5754 / https://github.com/prettier/prettier/issues/5581
Prettier 2.0 – Opinionated JavaScript formatter
61–70 of 91 posts
Re: Prettier 2.0 – Opinionated JavaScript formatter
#62I'm still really hoping for Jinja2/Django template support: https://github.com/prettier/prettier/issues/5754 / https://github.com/prettier/prettier/issues/5581
That’s different from a more structured template-style language like JSX, where there are only a few valid places to embed JS expressions so it isn’t too challenging to make them all look good.
Re: Prettier 2.0 – Opinionated JavaScript formatter
#63> Improved method chain breaking heuristic This is great! When I'm scripting in Node.js I tend to prefer either of these two styles, with the second one being normally a cleaned-up version of the first one: const res = base .map(a => a.b) .filter(b => /abc/.test(b)) .join('\n'); const res = base.map(extractB).filter(isAbc).join('\n'); The second one would be split into different lines with Prettier 1.x, which was ann…
I prefer Gofmt's strategy/philosophy, which is to mostly let the developer control breaking, and only format around it. Gofmt will format everthing strictly, but will leave decisions about "layout" to you. This is a wiser design because the formatter can't know what the best layout is, and a formatter really ought to only format something where there's is an unequivocally, universally correct way of formatting someth…
Re: Prettier 2.0 – Opinionated JavaScript formatter
#64Earlier quoted context omitted.
Configure your git blame to ignore cleanup changes. https://www.moxio.com/blog/43/ignoring-bulk-change-commits-w...
This changes everything. Thank you!!!
Re: Prettier 2.0 – Opinionated JavaScript formatter
#65A bit irritating that formatting zealots are changing the defaults. What can possibly drive the decision to change whatever option it is they landed on and deployed? It's contrary to everything they claimed Prettier was about: for better or worse, we have decided on X so we can all move on to more important issues. I feel like the cost of changing defaults is wildly underestimated because it's decided on by people wh…
> 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
#66Earlier quoted context omitted.
Run it in Docker. https://jonathan.bergknoff.com/journal/run-more-stuff-in-doc...
Whoah, aliasing shell commands to Docker one-offs for ethereal runs. Super useful, never thought of that. This comment was a hidden gem in this thread, I've bookmarked that blog post.
Re: Prettier 2.0 – Opinionated JavaScript formatter
#67A bit irritating that formatting zealots are changing the defaults. What can possibly drive the decision to change whatever option it is they landed on and deployed? It's contrary to everything they claimed Prettier was about: for better or worse, we have decided on X so we can all move on to more important issues. I feel like the cost of changing defaults is wildly underestimated because it's decided on by people wh…
Is the cost really that high? For the vast majority of projects, all developers will need to do is run "yarn prettier". We can't expect everything to be perfect on day one, nor should we be stuck with the poor choices we made when starting a project. Maintainers should be allowed to change their mind after careful consideration and community consensus.
Re: Prettier 2.0 – Opinionated JavaScript formatter
#68Earlier quoted context omitted.
I wouldn't call change of `arrowParens` to `always` as "incredibly sane". This is just a differt opinion about what is "better". I have different.
I like it, because it's consistent. If you remove or add a parameter to a function, you have parenthesis either way and don't have to think about it.
Re: Prettier 2.0 – Opinionated JavaScript formatter
#69> Improved method chain breaking heuristic This is great! When I'm scripting in Node.js I tend to prefer either of these two styles, with the second one being normally a cleaned-up version of the first one: const res = base .map(a => a.b) .filter(b => /abc/.test(b)) .join('\n'); const res = base.map(extractB).filter(isAbc).join('\n'); The second one would be split into different lines with Prettier 1.x, which was ann…
I prefer Gofmt's strategy/philosophy, which is to mostly let the developer control breaking, and only format around it. Gofmt will format everthing strictly, but will leave decisions about "layout" to you. This is a wiser design because the formatter can't know what the best layout is, and a formatter really ought to only format something where there's is an unequivocally, universally correct way of formatting someth…
//prettier-ignore
https://prettier.io/docs/en/ignore.html#javascriptRe: Prettier 2.0 – Opinionated JavaScript formatter
#70Earlier quoted context omitted.
> 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.
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.