mirror of
https://github.com/facebook/react.git
synced 2025-11-01 09:12:30 +00:00
Fix breakages and add fixture entrypoint
This commit is contained in:
@@ -13,6 +13,7 @@ import {
|
||||
CompilerSuggestionOperation,
|
||||
ErrorSeverity,
|
||||
} from "../CompilerError";
|
||||
import { assertExhaustive } from "../Utils/utils";
|
||||
|
||||
/**
|
||||
* Captures the start and end range of a pair of eslint-disable ... eslint-enable comments. In the
|
||||
@@ -170,6 +171,12 @@ export function suppressionsToCompilerError(
|
||||
reason =
|
||||
"React Forget has bailed out of optimizing this component as one or more React rule violations were reported by Flow";
|
||||
suggestion = "Remove the Flow suppression and address the React error";
|
||||
break;
|
||||
default:
|
||||
assertExhaustive(
|
||||
suppressionRange.source,
|
||||
"Unhandled suppression source"
|
||||
);
|
||||
}
|
||||
error.pushErrorDetail(
|
||||
new CompilerErrorDetail({
|
||||
|
||||
+3
-3
@@ -5,9 +5,9 @@
|
||||
// @enableFlowSuppressions
|
||||
|
||||
function Foo(props) {
|
||||
// $FlowFixMe[react-rule-hook]
|
||||
useX();
|
||||
return null;
|
||||
// $FlowFixMe[react-rule-hook]
|
||||
useX();
|
||||
return null;
|
||||
}
|
||||
|
||||
```
|
||||
|
||||
+24
-4
@@ -5,12 +5,22 @@
|
||||
// @enableFlowSuppressions
|
||||
|
||||
function Foo(props) {
|
||||
// $FlowFixMe[incompatible-type]
|
||||
useX();
|
||||
const x = new Foo(...props.foo, null, ...[props.bar]);
|
||||
return x;
|
||||
// $FlowFixMe[incompatible-type]
|
||||
useX();
|
||||
const x = new Foo(...props.foo, null, ...[props.bar]);
|
||||
return x;
|
||||
}
|
||||
|
||||
export const FIXTURE_ENTRYPOINT = {
|
||||
fn: Foo,
|
||||
params: [
|
||||
{
|
||||
foo: [1],
|
||||
bar: 2,
|
||||
},
|
||||
],
|
||||
};
|
||||
|
||||
```
|
||||
|
||||
## Code
|
||||
@@ -35,5 +45,15 @@ function Foo(props) {
|
||||
return x;
|
||||
}
|
||||
|
||||
export const FIXTURE_ENTRYPOINT = {
|
||||
fn: Foo,
|
||||
params: [
|
||||
{
|
||||
foo: [1],
|
||||
bar: 2,
|
||||
},
|
||||
],
|
||||
};
|
||||
|
||||
```
|
||||
|
||||
+10
@@ -6,3 +6,13 @@ function Foo(props) {
|
||||
const x = new Foo(...props.foo, null, ...[props.bar]);
|
||||
return x;
|
||||
}
|
||||
|
||||
export const FIXTURE_ENTRYPOINT = {
|
||||
fn: Foo,
|
||||
params: [
|
||||
{
|
||||
foo: [1],
|
||||
bar: 2,
|
||||
},
|
||||
],
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user