mirror of
https://github.com/facebook/react.git
synced 2025-11-01 09:12:30 +00:00
[dx] Update suppression error messages
ghstack-source-id: 0c362a349de86a07b4e9e381b942939ce4a24e69 Pull Request resolved: https://github.com/facebook/react-forget/pull/2859
This commit is contained in:
@@ -164,12 +164,13 @@ export function suppressionsToCompilerError(
|
||||
switch (suppressionRange.source) {
|
||||
case "Eslint":
|
||||
reason =
|
||||
"React Compiler has bailed out of optimizing this component as one or more React eslint rules were disabled";
|
||||
suggestion = "Remove the eslint disable";
|
||||
"React Compiler has skipped optimizing this component because one or more React ESLint rules were disabled";
|
||||
suggestion =
|
||||
"Remove the ESLint suppression and address the React error";
|
||||
break;
|
||||
case "Flow":
|
||||
reason =
|
||||
"React Compiler has bailed out of optimizing this component as one or more React rule violations were reported by Flow";
|
||||
"React Compiler has skipped optimizing this component because one or more React rule violations were reported by Flow";
|
||||
suggestion = "Remove the Flow suppression and address the React error";
|
||||
break;
|
||||
default:
|
||||
@@ -180,7 +181,7 @@ export function suppressionsToCompilerError(
|
||||
}
|
||||
error.pushErrorDetail(
|
||||
new CompilerErrorDetail({
|
||||
reason: `${reason}. React Compiler only works when your components follow all the rules of React, disabling them may result in undefined behavior`,
|
||||
reason: `${reason}. React Compiler only works when your components follow all the rules of React, disabling them may result in unexpected or incorrect behavior`,
|
||||
description: suppressionRange.disableComment.value.trim(),
|
||||
severity: ErrorSeverity.InvalidReact,
|
||||
loc: suppressionRange.disableComment.loc ?? null,
|
||||
|
||||
+1
-1
@@ -19,7 +19,7 @@ function Foo(props) {
|
||||
2 |
|
||||
3 | function Foo(props) {
|
||||
> 4 | // $FlowFixMe[react-rule-hook]
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ InvalidReact: React Compiler has bailed out of optimizing this component as one or more React rule violations were reported by Flow. React Compiler only works when your components follow all the rules of React, disabling them may result in undefined behavior. $FlowFixMe[react-rule-hook] (4:4)
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ InvalidReact: React Compiler has skipped optimizing this component because one or more React rule violations were reported by Flow. React Compiler only works when your components follow all the rules of React, disabling them may result in unexpected or incorrect behavior. $FlowFixMe[react-rule-hook] (4:4)
|
||||
5 | useX();
|
||||
6 | return null;
|
||||
7 | }
|
||||
|
||||
+2
-2
@@ -22,9 +22,9 @@ function lowercasecomponent() {
|
||||
1 | // @eslintSuppressionRules(my-app/react-rule)
|
||||
2 |
|
||||
> 3 | /* eslint-disable my-app/react-rule */
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ InvalidReact: React Compiler has bailed out of optimizing this component as one or more React eslint rules were disabled. React Compiler only works when your components follow all the rules of React, disabling them may result in undefined behavior. eslint-disable my-app/react-rule (3:3)
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ InvalidReact: React Compiler has skipped optimizing this component because one or more React ESLint rules were disabled. React Compiler only works when your components follow all the rules of React, disabling them may result in unexpected or incorrect behavior. eslint-disable my-app/react-rule (3:3)
|
||||
|
||||
InvalidReact: React Compiler has bailed out of optimizing this component as one or more React eslint rules were disabled. React Compiler only works when your components follow all the rules of React, disabling them may result in undefined behavior. eslint-disable-next-line my-app/react-rule (7:7)
|
||||
InvalidReact: React Compiler has skipped optimizing this component because one or more React ESLint rules were disabled. React Compiler only works when your components follow all the rules of React, disabling them may result in unexpected or incorrect behavior. eslint-disable-next-line my-app/react-rule (7:7)
|
||||
4 | function lowercasecomponent() {
|
||||
5 | "use forget";
|
||||
6 | const x = [];
|
||||
|
||||
+2
-2
@@ -18,9 +18,9 @@ function lowercasecomponent() {
|
||||
|
||||
```
|
||||
> 1 | /* eslint-disable react-hooks/rules-of-hooks */
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ InvalidReact: React Compiler has bailed out of optimizing this component as one or more React eslint rules were disabled. React Compiler only works when your components follow all the rules of React, disabling them may result in undefined behavior. eslint-disable react-hooks/rules-of-hooks (1:1)
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ InvalidReact: React Compiler has skipped optimizing this component because one or more React ESLint rules were disabled. React Compiler only works when your components follow all the rules of React, disabling them may result in unexpected or incorrect behavior. eslint-disable react-hooks/rules-of-hooks (1:1)
|
||||
|
||||
InvalidReact: React Compiler has bailed out of optimizing this component as one or more React eslint rules were disabled. React Compiler only works when your components follow all the rules of React, disabling them may result in undefined behavior. eslint-disable-next-line react-hooks/rules-of-hooks (5:5)
|
||||
InvalidReact: React Compiler has skipped optimizing this component because one or more React ESLint rules were disabled. React Compiler only works when your components follow all the rules of React, disabling them may result in unexpected or incorrect behavior. eslint-disable-next-line react-hooks/rules-of-hooks (5:5)
|
||||
2 | function lowercasecomponent() {
|
||||
3 | "use forget";
|
||||
4 | const x = [];
|
||||
|
||||
+2
-2
@@ -38,9 +38,9 @@ function CrimesAgainstReact() {
|
||||
```
|
||||
1 | // Note: Everything below this is sketchy
|
||||
> 2 | /* eslint-disable react-hooks/rules-of-hooks */
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ InvalidReact: React Compiler has bailed out of optimizing this component as one or more React eslint rules were disabled. React Compiler only works when your components follow all the rules of React, disabling them may result in undefined behavior. eslint-disable react-hooks/rules-of-hooks (2:2)
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ InvalidReact: React Compiler has skipped optimizing this component because one or more React ESLint rules were disabled. React Compiler only works when your components follow all the rules of React, disabling them may result in unexpected or incorrect behavior. eslint-disable react-hooks/rules-of-hooks (2:2)
|
||||
|
||||
InvalidReact: React Compiler has bailed out of optimizing this component as one or more React eslint rules were disabled. React Compiler only works when your components follow all the rules of React, disabling them may result in undefined behavior. eslint-disable-next-line react-hooks/rules-of-hooks (25:25)
|
||||
InvalidReact: React Compiler has skipped optimizing this component because one or more React ESLint rules were disabled. React Compiler only works when your components follow all the rules of React, disabling them may result in unexpected or incorrect behavior. eslint-disable-next-line react-hooks/rules-of-hooks (25:25)
|
||||
3 | function lowercasecomponent() {
|
||||
4 | "use forget";
|
||||
5 | const x = [];
|
||||
|
||||
+1
-1
@@ -23,7 +23,7 @@ function Component() {
|
||||
4 | () => {
|
||||
5 | item.push(1);
|
||||
> 6 | }, // eslint-disable-next-line react-hooks/exhaustive-deps
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ InvalidReact: React Compiler has bailed out of optimizing this component as one or more React eslint rules were disabled. React Compiler only works when your components follow all the rules of React, disabling them may result in undefined behavior. eslint-disable-next-line react-hooks/exhaustive-deps (6:6)
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ InvalidReact: React Compiler has skipped optimizing this component because one or more React ESLint rules were disabled. React Compiler only works when your components follow all the rules of React, disabling them may result in unexpected or incorrect behavior. eslint-disable-next-line react-hooks/exhaustive-deps (6:6)
|
||||
7 | []
|
||||
8 | );
|
||||
9 |
|
||||
|
||||
+1
-1
@@ -22,7 +22,7 @@ export const FIXTURE_ENTRYPOINT = {
|
||||
|
||||
```
|
||||
> 1 | /* eslint-disable react-hooks/rules-of-hooks */
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ InvalidReact: React Compiler has bailed out of optimizing this component as one or more React eslint rules were disabled. React Compiler only works when your components follow all the rules of React, disabling them may result in undefined behavior. eslint-disable react-hooks/rules-of-hooks (1:1)
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ InvalidReact: React Compiler has skipped optimizing this component because one or more React ESLint rules were disabled. React Compiler only works when your components follow all the rules of React, disabling them may result in unexpected or incorrect behavior. eslint-disable react-hooks/rules-of-hooks (1:1)
|
||||
2 | function lowercasecomponent() {
|
||||
3 | const x = [];
|
||||
4 | return <div>{x}</div>;
|
||||
|
||||
@@ -116,7 +116,7 @@ const tests: CompilerTestCases = {
|
||||
errors: [
|
||||
{
|
||||
message:
|
||||
"React Compiler has bailed out of optimizing this component as one or more React eslint rules were disabled. React Compiler only works when your components follow all the rules of React, disabling them may result in undefined behavior",
|
||||
"React Compiler has skipped optimizing this component because one or more React ESLint rules were disabled. React Compiler only works when your components follow all the rules of React, disabling them may result in unexpected or incorrect behavior",
|
||||
suggestions: [
|
||||
{
|
||||
output: normalizeIndent`
|
||||
|
||||
Reference in New Issue
Block a user