3.7 KiB
3.7 KiB
TypeScript: Print comment following a JSX element with generic (#6209 by @duailibe)
Previous versions would not print this comment, this has been fixed in this version.
// Input
const comp = (
<Foo<number>
// This comment goes missing
value={4}
>
Test
</Foo>
);
// Output (Prettier stable)
const comp = <Foo<number> value={4}>Test</Foo>;
// Output (Prettier master)
const comp = (
<Foo<number>
// This comment goes missing
value={4}
>
Test
</Foo>
);
Handlebars: Avoid adding unwanted line breaks between text and mustaches (#6186 by @gavinjoyce)
Previously, Prettier added line breaks between text and mustaches which resulted in unwanted whitespace in rendered output.
// Input
<p>Your username is @{{name}}</p>
<p>Hi {{firstName}} {{lastName}}</p>
// Output (Prettier stable)
<p>
Your username is @
{{name}}
</p>
<p>
Hi
{{firstName}}
{{lastName}}
</p>
// Output (Prettier master)
<p>
Your username is @{{name}}
</p>
<p>
Hi {{firstName}} {{lastName}}
</p>
Handlebars: Improve comment formatting (#6206 by @gavinjoyce)
Previously, Prettier would sometimes ignore whitespace when formatting comments.
// Input
<div>
{{! Foo }}
{{#if @foo}}
Foo
{{/if}}
{{! Bar }}
{{#if @bar}}
Bar
{{/if}}
</div>
// Output (Prettier stable)
<div>
{{! Foo }}
{{#if @foo}}
Foo
{{/if}}{{! Bar }}{{#if @bar}}
Bar
{{/if}}
</div>
// Output (Prettier master)
<div>
{{! Foo }}
{{#if @foo}}
Foo
{{/if}}
{{! Bar }}
{{#if @bar}}
Bar
{{/if}}
</div>
JavaScript: Keep unary expressions parentheses with comments (#6217 by @sosukesuzuki)
Previously, Prettier removes parentheses enclose unary expressions. This change modify to keep it when the expression has comments.
// Input
!(
/* foo */
foo
);
!(
foo // foo
);
// Output (Prettier stable)
!/* foo */
foo;
!foo; // foo
// Output (Prettier master)
!(/* foo */ foo);
!(
foo // foo
);
Handlebars: Improve comment formatting (#6234 by @gavinjoyce)
Previously, Prettier would incorrectly decode HTML entiites.
// Input
<p>
Some escaped characters: < > &
</p>
// Output (Prettier stable)
<p>
Some escaped characters: < > &
</p>
// Output (Prettier master)
<p>
Some escaped characters: < > &
</p>