forked from prettier/prettier
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix formatting of empty type parameters (prettier#14073)
- Loading branch information
Showing
5 changed files
with
71 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
#### Fix formatting of empty type parameters (#14073 by @fisker) | ||
|
||
<!-- prettier-ignore --> | ||
```jsx | ||
// Input | ||
const foo: bar</* comment */> = () => baz; | ||
|
||
// Prettier stable | ||
Error: Comment "comment" was not printed. Please report this error! | ||
|
||
// Prettier main | ||
const foo: bar</* comment */> = () => baz; | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
35 changes: 35 additions & 0 deletions
35
...pescript/typeparams/empty-parameters-with-arrow-function/__snapshots__/jsfmt.spec.js.snap
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
// Jest Snapshot v1, https://goo.gl/fbAQLP | ||
|
||
exports[`issue-13817.ts - {"arrowParens":"avoid","trailingComma":"all"} format 1`] = ` | ||
====================================options===================================== | ||
arrowParens: "avoid" | ||
parsers: ["typescript", "flow", "babel-flow"] | ||
printWidth: 80 | ||
trailingComma: "all" | ||
| printWidth | ||
=====================================input====================================== | ||
const xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx: xxxxxxxxxxxxxxxxxxxxxx<> = | ||
arg => null; | ||
const xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx: xxxxxxxxxxxxxxxxxxxxxx</* comment */> = | ||
arg => null; | ||
const xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx: xxxxxxxxxxxxxxxxxxxxxx< | ||
// comment | ||
> = | ||
arg => null; | ||
=====================================output===================================== | ||
const xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx: xxxxxxxxxxxxxxxxxxxxxx<> = | ||
arg => null; | ||
const xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx: xxxxxxxxxxxxxxxxxxxxxx</* comment */> = | ||
arg => null; | ||
const xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx: xxxxxxxxxxxxxxxxxxxxxx< | ||
// comment | ||
> = arg => null; | ||
================================================================================ | ||
`; |
11 changes: 11 additions & 0 deletions
11
tests/format/typescript/typeparams/empty-parameters-with-arrow-function/issue-13817.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
const xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx: xxxxxxxxxxxxxxxxxxxxxx<> = | ||
arg => null; | ||
|
||
const xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx: xxxxxxxxxxxxxxxxxxxxxx</* comment */> = | ||
arg => null; | ||
|
||
|
||
const xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx: xxxxxxxxxxxxxxxxxxxxxx< | ||
// comment | ||
> = | ||
arg => null; |
6 changes: 6 additions & 0 deletions
6
tests/format/typescript/typeparams/empty-parameters-with-arrow-function/jsfmt.spec.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
run_spec( | ||
__dirname, | ||
["typescript", "flow", "babel-flow"], | ||
// #13817 require those options to reproduce | ||
{ arrowParens: "avoid", trailingComma: "all" } | ||
); |