-
-
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.
Co-authored-by: Georgii Dolzhykov <thorn.mailbox@gmail.com>
- Loading branch information
Showing
34 changed files
with
760 additions
and
573 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,3 @@ | ||
#### [BREAKING] Remove Flow syntax support from `babel` parser (#14314 by @fisker, @thorn0) | ||
|
||
For historical reasons, Prettier used to recognize Flow syntax in JS files when the `parser` option was set to `babel` even if the file didn't include the `@flow` pragma. This support was limited and bad for performance, so it has been removed in Prettier main. Prettier with the `babel` parser still automatically switches to the Flow syntax if it finds the `@flow` pragma or the file has the `.flow.js` extension. |
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
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
117 changes: 117 additions & 0 deletions
117
tests/format/flow/decorator/__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,117 @@ | ||
// Jest Snapshot v1, https://goo.gl/fbAQLP | ||
|
||
exports[`comments.js format 1`] = ` | ||
====================================options===================================== | ||
parsers: ["babel-flow"] | ||
printWidth: 80 | ||
| printWidth | ||
=====================================input====================================== | ||
class Something { | ||
@Annotateme() | ||
// comment | ||
static property: Array<string>; | ||
} | ||
=====================================output===================================== | ||
class Something { | ||
@Annotateme() | ||
// comment | ||
static property: Array<string>; | ||
} | ||
================================================================================ | ||
`; | ||
exports[`mobx.js format 1`] = ` | ||
====================================options===================================== | ||
parsers: ["babel-flow"] | ||
printWidth: 80 | ||
| printWidth | ||
=====================================input====================================== | ||
import {observable} from "mobx"; | ||
@observer class OrderLine { | ||
@observable price:number = 0; | ||
@observable amount:number = 1; | ||
constructor(price) { | ||
this.price = price; | ||
} | ||
@computed get total() { | ||
return this.price * this.amount; | ||
} | ||
@action.bound setPrice(price) { | ||
this.price = price; | ||
} | ||
@computed | ||
get total() { | ||
return this.price * this.amount; | ||
} | ||
@action.bound | ||
setPrice(price) { | ||
this.price = price; | ||
} | ||
@computed @computed @computed @computed @computed @computed @computed get total() { | ||
return this.price * this.amount; | ||
} | ||
@action handleDecrease = (event: React.ChangeEvent<HTMLInputElement>) => this.count--; | ||
@action handleSomething = (event: React.ChangeEvent<HTMLInputElement>) => doSomething(); | ||
} | ||
=====================================output===================================== | ||
import { observable } from "mobx"; | ||
@observer | ||
class OrderLine { | ||
@observable price: number = 0; | ||
@observable amount: number = 1; | ||
constructor(price) { | ||
this.price = price; | ||
} | ||
@computed get total() { | ||
return this.price * this.amount; | ||
} | ||
@action.bound setPrice(price) { | ||
this.price = price; | ||
} | ||
@computed | ||
get total() { | ||
return this.price * this.amount; | ||
} | ||
@action.bound | ||
setPrice(price) { | ||
this.price = price; | ||
} | ||
@computed | ||
@computed | ||
@computed | ||
@computed | ||
@computed | ||
@computed | ||
@computed | ||
get total() { | ||
return this.price * this.amount; | ||
} | ||
@action handleDecrease = (event: React.ChangeEvent<HTMLInputElement>) => | ||
this.count--; | ||
@action handleSomething = (event: React.ChangeEvent<HTMLInputElement>) => | ||
doSomething(); | ||
} | ||
================================================================================ | ||
`; |
File renamed without changes.
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,2 @@ | ||
// TODO: Run tests with `flow` parser https://github.com/facebook/flow/issues/9003 | ||
run_spec(import.meta, ["babel-flow"]); |
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,36 @@ | ||
import {observable} from "mobx"; | ||
|
||
@observer class OrderLine { | ||
@observable price:number = 0; | ||
@observable amount:number = 1; | ||
|
||
constructor(price) { | ||
this.price = price; | ||
} | ||
|
||
@computed get total() { | ||
return this.price * this.amount; | ||
} | ||
|
||
@action.bound setPrice(price) { | ||
this.price = price; | ||
} | ||
|
||
@computed | ||
get total() { | ||
return this.price * this.amount; | ||
} | ||
|
||
@action.bound | ||
setPrice(price) { | ||
this.price = price; | ||
} | ||
|
||
@computed @computed @computed @computed @computed @computed @computed get total() { | ||
return this.price * this.amount; | ||
} | ||
|
||
@action handleDecrease = (event: React.ChangeEvent<HTMLInputElement>) => this.count--; | ||
|
||
@action handleSomething = (event: React.ChangeEvent<HTMLInputElement>) => doSomething(); | ||
} |
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
Oops, something went wrong.