-
Notifications
You must be signed in to change notification settings - Fork 47.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[BE] enable prettier for flow fixtures
- Loading branch information
Showing
15 changed files
with
46 additions
and
45 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
4 changes: 2 additions & 2 deletions
4
...plugin-react-compiler/src/__tests__/fixtures/compiler/component-declaration-basic.flow.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 |
---|---|---|
@@ -1,6 +1,6 @@ | ||
// @flow @compilationMode(infer) | ||
// @flow @compilationMode(infer) | ||
export default component Foo(bar: number) { | ||
return <Bar bar={bar} />; | ||
} | ||
|
||
function shouldNotCompile() {} | ||
function shouldNotCompile() {} |
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 |
---|---|---|
|
@@ -7,4 +7,4 @@ function Component(props) { | |
export const FIXTURE_ENTRYPOINT = { | ||
fn: Component, | ||
params: [{y: []}], | ||
}; | ||
}; |
4 changes: 2 additions & 2 deletions
4
...-react-compiler/src/__tests__/fixtures/compiler/error.component-syntax-ref-gating.flow.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 |
---|---|---|
@@ -1,4 +1,4 @@ | ||
// @flow @gating | ||
component Foo(ref: React.RefSetter<Controls>) { | ||
return <Bar ref={ref}/>; | ||
} | ||
return <Bar ref={ref} />; | ||
} |
2 changes: 1 addition & 1 deletion
2
...react-compiler/src/__tests__/fixtures/compiler/gating-with-hoisted-type-reference.flow.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
2 changes: 1 addition & 1 deletion
2
...abel-plugin-react-compiler/src/__tests__/fixtures/compiler/hook-declaration-basic.flow.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 |
---|---|---|
@@ -1,4 +1,4 @@ | ||
// @flow @compilationMode(infer) | ||
// @flow @compilationMode(infer) | ||
export default hook useFoo(bar: number) { | ||
return [bar]; | ||
} |
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 |
---|---|---|
|
@@ -14,4 +14,4 @@ export const FIXTURE_ENTRYPOINT = { | |
fn: Component, | ||
params: [{}], | ||
isComponent: false, | ||
} | ||
}; |
33 changes: 18 additions & 15 deletions
33
...ct-compiler/src/__tests__/fixtures/compiler/jsx-attribute-with-jsx-fragment-value.flow.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 |
---|---|---|
@@ -1,24 +1,27 @@ | ||
// @flow | ||
import { Stringify } from "shared-runtime"; | ||
import {Stringify} from 'shared-runtime'; | ||
|
||
function Component({items}) { | ||
// Per the spec, <Foo value=<>{...}</> /> is valid. | ||
// But many tools don't allow fragments as jsx attribute values, | ||
// so we ensure not to emit them wrapped in an expression container | ||
return items.length > 0 | ||
? ( | ||
<Foo value={ | ||
<>{items.map(item => <Stringify key={item.id} item={item} />)}</> | ||
}></Foo> | ||
) | ||
: null; | ||
// Per the spec, <Foo value=<>{...}</> /> is valid. | ||
// But many tools don't allow fragments as jsx attribute values, | ||
// so we ensure not to emit them wrapped in an expression container | ||
return items.length > 0 ? ( | ||
<Foo | ||
value={ | ||
<> | ||
{items.map(item => ( | ||
<Stringify key={item.id} item={item} /> | ||
))} | ||
</> | ||
}></Foo> | ||
) : null; | ||
} | ||
|
||
function Foo({value}) { | ||
return <div>{value}</div>; | ||
return <div>{value}</div>; | ||
} | ||
|
||
export const FIXTURE_ENTRYPOINT = { | ||
fn: Component, | ||
params: [{items: [{id: 1, name: 'One!'}]}], | ||
}; | ||
fn: Component, | ||
params: [{items: [{id: 1, name: 'One!'}]}], | ||
}; |
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
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 |
---|---|---|
|
@@ -8,4 +8,4 @@ function Component(props) { | |
export const FIXTURE_ENTRYPOINT = { | ||
fn: Component, | ||
params: [{name: 'Mofei'}], | ||
}; | ||
}; |
6 changes: 3 additions & 3 deletions
6
...mpiler/src/__tests__/fixtures/compiler/type-annotations/type-annotation-as-array_.flow.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 |
---|---|---|
@@ -1,13 +1,13 @@ | ||
// @flow @enableUseTypeAnnotations | ||
import { identity, makeArray } from "shared-runtime"; | ||
import {identity, makeArray} from 'shared-runtime'; | ||
|
||
function Component(props: { id: number }) { | ||
function Component(props: {id: number}) { | ||
const x = (makeArray(props.id): Array<number>); | ||
const y = x.at(0); | ||
return y; | ||
} | ||
|
||
export const FIXTURE_ENTRYPOINT = { | ||
fn: Component, | ||
params: [{ id: 42 }], | ||
params: [{id: 42}], | ||
}; |
2 changes: 1 addition & 1 deletion
2
...piler/src/__tests__/fixtures/compiler/type-annotations/type-annotation-as-number_.flow.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
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
14 changes: 7 additions & 7 deletions
14
.../babel-plugin-react-compiler/src/__tests__/fixtures/compiler/type-cast-expression.flow.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 |
---|---|---|
@@ -1,14 +1,14 @@ | ||
// @flow | ||
type Foo = {bar: string}; | ||
function Component(props) { | ||
const x = {bar: props.bar}; | ||
const y = (x: Foo); | ||
y.bar = 'hello'; | ||
const z = (y: Foo); | ||
return z; | ||
const x = {bar: props.bar}; | ||
const y = (x: Foo); | ||
y.bar = 'hello'; | ||
const z = (y: Foo); | ||
return z; | ||
} | ||
export const FIXTURE_ENTRYPOINT = { | ||
fn: Component, | ||
params: ["TodoAdd"], | ||
isComponent: "TodoAdd", | ||
params: ['TodoAdd'], | ||
isComponent: 'TodoAdd', | ||
}; |