-
-
Notifications
You must be signed in to change notification settings - Fork 4.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Support Flow Enums with unknown members (#9432)
- Loading branch information
Showing
6 changed files
with
97 additions
and
4 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,22 @@ | ||
#### Flow Enums with unknown members (#9432 by @gkz) | ||
|
||
Previously, was not supported. Now, the following is formatted: | ||
|
||
<!-- prettier-ignore --> | ||
```jsx | ||
// Input | ||
enum E { | ||
A, | ||
B, | ||
... | ||
} | ||
|
||
// Prettier stable: parse error | ||
|
||
// Prettier master | ||
enum E { | ||
A, | ||
B, | ||
... | ||
} | ||
``` |
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
51 changes: 51 additions & 0 deletions
51
tests/flow/enums-unknown-members/__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,51 @@ | ||
// Jest Snapshot v1, https://goo.gl/fbAQLP | ||
|
||
exports[`enum-unknown-members.js - {"trailingComma":"all"} format 1`] = ` | ||
====================================options===================================== | ||
parsers: ["flow"] | ||
printWidth: 80 | ||
trailingComma: "all" | ||
| printWidth | ||
=====================================input====================================== | ||
// @flow | ||
enum E { | ||
A, | ||
B, | ||
... | ||
} | ||
=====================================output===================================== | ||
// @flow | ||
enum E { | ||
A, | ||
B, | ||
... | ||
} | ||
================================================================================ | ||
`; | ||
|
||
exports[`enum-unknown-members-empty.js - {"trailingComma":"all"} format 1`] = ` | ||
====================================options===================================== | ||
parsers: ["flow"] | ||
printWidth: 80 | ||
trailingComma: "all" | ||
| printWidth | ||
=====================================input====================================== | ||
// @flow | ||
enum E { | ||
... | ||
} | ||
=====================================output===================================== | ||
// @flow | ||
enum E { | ||
... | ||
} | ||
================================================================================ | ||
`; |
5 changes: 5 additions & 0 deletions
5
tests/flow/enums-unknown-members/enum-unknown-members-empty.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,5 @@ | ||
// @flow | ||
|
||
enum E { | ||
... | ||
} |
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,7 @@ | ||
// @flow | ||
|
||
enum E { | ||
A, | ||
B, | ||
... | ||
} |
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 @@ | ||
run_spec(__dirname, ["flow"], { trailingComma: "all" }); |