[JSX] When breaking lines and removing significant whitespace, add {' '}
#201
Labels
locked-due-to-inactivity
Please open a new issue and fill out the template instead of commenting.
type:bug
Issues identifying ugly output, or a defect in the program
(c/p from #73 (comment))
When
prettier
breaks two previously adjacent text||jsx nodes onto separate lines, and those two nodes had been separated by whitespace,{' '}
(or equivalent) must be inserted.Eg, if prettier split this up...
into this...
(which it currently wouldn't, because those lines are short – but pretend they're long 😉)
then the compiled output would change from
to
generating "helloworldfoo" instead of "hello world foo" to the user. Oops!
That's not just a little "oops" – if someone is trying to adopt
prettier
in a large codebase, they're going to have to quickly skim a large number of minor changes, run their tests, and cross their fingers. This kind of thing is hard to catch, almost certainly not tested by unit tests, and results in an embarrassing visual bug being shipped to users.I have a fix mostly-written for this.
The text was updated successfully, but these errors were encountered: