Formatter: Preserve line breaks in destructuring assignment #2026
John-Paul-R
started this conversation in
Ideas
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Does Biome have any way to preserve line breaks in destructuring assignment? (examples below)
This problem was actually originally described in prettier/prettier#2550. The original prettier issue got a lot of traction (their 7th-most commented issue), so I suspect this is something people are interested in. Just in my personal experience, the inability to preserve this type of formatting is causing quite a bit of strain among my teams as I try to move us over to Biome.
I wonder if this is something that would be deserving of a config option?
You can also view the below examples in the the Biome Playground.
I'm particularly interested in the React hooks case, in which a destructuring assignment like
Input
gets reflowed to
Biome Output
It is worth noting that the moment you rebind a destructured key, the formatting that I would expect occurs:
Input
Biome Output
If "preserving line breaks" is not possible (e.g. if the system is entirely input-whitespace agnostic), I'd like an option that allows specifying that the
=
and the target being destructured cannot be separated by a newline. For example:Beta Was this translation helpful? Give feedback.
All reactions