dprint-plugin-typescript
dprint-plugin-typescript copied to clipboard
Multi-line JSX does not handle whitespace correctly with preferSingleLine
Describe the bug
dprint-plugin-typescript version: 0.80.2
When preferSingleLine
is enabled, dprint incorrectly collapses multi-line JSX, as there is no space in the rendered output of the original code (whitespace is collapsed), but there is a space in the formatted code.
Prettier doesn't collapse it at all, which makes me tend to believe that dealing with it is a PITA and it's probably better from a correctness perspective to just leave it alone and not collapse it.
Input Code
function Component({a, b}) {
return (
<Foo>
{a}
{b}
</Foo>
);
}
Expected Output
function Component({a, b}) {
return (
<Foo>
{a}
{b}
</Foo>
);
}
Actual Output
function Component({ a, b }) {
return <Foo>{a} {b}</Foo>;
}