@samitouri / QOS-React-2 / commits / 7748ce8f3f

Update compiler naming in remaining error text

Lauren Tan committed Mar 28, 2024 at 10:40 UTC 7748ce8f3ff89065b7c25622873f86e3693a5667
9 files changed +23 -23
compiler/packages/babel-plugin-react-forget/src/Entrypoint/Suppression.ts
+3 -3
@@ -164,12 +164,12 @@ export function suppressionsToCompilerError(
164 switch (suppressionRange.source) {
165 case "Eslint":
166 reason =
167 - "React Forget has bailed out of optimizing this component as one or more React eslint rules were disabled";
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";
169 break;
170 case "Flow":
171 reason =
172 - "React Forget has bailed out of optimizing this component as one or more React rule violations were reported by Flow";
172 + "React Compiler has bailed out of optimizing this component as one or more React rule violations were reported by Flow";
173 suggestion = "Remove the Flow suppression and address the React error";
174 break;
175 default:
@@ -180,7 +180,7 @@ export function suppressionsToCompilerError(
180 }
181 error.pushErrorDetail(
182 new CompilerErrorDetail({
183 - reason: `${reason}. React Forget only works when your components follow all the rules of React, disabling them may result in undefined behavior`,
183 + reason: `${reason}. React Compiler only works when your components follow all the rules of React, disabling them may result in undefined behavior`,
184 description: suppressionRange.disableComment.value.trim(),
185 severity: ErrorSeverity.InvalidReact,
186 loc: suppressionRange.disableComment.loc ?? null,
compiler/packages/babel-plugin-react-forget/src/HIR/BuildHIR.ts
+8 -8
@@ -182,7 +182,7 @@ export function lower(
182 lowerStatement(builder, body);
183 } else {
184 builder.errors.push({
185 - reason: `Unexpected function body kind: ${body.type}}. This error is likely caused by a bug in React Forget. Please file an issue`,
185 + reason: `Unexpected function body kind: ${body.type}}. This error is likely caused by a bug in React Compiler. Please file an issue`,
186 severity: ErrorSeverity.InvalidJS,
187 loc: body.node.loc ?? null,
188 suggestions: null,
@@ -735,7 +735,7 @@ function lowerStatement(
735 if (testExpr.node == null) {
736 if (hasDefault) {
737 builder.errors.push({
738 - reason: `Expected at most one \`default\` branch in SwitchStatement, this code should have failed to parse. This error is likely caused by a bug in React Forget. Please file an issue`,
738 + reason: `Expected at most one \`default\` branch in SwitchStatement, this code should have failed to parse. This error is likely caused by a bug in React Compiler. Please file an issue`,
739 severity: ErrorSeverity.InvalidJS,
740 loc: case_.node.loc ?? null,
741 suggestions: null,
@@ -898,7 +898,7 @@ function lowerStatement(
898 }
899 } else {
900 builder.errors.push({
901 - reason: `Expected variable declaration to be an identifier if no initializer was provided. This error is likely caused by a bug in React Forget. Please file an issue`,
901 + reason: `Expected variable declaration to be an identifier if no initializer was provided. This error is likely caused by a bug in React Compiler. Please file an issue`,
902 severity: ErrorSeverity.InvalidJS,
903 loc: stmt.node.loc ?? null,
904 suggestions: null,
@@ -1547,7 +1547,7 @@ function lowerExpression(
1547 const calleePath = expr.get("callee");
1548 if (!calleePath.isExpression()) {
1549 builder.errors.push({
1550 - reason: `Expected Expression, got ${calleePath.type} in NewExpression (v8 intrinsics not supported): ${calleePath.type}. This error is likely caused by a bug in React Forget. Please file an issue`,
1550 + reason: `Expected Expression, got ${calleePath.type} in NewExpression (v8 intrinsics not supported): ${calleePath.type}. This error is likely caused by a bug in React Compiler. Please file an issue`,
1551 severity: ErrorSeverity.InvalidJS,
1552 loc: calleePath.node.loc ?? null,
1553 suggestions: null,
@@ -1573,7 +1573,7 @@ function lowerExpression(
1573 const calleePath = expr.get("callee");
1574 if (!calleePath.isExpression()) {
1575 builder.errors.push({
1576 - reason: `Expected Expression, got ${calleePath.type} in CallExpression (v8 intrinsics not supported). This error is likely caused by a bug in React Forget. Please file an issue`,
1576 + reason: `Expected Expression, got ${calleePath.type} in CallExpression (v8 intrinsics not supported). This error is likely caused by a bug in React Compiler. Please file an issue`,
1577 severity: ErrorSeverity.Todo,
1578 loc: calleePath.node.loc ?? null,
1579 suggestions: null,
@@ -1639,7 +1639,7 @@ function lowerExpression(
1639 }
1640 if (last === null) {
1641 builder.errors.push({
1642 - reason: `Expected SequenceExpression to have at least one expression. This error is likely caused by a bug in React Forget. Please file an issue`,
1642 + reason: `Expected SequenceExpression to have at least one expression. This error is likely caused by a bug in React Compiler. Please file an issue`,
1643 severity: ErrorSeverity.InvalidJS,
1644 loc: expr.node.loc ?? null,
1645 suggestions: null,
@@ -2184,7 +2184,7 @@ function lowerExpression(
2184
2185 if (subexprs.length !== quasis.length - 1) {
2186 builder.errors.push({
2187 - reason: `Unexpected quasi and subexpression lengths in TemplateLiteral. This error is likely caused by a bug in React Forget. Please file an issue`,
2187 + reason: `Unexpected quasi and subexpression lengths in TemplateLiteral. This error is likely caused by a bug in React Compiler. Please file an issue`,
2188 severity: ErrorSeverity.InvalidJS,
2189 loc: exprPath.node.loc ?? null,
2190 suggestions: null,
@@ -2942,7 +2942,7 @@ function lowerJsxElementName(
2942 const tag = `${namespace}:${name}`;
2943 if (namespace.indexOf(":") !== -1 || name.indexOf(":") !== -1) {
2944 builder.errors.push({
2945 - reason: `Expected JSXNamespacedName to have no colons in the namespace or name, got '${namespace}' : '${name}'. This error is likely caused by a bug in React Forget. Please file an issue`,
2945 + reason: `Expected JSXNamespacedName to have no colons in the namespace or name, got '${namespace}' : '${name}'. This error is likely caused by a bug in React Compiler. Please file an issue`,
2946 severity: ErrorSeverity.InvalidJS,
2947 loc: exprPath.node.loc ?? null,
2948 suggestions: 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 Forget has bailed out of optimizing this component as one or more React rule violations were reported by Flow. React Forget 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 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)
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 Forget has bailed out of optimizing this component as one or more React eslint rules were disabled. React Forget 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 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)
26
27 -InvalidReact: React Forget has bailed out of optimizing this component as one or more React eslint rules were disabled. React Forget 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 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)
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 Forget has bailed out of optimizing this component as one or more React eslint rules were disabled. React Forget 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 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)
22
23 -InvalidReact: React Forget has bailed out of optimizing this component as one or more React eslint rules were disabled. React Forget 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 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)
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 Forget has bailed out of optimizing this component as one or more React eslint rules were disabled. React Forget 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 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)
42
43 -InvalidReact: React Forget has bailed out of optimizing this component as one or more React eslint rules were disabled. React Forget 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 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)
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 Forget has bailed out of optimizing this component as one or more React eslint rules were disabled. React Forget 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 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)
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 Forget has bailed out of optimizing this component as one or more React eslint rules were disabled. React Forget 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 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)
26 2 | function lowercasecomponent() {
27 3 | const x = [];
28 4 | return <div>{x}</div>;
compiler/packages/eslint-plugin-react-compiler/__tests__/ReactCompilerRule-test.ts
+3 -3
@@ -18,12 +18,12 @@ function normalizeIndent(strings: TemplateStringsArray): string {
18 return codeLines.map((line) => line.slice(leftPadding.length)).join("\n");
19 }
20
21 -type ForgetTestCases = {
21 +type CompilerTestCases = {
22 valid: ESLintTester.ValidTestCase[];
23 invalid: ESLintTester.InvalidTestCase[];
24 };
25
26 -const tests: ForgetTestCases = {
26 +const tests: CompilerTestCases = {
27 valid: [
28 {
29 name: "Basic example",
@@ -116,7 +116,7 @@ const tests: ForgetTestCases = {
116 errors: [
117 {
118 message:
119 - "React Forget has bailed out of optimizing this component as one or more React eslint rules were disabled. React Forget only works when your components follow all the rules of React, disabling them may result in undefined behavior",
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",
120 suggestions: [
121 {
122 output: normalizeIndent`