2019-01-21 03:33:07 +03:00
|
|
|
<!--
|
|
|
|
|
2019-05-13 21:12:30 +03:00
|
|
|
NOTE: Don't forget to add a link to your GitHub profile and the PR in the end of the file.
|
|
|
|
|
2019-01-21 03:33:07 +03:00
|
|
|
Format:
|
|
|
|
|
2019-06-06 23:42:52 +03:00
|
|
|
#### Category: Title ([#PR] by [@user])
|
2019-01-21 03:33:07 +03:00
|
|
|
|
2019-05-13 21:10:25 +03:00
|
|
|
Description
|
2019-01-21 03:33:07 +03:00
|
|
|
|
2019-05-13 21:10:25 +03:00
|
|
|
```
|
|
|
|
// Input
|
|
|
|
Code Sample
|
2019-01-21 03:33:07 +03:00
|
|
|
|
2019-05-13 21:10:25 +03:00
|
|
|
// Output (Prettier stable)
|
|
|
|
Code Sample
|
2019-01-21 03:33:07 +03:00
|
|
|
|
2019-05-13 21:10:25 +03:00
|
|
|
// Output (Prettier master)
|
|
|
|
Code Sample
|
|
|
|
```
|
2019-01-21 03:33:07 +03:00
|
|
|
|
|
|
|
Details:
|
|
|
|
|
|
|
|
Description: optional if the `Title` is enough to explain everything.
|
|
|
|
|
|
|
|
Examples:
|
|
|
|
|
2019-06-06 23:42:52 +03:00
|
|
|
#### TypeScript: Correctly handle `//` in TSX ([#5728] by [@JamesHenry])
|
2019-01-21 03:33:07 +03:00
|
|
|
|
2019-05-13 21:10:25 +03:00
|
|
|
Previously, putting `//` as a child of a JSX element in TypeScript led to an error
|
|
|
|
because it was interpreted as a comment. Prettier master fixes this issue.
|
2019-01-21 03:33:07 +03:00
|
|
|
|
2019-05-13 21:10:25 +03:00
|
|
|
<!-- prettier-ignore --\>
|
|
|
|
```js
|
|
|
|
// Input
|
|
|
|
const link = <a href="example.com">http://example.com</a>
|
2019-01-21 03:33:07 +03:00
|
|
|
|
2019-05-13 21:10:25 +03:00
|
|
|
// Output (Prettier stable)
|
|
|
|
// Error: Comment location overlaps with node location
|
2019-01-21 03:33:07 +03:00
|
|
|
|
2019-05-13 21:10:25 +03:00
|
|
|
// Output (Prettier master)
|
|
|
|
const link = <a href="example.com">http://example.com</a>;
|
|
|
|
```
|
2019-01-21 03:33:07 +03:00
|
|
|
|
|
|
|
-->
|
2019-06-10 15:30:54 +03:00
|
|
|
|
|
|
|
#### 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.
|
|
|
|
|
|
|
|
<!-- prettier-ignore -->
|
|
|
|
```ts
|
|
|
|
// 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>
|
|
|
|
);
|
|
|
|
```
|
|
|
|
|
2019-06-14 18:11:47 +03:00
|
|
|
### 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.
|
|
|
|
|
|
|
|
<!-- prettier-ignore -->
|
|
|
|
```hbs
|
|
|
|
// 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>
|
|
|
|
```
|
|
|
|
|
2019-06-19 15:53:27 +03:00
|
|
|
### Handlebars: Improve comment formatting ([#6206] by [@gavinjoyce])
|
|
|
|
|
|
|
|
Previously, Prettier would sometimes ignore whitespace when formatting comments.
|
|
|
|
|
|
|
|
<!-- prettier-ignore -->
|
|
|
|
```hbs
|
|
|
|
// 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>
|
|
|
|
```
|
|
|
|
|
2019-06-10 15:30:54 +03:00
|
|
|
[#6209]: https://github.com/prettier/prettier/pull/6209
|
2019-06-14 18:11:47 +03:00
|
|
|
[#6186]: https://github.com/prettier/prettier/pull/6186
|
2019-06-19 15:53:27 +03:00
|
|
|
[#6186]: https://github.com/prettier/prettier/pull/6206
|
2019-06-10 15:30:54 +03:00
|
|
|
[@duailibe]: https://github.com/duailibe
|
2019-06-14 18:11:47 +03:00
|
|
|
[@gavinjoyce]: https://github.com/gavinjoyce
|