2019-01-21 03:33:07 +03:00
<!--
Format:
2019-05-13 21:10:25 +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-05-13 21:10:25 +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-04-26 20:05:57 +03:00
2019-05-13 21:10:25 +03:00
### JavaScript: Don't break simple template literals ([#5979] by [@jwbay])
<!-- prettier - ignore -->
```js
// Input
console.log(chalk.white(`Covered Lines below threshold: ${coverageSettings.lines}%. Actual: ${coverageSummary.total.lines.pct}%`))
// Output (Prettier stable)
console.log(
chalk.white(
`Covered Lines below threshold: ${coverageSettings.lines}%. Actual: ${
coverageSummary.total.lines.pct
}%`
)
);
// Output (Prettier master)
console.log(
chalk.white(
`Covered Lines below threshold: ${coverageSettings.lines}%. Actual: ${coverageSummary.total.lines.pct}%`
)
);
```
### TypeScript: Keep trailing comma in tsx type parameters ([#6115] by [@sosukesuzuki])
Previously, a trailing comma after single type parameter in arrow function was cleaned up. The formatted result is valid as ts, but is invalid as tsx. Prettier master fixes this issue.
<!-- prettier - ignore -->
```tsx
// Input
type G< T > = any;
const myFunc = < T , > (arg1: G< T > ) => false;
// Output (Prettier stable)
type G< T > = any;
const myFunc = < T > (arg1: G< T > ) => false;
// Output (prettier master)
type G< T > = any;
const myFunc = < T , > (arg1: G< T > ) => false;
```