Fix breakages and add fixture entrypoint

This commit is contained in:
Mike Vitousek
2024-02-09 15:00:05 -08:00
parent 48024b76bb
commit 8c7685ed40
4 changed files with 44 additions and 7 deletions
@@ -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({
@@ -5,9 +5,9 @@
// @enableFlowSuppressions
function Foo(props) {
// $FlowFixMe[react-rule-hook]
useX();
return null;
// $FlowFixMe[react-rule-hook]
useX();
return null;
}
```
@@ -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,
},
],
};
```
@@ -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,
},
],
};