silx-kit / h5web

React components for data visualization and exploration
https://h5web.panosc.eu/
MIT License
183 stars 18 forks source link

Check out Prettier's experimental ternary formatting #1548

Closed axelboc closed 8 months ago

axelboc commented 8 months ago

Prettier is asking for feedback on its ternary formatting experimentation. All the context here: https://prettier.io/blog/2023/11/13/curious-ternaries

I don't intend to merge this. Just thought you might be interested in giving your own input @loichuder.

axelboc commented 8 months ago

I quite like the fact that the question mark is closer to the condition; it makes a lot of sense. I also like the indentation of the then/else clauses.

Only downside for me is that the condition tends to move to (or stay on) a new line more often than it needs to. So it's not really a problem with the new ternary syntax, but more with how ternaries integrate with the code that surrounds them. Like here and the one just after: https://github.com/silx-kit/h5web/pull/1548/files?diff=split&w=0#diff-0217bbf7bde59b0a50e0c55dca473df1dff3275ed66a4480fb69e34f596b665eR70-R73