@samitouri / QOS-React / commits / 87993f333a

[dx] Update suppression error messages

ghstack-source-id: 0c362a349de86a07b4e9e381b942939ce4a24e69 Pull Request resolved: https://github.com/facebook/react-forget/pull/2859

Joe Savona committed Apr 17, 2024 at 18:25 UTC 87993f333adf28003bca97a24507be6ddc13a2f4
8 files changed +15 -14
compiler/packages/babel-plugin-react-forget/src/Entrypoint/Suppression.ts
+5 -4
@@ -164,12 +164,13 @@ export function suppressionsToCompilerError(
164 switch (suppressionRange.source) {
165 case "Eslint":
166 reason =
167 - "React Compiler has bailed out of optimizing this component as one or more React eslint rules were disabled";
168 - suggestion = "Remove the eslint disable";
167 + "React Compiler has skipped optimizing this component because one or more React ESLint rules were disabled";
168 + suggestion =
169 + "Remove the ESLint suppression and address the React error";
170 break;
171 case "Flow":
172 reason =
172 - "React Compiler has bailed out of optimizing this component as one or more React rule violations were reported by Flow";
173 + "React Compiler has skipped optimizing this component because one or more React rule violations were reported by Flow";
174 suggestion = "Remove the Flow suppression and address the React error";
175 break;
176 default:
@@ -180,7 +181,7 @@ export function suppressionsToCompilerError(
181 }
182 error.pushErrorDetail(
183 new CompilerErrorDetail({
183 - reason: `${reason}. React Compiler only works when your components follow all the rules of React, disabling them may result in undefined behavior`,
184 + reason: `${reason}. React Compiler only works when your components follow all the rules of React, disabling them may result in unexpected or incorrect behavior`,
185 description: suppressionRange.disableComment.value.trim(),
186 severity: ErrorSeverity.InvalidReact,
187 loc: suppressionRange.disableComment.loc ?? null,
compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/error.bailout-on-flow-suppression.expect.md
+1 -1
@@ -19,7 +19,7 @@ function Foo(props) {
19 2 |
20 3 | function Foo(props) {
21 > 4 | // $FlowFixMe[react-rule-hook]
22 - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 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)
22 + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 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)
23 5 | useX();
24 6 | return null;
25 7 | }
compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/error.bailout-on-suppression-of-custom-rule.expect.md
+2 -2
@@ -22,9 +22,9 @@ function lowercasecomponent() {
22 1 | // @eslintSuppressionRules(my-app/react-rule)
23 2 |
24 > 3 | /* eslint-disable my-app/react-rule */
25 - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 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)
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 my-app/react-rule (3:3)
26
27 -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)
27 +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)
28 4 | function lowercasecomponent() {
29 5 | "use forget";
30 6 | const x = [];
compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/error.invalid-sketchy-code-use-forget.expect.md
+2 -2
@@ -18,9 +18,9 @@ function lowercasecomponent() {
18
19 ```
20 > 1 | /* eslint-disable react-hooks/rules-of-hooks */
21 - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 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)
21 + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 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)
22
23 -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)
23 +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)
24 2 | function lowercasecomponent() {
25 3 | "use forget";
26 4 | const x = [];
compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/error.invalid-unclosed-eslint-suppression.expect.md
+2 -2
@@ -38,9 +38,9 @@ function CrimesAgainstReact() {
38 ```
39 1 | // Note: Everything below this is sketchy
40 > 2 | /* eslint-disable react-hooks/rules-of-hooks */
41 - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 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)
41 + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 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)
42
43 -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)
43 +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)
44 3 | function lowercasecomponent() {
45 4 | "use forget";
46 5 | const x = [];
compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/error.sketchy-code-exhaustive-deps.expect.md
+1 -1
@@ -23,7 +23,7 @@ function Component() {
23 4 | () => {
24 5 | item.push(1);
25 > 6 | }, // eslint-disable-next-line react-hooks/exhaustive-deps
26 - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 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)
26 + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 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)
27 7 | []
28 8 | );
29 9 |
compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/error.sketchy-code-rules-of-hooks.expect.md
+1 -1
@@ -22,7 +22,7 @@ export const FIXTURE_ENTRYPOINT = {
22
23 ```
24 > 1 | /* eslint-disable react-hooks/rules-of-hooks */
25 - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 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)
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 react-hooks/rules-of-hooks (1:1)
26 2 | function lowercasecomponent() {
27 3 | const x = [];
28 4 | return <div>{x}</div>;
compiler/packages/eslint-plugin-react-compiler/__tests__/ReactCompilerRule-test.ts
+1 -1
@@ -116,7 +116,7 @@ const tests: CompilerTestCases = {
116 errors: [
117 {
118 message:
119 - "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",
119 + "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",
120 suggestions: [
121 {
122 output: normalizeIndent`