Re:Prettier 2.0 – Opinionated JavaScript formatter
by simonw on Sunday March 22, 2020 @07:41PM
(#22659872)
I'm still really hoping for Jinja2/Django template support: https://github.com/prettier/prettier/issues/5754 / https://github.com/prettier/prettier/issues/5581
[ Parent
| on HN ]
Re:Prettier 2.0 – Opinionated JavaScript formatter
by j-f1 on Sunday March 22, 2020 @08:05PM
(#22660015)
This is actually quite challenging because the template language allows you to insert template tags into any location in the template file, and while people usually put them in reasonable places, there’s no guarantee. For example, someone could do a thing like `{{ less_than }}div class="foo">abc</div>` and that would be totally valid but a nightmare to parse.
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
by gkoberger on Sunday March 22, 2020 @07:52PM
(#22659941)
Prettier was originally created by James Long, who also created Nunchucks (which is the Node port of Jinja2, since we were all familiar with Jinja2 at Mozilla). I don't really have a point since he's not involved in either anymore; just thought it was interesting!