@samitouri / QOS-React-2 / commits / 638f8e3ddc

Remove [ReactForget] prefix from error messages

Lauren Tan committed Mar 28, 2024 at 10:40 UTC 638f8e3ddc9a73036d527dfc396e21fa8862a20f
166 files changed +206 -206
compiler/packages/babel-plugin-react-forget/src/CompilerError.ts
+1 -1
@@ -93,7 +93,7 @@ export class CompilerErrorDetail {
93 }
94
95 toString(): string {
96 - return `[ReactForget] ${this.printErrorMessage()}`;
96 + return this.printErrorMessage();
97 }
98 }
99
compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/error._todo.computed-lval-in-destructure.expect.md
+1 -1
@@ -18,7 +18,7 @@ function Component(props) {
18 1 | function Component(props) {
19 2 | const computedKey = props.key;
20 > 3 | const { [computedKey]: x } = props.val;
21 - | ^^^^^^^^^^^^^^^^ [ReactForget] Todo: (BuildHIR::lowerAssignment) Handle computed properties in ObjectPattern (3:3)
21 + | ^^^^^^^^^^^^^^^^ Todo: (BuildHIR::lowerAssignment) Handle computed properties in ObjectPattern (3:3)
22 4 |
23 5 | return x;
24 6 | }
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 - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ [ReactForget] 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 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)
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 - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ [ReactForget] 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 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)
26
27 -[ReactForget] 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 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)
28 4 | function lowercasecomponent() {
29 5 | "use forget";
30 6 | const x = [];
compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/error.call-args-destructuring-asignment-complex.expect.md
+1 -1
@@ -17,7 +17,7 @@ function Component(props) {
17 1 | function Component(props) {
18 2 | let x = makeObject();
19 > 3 | x.foo(([[x]] = makeObject()));
20 - | ^^^^^ [ReactForget] Invariant: Const declaration cannot be referenced as an expression (3:3)
20 + | ^^^^^ Invariant: Const declaration cannot be referenced as an expression (3:3)
21 4 | return x;
22 5 | }
23 6 |
compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/error.capitalized-function-call-aliased.expect.md
+1 -1
@@ -17,7 +17,7 @@ function Foo() {
17 2 | function Foo() {
18 3 | let x = Bar;
19 > 4 | x(); // ERROR
20 - | ^^^ [ReactForget] InvalidReact: Capitalized function calls may be calling components that use hooks, which make them dangerous to memoize. Ensure there are no hook calls in the function and rename it to begin with a lowercase letter to fix this error. Bar may be a component. (4:4)
20 + | ^^^ InvalidReact: Capitalized function calls may be calling components that use hooks, which make them dangerous to memoize. Ensure there are no hook calls in the function and rename it to begin with a lowercase letter to fix this error. Bar may be a component. (4:4)
21 5 | }
22 6 |
23 ```
compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/error.capitalized-function-call.expect.md
+1 -1
@@ -18,7 +18,7 @@ function Component() {
18 1 | // @validateNoCapitalizedCalls
19 2 | function Component() {
20 > 3 | const x = SomeFunc();
21 - | ^^^^^^^^^^ [ReactForget] InvalidReact: Capitalized function calls may be calling components that use hooks, which make them dangerous to memoize. Ensure there are no hook calls in the function and rename it to begin with a lowercase letter to fix this error. SomeFunc may be a component. (3:3)
21 + | ^^^^^^^^^^ InvalidReact: Capitalized function calls may be calling components that use hooks, which make them dangerous to memoize. Ensure there are no hook calls in the function and rename it to begin with a lowercase letter to fix this error. SomeFunc may be a component. (3:3)
22 4 |
23 5 | return x;
24 6 | }
compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/error.codegen-error-on-conflicting-imports.expect.md
+1 -1
@@ -15,7 +15,7 @@ function useFoo(props) {
15 ## Error
16
17 ```
18 -[ReactForget] Invariant: Encountered conflicting import specifiers for makeReadOnly in generated program.
18 +Invariant: Encountered conflicting import specifiers for makeReadOnly in generated program.
19 ```
20
21
\ No newline at end of file
compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/error.component-syntax-ref-gating.flow.expect.md
+1 -1
@@ -14,7 +14,7 @@ component Foo(ref: React.RefSetter<Controls>) {
14 ```
15 1 | // @flow @gating
16 > 2 | component Foo(ref: React.RefSetter<Controls>) {
17 - | ^^^ [ReactForget] Invariant: Encountered a function used before its declaration, which breaks Forget's gating codegen due to hoisting. Rewrite the reference to Foo_withRef to not rely on hoisting to fix this issue (2:2)
17 + | ^^^ Invariant: Encountered a function used before its declaration, which breaks Forget's gating codegen due to hoisting. Rewrite the reference to Foo_withRef to not rely on hoisting to fix this issue (2:2)
18 3 | return <Bar ref={ref}/>;
19 4 | }
20 ```
compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/error.conditional-hook-unknown-hook-react-namespace.expect.md
+1 -1
@@ -19,7 +19,7 @@ function Component(props) {
19 2 | let x = null;
20 3 | if (props.cond) {
21 > 4 | x = React.useNonexistentHook();
22 - | ^^^^^^^^^^^^^^^^^^^^^^^^ [ReactForget] InvalidReact: Hooks must always be called in a consistent order, and may not be called conditionally. See the Rules of Hooks (https://react.dev/warnings/invalid-hook-call-warning) (4:4)
22 + | ^^^^^^^^^^^^^^^^^^^^^^^^ InvalidReact: Hooks must always be called in a consistent order, and may not be called conditionally. See the Rules of Hooks (https://react.dev/warnings/invalid-hook-call-warning) (4:4)
23 5 | }
24 6 | return x;
25 7 | }
compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/error.conditional-hooks-as-method-call.expect.md
+1 -1
@@ -19,7 +19,7 @@ function Component(props) {
19 2 | let x = null;
20 3 | if (props.cond) {
21 > 4 | x = Foo.useFoo();
22 - | ^^^^^^^^^^ [ReactForget] InvalidReact: Hooks must always be called in a consistent order, and may not be called conditionally. See the Rules of Hooks (https://react.dev/warnings/invalid-hook-call-warning) (4:4)
22 + | ^^^^^^^^^^ InvalidReact: Hooks must always be called in a consistent order, and may not be called conditionally. See the Rules of Hooks (https://react.dev/warnings/invalid-hook-call-warning) (4:4)
23 5 | }
24 6 | return x;
25 7 | }
compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/error.default-param-accesses-local.expect.md
+1 -1
@@ -29,7 +29,7 @@ export const FIXTURE_ENTRYPOINT = {
29 > 4 | return x;
30 | ^^^^^^^^^^^^^
31 > 5 | }
32 - | ^^^^ [ReactForget] Todo: (BuildHIR::node.lowerReorderableExpression) Expression type 'ArrowFunctionExpression' cannot be safely reordered (3:5)
32 + | ^^^^ Todo: (BuildHIR::node.lowerReorderableExpression) Expression type 'ArrowFunctionExpression' cannot be safely reordered (3:5)
33 6 | ) {
34 7 | return y();
35 8 | }
compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/error.dont-hoist-inline-reference.expect.md
+1 -1
@@ -22,7 +22,7 @@ export const FIXTURE_ENTRYPOINT = {
22 1 | import { identity } from "shared-runtime";
23 2 | function useInvalid() {
24 > 3 | const x = identity(x);
25 - | ^^^^^^^^^^^^^^^^^^^^^^ [ReactForget] Todo: [hoisting] EnterSSA: Expected identifier to be defined before being used. Identifier x$1 is undefined (3:3)
25 + | ^^^^^^^^^^^^^^^^^^^^^^ Todo: [hoisting] EnterSSA: Expected identifier to be defined before being used. Identifier x$1 is undefined (3:3)
26 4 | return x;
27 5 | }
28 6 |
compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/error.gating-hoisting.expect.md
+1 -1
@@ -17,7 +17,7 @@ function Foo_withRef(props, ref) {
17 1 | // @gating
18 2 | const Foo = React.forwardRef(Foo_withRef);
19 > 3 | function Foo_withRef(props, ref) {
20 - | ^^^^^^^^^^^ [ReactForget] Invariant: Encountered a function used before its declaration, which breaks Forget's gating codegen due to hoisting. Rewrite the reference to Foo_withRef to not rely on hoisting to fix this issue (3:3)
20 + | ^^^^^^^^^^^ Invariant: Encountered a function used before its declaration, which breaks Forget's gating codegen due to hoisting. Rewrite the reference to Foo_withRef to not rely on hoisting to fix this issue (3:3)
21 4 | return <Bar ref={ref} {...props}></Bar>;
22 5 | }
23 6 |
compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/error.gating-use-before-decl.expect.md
+1 -1
@@ -17,7 +17,7 @@ function Foo() {}
17 3 |
18 4 | export default memo(Foo);
19 > 5 | function Foo() {}
20 - | ^^^ [ReactForget] Invariant: Encountered a function used before its declaration, which breaks Forget's gating codegen due to hoisting. Rewrite the reference to Foo to not rely on hoisting to fix this issue (5:5)
20 + | ^^^ Invariant: Encountered a function used before its declaration, which breaks Forget's gating codegen due to hoisting. Rewrite the reference to Foo to not rely on hoisting to fix this issue (5:5)
21 6 |
22 ```
23
compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/error.hoisted-function-declaration.expect.md
+1 -1
@@ -20,7 +20,7 @@ function component(a) {
20 1 | function component(a) {
21 2 | let t = { a };
22 > 3 | x(t); // hoisted call
23 - | ^^^^ [ReactForget] Todo: Unsupported declaration type for hoisting. variable "x" declared with FunctionDeclaration (3:3)
23 + | ^^^^ Todo: Unsupported declaration type for hoisting. variable "x" declared with FunctionDeclaration (3:3)
24 4 | function x(p) {
25 5 | p.foo();
26 6 | }
compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/error.hoisting-simple-function-declaration.expect.md
+1 -1
@@ -27,7 +27,7 @@ export const FIXTURE_ENTRYPOINT = {
27 3 | return x;
28 4 | }
29 > 5 | return baz(); // OK: FuncDecls are HoistableDeclarations that have both declaration and value hoisting
30 - | ^^^^^ [ReactForget] Todo: Unsupported declaration type for hoisting. variable "baz" declared with FunctionDeclaration (5:5)
30 + | ^^^^^ Todo: Unsupported declaration type for hoisting. variable "baz" declared with FunctionDeclaration (5:5)
31 6 | function baz() {
32 7 | return bar();
33 8 | }
compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/error.hook-property-load-local-hook.expect.md
+2 -2
@@ -26,9 +26,9 @@ export const FIXTURE_ENTRYPOINT = {
26 5 |
27 6 | function Foo() {
28 > 7 | let bar = useFoo.useBar;
29 - | ^^^^^^^^^^^^^ [ReactForget] InvalidReact: Hooks may not be referenced as normal values, they must be called. See the Rules of Hooks (https://react.dev/warnings/invalid-hook-call-warning) (7:7)
29 + | ^^^^^^^^^^^^^ InvalidReact: Hooks may not be referenced as normal values, they must be called. See the Rules of Hooks (https://react.dev/warnings/invalid-hook-call-warning) (7:7)
30
31 -[ReactForget] InvalidReact: Hooks may not be referenced as normal values, they must be called. See the Rules of Hooks (https://react.dev/warnings/invalid-hook-call-warning) (8:8)
31 +InvalidReact: Hooks may not be referenced as normal values, they must be called. See the Rules of Hooks (https://react.dev/warnings/invalid-hook-call-warning) (8:8)
32 8 | return bar();
33 9 | }
34 10 |
compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/error.invalid-ReactUseMemo-async-callback.expect.md
+1 -1
@@ -21,7 +21,7 @@ function component(a, b) {
21 > 3 | await a;
22 | ^^^^^^^^^^^^
23 > 4 | }, []);
24 - | ^^^^ [ReactForget] InvalidReact: useMemo callbacks may not be async or generator functions (2:4)
24 + | ^^^^ InvalidReact: useMemo callbacks may not be async or generator functions (2:4)
25 5 | return x;
26 6 | }
27 7 |
compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/error.invalid-access-ref-during-render.expect.md
+1 -1
@@ -18,7 +18,7 @@ function Component(props) {
18 3 | const ref = useRef(null);
19 4 | const value = ref.current;
20 > 5 | return value;
21 - | ^^^^^ [ReactForget] InvalidReact: Ref values (the `current` property) may not be accessed during render. (https://react.dev/reference/react/useRef). Cannot access ref value at freeze $22:TObject<BuiltInRefValue> (5:5)
21 + | ^^^^^ InvalidReact: Ref values (the `current` property) may not be accessed during render. (https://react.dev/reference/react/useRef). Cannot access ref value at freeze $22:TObject<BuiltInRefValue> (5:5)
22 6 | }
23 7 |
24 ```
compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/error.invalid-aliased-ref-in-callback-invoked-during-render-.expect.md
+1 -1
@@ -22,7 +22,7 @@ function Component(props) {
22 7 | return <Foo item={item} current={current} />;
23 8 | };
24 > 9 | return <Items>{props.items.map((item) => renderItem(item))}</Items>;
25 - | ^^^^^^^^^^^^^^^^^^^^^^^^^^ [ReactForget] InvalidReact: Ref values (the `current` property) may not be accessed during render. (https://react.dev/reference/react/useRef). Cannot access ref value at mutate? $64[13:15] (9:9)
25 + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ InvalidReact: Ref values (the `current` property) may not be accessed during render. (https://react.dev/reference/react/useRef). Cannot access ref value at mutate? $64[13:15] (9:9)
26 10 | }
27 11 |
28 ```
compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/error.invalid-array-push-frozen.expect.md
+1 -1
@@ -18,7 +18,7 @@ function Component(props) {
18 2 | const x = [];
19 3 | <div>{x}</div>;
20 > 4 | x.push(props.value);
21 - | ^ [ReactForget] InvalidReact: Updating a value used previously in JSX is not allowed. Consider moving the mutation before the JSX. (4:4)
21 + | ^ InvalidReact: Updating a value used previously in JSX is not allowed. Consider moving the mutation before the JSX. (4:4)
22 5 | return x;
23 6 | }
24 7 |
compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/error.invalid-assign-hook-to-local.expect.md
+1 -1
@@ -16,7 +16,7 @@ function Component(props) {
16 ```
17 1 | function Component(props) {
18 > 2 | const x = useState;
19 - | ^^^^^^^^ [ReactForget] InvalidReact: Hooks may not be referenced as normal values, they must be called. See the Rules of Hooks (https://react.dev/warnings/invalid-hook-call-warning) (2:2)
19 + | ^^^^^^^^ InvalidReact: Hooks may not be referenced as normal values, they must be called. See the Rules of Hooks (https://react.dev/warnings/invalid-hook-call-warning) (2:2)
20 3 | const state = x(null);
21 4 | return state[0];
22 5 | }
compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/error.invalid-computed-store-to-frozen-value.expect.md
+1 -1
@@ -19,7 +19,7 @@ function Component(props) {
19 3 | // freeze
20 4 | <div>{x}</div>;
21 > 5 | x[0] = true;
22 - | ^ [ReactForget] InvalidReact: Updating a value used previously in JSX is not allowed. Consider moving the mutation before the JSX. (5:5)
22 + | ^ InvalidReact: Updating a value used previously in JSX is not allowed. Consider moving the mutation before the JSX. (5:5)
23 6 | return x;
24 7 | }
25 8 |
compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/error.invalid-delete-computed-property-of-frozen-value.expect.md
+1 -1
@@ -19,7 +19,7 @@ function Component(props) {
19 3 | // freeze
20 4 | <div>{x}</div>;
21 > 5 | delete x[y];
22 - | ^ [ReactForget] InvalidReact: Updating a value used previously in JSX is not allowed. Consider moving the mutation before the JSX. (5:5)
22 + | ^ InvalidReact: Updating a value used previously in JSX is not allowed. Consider moving the mutation before the JSX. (5:5)
23 6 | return x;
24 7 | }
25 8 |
compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/error.invalid-delete-property-of-frozen-value.expect.md
+1 -1
@@ -19,7 +19,7 @@ function Component(props) {
19 3 | // freeze
20 4 | <div>{x}</div>;
21 > 5 | delete x.y;
22 - | ^ [ReactForget] InvalidReact: Updating a value used previously in JSX is not allowed. Consider moving the mutation before the JSX. (5:5)
22 + | ^ InvalidReact: Updating a value used previously in JSX is not allowed. Consider moving the mutation before the JSX. (5:5)
23 6 | return x;
24 7 | }
25 8 |
compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/error.invalid-destructure-assignment-to-global.expect.md
+1 -1
@@ -15,7 +15,7 @@ function useFoo(props) {
15 ```
16 1 | function useFoo(props) {
17 > 2 | [x] = props;
18 - | ^^^ [ReactForget] InvalidReact: This reassigns a variable which was not defined inside of the component. Components should be pure and side-effect free. If this variable is used in rendering, use useState instead. (https://react.dev/learn/keeping-components-pure) (2:2)
18 + | ^^^ InvalidReact: This reassigns a variable which was not defined inside of the component. Components should be pure and side-effect free. If this variable is used in rendering, use useState instead. (https://react.dev/learn/keeping-components-pure) (2:2)
19 3 | return { x };
20 4 | }
21 5 |
compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/error.invalid-destructure-to-local-global-variables.expect.md
+1 -1
@@ -18,7 +18,7 @@ function Component(props) {
18 1 | function Component(props) {
19 2 | let a;
20 > 3 | [a, b] = props.value;
21 - | ^^^^^^ [ReactForget] InvalidReact: This reassigns a variable which was not defined inside of the component. Components should be pure and side-effect free. If this variable is used in rendering, use useState instead. (https://react.dev/learn/keeping-components-pure) (3:3)
21 + | ^^^^^^ InvalidReact: This reassigns a variable which was not defined inside of the component. Components should be pure and side-effect free. If this variable is used in rendering, use useState instead. (https://react.dev/learn/keeping-components-pure) (3:3)
22 4 |
23 5 | return [a, b];
24 6 | }
compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/error.invalid-function-expression-mutates-immutable-value.expect.md
+1 -1
@@ -21,7 +21,7 @@ function Component(props) {
21 3 | const onChange = (e) => {
22 4 | // INVALID! should use copy-on-write and pass the new value
23 > 5 | x.value = e.target.value;
24 - | ^^^^^^^ [ReactForget] InvalidReact: Mutating a value returned from 'useState()', which should not be mutated. Use the setter function to update instead. (5:5)
24 + | ^^^^^^^ InvalidReact: Mutating a value returned from 'useState()', which should not be mutated. Use the setter function to update instead. (5:5)
25 6 | setX(x);
26 7 | };
27 8 | return <input value={x.value} onChange={onChange} />;
compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/error.invalid-mutate-after-aliased-freeze.expect.md
+1 -1
@@ -28,7 +28,7 @@ function Component(props) {
28 11 | // y is MaybeFrozen at this point, since it may alias to x
29 12 | // (which is the above line freezes)
30 > 13 | y.push(props.p2);
31 - | ^ [ReactForget] InvalidReact: Updating a value used previously in JSX is not allowed. Consider moving the mutation before the JSX. (13:13)
31 + | ^ InvalidReact: Updating a value used previously in JSX is not allowed. Consider moving the mutation before the JSX. (13:13)
32 14 |
33 15 | return <Component x={x} y={y} />;
34 16 | }
compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/error.invalid-mutate-after-freeze.expect.md
+1 -1
@@ -22,7 +22,7 @@ function Component(props) {
22 5 |
23 6 | // x is Frozen at this point
24 > 7 | x.push(props.p2);
25 - | ^ [ReactForget] InvalidReact: Updating a value used previously in JSX is not allowed. Consider moving the mutation before the JSX. (7:7)
25 + | ^ InvalidReact: Updating a value used previously in JSX is not allowed. Consider moving the mutation before the JSX. (7:7)
26 8 |
27 9 | return <div>{_}</div>;
28 10 | }
compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/error.invalid-mutate-context-in-callback.expect.md
+1 -1
@@ -27,7 +27,7 @@ function Component(props) {
27 10 | // independently
28 11 | const onClick = () => {
29 > 12 | FooContext.current = true;
30 - | ^^^^^^^^^^^^^^^^^^ [ReactForget] InvalidReact: Mutating a value returned from 'useContext()', which should not be mutated. (12:12)
30 + | ^^^^^^^^^^^^^^^^^^ InvalidReact: Mutating a value returned from 'useContext()', which should not be mutated. (12:12)
31 13 | };
32 14 | return <div onClick={onClick} />;
33 15 | }
compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/error.invalid-mutate-context.expect.md
+1 -1
@@ -17,7 +17,7 @@ function Component(props) {
17 1 | function Component(props) {
18 2 | const context = useContext(FooContext);
19 > 3 | context.value = props.value;
20 - | ^^^^^^^ [ReactForget] InvalidReact: Mutating a value returned from 'useContext()', which should not be mutated. (3:3)
20 + | ^^^^^^^ InvalidReact: Mutating a value returned from 'useContext()', which should not be mutated. (3:3)
21 4 | return context.value;
22 5 | }
23 6 |
compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/error.invalid-mutation-in-closure.expect.md
+1 -1
@@ -19,7 +19,7 @@ function useInvalidMutation(options) {
19 1 | function useInvalidMutation(options) {
20 2 | function test() {
21 > 3 | foo(options.foo); // error should not point on this line
22 - | ^^^^^^^^^^^ [ReactForget] InvalidReact: Mutating props or hook arguments is not allowed. Consider using a local variable instead. (3:3)
22 + | ^^^^^^^^^^^ InvalidReact: Mutating props or hook arguments is not allowed. Consider using a local variable instead. (3:3)
23 4 | options.foo = "bar";
24 5 | }
25 6 | return test;
compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/error.invalid-pass-hook-as-call-arg.expect.md
+1 -1
@@ -14,7 +14,7 @@ function Component(props) {
14 ```
15 1 | function Component(props) {
16 > 2 | return foo(useFoo);
17 - | ^^^^^^ [ReactForget] InvalidReact: Hooks may not be referenced as normal values, they must be called. See the Rules of Hooks (https://react.dev/warnings/invalid-hook-call-warning) (2:2)
17 + | ^^^^^^ InvalidReact: Hooks may not be referenced as normal values, they must be called. See the Rules of Hooks (https://react.dev/warnings/invalid-hook-call-warning) (2:2)
18 3 | }
19 4 |
20 ```
compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/error.invalid-pass-hook-as-prop.expect.md
+1 -1
@@ -14,7 +14,7 @@ function Component(props) {
14 ```
15 1 | function Component(props) {
16 > 2 | return <Child foo={useFoo} />;
17 - | ^^^^^^ [ReactForget] InvalidReact: Hooks may not be referenced as normal values, they must be called. See the Rules of Hooks (https://react.dev/warnings/invalid-hook-call-warning) (2:2)
17 + | ^^^^^^ InvalidReact: Hooks may not be referenced as normal values, they must be called. See the Rules of Hooks (https://react.dev/warnings/invalid-hook-call-warning) (2:2)
18 3 | }
19 4 |
20 ```
compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/error.invalid-pass-ref-to-function.expect.md
+1 -1
@@ -18,7 +18,7 @@ function Component(props) {
18 2 | function Component(props) {
19 3 | const ref = useRef(null);
20 > 4 | const x = foo(ref);
21 - | ^^^ [ReactForget] InvalidReact: Ref values (the `current` property) may not be accessed during render. (https://react.dev/reference/react/useRef). Cannot access ref value at mutate? $21[6:8]:TObject<BuiltInUseRefId> (4:4)
21 + | ^^^ InvalidReact: Ref values (the `current` property) may not be accessed during render. (https://react.dev/reference/react/useRef). Cannot access ref value at mutate? $21[6:8]:TObject<BuiltInUseRefId> (4:4)
22 5 | return x.current;
23 6 | }
24 7 |
compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/error.invalid-property-store-to-frozen-value.expect.md
+1 -1
@@ -19,7 +19,7 @@ function Component(props) {
19 3 | // freeze
20 4 | <div>{x}</div>;
21 > 5 | x.y = true;
22 - | ^ [ReactForget] InvalidReact: Updating a value used previously in JSX is not allowed. Consider moving the mutation before the JSX. (5:5)
22 + | ^ InvalidReact: Updating a value used previously in JSX is not allowed. Consider moving the mutation before the JSX. (5:5)
23 6 | return x;
24 7 | }
25 8 |
compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/error.invalid-ref-in-callback-invoked-during-render.expect.md
+1 -1
@@ -21,7 +21,7 @@ function Component(props) {
21 6 | return <Foo item={item} current={current} />;
22 7 | };
23 > 8 | return <Items>{props.items.map((item) => renderItem(item))}</Items>;
24 - | ^^^^^^^^^^^^^^^^^^^^^^^^^^ [ReactForget] InvalidReact: Ref values (the `current` property) may not be accessed during render. (https://react.dev/reference/react/useRef). Cannot access ref value at mutate? $60[14:16] (8:8)
24 + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ InvalidReact: Ref values (the `current` property) may not be accessed during render. (https://react.dev/reference/react/useRef). Cannot access ref value at mutate? $60[14:16] (8:8)
25 9 | }
26 10 |
27 ```
compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/error.invalid-ref-value-as-props.expect.md
+1 -1
@@ -17,7 +17,7 @@ function Component(props) {
17 2 | function Component(props) {
18 3 | const ref = useRef(null);
19 > 4 | return <Foo ref={ref.current} />;
20 - | ^^^^^^^^^^^ [ReactForget] InvalidReact: Ref values (the `current` property) may not be accessed during render. (https://react.dev/reference/react/useRef). Cannot access ref value at freeze $19:TObject<BuiltInRefValue> (4:4)
20 + | ^^^^^^^^^^^ InvalidReact: Ref values (the `current` property) may not be accessed during render. (https://react.dev/reference/react/useRef). Cannot access ref value at freeze $19:TObject<BuiltInRefValue> (4:4)
21 5 | }
22 6 |
23 ```
compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/error.invalid-set-and-read-ref-during-render.expect.md
+1 -1
@@ -18,7 +18,7 @@ function Component(props) {
18 3 | const ref = useRef(null);
19 4 | ref.current = props.value;
20 > 5 | return ref.current;
21 - | ^^^^^^^^^^^ [ReactForget] InvalidReact: Ref values (the `current` property) may not be accessed during render. (https://react.dev/reference/react/useRef). Cannot access ref value at freeze $24:TObject<BuiltInRefValue> (5:5)
21 + | ^^^^^^^^^^^ InvalidReact: Ref values (the `current` property) may not be accessed during render. (https://react.dev/reference/react/useRef). Cannot access ref value at freeze $24:TObject<BuiltInRefValue> (5:5)
22 6 | }
23 7 |
24 ```
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 - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ [ReactForget] 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 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)
22
23 -[ReactForget] 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 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)
24 2 | function lowercasecomponent() {
25 3 | "use forget";
26 4 | const x = [];
compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/error.invalid-ternary-with-hook-values.expect.md
+4 -4
@@ -15,13 +15,13 @@ function Component(props) {
15 ```
16 1 | function Component(props) {
17 > 2 | const x = props.cond ? useA : useB;
18 - | ^^^^ [ReactForget] InvalidReact: Hooks may not be referenced as normal values, they must be called. See the Rules of Hooks (https://react.dev/warnings/invalid-hook-call-warning) (2:2)
18 + | ^^^^ InvalidReact: Hooks may not be referenced as normal values, they must be called. See the Rules of Hooks (https://react.dev/warnings/invalid-hook-call-warning) (2:2)
19
20 -[ReactForget] InvalidReact: Hooks may not be referenced as normal values, they must be called. See the Rules of Hooks (https://react.dev/warnings/invalid-hook-call-warning) (2:2)
20 +InvalidReact: Hooks may not be referenced as normal values, they must be called. See the Rules of Hooks (https://react.dev/warnings/invalid-hook-call-warning) (2:2)
21
22 -[ReactForget] InvalidReact: Hooks may not be referenced as normal values, they must be called. See the Rules of Hooks (https://react.dev/warnings/invalid-hook-call-warning) (2:2)
22 +InvalidReact: Hooks may not be referenced as normal values, they must be called. See the Rules of Hooks (https://react.dev/warnings/invalid-hook-call-warning) (2:2)
23
24 -[ReactForget] InvalidReact: Hooks may not be referenced as normal values, they must be called. See the Rules of Hooks (https://react.dev/warnings/invalid-hook-call-warning) (3:3)
24 +InvalidReact: Hooks may not be referenced as normal values, they must be called. See the Rules of Hooks (https://react.dev/warnings/invalid-hook-call-warning) (3:3)
25 3 | return x();
26 4 | }
27 5 |
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 - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ [ReactForget] 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 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)
42
43 -[ReactForget] 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 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)
44 3 | function lowercasecomponent() {
45 4 | "use forget";
46 5 | const x = [];
compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/error.invalid-unconditional-set-state-in-render.expect.md
+2 -2
@@ -22,9 +22,9 @@ function Component(props) {
22 4 | const aliased = setX;
23 5 |
24 > 6 | setX(1);
25 - | ^^^^ [ReactForget] InvalidReact: This is an unconditional set state during render, which will trigger an infinite loop. (https://react.dev/reference/react/useState) (6:6)
25 + | ^^^^ InvalidReact: This is an unconditional set state during render, which will trigger an infinite loop. (https://react.dev/reference/react/useState) (6:6)
26
27 -[ReactForget] InvalidReact: This is an unconditional set state during render, which will trigger an infinite loop. (https://react.dev/reference/react/useState) (7:7)
27 +InvalidReact: This is an unconditional set state during render, which will trigger an infinite loop. (https://react.dev/reference/react/useState) (7:7)
28 7 | aliased(2);
29 8 |
30 9 | return x;
compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/error.invalid-use-ref-added-to-dep-without-type-info.expect.md
+1 -1
@@ -25,7 +25,7 @@ function Foo({ a }) {
25 3 | const ref = useRef();
26 4 | // type information is lost here as we don't track types of fields
27 > 5 | const val = { ref };
28 - | ^^^ [ReactForget] InvalidReact: Ref values (the `current` property) may not be accessed during render. (https://react.dev/reference/react/useRef). Cannot access ref value at capture $29:TObject<BuiltInUseRefId> (5:5)
28 + | ^^^ InvalidReact: Ref values (the `current` property) may not be accessed during render. (https://react.dev/reference/react/useRef). Cannot access ref value at capture $29:TObject<BuiltInUseRefId> (5:5)
29 6 | // without type info, we don't know that val.ref.current is a ref value so we
30 7 | // *would* end up depending on val.ref.current
31 8 | // however, this is an instance of accessing a ref during render and is disallowed
compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/error.invalid-useEffect-dep-not-memoized-bc-range-overlaps-hook.expect.md
+1 -1
@@ -30,7 +30,7 @@ function Component(props) {
30 > 10 | console.log(items);
31 | ^^^^^^^^^^^^^^^^^^^^^^^
32 > 11 | }, [items]);
33 - | ^^^^^^^^^^^^^^ [ReactForget] InvalidReact: This effect may trigger an infinite loop: one or more of its dependencies could not be memoized due to a later mutation (9:11)
33 + | ^^^^^^^^^^^^^^ InvalidReact: This effect may trigger an infinite loop: one or more of its dependencies could not be memoized due to a later mutation (9:11)
34 12 |
35 13 | return [items, state];
36 14 | }
compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/error.invalid-useEffect-dep-not-memoized.expect.md
+1 -1
@@ -27,7 +27,7 @@ function Component(props) {
27 > 7 | console.log(props.value);
28 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
29 > 8 | }, [data]);
30 - | ^^^^^^^^^^^^^ [ReactForget] InvalidReact: This effect may trigger an infinite loop: one or more of its dependencies could not be memoized due to a later mutation (6:8)
30 + | ^^^^^^^^^^^^^ InvalidReact: This effect may trigger an infinite loop: one or more of its dependencies could not be memoized due to a later mutation (6:8)
31 9 | mutate(data);
32 10 | return data;
33 11 | }
compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/error.invalid-useInsertionEffect-dep-not-memoized.expect.md
+1 -1
@@ -27,7 +27,7 @@ function Component(props) {
27 > 7 | console.log(props.value);
28 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
29 > 8 | }, [data]);
30 - | ^^^^^^^^^^^^^ [ReactForget] InvalidReact: This effect may trigger an infinite loop: one or more of its dependencies could not be memoized due to a later mutation (6:8)
30 + | ^^^^^^^^^^^^^ InvalidReact: This effect may trigger an infinite loop: one or more of its dependencies could not be memoized due to a later mutation (6:8)
31 9 | mutate(data);
32 10 | return data;
33 11 | }
compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/error.invalid-useLayoutEffect-dep-not-memoized.expect.md
+1 -1
@@ -27,7 +27,7 @@ function Component(props) {
27 > 7 | console.log(props.value);
28 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
29 > 8 | }, [data]);
30 - | ^^^^^^^^^^^^^ [ReactForget] InvalidReact: This effect may trigger an infinite loop: one or more of its dependencies could not be memoized due to a later mutation (6:8)
30 + | ^^^^^^^^^^^^^ InvalidReact: This effect may trigger an infinite loop: one or more of its dependencies could not be memoized due to a later mutation (6:8)
31 9 | mutate(data);
32 10 | return data;
33 11 | }
compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/error.invalid-useMemo-async-callback.expect.md
+1 -1
@@ -21,7 +21,7 @@ function component(a, b) {
21 > 3 | await a;
22 | ^^^^^^^^^^^^
23 > 4 | }, []);
24 - | ^^^^ [ReactForget] InvalidReact: useMemo callbacks may not be async or generator functions (2:4)
24 + | ^^^^ InvalidReact: useMemo callbacks may not be async or generator functions (2:4)
25 5 | return x;
26 6 | }
27 7 |
compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/error.invalid-useMemo-callback-args.expect.md
+1 -1
@@ -15,7 +15,7 @@ function component(a, b) {
15 ```
16 1 | function component(a, b) {
17 > 2 | let x = useMemo((c) => a, []);
18 - | ^^^^^^^^ [ReactForget] InvalidReact: useMemo callbacks may not accept any arguments (2:2)
18 + | ^^^^^^^^ InvalidReact: useMemo callbacks may not accept any arguments (2:2)
19 3 | return x;
20 4 | }
21 5 |
compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/error.modify-state-2.expect.md
+1 -1
@@ -20,7 +20,7 @@ function Foo() {
20 4 | const [state, setState] = useState({ foo: { bar: 3 } });
21 5 | const foo = state.foo;
22 > 6 | foo.bar = 1;
23 - | ^^^ [ReactForget] InvalidReact: Mutating a value returned from 'useState()', which should not be mutated. Use the setter function to update instead. (6:6)
23 + | ^^^ InvalidReact: Mutating a value returned from 'useState()', which should not be mutated. Use the setter function to update instead. (6:6)
24 7 | return state;
25 8 | }
26 9 |
compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/error.modify-state.expect.md
+1 -1
@@ -19,7 +19,7 @@ function Foo() {
19 3 | function Foo() {
20 4 | let [state, setState] = useState({});
21 > 5 | state.foo = 1;
22 - | ^^^^^ [ReactForget] InvalidReact: Mutating a value returned from 'useState()', which should not be mutated. Use the setter function to update instead. (5:5)
22 + | ^^^^^ InvalidReact: Mutating a value returned from 'useState()', which should not be mutated. Use the setter function to update instead. (5:5)
23 6 | return state;
24 7 | }
25 8 |
compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/error.mutate-captured-arg-separately.expect.md
+1 -1
@@ -22,7 +22,7 @@ function component(a) {
22 2 | function component(a) {
23 3 | let y = function () {
24 > 4 | m(x);
25 - | ^^^^ [ReactForget] Todo: Handle non-const declarations for hoisting. variable "x" declared with let (4:4)
25 + | ^^^^ Todo: Handle non-const declarations for hoisting. variable "x" declared with let (4:4)
26 5 | };
27 6 |
28 7 | let x = { a };
compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/error.mutate-function-property.expect.md
+1 -1
@@ -18,7 +18,7 @@ export function ViewModeSelector(props) {
18 1 | export function ViewModeSelector(props) {
19 2 | const renderIcon = () => <AcceptIcon />;
20 > 3 | renderIcon.displayName = "AcceptIcon";
21 - | ^^^^^^^^^^ [ReactForget] InvalidReact: This mutates a variable that React considers immutable. (3:3)
21 + | ^^^^^^^^^^ InvalidReact: This mutates a variable that React considers immutable. (3:3)
22 4 |
23 5 | return <Dropdown checkableIndicator={{ children: renderIcon }} />;
24 6 | }
compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/error.mutate-global-increment-op-invalid-react.expect.md
+1 -1
@@ -18,7 +18,7 @@ function NoHooks() {
18 2 |
19 3 | function NoHooks() {
20 > 4 | renderCount++;
21 - | ^^^^^^^^^^^^^ [ReactForget] InvalidReact: This reassigns a variable which was not defined inside of the component. Components should be pure and side-effect free. If this variable is used in rendering, use useState instead. (https://react.dev/learn/keeping-components-pure) (4:4)
21 + | ^^^^^^^^^^^^^ InvalidReact: This reassigns a variable which was not defined inside of the component. Components should be pure and side-effect free. If this variable is used in rendering, use useState instead. (https://react.dev/learn/keeping-components-pure) (4:4)
22 5 | return <div />;
23 6 | }
24 7 |
compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/error.mutate-hook-argument.expect.md
+1 -1
@@ -15,7 +15,7 @@ function useHook(a, b) {
15 ```
16 1 | function useHook(a, b) {
17 > 2 | b.test = 1;
18 - | ^ [ReactForget] InvalidReact: Mutating props or hook arguments is not allowed. Consider using a local variable instead. (2:2)
18 + | ^ InvalidReact: Mutating props or hook arguments is not allowed. Consider using a local variable instead. (2:2)
19 3 | a.test = 2;
20 4 | }
21 5 |
compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/error.mutate-property-from-global.expect.md
+1 -1
@@ -18,7 +18,7 @@ function Foo() {
18 2 |
19 3 | function Foo() {
20 > 4 | delete wat.foo;
21 - | ^^^ [ReactForget] InvalidReact: Writing to a variable defined outside a component or hook is not allowed. Consider using an effect. (4:4)
21 + | ^^^ InvalidReact: Writing to a variable defined outside a component or hook is not allowed. Consider using an effect. (4:4)
22 5 | return wat;
23 6 | }
24 7 |
compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/error.mutate-props.expect.md
+1 -1
@@ -15,7 +15,7 @@ function Foo(props) {
15 ```
16 1 | function Foo(props) {
17 > 2 | props.test = 1;
18 - | ^^^^^ [ReactForget] InvalidReact: Mutating props or hook arguments is not allowed. Consider using a local variable instead. (2:2)
18 + | ^^^^^ InvalidReact: Mutating props or hook arguments is not allowed. Consider using a local variable instead. (2:2)
19 3 | return null;
20 4 | }
21 5 |
compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/error.not-useEffect-external-mutate.expect.md
+1 -1
@@ -20,7 +20,7 @@ function Component(props) {
20 3 | function Component(props) {
21 4 | foo(() => {
22 > 5 | x.a = 10;
23 - | ^ [ReactForget] InvalidReact: Writing to a variable defined outside a component or hook is not allowed. Consider using an effect. (5:5)
23 + | ^ InvalidReact: Writing to a variable defined outside a component or hook is not allowed. Consider using an effect. (5:5)
24 6 | x.a = 20;
25 7 | });
26 8 | }
compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/error.propertyload-hook.expect.md
+2 -2
@@ -15,9 +15,9 @@ function Component() {
15 ```
16 1 | function Component() {
17 > 2 | const x = Foo.useFoo;
18 - | ^^^^^^^^^^ [ReactForget] InvalidReact: Hooks may not be referenced as normal values, they must be called. See the Rules of Hooks (https://react.dev/warnings/invalid-hook-call-warning) (2:2)
18 + | ^^^^^^^^^^ InvalidReact: Hooks may not be referenced as normal values, they must be called. See the Rules of Hooks (https://react.dev/warnings/invalid-hook-call-warning) (2:2)
19
20 -[ReactForget] InvalidReact: Hooks may not be referenced as normal values, they must be called. See the Rules of Hooks (https://react.dev/warnings/invalid-hook-call-warning) (3:3)
20 +InvalidReact: Hooks may not be referenced as normal values, they must be called. See the Rules of Hooks (https://react.dev/warnings/invalid-hook-call-warning) (3:3)
21 3 | return x();
22 4 | }
23 5 |
compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/error.reassignment-to-global.expect.md
+2 -2
@@ -17,9 +17,9 @@ function Component() {
17 1 | function Component() {
18 2 | // Cannot assign to globals
19 > 3 | someUnknownGlobal = true;
20 - | ^^^^^^^^^^^^^^^^^^^^^^^^ [ReactForget] InvalidReact: This reassigns a variable which was not defined inside of the component. Components should be pure and side-effect free. If this variable is used in rendering, use useState instead. (https://react.dev/learn/keeping-components-pure) (3:3)
20 + | ^^^^^^^^^^^^^^^^^^^^^^^^ InvalidReact: This reassigns a variable which was not defined inside of the component. Components should be pure and side-effect free. If this variable is used in rendering, use useState instead. (https://react.dev/learn/keeping-components-pure) (3:3)
21
22 -[ReactForget] InvalidReact: This reassigns a variable which was not defined inside of the component. Components should be pure and side-effect free. If this variable is used in rendering, use useState instead. (https://react.dev/learn/keeping-components-pure) (4:4)
22 +InvalidReact: This reassigns a variable which was not defined inside of the component. Components should be pure and side-effect free. If this variable is used in rendering, use useState instead. (https://react.dev/learn/keeping-components-pure) (4:4)
23 4 | moduleLocal = true;
24 5 | }
25 6 |
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 - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ [ReactForget] 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 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)
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 - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ [ReactForget] 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 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)
26 2 | function lowercasecomponent() {
27 3 | const x = [];
28 4 | return <div>{x}</div>;
compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/error.store-property-in-global.expect.md
+1 -1
@@ -18,7 +18,7 @@ function Foo() {
18 2 |
19 3 | function Foo() {
20 > 4 | wat.test = 1;
21 - | ^^^ [ReactForget] InvalidReact: Writing to a variable defined outside a component or hook is not allowed. Consider using an effect. (4:4)
21 + | ^^^ InvalidReact: Writing to a variable defined outside a component or hook is not allowed. Consider using an effect. (4:4)
22 5 | return wat;
23 6 | }
24 7 |
compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/error.todo-early-return--early-return-within-reactive-scope.expect.md
+1 -1
@@ -28,7 +28,7 @@ export const FIXTURE_ENTRYPOINT = {
28 5 | x.push(props.a);
29 6 | // oops no memo!
30 > 7 | return x;
31 - | ^ [ReactForget] Todo: Support early return within a reactive scope (7:7)
31 + | ^ Todo: Support early return within a reactive scope (7:7)
32 8 | } else {
33 9 | return foo();
34 10 | }
compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/error.todo-for-in-loop-with-context-variable-iterator.expect.md
+1 -1
@@ -48,7 +48,7 @@ export const FIXTURE_ENTRYPOINT = {
48 > 14 | );
49 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
50 > 15 | }
51 - | ^^^^ [ReactForget] Todo: Support non-trivial ForOf inits (8:15)
51 + | ^^^^ Todo: Support non-trivial ForOf inits (8:15)
52 16 | return <div>{items}</div>;
53 17 | }
54 18 |
compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/error.todo-for-loop-with-context-variable-iterator.expect.md
+1 -1
@@ -22,7 +22,7 @@ function Component() {
22 4 | // NOTE: `i` is a context variable because it's reassigned and also referenced
23 5 | // within a closure, the `onClick` handler of each item
24 > 6 | for (let i = MIN; i <= MAX; i += INCREMENT) {
25 - | ^^^^^^^^^^^ [ReactForget] Todo: Support for loops where the index variable is a context variable. 'i' is a context variable (6:6)
25 + | ^^^^^^^^^^^ Todo: Support for loops where the index variable is a context variable. 'i' is a context variable (6:6)
26 7 | items.push(<Stringify key={i} onClick={() => data.set(i)} />);
27 8 | }
28 9 | return items;
compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/error.todo-for-of-loop-with-context-variable-iterator.expect.md
+1 -1
@@ -48,7 +48,7 @@ export const FIXTURE_ENTRYPOINT = {
48 > 14 | );
49 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
50 > 15 | }
51 - | ^^^^ [ReactForget] Todo: Support non-trivial ForOf inits (8:15)
51 + | ^^^^ Todo: Support non-trivial ForOf inits (8:15)
52 16 | return <div>{items}</div>;
53 17 | }
54 18 |
compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/error.todo-function-expression-references-later-variable-declaration.expect.md
+1 -1
@@ -20,7 +20,7 @@ function Component() {
20 1 | function Component() {
21 2 | let callback = () => {
22 > 3 | onClick = () => {};
23 - | ^^^^^^^^^^^^^^^^^^ [ReactForget] Todo: Handle non-const declarations for hoisting. variable "onClick" declared with let (3:3)
23 + | ^^^^^^^^^^^^^^^^^^ Todo: Handle non-const declarations for hoisting. variable "onClick" declared with let (3:3)
24 4 | };
25 5 | let onClick;
26 6 |
compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/error.todo-function-expression-references-variable-its-assigned-to.expect.md
+1 -1
@@ -18,7 +18,7 @@ function Component() {
18 1 | function Component() {
19 2 | let callback = () => {
20 > 3 | callback = null;
21 - | ^^^^^^^^^^^^^^^ [ReactForget] Todo: Handle non-const declarations for hoisting. variable "callback" declared with let (3:3)
21 + | ^^^^^^^^^^^^^^^ Todo: Handle non-const declarations for hoisting. variable "callback" declared with let (3:3)
22 4 | };
23 5 | return <div onClick={callback} />;
24 6 | }
compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/error.todo-handle-update-context-identifiers.expect.md
+1 -1
@@ -25,7 +25,7 @@ export const FIXTURE_ENTRYPOINT = {
25 2 | let counter = 2;
26 3 | const fn = () => {
27 > 4 | return counter++;
28 - | ^^^^^^^^^ [ReactForget] Todo: (BuildHIR::lowerExpression) Handle UpdateExpression to variables captured within lambdas. (4:4)
28 + | ^^^^^^^^^ Todo: (BuildHIR::lowerExpression) Handle UpdateExpression to variables captured within lambdas. (4:4)
29 5 | };
30 6 |
31 7 | return fn();
compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/error.todo-hoist-function-decls.expect.md
+1 -1
@@ -17,7 +17,7 @@ function Component() {
17 ```
18 1 | function Component() {
19 > 2 | return get2();
20 - | ^^^^^^ [ReactForget] Todo: Unsupported declaration type for hoisting. variable "get2" declared with FunctionDeclaration (2:2)
20 + | ^^^^^^ Todo: Unsupported declaration type for hoisting. variable "get2" declared with FunctionDeclaration (2:2)
21 3 | function get2() {
22 4 | return 2;
23 5 | }
compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/error.todo-hoisted-function-in-unreachable-code.expect.md
+1 -1
@@ -19,7 +19,7 @@ function Component() {
19 4 |
20 5 | // This is unreachable from a control-flow perspective, but it gets hoisted
21 > 6 | function Foo() {}
22 - | ^^^^^^^^^^^^^^^^^ [ReactForget] Todo: Support functions with unreachable code that may contain hoisted declarations (6:6)
22 + | ^^^^^^^^^^^^^^^^^ Todo: Support functions with unreachable code that may contain hoisted declarations (6:6)
23 7 | }
24 8 |
25 ```
compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/error.todo-hoisting-simple-var-declaration.expect.md
+1 -1
@@ -28,7 +28,7 @@ export const FIXTURE_ENTRYPOINT = {
28 5 | }
29 6 | const result = addOne(2);
30 > 7 | var a = 1;
31 - | ^^^^^^^^^^ [ReactForget] Todo: (BuildHIR::lowerStatement) Handle var kinds in VariableDeclaration (7:7)
31 + | ^^^^^^^^^^ Todo: (BuildHIR::lowerStatement) Handle var kinds in VariableDeclaration (7:7)
32 8 |
33 9 | return result; // OK: returns NaN. The code is semantically wrong but technically correct
34 10 | }
compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/error.todo-kitchensink.expect.md
+15 -15
@@ -82,35 +82,35 @@ let moduleLocal = false;
82 1 | function foo([a, b], { c, d, e = "e" }, f = "f", ...args) {
83 2 | let i = 0;
84 > 3 | var x = [];
85 - | ^^^^^^^^^^^ [ReactForget] Todo: (BuildHIR::lowerStatement) Handle var kinds in VariableDeclaration (3:3)
85 + | ^^^^^^^^^^^ Todo: (BuildHIR::lowerStatement) Handle var kinds in VariableDeclaration (3:3)
86
87 -[ReactForget] Todo: (BuildHIR::lowerStatement) Handle ClassDeclaration statements (5:10)
87 +Todo: (BuildHIR::lowerStatement) Handle ClassDeclaration statements (5:10)
88
89 -[ReactForget] Todo: (BuildHIR::lowerStatement) Handle non-variable initialization in ForStatement (20:22)
89 +Todo: (BuildHIR::lowerStatement) Handle non-variable initialization in ForStatement (20:22)
90
91 -[ReactForget] Todo: (BuildHIR::lowerStatement) Handle non-variable initialization in ForStatement (23:25)
91 +Todo: (BuildHIR::lowerStatement) Handle non-variable initialization in ForStatement (23:25)
92
93 -[ReactForget] Todo: (BuildHIR::lowerStatement) Handle non-variable initialization in ForStatement (26:28)
93 +Todo: (BuildHIR::lowerStatement) Handle non-variable initialization in ForStatement (26:28)
94
95 -[ReactForget] Todo: (BuildHIR::lowerStatement) Handle empty test in ForStatement (26:28)
95 +Todo: (BuildHIR::lowerStatement) Handle empty test in ForStatement (26:28)
96
97 -[ReactForget] Todo: (BuildHIR::lowerExpression) Handle tagged template with interpolations (30:32)
97 +Todo: (BuildHIR::lowerExpression) Handle tagged template with interpolations (30:32)
98
99 -[ReactForget] Todo: (BuildHIR::lowerExpression) Handle tagged template where cooked value is different from raw value (34:34)
99 +Todo: (BuildHIR::lowerExpression) Handle tagged template where cooked value is different from raw value (34:34)
100
101 -[ReactForget] Todo: (BuildHIR::lowerStatement) Handle Identifier inits in ForOfStatement (36:36)
101 +Todo: (BuildHIR::lowerStatement) Handle Identifier inits in ForOfStatement (36:36)
102
103 -[ReactForget] Todo: (BuildHIR::lowerStatement) Handle ArrayPattern inits in ForOfStatement (38:38)
103 +Todo: (BuildHIR::lowerStatement) Handle ArrayPattern inits in ForOfStatement (38:38)
104
105 -[ReactForget] Todo: (BuildHIR::lowerStatement) Handle ObjectPattern inits in ForOfStatement (40:40)
105 +Todo: (BuildHIR::lowerStatement) Handle ObjectPattern inits in ForOfStatement (40:40)
106
107 -[ReactForget] Todo: (BuildHIR::lowerExpression) Handle UpdateExpression with MemberExpression argument (49:49)
107 +Todo: (BuildHIR::lowerExpression) Handle UpdateExpression with MemberExpression argument (49:49)
108
109 -[ReactForget] Todo: (BuildHIR::lowerExpression) Handle UpdateExpression with MemberExpression argument (50:50)
109 +Todo: (BuildHIR::lowerExpression) Handle UpdateExpression with MemberExpression argument (50:50)
110
111 -[ReactForget] Todo: (BuildHIR::node.lowerReorderableExpression) Expression type 'MemberExpression' cannot be safely reordered (57:57)
111 +Todo: (BuildHIR::node.lowerReorderableExpression) Expression type 'MemberExpression' cannot be safely reordered (57:57)
112
113 -[ReactForget] Todo: (BuildHIR::node.lowerReorderableExpression) Expression type 'BinaryExpression' cannot be safely reordered (53:53)
113 +Todo: (BuildHIR::node.lowerReorderableExpression) Expression type 'BinaryExpression' cannot be safely reordered (53:53)
114 4 |
115 5 | class Bar {
116 6 | #secretSauce = 42;
compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/error.todo-logical-expression-within-try-catch.expect.md
+1 -1
@@ -21,7 +21,7 @@ function Component(props) {
21 2 | let result;
22 3 | try {
23 > 4 | result = props.cond && props.foo;
24 - | ^^^^^ [ReactForget] Todo: Support value blocks (conditional, logical, optional chaining, etc) within a try/catch statement (4:4)
24 + | ^^^^^ Todo: Support value blocks (conditional, logical, optional chaining, etc) within a try/catch statement (4:4)
25 5 | } catch (e) {
26 6 | console.log(e);
27 7 | }
compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/error.todo-multiple-calls-to-hoisted-callback-from-other-callback.expect.md
+1 -1
@@ -37,7 +37,7 @@ export const FIXTURE_ENTRYPONT = {
37 9 | <>
38 10 | <div onClick={() => onClick(true)} />
39 > 11 | <div onClick={() => onClick(false)} />
40 - | ^^^^^^^ [ReactForget] Invariant: [InferReferenceEffects] Context variables are always mutable. (11:11)
40 + | ^^^^^^^ Invariant: [InferReferenceEffects] Context variables are always mutable. (11:11)
41 12 | </>
42 13 | );
43 14 | };
compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/error.todo-nested-method-calls-lower-property-load-into-temporary.expect.md
+1 -1
@@ -24,7 +24,7 @@ export const FIXTURE_ENTRYPOINT = {
24 3 | function Component(props) {
25 4 | const items = makeArray(0, 1, 2, null, 4, false, 6);
26 > 5 | const max = Math.max(...items.filter(Boolean));
27 - | ^^^^^^^^ [ReactForget] Invariant: [Codegen] Internal error: MethodCall::property must be an unpromoted + unmemoized MemberExpression. Got a 'Identifier' (5:5)
27 + | ^^^^^^^^ Invariant: [Codegen] Internal error: MethodCall::property must be an unpromoted + unmemoized MemberExpression. Got a 'Identifier' (5:5)
28 6 | return max;
29 7 | }
30 8 |
compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/error.todo-object-expression-computed-key-modified-during-after-construction-sequence-expr.expect.md
+1 -1
@@ -27,7 +27,7 @@ export const FIXTURE_ENTRYPOINT = {
27 4 | const key = {};
28 5 | const context = {
29 > 6 | [(mutate(key), key)]: identity([props.value]),
30 - | ^^^^^^^^^^^^^^^^ [ReactForget] Todo: (BuildHIR::lowerExpression) Expected Identifier, got SequenceExpression key in ObjectExpression (6:6)
30 + | ^^^^^^^^^^^^^^^^ Todo: (BuildHIR::lowerExpression) Expected Identifier, got SequenceExpression key in ObjectExpression (6:6)
31 7 | };
32 8 | mutate(key);
33 9 | return context;
compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/error.todo-object-expression-computed-key-modified-during-after-construction.expect.md
+1 -1
@@ -27,7 +27,7 @@ export const FIXTURE_ENTRYPOINT = {
27 4 | const key = {};
28 5 | const context = {
29 > 6 | [mutateAndReturn(key)]: identity([props.value]),
30 - | ^^^^^^^^^^^^^^^^^^^^ [ReactForget] Todo: (BuildHIR::lowerExpression) Expected Identifier, got CallExpression key in ObjectExpression (6:6)
30 + | ^^^^^^^^^^^^^^^^^^^^ Todo: (BuildHIR::lowerExpression) Expected Identifier, got CallExpression key in ObjectExpression (6:6)
31 7 | };
32 8 | mutate(key);
33 9 | return context;
compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/error.todo-object-expression-computed-key-mutate-key-while-constructing-object.expect.md
+1 -1
@@ -26,7 +26,7 @@ export const FIXTURE_ENTRYPOINT = {
26 4 | const key = {};
27 5 | const context = {
28 > 6 | [mutateAndReturn(key)]: identity([props.value]),
29 - | ^^^^^^^^^^^^^^^^^^^^ [ReactForget] Todo: (BuildHIR::lowerExpression) Expected Identifier, got CallExpression key in ObjectExpression (6:6)
29 + | ^^^^^^^^^^^^^^^^^^^^ Todo: (BuildHIR::lowerExpression) Expected Identifier, got CallExpression key in ObjectExpression (6:6)
30 7 | };
31 8 | return context;
32 9 | }
compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/error.todo-optional-call-chain-in-logical-expr.expect.md
+1 -1
@@ -23,7 +23,7 @@ export const FIXTURE_ENTRYPONT = {
23 3 | function useFoo(props: { value: { x: string; y: string } | null }) {
24 4 | const value = props.value;
25 > 5 | return useNoAlias(value?.x, value?.y) ?? {};
26 - | ^^^^^^^^ [ReactForget] Todo: Unexpected terminal kind 'optional' for logical test block (5:5)
26 + | ^^^^^^^^ Todo: Unexpected terminal kind 'optional' for logical test block (5:5)
27 6 | }
28 7 |
29 8 | export const FIXTURE_ENTRYPONT = {
compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/error.todo-optional-call-chain-in-optional.expect.md
+1 -1
@@ -25,7 +25,7 @@ export const FIXTURE_ENTRYPONT = {
25 1 | function useFoo(props: { value: { x: string; y: string } | null }) {
26 2 | const value = props.value;
27 > 3 | return createArray(value?.x, value?.y)?.join(", ");
28 - | ^^^^^^^^ [ReactForget] Todo: Unexpected terminal kind 'optional' for optional test block (3:3)
28 + | ^^^^^^^^ Todo: Unexpected terminal kind 'optional' for optional test block (3:3)
29 4 | }
30 5 |
31 6 | function createArray<T>(...args: Array<T>): Array<T> {
compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/error.todo-optional-call-chain-in-ternary.expect.md
+1 -1
@@ -23,7 +23,7 @@ export const FIXTURE_ENTRYPONT = {
23 3 | function useFoo(props: { value: { x: string; y: string } | null }) {
24 4 | const value = props.value;
25 > 5 | return useNoAlias(value?.x, value?.y) ? {} : null;
26 - | ^^^^^^^^ [ReactForget] Todo: Unexpected terminal kind 'optional' for ternary test block (5:5)
26 + | ^^^^^^^^ Todo: Unexpected terminal kind 'optional' for ternary test block (5:5)
27 6 | }
28 7 |
29 8 | export const FIXTURE_ENTRYPONT = {
compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/error.todo-reassign-const.expect.md
+1 -1
@@ -24,7 +24,7 @@ function Component({ foo }) {
24 1 | import { Stringify } from "shared-runtime";
25 2 |
26 > 3 | function Component({ foo }) {
27 - | ^^^ [ReactForget] Todo: Support destructuring of context variables (3:3)
27 + | ^^^ Todo: Support destructuring of context variables (3:3)
28 4 | let bar = foo.bar;
29 5 | return (
30 6 | <Stringify
compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/error.todo-recursive-function-expression.expect.md
+1 -1
@@ -21,7 +21,7 @@ function Component() {
21 4 | return null;
22 5 | }
23 > 6 | return callback(x - 1);
24 - | ^^^^^^^^^^^^^^^ [ReactForget] Todo: Unsupported declaration type for hoisting. variable "callback" declared with FunctionDeclaration (6:6)
24 + | ^^^^^^^^^^^^^^^ Todo: Unsupported declaration type for hoisting. variable "callback" declared with FunctionDeclaration (6:6)
25 7 | }
26 8 | return callback(10);
27 9 | }
compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/error.todo-repro-declaration-for-all-identifiers.expect.md
+1 -1
@@ -19,7 +19,7 @@ function Foo() {
19 3 | // NOTE: this fixture previously failed during LeaveSSA;
20 4 | // double-check this code when supporting value blocks in try/catch
21 > 5 | for (let i = 0; i < 2; i++) {}
22 - | ^ [ReactForget] Todo: Support value blocks (conditional, logical, optional chaining, etc) within a try/catch statement (5:5)
22 + | ^ Todo: Support value blocks (conditional, logical, optional chaining, etc) within a try/catch statement (5:5)
23 6 | } catch {}
24 7 | }
25 8 |
compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/error.todo-repro-named-function-with-shadowed-local-same-name.expect.md
+1 -1
@@ -22,7 +22,7 @@ function Component(props) {
22 7 | return hasErrors;
23 8 | }
24 > 9 | return hasErrors();
25 - | ^^^^^^^^^ [ReactForget] Invariant: [hoisting] Expected value for identifier to be initialized. hasErrors_0$16 (9:9)
25 + | ^^^^^^^^^ Invariant: [hoisting] Expected value for identifier to be initialized. hasErrors_0$16 (9:9)
26 10 | }
27 11 |
28 ```
compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/error.todo-useCallback-accesses-ref-mutated-later-via-function-preserve-memoization.expect.md
+1 -1
@@ -45,7 +45,7 @@ export const FIXTURE_ENTRYPOINT = {
45 > 10 | ref.current.inner = event.target.value;
46 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
47 > 11 | });
48 - | ^^^^ [ReactForget] InvalidReact: This value was manually memoized, but cannot be memoized under Forget because it may be mutated after it is memoized (7:11)
48 + | ^^^^ InvalidReact: This value was manually memoized, but cannot be memoized under Forget because it may be mutated after it is memoized (7:11)
49 12 |
50 13 | // The ref is modified later, extending its range and preventing memoization of onChange
51 14 | const reset = () => {
compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/error.todo-useCallback-set-ref-nested-property-ref-modified-later-preserve-memoization.expect.md
+1 -1
@@ -42,7 +42,7 @@ export const FIXTURE_ENTRYPOINT = {
42 > 10 | ref.current.inner = event.target.value;
43 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
44 > 11 | });
45 - | ^^^^ [ReactForget] InvalidReact: This value was manually memoized, but cannot be memoized under Forget because it may be mutated after it is memoized (7:11)
45 + | ^^^^ InvalidReact: This value was manually memoized, but cannot be memoized under Forget because it may be mutated after it is memoized (7:11)
46 12 |
47 13 | // The ref is modified later, extending its range and preventing memoization of onChange
48 14 | ref.current.inner = null;
compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/error.todo-useMemo-with-optional.expect.md
+1 -1
@@ -23,7 +23,7 @@ function Component(props) {
23 > 4 | return [props.value];
24 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^
25 > 5 | }) || []
26 - | ^^^^^^^^^^^^^ [ReactForget] Todo: Support labeled statements combined with value blocks (conditional, logical, optional chaining, etc) (3:5)
26 + | ^^^^^^^^^^^^^ Todo: Support labeled statements combined with value blocks (conditional, logical, optional chaining, etc) (3:5)
27 6 | );
28 7 | }
29 8 |
compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/error.todo.try-catch-with-throw.expect.md
+1 -1
@@ -21,7 +21,7 @@ function Component(props) {
21 2 | let x;
22 3 | try {
23 > 4 | throw [];
24 - | ^^^^^^^^^ [ReactForget] Todo: (BuildHIR::lowerStatement) Support ThrowStatement inside of try/catch (4:4)
24 + | ^^^^^^^^^ Todo: (BuildHIR::lowerStatement) Support ThrowStatement inside of try/catch (4:4)
25 5 | } catch (e) {
26 6 | x.push(e);
27 7 | }
compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/error.unconditional-set-state-in-render-after-loop-break.expect.md
+1 -1
@@ -25,7 +25,7 @@ function Component(props) {
25 9 | }
26 10 | }
27 > 11 | setState(true);
28 - | ^^^^^^^^ [ReactForget] InvalidReact: This is an unconditional set state during render, which will trigger an infinite loop. (https://react.dev/reference/react/useState) (11:11)
28 + | ^^^^^^^^ InvalidReact: This is an unconditional set state during render, which will trigger an infinite loop. (https://react.dev/reference/react/useState) (11:11)
29 12 | return state;
30 13 | }
31 14 |
compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/error.unconditional-set-state-in-render-after-loop.expect.md
+1 -1
@@ -20,7 +20,7 @@ function Component(props) {
20 4 | for (const _ of props) {
21 5 | }
22 > 6 | setState(true);
23 - | ^^^^^^^^ [ReactForget] InvalidReact: This is an unconditional set state during render, which will trigger an infinite loop. (https://react.dev/reference/react/useState) (6:6)
23 + | ^^^^^^^^ InvalidReact: This is an unconditional set state during render, which will trigger an infinite loop. (https://react.dev/reference/react/useState) (6:6)
24 7 | return state;
25 8 | }
26 9 |
compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/error.unconditional-set-state-in-render-with-loop-throw.expect.md
+1 -1
@@ -25,7 +25,7 @@ function Component(props) {
25 9 | }
26 10 | }
27 > 11 | setState(true);
28 - | ^^^^^^^^ [ReactForget] InvalidReact: This is an unconditional set state during render, which will trigger an infinite loop. (https://react.dev/reference/react/useState) (11:11)
28 + | ^^^^^^^^ InvalidReact: This is an unconditional set state during render, which will trigger an infinite loop. (https://react.dev/reference/react/useState) (11:11)
29 12 | return state;
30 13 | }
31 14 |
compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/error.unconditional-set-state-lambda.expect.md
+1 -1
@@ -23,7 +23,7 @@ function Component(props) {
23 6 | setX(1);
24 7 | };
25 > 8 | foo();
26 - | ^^^ [ReactForget] InvalidReact: This is an unconditional set state during render, which will trigger an infinite loop. (https://react.dev/reference/react/useState) (8:8)
26 + | ^^^ InvalidReact: This is an unconditional set state during render, which will trigger an infinite loop. (https://react.dev/reference/react/useState) (8:8)
27 9 |
28 10 | return [x];
29 11 | }
compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/error.unconditional-set-state-nested-function-expressions.expect.md
+1 -1
@@ -31,7 +31,7 @@ function Component(props) {
31 14 | bar();
32 15 | };
33 > 16 | baz();
34 - | ^^^ [ReactForget] InvalidReact: This is an unconditional set state during render, which will trigger an infinite loop. (https://react.dev/reference/react/useState) (16:16)
34 + | ^^^ InvalidReact: This is an unconditional set state during render, which will trigger an infinite loop. (https://react.dev/reference/react/useState) (16:16)
35 17 |
36 18 | return [x];
37 19 | }
compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/error.useMemo-callback-generator.expect.md
+1 -1
@@ -21,7 +21,7 @@ function component(a, b) {
21 4 | // add support for generators in the future.
22 5 | let x = useMemo(function* () {
23 > 6 | yield a;
24 - | ^^^^^^^ [ReactForget] Todo: (BuildHIR::lowerExpression) Handle YieldExpression expressions (6:6)
24 + | ^^^^^^^ Todo: (BuildHIR::lowerExpression) Handle YieldExpression expressions (6:6)
25 7 | }, []);
26 8 | return x;
27 9 | }
compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/error.useMemo-non-literal-depslist.expect.md
+1 -1
@@ -31,7 +31,7 @@ export const FIXTURE_ENTRYPOINT = {
31 8 | return text.toUpperCase();
32 9 | },
33 > 10 | hasDeps ? null : [text] // should be DCE'd
34 - | ^^^^^^^^^^^^^^^^^^^^^^^ [ReactForget] InvalidReact: Expected the dependency list for useMemo to be an array literal without rest spreads (10:10)
34 + | ^^^^^^^^^^^^^^^^^^^^^^^ InvalidReact: Expected the dependency list for useMemo to be an array literal without rest spreads (10:10)
35 11 | );
36 12 | return resolvedText;
37 13 | }
compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/error.validate-memoized-effect-deps-invalidated-dep-value.expect.md
+1 -1
@@ -35,7 +35,7 @@ export const FIXTURE_ENTRYPOINT = {
35 > 12 | console.log(y);
36 | ^^^^^^^^^^^^^^^^^^^
37 > 13 | }, [y]);
38 - | ^^^^^^^^^^ [ReactForget] InvalidReact: This effect may trigger an infinite loop: one or more of its dependencies could not be memoized due to a later mutation (11:13)
38 + | ^^^^^^^^^^ InvalidReact: This effect may trigger an infinite loop: one or more of its dependencies could not be memoized due to a later mutation (11:13)
39 14 | }
40 15 |
41 16 | export const FIXTURE_ENTRYPOINT = {
compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/error.validate-mutate-ref-arg-in-render.expect.md
+1 -1
@@ -23,7 +23,7 @@ export const FIXTURE_ENTRYPOINT = {
23 1 | // @validateRefAccessDuringRender:true
24 2 | function Foo(props, ref) {
25 > 3 | console.log(ref.current);
26 - | ^^^^^^^^^^^ [ReactForget] InvalidReact: Ref values (the `current` property) may not be accessed during render. (https://react.dev/reference/react/useRef). Cannot access ref value at read $16:TObject<BuiltInRefValue> (3:3)
26 + | ^^^^^^^^^^^ InvalidReact: Ref values (the `current` property) may not be accessed during render. (https://react.dev/reference/react/useRef). Cannot access ref value at read $16:TObject<BuiltInRefValue> (3:3)
27 4 | return <div>{props.bar}</div>;
28 5 | }
29 6 |
compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/fbt/error.todo-fbt-unknown-enum-value.expect.md
+1 -1
@@ -22,7 +22,7 @@ function Component({ a, b }) {
22 5 | <fbt desc="Description">
23 6 | <fbt:enum enum-range={["avalue1", "avalue1"]} value={a} />{" "}
24 > 7 | <fbt:enum enum-range={["bvalue1", "bvalue2"]} value={b} />
25 - | ^^^^^^^^ [ReactForget] Todo: Support <fbt> tags with multiple <fbt:enum> values (7:7)
25 + | ^^^^^^^^ Todo: Support <fbt> tags with multiple <fbt:enum> values (7:7)
26 8 | </fbt>
27 9 | );
28 10 | }
compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/fbt/error.todo-locally-require-fbt.expect.md
+1 -1
@@ -17,7 +17,7 @@ function Component(props) {
17 2 | const fbt = require("fbt");
18 3 |
19 > 4 | return <fbt desc="Description">{"Text"}</fbt>;
20 - | ^^^ [ReactForget] Todo: Support <fbt> tags where 'fbt' is a local variable instead of a global (4:4)
20 + | ^^^ Todo: Support <fbt> tags where 'fbt' is a local variable instead of a global (4:4)
21 5 | }
22 6 |
23 ```
compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/preserve-memo-validation/error.false-positive-useMemo-infer-mutate-deps.expect.md
+1 -1
@@ -36,7 +36,7 @@ export const FIXTURE_ENTRYPOINT = {
36 > 13 | return identity(val);
37 | ^^^^^^^^^^^^^^^^^^^^^^^^^
38 > 14 | }, [val]);
39 - | ^^^^ [ReactForget] InvalidReact: This value was manually memoized, but cannot be memoized under Forget because it may be mutated after it is memoized (12:14)
39 + | ^^^^ InvalidReact: This value was manually memoized, but cannot be memoized under Forget because it may be mutated after it is memoized (12:14)
40 15 | }
41 16 |
42 17 | export const FIXTURE_ENTRYPOINT = {
compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/preserve-memo-validation/error.invalid-useCallback-captures-reassigned-context.expect.md
+2 -2
@@ -33,9 +33,9 @@ export const FIXTURE_ENTRYPOINT = {
33 10 |
34 11 | // makeArray() is captured, but depsList contains [props]
35 > 12 | const cb = useCallback(() => [x], [x]);
36 - | ^^^^^^^^^ [ReactForget] InvalidReact: This value was manually memoized, but cannot be memoized under Forget because it may be mutated after it is memoized (12:12)
36 + | ^^^^^^^^^ InvalidReact: This value was manually memoized, but cannot be memoized under Forget because it may be mutated after it is memoized (12:12)
37
38 -[ReactForget] InvalidReact: This value was manually memoized, but cannot be memoized under Forget because it may be mutated after it is memoized (12:12)
38 +InvalidReact: This value was manually memoized, but cannot be memoized under Forget because it may be mutated after it is memoized (12:12)
39 13 |
40 14 | x = makeArray();
41 15 |
compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/preserve-memo-validation/error.maybe-invalid-useCallback-read-maybeRef.expect.md
+1 -1
@@ -17,7 +17,7 @@ function useHook(maybeRef) {
17 ## Error
18
19 ```
20 -[ReactForget] Todo: Could not preserve manual memoization because an inferred dependency does not match the dependency list in source. The inferred dependency was `maybeRef.current`, but the source dependencies were [maybeRef]. Detail: differences in ref.current access
20 +Todo: Could not preserve manual memoization because an inferred dependency does not match the dependency list in source. The inferred dependency was `maybeRef.current`, but the source dependencies were [maybeRef]. Detail: differences in ref.current access
21 ```
22
23
\ No newline at end of file
compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/preserve-memo-validation/error.maybe-invalid-useMemo-read-maybeRef.expect.md
+1 -1
@@ -17,7 +17,7 @@ function useHook(maybeRef, shouldRead) {
17 ## Error
18
19 ```
20 -[ReactForget] Todo: Could not preserve manual memoization because an inferred dependency does not match the dependency list in source. The inferred dependency was `maybeRef.current`, but the source dependencies were [shouldRead, maybeRef]. Detail: differences in ref.current access
20 +Todo: Could not preserve manual memoization because an inferred dependency does not match the dependency list in source. The inferred dependency was `maybeRef.current`, but the source dependencies were [shouldRead, maybeRef]. Detail: differences in ref.current access
21 ```
22
23
\ No newline at end of file
compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/preserve-memo-validation/error.todo-useCallback-captures-invalidating-value.expect.md
+1 -1
@@ -31,7 +31,7 @@ export const FIXTURE_ENTRYPOINT = {
31 11 | x.push(props);
32 12 |
33 > 13 | return useCallback(() => [x], [x]);
34 - | ^^^^^^^^^ [ReactForget] InvalidReact: This value was manually memoized, but cannot be memoized under Forget because it may be mutated after it is memoized (13:13)
34 + | ^^^^^^^^^ InvalidReact: This value was manually memoized, but cannot be memoized under Forget because it may be mutated after it is memoized (13:13)
35 14 | }
36 15 |
37 16 | export const FIXTURE_ENTRYPOINT = {
compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/preserve-memo-validation/error.useCallback-aliased-var.expect.md
+1 -1
@@ -19,7 +19,7 @@ function useHook(x) {
19 ## Error
20
21 ```
22 -[ReactForget] Todo: Could not preserve manual memoization because an inferred dependency does not match the dependency list in source. The inferred dependency was `aliasedX`, but the source dependencies were [x, aliasedProp]. Detail: inferred different dependency than source
22 +Todo: Could not preserve manual memoization because an inferred dependency does not match the dependency list in source. The inferred dependency was `aliasedX`, but the source dependencies were [x, aliasedProp]. Detail: inferred different dependency than source
23 ```
24
25
\ No newline at end of file
compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/preserve-memo-validation/error.useCallback-conditional-access-noAlloc.expect.md
+1 -1
@@ -25,7 +25,7 @@ export const FIXTURE_ENTRYPOINT = {
25 ## Error
26
27 ```
28 -[ReactForget] Todo: Could not preserve manual memoization because an inferred dependency does not match the dependency list in source. The inferred dependency was `propB`, but the source dependencies were [propA, propB.x.y]. Detail: inferred less specific property than source
28 +Todo: Could not preserve manual memoization because an inferred dependency does not match the dependency list in source. The inferred dependency was `propB`, but the source dependencies were [propA, propB.x.y]. Detail: inferred less specific property than source
29 ```
30
31
\ No newline at end of file
compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/preserve-memo-validation/error.useCallback-infer-less-specific-conditional-access.expect.md
+1 -1
@@ -24,7 +24,7 @@ function Component({ propA, propB }) {
24 ## Error
25
26 ```
27 -[ReactForget] Todo: Could not preserve manual memoization because an inferred dependency does not match the dependency list in source. The inferred dependency was `propA`, but the source dependencies were [propA.a, propB.x.y]. Detail: inferred less specific property than source
27 +Todo: Could not preserve manual memoization because an inferred dependency does not match the dependency list in source. The inferred dependency was `propA`, but the source dependencies were [propA.a, propB.x.y]. Detail: inferred less specific property than source
28 ```
29
30
\ No newline at end of file
compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/preserve-memo-validation/error.useCallback-property-call-dep.expect.md
+1 -1
@@ -17,7 +17,7 @@ function Component({ propA }) {
17 ## Error
18
19 ```
20 -[ReactForget] Todo: Could not preserve manual memoization because an inferred dependency does not match the dependency list in source. The inferred dependency was `propA`, but the source dependencies were [propA.x]. Detail: inferred less specific property than source
20 +Todo: Could not preserve manual memoization because an inferred dependency does not match the dependency list in source. The inferred dependency was `propA`, but the source dependencies were [propA.x]. Detail: inferred less specific property than source
21 ```
22
23
\ No newline at end of file
compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/preserve-memo-validation/error.useMemo-aliased-var.expect.md
+1 -1
@@ -19,7 +19,7 @@ function useHook(x) {
19 ## Error
20
21 ```
22 -[ReactForget] Todo: Could not preserve manual memoization because an inferred dependency does not match the dependency list in source. The inferred dependency was `x`, but the source dependencies were [aliasedX, aliasedProp]. Detail: inferred different dependency than source
22 +Todo: Could not preserve manual memoization because an inferred dependency does not match the dependency list in source. The inferred dependency was `x`, but the source dependencies were [aliasedX, aliasedProp]. Detail: inferred different dependency than source
23 ```
24
25
\ No newline at end of file
compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/preserve-memo-validation/error.useMemo-dep-not-recognized.expect.md
+1 -1
@@ -31,7 +31,7 @@ export const FIXTURE_ENTRYPOINT = {
31 11 | const x = makeArray(props);
32 12 | // react-hooks-deps lint would already fail here
33 > 13 | return useMemo(() => [x[0]], [x[0]]);
34 - | ^^^^ [ReactForget] InvalidReact: Expected the dependency list for useMemo to be an array of simple expressions (13:13)
34 + | ^^^^ InvalidReact: Expected the dependency list for useMemo to be an array of simple expressions (13:13)
35 14 | }
36 15 |
37 16 | export const FIXTURE_ENTRYPOINT = {
compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/preserve-memo-validation/error.useMemo-infer-less-specific-conditional-access.expect.md
+2 -2
@@ -24,9 +24,9 @@ function Component({ propA, propB }) {
24 ## Error
25
26 ```
27 -[ReactForget] Todo: Could not preserve manual memoization because an inferred dependency does not match the dependency list in source. The inferred dependency was `propA`, but the source dependencies were [propA.a, propB.x.y]. Detail: inferred less specific property than source
27 +Todo: Could not preserve manual memoization because an inferred dependency does not match the dependency list in source. The inferred dependency was `propA`, but the source dependencies were [propA.a, propB.x.y]. Detail: inferred less specific property than source
28
29 -[ReactForget] Todo: Could not preserve manual memoization because an inferred dependency does not match the dependency list in source. The inferred dependency was `propB`, but the source dependencies were [propA.a, propB.x.y]. Detail: inferred less specific property than source
29 +Todo: Could not preserve manual memoization because an inferred dependency does not match the dependency list in source. The inferred dependency was `propB`, but the source dependencies were [propA.a, propB.x.y]. Detail: inferred less specific property than source
30 ```
31
32
\ No newline at end of file
compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/preserve-memo-validation/error.useMemo-infer-less-specific-conditional-value-block.expect.md
+2 -2
@@ -24,9 +24,9 @@ function Component({ propA, propB }) {
24 ## Error
25
26 ```
27 -[ReactForget] Todo: Could not preserve manual memoization because an inferred dependency does not match the dependency list in source. The inferred dependency was `propA`, but the source dependencies were [propA.a, propB.x.y]. Detail: inferred less specific property than source
27 +Todo: Could not preserve manual memoization because an inferred dependency does not match the dependency list in source. The inferred dependency was `propA`, but the source dependencies were [propA.a, propB.x.y]. Detail: inferred less specific property than source
28
29 -[ReactForget] Todo: Could not preserve manual memoization because an inferred dependency does not match the dependency list in source. The inferred dependency was `propB`, but the source dependencies were [propA.a, propB.x.y]. Detail: inferred less specific property than source
29 +Todo: Could not preserve manual memoization because an inferred dependency does not match the dependency list in source. The inferred dependency was `propB`, but the source dependencies were [propA.a, propB.x.y]. Detail: inferred less specific property than source
30 ```
31
32
\ No newline at end of file
compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/preserve-memo-validation/error.useMemo-property-call-chained-object.expect.md
+1 -1
@@ -19,7 +19,7 @@ function Component({ propA }) {
19 ## Error
20
21 ```
22 -[ReactForget] Todo: Could not preserve manual memoization because an inferred dependency does not match the dependency list in source. The inferred dependency was `propA`, but the source dependencies were [propA.x]. Detail: inferred less specific property than source
22 +Todo: Could not preserve manual memoization because an inferred dependency does not match the dependency list in source. The inferred dependency was `propA`, but the source dependencies were [propA.x]. Detail: inferred less specific property than source
23 ```
24
25
\ No newline at end of file
compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/preserve-memo-validation/error.useMemo-property-call-dep.expect.md
+1 -1
@@ -17,7 +17,7 @@ function Component({ propA }) {
17 ## Error
18
19 ```
20 -[ReactForget] Todo: Could not preserve manual memoization because an inferred dependency does not match the dependency list in source. The inferred dependency was `propA`, but the source dependencies were [propA.x]. Detail: inferred less specific property than source
20 +Todo: Could not preserve manual memoization because an inferred dependency does not match the dependency list in source. The inferred dependency was `propA`, but the source dependencies were [propA.x]. Detail: inferred less specific property than source
21 ```
22
23
\ No newline at end of file
compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/preserve-memo-validation/error.useMemo-unrelated-mutation-in-depslist.expect.md
+1 -1
@@ -30,7 +30,7 @@ function useFoo(input1) {
30 ## Error
31
32 ```
33 -[ReactForget] Todo: Could not preserve manual memoization because an inferred dependency does not match the dependency list in source. The inferred dependency was `input1`, but the source dependencies were [y]. Detail: inferred different dependency than source
33 +Todo: Could not preserve manual memoization because an inferred dependency does not match the dependency list in source. The inferred dependency was `input1`, but the source dependencies were [y]. Detail: inferred different dependency than source
34 ```
35
36
\ No newline at end of file
compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/preserve-memo-validation/error.validate-useMemo-named-function.expect.md
+1 -1
@@ -23,7 +23,7 @@ function Component(props) {
23 7 | // for now.
24 8 | function Component(props) {
25 > 9 | const x = useMemo(someHelper, []);
26 - | ^^^^^^^^^^ [ReactForget] InvalidReact: Expected the first argument of useMemo to be an inline function expression (9:9)
26 + | ^^^^^^^^^^ InvalidReact: Expected the first argument of useMemo to be an inline function expression (9:9)
27 10 | return x;
28 11 | }
29 12 |
compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/rules-of-hooks/error.bail.rules-of-hooks-3d692676194b.expect.md
+1 -1
@@ -23,7 +23,7 @@ const ComponentWithHookInsideCallback = React.forwardRef((props, ref) => {
23 6 | const ComponentWithHookInsideCallback = React.forwardRef((props, ref) => {
24 7 | useEffect(() => {
25 > 8 | useHookInsideCallback();
26 - | ^^^^^^^^^^^^^^^^^^^^^ [ReactForget] InvalidReact: Hooks must be called at the top level in the body of a function component or custom hook, and may not be called within function expressions. See the Rules of Hooks (https://react.dev/warnings/invalid-hook-call-warning). Cannot call Custom within a function component (8:8)
26 + | ^^^^^^^^^^^^^^^^^^^^^ InvalidReact: Hooks must be called at the top level in the body of a function component or custom hook, and may not be called within function expressions. See the Rules of Hooks (https://react.dev/warnings/invalid-hook-call-warning). Cannot call Custom within a function component (8:8)
27 9 | });
28 10 | return <button {...props} ref={ref} />;
29 11 | });
compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/rules-of-hooks/error.bail.rules-of-hooks-8503ca76d6f8.expect.md
+1 -1
@@ -23,7 +23,7 @@ const ComponentWithHookInsideCallback = React.memo((props) => {
23 6 | const ComponentWithHookInsideCallback = React.memo((props) => {
24 7 | useEffect(() => {
25 > 8 | useHookInsideCallback();
26 - | ^^^^^^^^^^^^^^^^^^^^^ [ReactForget] InvalidReact: Hooks must be called at the top level in the body of a function component or custom hook, and may not be called within function expressions. See the Rules of Hooks (https://react.dev/warnings/invalid-hook-call-warning). Cannot call Custom within a function component (8:8)
26 + | ^^^^^^^^^^^^^^^^^^^^^ InvalidReact: Hooks must be called at the top level in the body of a function component or custom hook, and may not be called within function expressions. See the Rules of Hooks (https://react.dev/warnings/invalid-hook-call-warning). Cannot call Custom within a function component (8:8)
27 9 | });
28 10 | return <button {...props} />;
29 11 | });
compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/rules-of-hooks/error.invalid-call-phi-possibly-hook.expect.md
+3 -3
@@ -21,11 +21,11 @@ function Component(props) {
21 1 | function Component(props) {
22 2 | // This is a violation of using a hook as a normal value rule:
23 > 3 | const getUser = props.cond ? useGetUser : emptyFunction;
24 - | ^^^^^^^^^^ [ReactForget] InvalidReact: Hooks may not be referenced as normal values, they must be called. See the Rules of Hooks (https://react.dev/warnings/invalid-hook-call-warning) (3:3)
24 + | ^^^^^^^^^^ InvalidReact: Hooks may not be referenced as normal values, they must be called. See the Rules of Hooks (https://react.dev/warnings/invalid-hook-call-warning) (3:3)
25
26 -[ReactForget] InvalidReact: Hooks may not be referenced as normal values, they must be called. See the Rules of Hooks (https://react.dev/warnings/invalid-hook-call-warning) (3:3)
26 +InvalidReact: Hooks may not be referenced as normal values, they must be called. See the Rules of Hooks (https://react.dev/warnings/invalid-hook-call-warning) (3:3)
27
28 -[ReactForget] InvalidReact: Hooks may not be referenced as normal values, they must be called. See the Rules of Hooks (https://react.dev/warnings/invalid-hook-call-warning) (8:8)
28 +InvalidReact: Hooks may not be referenced as normal values, they must be called. See the Rules of Hooks (https://react.dev/warnings/invalid-hook-call-warning) (8:8)
29 4 |
30 5 | // Ideally we would report a "conditional hook call" error here.
31 6 | // It's an unconditional call, but the value may or may not be a hook.
compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/rules-of-hooks/error.invalid-conditionally-call-local-named-like-hook.expect.md
+1 -1
@@ -20,7 +20,7 @@ function Component(props) {
20 4 | const useFoo = makeObject_Primitives();
21 5 | if (props.cond) {
22 > 6 | useFoo();
23 - | ^^^^^^ [ReactForget] InvalidReact: Hooks must always be called in a consistent order, and may not be called conditionally. See the Rules of Hooks (https://react.dev/warnings/invalid-hook-call-warning) (6:6)
23 + | ^^^^^^ InvalidReact: Hooks must always be called in a consistent order, and may not be called conditionally. See the Rules of Hooks (https://react.dev/warnings/invalid-hook-call-warning) (6:6)
24 7 | }
25 8 | }
26 9 |
compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/rules-of-hooks/error.invalid-conditionally-call-prop-named-like-hook.expect.md
+1 -1
@@ -17,7 +17,7 @@ function Component({ cond, useFoo }) {
17 1 | function Component({ cond, useFoo }) {
18 2 | if (cond) {
19 > 3 | useFoo();
20 - | ^^^^^^ [ReactForget] InvalidReact: Hooks must always be called in a consistent order, and may not be called conditionally. See the Rules of Hooks (https://react.dev/warnings/invalid-hook-call-warning) (3:3)
20 + | ^^^^^^ InvalidReact: Hooks must always be called in a consistent order, and may not be called conditionally. See the Rules of Hooks (https://react.dev/warnings/invalid-hook-call-warning) (3:3)
21 4 | }
22 5 | }
23 6 |
compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/rules-of-hooks/error.invalid-conditionally-methodcall-hooklike-property-of-local.expect.md
+1 -1
@@ -20,7 +20,7 @@ function Component(props) {
20 4 | const local = makeObject_Primitives();
21 5 | if (props.cond) {
22 > 6 | local.useFoo();
23 - | ^^^^^^^^^^^^ [ReactForget] InvalidReact: Hooks must always be called in a consistent order, and may not be called conditionally. See the Rules of Hooks (https://react.dev/warnings/invalid-hook-call-warning) (6:6)
23 + | ^^^^^^^^^^^^ InvalidReact: Hooks must always be called in a consistent order, and may not be called conditionally. See the Rules of Hooks (https://react.dev/warnings/invalid-hook-call-warning) (6:6)
24 7 | }
25 8 | }
26 9 |
compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/rules-of-hooks/error.invalid-condtionally-call-hooklike-property-of-local.expect.md
+1 -1
@@ -21,7 +21,7 @@ function Component(props) {
21 5 | if (props.cond) {
22 6 | const foo = local.useFoo;
23 > 7 | foo();
24 - | ^^^ [ReactForget] InvalidReact: Hooks must always be called in a consistent order, and may not be called conditionally. See the Rules of Hooks (https://react.dev/warnings/invalid-hook-call-warning) (7:7)
24 + | ^^^ InvalidReact: Hooks must always be called in a consistent order, and may not be called conditionally. See the Rules of Hooks (https://react.dev/warnings/invalid-hook-call-warning) (7:7)
25 8 | }
26 9 | }
27 10 |
compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/rules-of-hooks/error.invalid-hook-after-early-return.expect.md
+1 -1
@@ -18,7 +18,7 @@ function Component(props) {
18 3 | return null;
19 4 | }
20 > 5 | return useHook();
21 - | ^^^^^^^ [ReactForget] InvalidReact: Hooks must always be called in a consistent order, and may not be called conditionally. See the Rules of Hooks (https://react.dev/warnings/invalid-hook-call-warning) (5:5)
21 + | ^^^^^^^ InvalidReact: Hooks must always be called in a consistent order, and may not be called conditionally. See the Rules of Hooks (https://react.dev/warnings/invalid-hook-call-warning) (5:5)
22 6 | }
23 7 |
24 ```
compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/rules-of-hooks/error.invalid-hook-as-conditional-test.expect.md
+1 -1
@@ -15,7 +15,7 @@ function Component(props) {
15 ```
16 1 | function Component(props) {
17 > 2 | const x = props.cond ? (useFoo ? 1 : 2) : 3;
18 - | ^^^^^^ [ReactForget] InvalidReact: Hooks may not be referenced as normal values, they must be called. See the Rules of Hooks (https://react.dev/warnings/invalid-hook-call-warning) (2:2)
18 + | ^^^^^^ InvalidReact: Hooks may not be referenced as normal values, they must be called. See the Rules of Hooks (https://react.dev/warnings/invalid-hook-call-warning) (2:2)
19 3 | return x;
20 4 | }
21 5 |
compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/rules-of-hooks/error.invalid-hook-for.expect.md
+2 -2
@@ -19,9 +19,9 @@ function Component(props) {
19 2 | let i = 0;
20 3 | for (let x = 0; useHook(x) < 10; useHook(i), x++) {
21 > 4 | i += useHook(x);
22 - | ^^^^^^^ [ReactForget] InvalidReact: Hooks must always be called in a consistent order, and may not be called conditionally. See the Rules of Hooks (https://react.dev/warnings/invalid-hook-call-warning) (4:4)
22 + | ^^^^^^^ InvalidReact: Hooks must always be called in a consistent order, and may not be called conditionally. See the Rules of Hooks (https://react.dev/warnings/invalid-hook-call-warning) (4:4)
23
24 -[ReactForget] InvalidReact: Hooks must always be called in a consistent order, and may not be called conditionally. See the Rules of Hooks (https://react.dev/warnings/invalid-hook-call-warning) (3:3)
24 +InvalidReact: Hooks must always be called in a consistent order, and may not be called conditionally. See the Rules of Hooks (https://react.dev/warnings/invalid-hook-call-warning) (3:3)
25 5 | }
26 6 | return i;
27 7 | }
compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/rules-of-hooks/error.invalid-hook-if-alternate.expect.md
+1 -1
@@ -20,7 +20,7 @@ function Component(props) {
20 3 | if (props.cond) {
21 4 | } else {
22 > 5 | x = useHook();
23 - | ^^^^^^^ [ReactForget] InvalidReact: Hooks must always be called in a consistent order, and may not be called conditionally. See the Rules of Hooks (https://react.dev/warnings/invalid-hook-call-warning) (5:5)
23 + | ^^^^^^^ InvalidReact: Hooks must always be called in a consistent order, and may not be called conditionally. See the Rules of Hooks (https://react.dev/warnings/invalid-hook-call-warning) (5:5)
24 6 | }
25 7 | return x;
26 8 | }
compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/rules-of-hooks/error.invalid-hook-if-consequent.expect.md
+1 -1
@@ -19,7 +19,7 @@ function Component(props) {
19 2 | let x = null;
20 3 | if (props.cond) {
21 > 4 | x = useHook();
22 - | ^^^^^^^ [ReactForget] InvalidReact: Hooks must always be called in a consistent order, and may not be called conditionally. See the Rules of Hooks (https://react.dev/warnings/invalid-hook-call-warning) (4:4)
22 + | ^^^^^^^ InvalidReact: Hooks must always be called in a consistent order, and may not be called conditionally. See the Rules of Hooks (https://react.dev/warnings/invalid-hook-call-warning) (4:4)
23 5 | }
24 6 | return x;
25 7 | }
compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/rules-of-hooks/error.invalid-hook-in-nested-function-expression-object-expression.expect.md
+1 -1
@@ -30,7 +30,7 @@ function Component() {
30 7 | const y = {
31 8 | inner() {
32 > 9 | return useFoo();
33 - | ^^^^^^ [ReactForget] InvalidReact: Hooks must be called at the top level in the body of a function component or custom hook, and may not be called within function expressions. See the Rules of Hooks (https://react.dev/warnings/invalid-hook-call-warning). Cannot call Custom within a function component (9:9)
33 + | ^^^^^^ InvalidReact: Hooks must be called at the top level in the body of a function component or custom hook, and may not be called within function expressions. See the Rules of Hooks (https://react.dev/warnings/invalid-hook-call-warning). Cannot call Custom within a function component (9:9)
34 10 | },
35 11 | };
36 12 | return y;
compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/rules-of-hooks/error.invalid-hook-in-nested-object-method.expect.md
+1 -1
@@ -26,7 +26,7 @@ function Component() {
26 5 | const y = {
27 6 | inner() {
28 > 7 | return useFoo();
29 - | ^^^^^^ [ReactForget] InvalidReact: Hooks must be called at the top level in the body of a function component or custom hook, and may not be called within function expressions. See the Rules of Hooks (https://react.dev/warnings/invalid-hook-call-warning). Cannot call Custom within a function component (7:7)
29 + | ^^^^^^ InvalidReact: Hooks must be called at the top level in the body of a function component or custom hook, and may not be called within function expressions. See the Rules of Hooks (https://react.dev/warnings/invalid-hook-call-warning). Cannot call Custom within a function component (7:7)
30 8 | },
31 9 | };
32 10 | return y;
compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/rules-of-hooks/error.invalid-hook-optional-methodcall.expect.md
+1 -1
@@ -15,7 +15,7 @@ function Component() {
15 ```
16 1 | function Component() {
17 > 2 | const { result } = Module.useConditionalHook?.() ?? {};
18 - | ^^^^^^^^^^^^^^^^^^^^^^^^^ [ReactForget] InvalidReact: Hooks must always be called in a consistent order, and may not be called conditionally. See the Rules of Hooks (https://react.dev/warnings/invalid-hook-call-warning) (2:2)
18 + | ^^^^^^^^^^^^^^^^^^^^^^^^^ InvalidReact: Hooks must always be called in a consistent order, and may not be called conditionally. See the Rules of Hooks (https://react.dev/warnings/invalid-hook-call-warning) (2:2)
19 3 | return result;
20 4 | }
21 5 |
compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/rules-of-hooks/error.invalid-hook-optional-property.expect.md
+1 -1
@@ -15,7 +15,7 @@ function Component() {
15 ```
16 1 | function Component() {
17 > 2 | const { result } = Module?.useConditionalHook() ?? {};
18 - | ^^^^^^^^^^^^^^^^^^^^^^^^^^ [ReactForget] InvalidReact: Hooks must always be called in a consistent order, and may not be called conditionally. See the Rules of Hooks (https://react.dev/warnings/invalid-hook-call-warning) (2:2)
18 + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ InvalidReact: Hooks must always be called in a consistent order, and may not be called conditionally. See the Rules of Hooks (https://react.dev/warnings/invalid-hook-call-warning) (2:2)
19 3 | return result;
20 4 | }
21 5 |
compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/rules-of-hooks/error.invalid-hook-optionalcall.expect.md
+1 -1
@@ -15,7 +15,7 @@ function Component() {
15 ```
16 1 | function Component() {
17 > 2 | const { result } = useConditionalHook?.() ?? {};
18 - | ^^^^^^^^^^^^^^^^^^ [ReactForget] InvalidReact: Hooks must always be called in a consistent order, and may not be called conditionally. See the Rules of Hooks (https://react.dev/warnings/invalid-hook-call-warning) (2:2)
18 + | ^^^^^^^^^^^^^^^^^^ InvalidReact: Hooks must always be called in a consistent order, and may not be called conditionally. See the Rules of Hooks (https://react.dev/warnings/invalid-hook-call-warning) (2:2)
19 3 | return result;
20 4 | }
21 5 |
compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/rules-of-hooks/error.invalid-hook-reassigned-in-conditional.expect.md
+3 -3
@@ -17,11 +17,11 @@ function Component(props) {
17 1 | function Component(props) {
18 2 | let y;
19 > 3 | props.cond ? (y = useFoo) : null;
20 - | ^^^^^^ [ReactForget] InvalidReact: Hooks may not be referenced as normal values, they must be called. See the Rules of Hooks (https://react.dev/warnings/invalid-hook-call-warning) (3:3)
20 + | ^^^^^^ InvalidReact: Hooks may not be referenced as normal values, they must be called. See the Rules of Hooks (https://react.dev/warnings/invalid-hook-call-warning) (3:3)
21
22 -[ReactForget] InvalidReact: Hooks may not be referenced as normal values, they must be called. See the Rules of Hooks (https://react.dev/warnings/invalid-hook-call-warning) (3:3)
22 +InvalidReact: Hooks may not be referenced as normal values, they must be called. See the Rules of Hooks (https://react.dev/warnings/invalid-hook-call-warning) (3:3)
23
24 -[ReactForget] InvalidReact: Hooks may not be referenced as normal values, they must be called. See the Rules of Hooks (https://react.dev/warnings/invalid-hook-call-warning) (4:4)
24 +InvalidReact: Hooks may not be referenced as normal values, they must be called. See the Rules of Hooks (https://react.dev/warnings/invalid-hook-call-warning) (4:4)
25 4 | return y();
26 5 | }
27 6 |
compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/rules-of-hooks/error.invalid-rules-of-hooks-1b9527f967f3.expect.md
+4 -4
@@ -28,13 +28,13 @@ function useHookInLoops() {
28 5 | function useHookInLoops() {
29 6 | while (a) {
30 > 7 | useHook1();
31 - | ^^^^^^^^ [ReactForget] InvalidReact: Hooks must always be called in a consistent order, and may not be called conditionally. See the Rules of Hooks (https://react.dev/warnings/invalid-hook-call-warning) (7:7)
31 + | ^^^^^^^^ InvalidReact: Hooks must always be called in a consistent order, and may not be called conditionally. See the Rules of Hooks (https://react.dev/warnings/invalid-hook-call-warning) (7:7)
32
33 -[ReactForget] InvalidReact: Hooks must always be called in a consistent order, and may not be called conditionally. See the Rules of Hooks (https://react.dev/warnings/invalid-hook-call-warning) (9:9)
33 +InvalidReact: Hooks must always be called in a consistent order, and may not be called conditionally. See the Rules of Hooks (https://react.dev/warnings/invalid-hook-call-warning) (9:9)
34
35 -[ReactForget] InvalidReact: Hooks must always be called in a consistent order, and may not be called conditionally. See the Rules of Hooks (https://react.dev/warnings/invalid-hook-call-warning) (12:12)
35 +InvalidReact: Hooks must always be called in a consistent order, and may not be called conditionally. See the Rules of Hooks (https://react.dev/warnings/invalid-hook-call-warning) (12:12)
36
37 -[ReactForget] InvalidReact: Hooks must always be called in a consistent order, and may not be called conditionally. See the Rules of Hooks (https://react.dev/warnings/invalid-hook-call-warning) (14:14)
37 +InvalidReact: Hooks must always be called in a consistent order, and may not be called conditionally. See the Rules of Hooks (https://react.dev/warnings/invalid-hook-call-warning) (14:14)
38 8 | if (b) return;
39 9 | useHook2();
40 10 | }
compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/rules-of-hooks/error.invalid-rules-of-hooks-2aabd222fc6a.expect.md
+1 -1
@@ -21,7 +21,7 @@ function ComponentWithConditionalHook() {
21 5 | function ComponentWithConditionalHook() {
22 6 | if (cond) {
23 > 7 | useConditionalHook();
24 - | ^^^^^^^^^^^^^^^^^^ [ReactForget] InvalidReact: Hooks must always be called in a consistent order, and may not be called conditionally. See the Rules of Hooks (https://react.dev/warnings/invalid-hook-call-warning) (7:7)
24 + | ^^^^^^^^^^^^^^^^^^ InvalidReact: Hooks must always be called in a consistent order, and may not be called conditionally. See the Rules of Hooks (https://react.dev/warnings/invalid-hook-call-warning) (7:7)
25 8 | }
26 9 | }
27 10 |
compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/rules-of-hooks/error.invalid-rules-of-hooks-49d341e5d68f.expect.md
+1 -1
@@ -22,7 +22,7 @@ function useLabeledBlock() {
22 6 | label: {
23 7 | if (a) break label;
24 > 8 | useHook();
25 - | ^^^^^^^ [ReactForget] InvalidReact: Hooks must always be called in a consistent order, and may not be called conditionally. See the Rules of Hooks (https://react.dev/warnings/invalid-hook-call-warning) (8:8)
25 + | ^^^^^^^ InvalidReact: Hooks must always be called in a consistent order, and may not be called conditionally. See the Rules of Hooks (https://react.dev/warnings/invalid-hook-call-warning) (8:8)
26 9 | }
27 10 | }
28 11 |
compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/rules-of-hooks/error.invalid-rules-of-hooks-79128a755612.expect.md
+1 -1
@@ -21,7 +21,7 @@ function ComponentWithHookInsideLoop() {
21 5 | function ComponentWithHookInsideLoop() {
22 6 | while (cond) {
23 > 7 | useHookInsideLoop();
24 - | ^^^^^^^^^^^^^^^^^ [ReactForget] InvalidReact: Hooks must always be called in a consistent order, and may not be called conditionally. See the Rules of Hooks (https://react.dev/warnings/invalid-hook-call-warning) (7:7)
24 + | ^^^^^^^^^^^^^^^^^ InvalidReact: Hooks must always be called in a consistent order, and may not be called conditionally. See the Rules of Hooks (https://react.dev/warnings/invalid-hook-call-warning) (7:7)
25 8 | }
26 9 | }
27 10 |
compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/rules-of-hooks/error.invalid-rules-of-hooks-9718e30b856c.expect.md
+1 -1
@@ -25,7 +25,7 @@ function useHook() {
25 10 | console.log("false");
26 11 | }
27 > 12 | useState();
28 - | ^^^^^^^^ [ReactForget] InvalidReact: Hooks must always be called in a consistent order, and may not be called conditionally. See the Rules of Hooks (https://react.dev/warnings/invalid-hook-call-warning) (12:12)
28 + | ^^^^^^^^ InvalidReact: Hooks must always be called in a consistent order, and may not be called conditionally. See the Rules of Hooks (https://react.dev/warnings/invalid-hook-call-warning) (12:12)
29 13 | }
30 14 |
31 ```
compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/rules-of-hooks/error.invalid-rules-of-hooks-9bf17c174134.expect.md
+2 -2
@@ -20,9 +20,9 @@ function useHook() {
20 4 | // This *must* be invalid.
21 5 | function useHook() {
22 > 6 | a && useHook1();
23 - | ^^^^^^^^ [ReactForget] InvalidReact: Hooks must always be called in a consistent order, and may not be called conditionally. See the Rules of Hooks (https://react.dev/warnings/invalid-hook-call-warning) (6:6)
23 + | ^^^^^^^^ InvalidReact: Hooks must always be called in a consistent order, and may not be called conditionally. See the Rules of Hooks (https://react.dev/warnings/invalid-hook-call-warning) (6:6)
24
25 -[ReactForget] InvalidReact: Hooks must always be called in a consistent order, and may not be called conditionally. See the Rules of Hooks (https://react.dev/warnings/invalid-hook-call-warning) (7:7)
25 +InvalidReact: Hooks must always be called in a consistent order, and may not be called conditionally. See the Rules of Hooks (https://react.dev/warnings/invalid-hook-call-warning) (7:7)
26 7 | b && useHook2();
27 8 | }
28 9 |
compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/rules-of-hooks/error.invalid-rules-of-hooks-b4dcda3d60ed.expect.md
+1 -1
@@ -19,7 +19,7 @@ function ComponentWithTernaryHook() {
19 4 | // This *must* be invalid.
20 5 | function ComponentWithTernaryHook() {
21 > 6 | cond ? useTernaryHook() : null;
22 - | ^^^^^^^^^^^^^^ [ReactForget] InvalidReact: Hooks must always be called in a consistent order, and may not be called conditionally. See the Rules of Hooks (https://react.dev/warnings/invalid-hook-call-warning) (6:6)
22 + | ^^^^^^^^^^^^^^ InvalidReact: Hooks must always be called in a consistent order, and may not be called conditionally. See the Rules of Hooks (https://react.dev/warnings/invalid-hook-call-warning) (6:6)
23 7 | }
24 8 |
25 ```
compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/rules-of-hooks/error.invalid-rules-of-hooks-c906cace44e9.expect.md
+1 -1
@@ -20,7 +20,7 @@ function useHook() {
20 5 | function useHook() {
21 6 | if (a) return;
22 > 7 | useState();
23 - | ^^^^^^^^ [ReactForget] InvalidReact: Hooks must always be called in a consistent order, and may not be called conditionally. See the Rules of Hooks (https://react.dev/warnings/invalid-hook-call-warning) (7:7)
23 + | ^^^^^^^^ InvalidReact: Hooks must always be called in a consistent order, and may not be called conditionally. See the Rules of Hooks (https://react.dev/warnings/invalid-hook-call-warning) (7:7)
24 8 | }
25 9 |
26 ```
compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/rules-of-hooks/error.invalid-rules-of-hooks-d740d54e9c21.expect.md
+1 -1
@@ -21,7 +21,7 @@ function normalFunctionWithConditionalHook() {
21 5 | function normalFunctionWithConditionalHook() {
22 6 | if (cond) {
23 > 7 | useHookInsideNormalFunction();
24 - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ [ReactForget] InvalidReact: Hooks must always be called in a consistent order, and may not be called conditionally. See the Rules of Hooks (https://react.dev/warnings/invalid-hook-call-warning) (7:7)
24 + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ InvalidReact: Hooks must always be called in a consistent order, and may not be called conditionally. See the Rules of Hooks (https://react.dev/warnings/invalid-hook-call-warning) (7:7)
25 8 | }
26 9 | }
27 10 |
compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/rules-of-hooks/error.invalid-rules-of-hooks-d85c144bdf40.expect.md
+2 -2
@@ -23,9 +23,9 @@ function useHookInLoops() {
23 5 | function useHookInLoops() {
24 6 | while (a) {
25 > 7 | useHook1();
26 - | ^^^^^^^^ [ReactForget] InvalidReact: Hooks must always be called in a consistent order, and may not be called conditionally. See the Rules of Hooks (https://react.dev/warnings/invalid-hook-call-warning) (7:7)
26 + | ^^^^^^^^ InvalidReact: Hooks must always be called in a consistent order, and may not be called conditionally. See the Rules of Hooks (https://react.dev/warnings/invalid-hook-call-warning) (7:7)
27
28 -[ReactForget] InvalidReact: Hooks must always be called in a consistent order, and may not be called conditionally. See the Rules of Hooks (https://react.dev/warnings/invalid-hook-call-warning) (9:9)
28 +InvalidReact: Hooks must always be called in a consistent order, and may not be called conditionally. See the Rules of Hooks (https://react.dev/warnings/invalid-hook-call-warning) (9:9)
29 8 | if (b) continue;
30 9 | useHook2();
31 10 | }
compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/rules-of-hooks/error.invalid-rules-of-hooks-ea7c2fb545a9.expect.md
+1 -1
@@ -21,7 +21,7 @@ function useHookWithConditionalHook() {
21 5 | function useHookWithConditionalHook() {
22 6 | if (cond) {
23 > 7 | useConditionalHook();
24 - | ^^^^^^^^^^^^^^^^^^ [ReactForget] InvalidReact: Hooks must always be called in a consistent order, and may not be called conditionally. See the Rules of Hooks (https://react.dev/warnings/invalid-hook-call-warning) (7:7)
24 + | ^^^^^^^^^^^^^^^^^^ InvalidReact: Hooks must always be called in a consistent order, and may not be called conditionally. See the Rules of Hooks (https://react.dev/warnings/invalid-hook-call-warning) (7:7)
25 8 | }
26 9 | }
27 10 |
compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/rules-of-hooks/error.invalid-rules-of-hooks-f3d6c5e9c83d.expect.md
+1 -1
@@ -25,7 +25,7 @@ function useHook() {
25 10 | }
26 11 | if (a) return;
27 > 12 | useState();
28 - | ^^^^^^^^ [ReactForget] InvalidReact: Hooks must always be called in a consistent order, and may not be called conditionally. See the Rules of Hooks (https://react.dev/warnings/invalid-hook-call-warning) (12:12)
28 + | ^^^^^^^^ InvalidReact: Hooks must always be called in a consistent order, and may not be called conditionally. See the Rules of Hooks (https://react.dev/warnings/invalid-hook-call-warning) (12:12)
29 13 | }
30 14 |
31 ```
compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/rules-of-hooks/error.invalid-rules-of-hooks-f69800950ff0.expect.md
+3 -3
@@ -21,11 +21,11 @@ function useHook({ bar }) {
21 4 | // This *must* be invalid.
22 5 | function useHook({ bar }) {
23 > 6 | let foo1 = bar && useState();
24 - | ^^^^^^^^ [ReactForget] InvalidReact: Hooks must always be called in a consistent order, and may not be called conditionally. See the Rules of Hooks (https://react.dev/warnings/invalid-hook-call-warning) (6:6)
24 + | ^^^^^^^^ InvalidReact: Hooks must always be called in a consistent order, and may not be called conditionally. See the Rules of Hooks (https://react.dev/warnings/invalid-hook-call-warning) (6:6)
25
26 -[ReactForget] InvalidReact: Hooks must always be called in a consistent order, and may not be called conditionally. See the Rules of Hooks (https://react.dev/warnings/invalid-hook-call-warning) (7:7)
26 +InvalidReact: Hooks must always be called in a consistent order, and may not be called conditionally. See the Rules of Hooks (https://react.dev/warnings/invalid-hook-call-warning) (7:7)
27
28 -[ReactForget] InvalidReact: Hooks must always be called in a consistent order, and may not be called conditionally. See the Rules of Hooks (https://react.dev/warnings/invalid-hook-call-warning) (8:8)
28 +InvalidReact: Hooks must always be called in a consistent order, and may not be called conditionally. See the Rules of Hooks (https://react.dev/warnings/invalid-hook-call-warning) (8:8)
29 7 | let foo2 = bar || useState();
30 8 | let foo3 = bar ?? useState();
31 9 | }
compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/rules-of-hooks/error.invalid.invalid-rules-of-hooks-0a1dbff27ba0.expect.md
+1 -1
@@ -21,7 +21,7 @@ function createHook() {
21 4 | return function useHookWithConditionalHook() {
22 5 | if (cond) {
23 > 6 | useConditionalHook();
24 - | ^^^^^^^^^^^^^^^^^^ [ReactForget] InvalidReact: Hooks must be called at the top level in the body of a function component or custom hook, and may not be called within function expressions. See the Rules of Hooks (https://react.dev/warnings/invalid-hook-call-warning). Cannot call Custom within a function component (6:6)
24 + | ^^^^^^^^^^^^^^^^^^ InvalidReact: Hooks must be called at the top level in the body of a function component or custom hook, and may not be called within function expressions. See the Rules of Hooks (https://react.dev/warnings/invalid-hook-call-warning). Cannot call Custom within a function component (6:6)
25 7 | }
26 8 | };
27 9 | }
compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/rules-of-hooks/error.invalid.invalid-rules-of-hooks-0de1224ce64b.expect.md
+2 -2
@@ -21,9 +21,9 @@ function createComponent() {
21 4 | return function ComponentWithHookInsideCallback() {
22 5 | useEffect(() => {
23 > 6 | useHookInsideCallback();
24 - | ^^^^^^^^^^^^^^^^^^^^^ [ReactForget] InvalidReact: Hooks must be called at the top level in the body of a function component or custom hook, and may not be called within function expressions. See the Rules of Hooks (https://react.dev/warnings/invalid-hook-call-warning). Cannot call Custom within a function component (6:6)
24 + | ^^^^^^^^^^^^^^^^^^^^^ InvalidReact: Hooks must be called at the top level in the body of a function component or custom hook, and may not be called within function expressions. See the Rules of Hooks (https://react.dev/warnings/invalid-hook-call-warning). Cannot call Custom within a function component (6:6)
25
26 -[ReactForget] InvalidReact: Hooks must be called at the top level in the body of a function component or custom hook, and may not be called within function expressions. See the Rules of Hooks (https://react.dev/warnings/invalid-hook-call-warning). Cannot call useEffect within a function component (5:5)
26 +InvalidReact: Hooks must be called at the top level in the body of a function component or custom hook, and may not be called within function expressions. See the Rules of Hooks (https://react.dev/warnings/invalid-hook-call-warning). Cannot call useEffect within a function component (5:5)
27 7 | });
28 8 | };
29 9 | }
compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/rules-of-hooks/error.invalid.invalid-rules-of-hooks-449a37146a83.expect.md
+1 -1
@@ -21,7 +21,7 @@ function createComponent() {
21 4 | return function ComponentWithHookInsideCallback() {
22 5 | function handleClick() {
23 > 6 | useState();
24 - | ^^^^^^^^ [ReactForget] InvalidReact: Hooks must be called at the top level in the body of a function component or custom hook, and may not be called within function expressions. See the Rules of Hooks (https://react.dev/warnings/invalid-hook-call-warning). Cannot call useState within a function component (6:6)
24 + | ^^^^^^^^ InvalidReact: Hooks must be called at the top level in the body of a function component or custom hook, and may not be called within function expressions. See the Rules of Hooks (https://react.dev/warnings/invalid-hook-call-warning). Cannot call useState within a function component (6:6)
25 7 | }
26 8 | };
27 9 | }
compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/rules-of-hooks/error.invalid.invalid-rules-of-hooks-76a74b4666e9.expect.md
+1 -1
@@ -19,7 +19,7 @@ function ComponentWithHookInsideCallback() {
19 3 | function ComponentWithHookInsideCallback() {
20 4 | function handleClick() {
21 > 5 | useState();
22 - | ^^^^^^^^ [ReactForget] InvalidReact: Hooks must be called at the top level in the body of a function component or custom hook, and may not be called within function expressions. See the Rules of Hooks (https://react.dev/warnings/invalid-hook-call-warning). Cannot call useState within a function component (5:5)
22 + | ^^^^^^^^ InvalidReact: Hooks must be called at the top level in the body of a function component or custom hook, and may not be called within function expressions. See the Rules of Hooks (https://react.dev/warnings/invalid-hook-call-warning). Cannot call useState within a function component (5:5)
23 6 | }
24 7 | }
25 8 |
compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/rules-of-hooks/error.invalid.invalid-rules-of-hooks-d842d36db450.expect.md
+1 -1
@@ -21,7 +21,7 @@ function createComponent() {
21 4 | return function ComponentWithConditionalHook() {
22 5 | if (cond) {
23 > 6 | useConditionalHook();
24 - | ^^^^^^^^^^^^^^^^^^ [ReactForget] InvalidReact: Hooks must be called at the top level in the body of a function component or custom hook, and may not be called within function expressions. See the Rules of Hooks (https://react.dev/warnings/invalid-hook-call-warning). Cannot call Custom within a function component (6:6)
24 + | ^^^^^^^^^^^^^^^^^^ InvalidReact: Hooks must be called at the top level in the body of a function component or custom hook, and may not be called within function expressions. See the Rules of Hooks (https://react.dev/warnings/invalid-hook-call-warning). Cannot call Custom within a function component (6:6)
25 7 | }
26 8 | };
27 9 | }
compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/rules-of-hooks/error.invalid.invalid-rules-of-hooks-d952b82c2597.expect.md
+1 -1
@@ -19,7 +19,7 @@ function ComponentWithHookInsideCallback() {
19 3 | function ComponentWithHookInsideCallback() {
20 4 | useEffect(() => {
21 > 5 | useHookInsideCallback();
22 - | ^^^^^^^^^^^^^^^^^^^^^ [ReactForget] InvalidReact: Hooks must be called at the top level in the body of a function component or custom hook, and may not be called within function expressions. See the Rules of Hooks (https://react.dev/warnings/invalid-hook-call-warning). Cannot call Custom within a function component (5:5)
22 + | ^^^^^^^^^^^^^^^^^^^^^ InvalidReact: Hooks must be called at the top level in the body of a function component or custom hook, and may not be called within function expressions. See the Rules of Hooks (https://react.dev/warnings/invalid-hook-call-warning). Cannot call Custom within a function component (5:5)
23 6 | });
24 7 | }
25 8 |
compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/rules-of-hooks/todo.error.invalid-rules-of-hooks-368024110a58.expect.md
+1 -1
@@ -23,7 +23,7 @@ const FancyButton = forwardRef(function (props, ref) {
23 6 | const FancyButton = forwardRef(function (props, ref) {
24 7 | if (props.fancy) {
25 > 8 | useCustomHook();
26 - | ^^^^^^^^^^^^^ [ReactForget] InvalidReact: Hooks must always be called in a consistent order, and may not be called conditionally. See the Rules of Hooks (https://react.dev/warnings/invalid-hook-call-warning) (8:8)
26 + | ^^^^^^^^^^^^^ InvalidReact: Hooks must always be called in a consistent order, and may not be called conditionally. See the Rules of Hooks (https://react.dev/warnings/invalid-hook-call-warning) (8:8)
27 9 | }
28 10 | return <button ref={ref}>{props.children}</button>;
29 11 | });
compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/rules-of-hooks/todo.error.invalid-rules-of-hooks-8566f9a360e2.expect.md
+1 -1
@@ -23,7 +23,7 @@ const MemoizedButton = memo(function (props) {
23 6 | const MemoizedButton = memo(function (props) {
24 7 | if (props.fancy) {
25 > 8 | useCustomHook();
26 - | ^^^^^^^^^^^^^ [ReactForget] InvalidReact: Hooks must always be called in a consistent order, and may not be called conditionally. See the Rules of Hooks (https://react.dev/warnings/invalid-hook-call-warning) (8:8)
26 + | ^^^^^^^^^^^^^ InvalidReact: Hooks must always be called in a consistent order, and may not be called conditionally. See the Rules of Hooks (https://react.dev/warnings/invalid-hook-call-warning) (8:8)
27 9 | }
28 10 | return <button>{props.children}</button>;
29 11 | });
compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/rules-of-hooks/todo.error.invalid-rules-of-hooks-a0058f0b446d.expect.md
+1 -1
@@ -22,7 +22,7 @@ function ComponentWithConditionalHook() {
22 6 | function ComponentWithConditionalHook() {
23 7 | if (cond) {
24 > 8 | Namespace.useConditionalHook();
25 - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ [ReactForget] InvalidReact: Hooks must always be called in a consistent order, and may not be called conditionally. See the Rules of Hooks (https://react.dev/warnings/invalid-hook-call-warning) (8:8)
25 + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ InvalidReact: Hooks must always be called in a consistent order, and may not be called conditionally. See the Rules of Hooks (https://react.dev/warnings/invalid-hook-call-warning) (8:8)
26 9 | }
27 10 | }
28 11 |
compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/rules-of-hooks/todo.error.rules-of-hooks-27c18dc8dad2.expect.md
+1 -1
@@ -23,7 +23,7 @@ const FancyButton = React.forwardRef((props, ref) => {
23 6 | const FancyButton = React.forwardRef((props, ref) => {
24 7 | if (props.fancy) {
25 > 8 | useCustomHook();
26 - | ^^^^^^^^^^^^^ [ReactForget] InvalidReact: Hooks must always be called in a consistent order, and may not be called conditionally. See the Rules of Hooks (https://react.dev/warnings/invalid-hook-call-warning) (8:8)
26 + | ^^^^^^^^^^^^^ InvalidReact: Hooks must always be called in a consistent order, and may not be called conditionally. See the Rules of Hooks (https://react.dev/warnings/invalid-hook-call-warning) (8:8)
27 9 | }
28 10 | return <button ref={ref}>{props.children}</button>;
29 11 | });
compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/rules-of-hooks/todo.error.rules-of-hooks-d0935abedc42.expect.md
+1 -1
@@ -22,7 +22,7 @@ React.unknownFunction((foo, bar) => {
22 6 | React.unknownFunction((foo, bar) => {
23 7 | if (foo) {
24 > 8 | useNotAHook(bar);
25 - | ^^^^^^^^^^^ [ReactForget] InvalidReact: Hooks must always be called in a consistent order, and may not be called conditionally. See the Rules of Hooks (https://react.dev/warnings/invalid-hook-call-warning) (8:8)
25 + | ^^^^^^^^^^^ InvalidReact: Hooks must always be called in a consistent order, and may not be called conditionally. See the Rules of Hooks (https://react.dev/warnings/invalid-hook-call-warning) (8:8)
26 9 | }
27 10 | });
28 11 |
compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/rules-of-hooks/todo.error.rules-of-hooks-e29c874aa913.expect.md
+1 -1
@@ -23,7 +23,7 @@ function useHook() {
23 7 | try {
24 8 | f();
25 > 9 | useState();
26 - | ^^^^^^^^ [ReactForget] InvalidReact: Hooks must always be called in a consistent order, and may not be called conditionally. See the Rules of Hooks (https://react.dev/warnings/invalid-hook-call-warning) (9:9)
26 + | ^^^^^^^^ InvalidReact: Hooks must always be called in a consistent order, and may not be called conditionally. See the Rules of Hooks (https://react.dev/warnings/invalid-hook-call-warning) (9:9)
27 10 | } catch {}
28 11 | }
29 12 |
compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/todo.error.object-pattern-computed-key.expect.md
+1 -1
@@ -24,7 +24,7 @@ export const FIXTURE_ENTRYPOINT = {
24 3 | const SCALE = 2;
25 4 | function Component(props) {
26 > 5 | const { [props.name]: value } = props;
27 - | ^^^^^^^^^^^^^^^^^^^ [ReactForget] Todo: (BuildHIR::lowerAssignment) Handle computed properties in ObjectPattern (5:5)
27 + | ^^^^^^^^^^^^^^^^^^^ Todo: (BuildHIR::lowerAssignment) Handle computed properties in ObjectPattern (5:5)
28 6 | return value;
29 7 | }
30 8 |