From bc990fa41335f9a40d323b24418cd90323084db5 Mon Sep 17 00:00:00 2001 From: poteto Date: Mon, 28 Jul 2025 10:42:25 -0700 Subject: [PATCH] [compiler] Aggregate all errors reported from DropManualMemoization (#34002) Noticed this from my previous PR that this pass was throwing on the first error. This PR is a small refactor to aggregate every violation and report them all at once. --- [//]: # (BEGIN SAPLING FOOTER) Stack created with [Sapling](https://sapling-scm.com). Best reviewed with [ReviewStack](https://reviewstack.dev/facebook/react/pull/34002). * #34022 * __->__ #34002 DiffTrain build for [6b22f31f1ac88cce1b38c67a5c97c7ab0e832823](https://github.com/facebook/react/commit/6b22f31f1ac88cce1b38c67a5c97c7ab0e832823) --- compiled-rn/VERSION_NATIVE_FB | 2 +- .../react/react-dom/cjs/ReactDOM-dev.js | 4 +- .../react/react-dom/cjs/ReactDOM-prod.js | 4 +- .../react/react-dom/cjs/ReactDOM-profiling.js | 4 +- .../react/react-dom/cjs/ReactDOMClient-dev.js | 12 +- .../react-dom/cjs/ReactDOMClient-prod.js | 12 +- .../react-dom/cjs/ReactDOMClient-profiling.js | 12 +- .../react-dom/cjs/ReactDOMProfiling-dev.js | 12 +- .../react-dom/cjs/ReactDOMProfiling-prod.js | 12 +- .../cjs/ReactDOMProfiling-profiling.js | 12 +- .../cjs/ReactTestRenderer-dev.js | 8 +- .../cjs/ReactTestRenderer-prod.js | 8 +- .../cjs/ReactTestRenderer-profiling.js | 8 +- .../vendor/react/react/cjs/React-dev.js | 4 +- .../vendor/react/react/cjs/React-prod.js | 4 +- .../vendor/react/react/cjs/React-profiling.js | 4 +- .../Libraries/Renderer/REVISION | 2 +- .../implementations/ReactFabric-dev.fb.js | 6 +- .../implementations/ReactFabric-prod.fb.js | 6 +- .../ReactFabric-profiling.fb.js | 6 +- .../ReactNativeRenderer-dev.fb.js | 10 +- .../ReactNativeRenderer-prod.fb.js | 10 +- .../ReactNativeRenderer-profiling.fb.js | 10 +- .../eslint-plugin-react-hooks.development.js | 225 ++++++++---------- .../eslint-plugin-react-hooks.production.js | 225 ++++++++---------- .../eslint-plugin-react-hooks/package.json | 2 +- 26 files changed, 277 insertions(+), 347 deletions(-) diff --git a/compiled-rn/VERSION_NATIVE_FB b/compiled-rn/VERSION_NATIVE_FB index 1b7684ca2b..79fdfadc3f 100644 --- a/compiled-rn/VERSION_NATIVE_FB +++ b/compiled-rn/VERSION_NATIVE_FB @@ -1 +1 @@ -19.2.0-native-fb-c60eebff-20250728 \ No newline at end of file +19.2.0-native-fb-6b22f31f-20250728 \ No newline at end of file diff --git a/compiled-rn/facebook-fbsource/xplat/js/RKJSModules/vendor/react/react-dom/cjs/ReactDOM-dev.js b/compiled-rn/facebook-fbsource/xplat/js/RKJSModules/vendor/react/react-dom/cjs/ReactDOM-dev.js index 6e8a0876d4..55973e8397 100644 --- a/compiled-rn/facebook-fbsource/xplat/js/RKJSModules/vendor/react/react-dom/cjs/ReactDOM-dev.js +++ b/compiled-rn/facebook-fbsource/xplat/js/RKJSModules/vendor/react/react-dom/cjs/ReactDOM-dev.js @@ -7,7 +7,7 @@ * @noflow * @nolint * @preventMunge - * @generated SignedSource<<25c3fc73f483d3bc1e7eea51752aec28>> + * @generated SignedSource<> */ "use strict"; @@ -404,5 +404,5 @@ __DEV__ && exports.useFormStatus = function () { return resolveDispatcher().useHostTransitionStatus(); }; - exports.version = "19.2.0-native-fb-c60eebff-20250728"; + exports.version = "19.2.0-native-fb-6b22f31f-20250728"; })(); diff --git a/compiled-rn/facebook-fbsource/xplat/js/RKJSModules/vendor/react/react-dom/cjs/ReactDOM-prod.js b/compiled-rn/facebook-fbsource/xplat/js/RKJSModules/vendor/react/react-dom/cjs/ReactDOM-prod.js index c1963ec6f7..47abdf69b5 100644 --- a/compiled-rn/facebook-fbsource/xplat/js/RKJSModules/vendor/react/react-dom/cjs/ReactDOM-prod.js +++ b/compiled-rn/facebook-fbsource/xplat/js/RKJSModules/vendor/react/react-dom/cjs/ReactDOM-prod.js @@ -7,7 +7,7 @@ * @noflow * @nolint * @preventMunge - * @generated SignedSource<> + * @generated SignedSource<<9b01410f22f5e09d1db49bbf6218777b>> */ "use strict"; @@ -203,4 +203,4 @@ exports.useFormState = function (action, initialState, permalink) { exports.useFormStatus = function () { return ReactSharedInternals.H.useHostTransitionStatus(); }; -exports.version = "19.2.0-native-fb-c60eebff-20250728"; +exports.version = "19.2.0-native-fb-6b22f31f-20250728"; diff --git a/compiled-rn/facebook-fbsource/xplat/js/RKJSModules/vendor/react/react-dom/cjs/ReactDOM-profiling.js b/compiled-rn/facebook-fbsource/xplat/js/RKJSModules/vendor/react/react-dom/cjs/ReactDOM-profiling.js index c1963ec6f7..47abdf69b5 100644 --- a/compiled-rn/facebook-fbsource/xplat/js/RKJSModules/vendor/react/react-dom/cjs/ReactDOM-profiling.js +++ b/compiled-rn/facebook-fbsource/xplat/js/RKJSModules/vendor/react/react-dom/cjs/ReactDOM-profiling.js @@ -7,7 +7,7 @@ * @noflow * @nolint * @preventMunge - * @generated SignedSource<> + * @generated SignedSource<<9b01410f22f5e09d1db49bbf6218777b>> */ "use strict"; @@ -203,4 +203,4 @@ exports.useFormState = function (action, initialState, permalink) { exports.useFormStatus = function () { return ReactSharedInternals.H.useHostTransitionStatus(); }; -exports.version = "19.2.0-native-fb-c60eebff-20250728"; +exports.version = "19.2.0-native-fb-6b22f31f-20250728"; diff --git a/compiled-rn/facebook-fbsource/xplat/js/RKJSModules/vendor/react/react-dom/cjs/ReactDOMClient-dev.js b/compiled-rn/facebook-fbsource/xplat/js/RKJSModules/vendor/react/react-dom/cjs/ReactDOMClient-dev.js index 17103fd9e0..fd4242866f 100644 --- a/compiled-rn/facebook-fbsource/xplat/js/RKJSModules/vendor/react/react-dom/cjs/ReactDOMClient-dev.js +++ b/compiled-rn/facebook-fbsource/xplat/js/RKJSModules/vendor/react/react-dom/cjs/ReactDOMClient-dev.js @@ -7,7 +7,7 @@ * @noflow * @nolint * @preventMunge - * @generated SignedSource<> + * @generated SignedSource<<5e7033f1de0870615b2f40810b53e26e>> */ /* @@ -29012,11 +29012,11 @@ __DEV__ && }; (function () { var isomorphicReactPackageVersion = React.version; - if ("19.2.0-native-fb-c60eebff-20250728" !== isomorphicReactPackageVersion) + if ("19.2.0-native-fb-6b22f31f-20250728" !== isomorphicReactPackageVersion) throw Error( 'Incompatible React versions: The "react" and "react-dom" packages must have the exact same version. Instead got:\n - react: ' + (isomorphicReactPackageVersion + - "\n - react-dom: 19.2.0-native-fb-c60eebff-20250728\nLearn more: https://react.dev/warnings/version-mismatch") + "\n - react-dom: 19.2.0-native-fb-6b22f31f-20250728\nLearn more: https://react.dev/warnings/version-mismatch") ); })(); ("function" === typeof Map && @@ -29053,10 +29053,10 @@ __DEV__ && !(function () { var internals = { bundleType: 1, - version: "19.2.0-native-fb-c60eebff-20250728", + version: "19.2.0-native-fb-6b22f31f-20250728", rendererPackageName: "react-dom", currentDispatcherRef: ReactSharedInternals, - reconcilerVersion: "19.2.0-native-fb-c60eebff-20250728" + reconcilerVersion: "19.2.0-native-fb-6b22f31f-20250728" }; internals.overrideHookState = overrideHookState; internals.overrideHookStateDeletePath = overrideHookStateDeletePath; @@ -29194,5 +29194,5 @@ __DEV__ && listenToAllSupportedEvents(container); return new ReactDOMHydrationRoot(initialChildren); }; - exports.version = "19.2.0-native-fb-c60eebff-20250728"; + exports.version = "19.2.0-native-fb-6b22f31f-20250728"; })(); diff --git a/compiled-rn/facebook-fbsource/xplat/js/RKJSModules/vendor/react/react-dom/cjs/ReactDOMClient-prod.js b/compiled-rn/facebook-fbsource/xplat/js/RKJSModules/vendor/react/react-dom/cjs/ReactDOMClient-prod.js index 6730011c7b..a1c8bb5bd6 100644 --- a/compiled-rn/facebook-fbsource/xplat/js/RKJSModules/vendor/react/react-dom/cjs/ReactDOMClient-prod.js +++ b/compiled-rn/facebook-fbsource/xplat/js/RKJSModules/vendor/react/react-dom/cjs/ReactDOMClient-prod.js @@ -7,7 +7,7 @@ * @noflow * @nolint * @preventMunge - * @generated SignedSource<> + * @generated SignedSource<> */ /* @@ -17123,14 +17123,14 @@ ReactDOMHydrationRoot.prototype.unstable_scheduleHydration = function (target) { }; var isomorphicReactPackageVersion$jscomp$inline_2004 = React.version; if ( - "19.2.0-native-fb-c60eebff-20250728" !== + "19.2.0-native-fb-6b22f31f-20250728" !== isomorphicReactPackageVersion$jscomp$inline_2004 ) throw Error( formatProdErrorMessage( 527, isomorphicReactPackageVersion$jscomp$inline_2004, - "19.2.0-native-fb-c60eebff-20250728" + "19.2.0-native-fb-6b22f31f-20250728" ) ); ReactDOMSharedInternals.findDOMNode = function (componentOrElement) { @@ -17152,10 +17152,10 @@ ReactDOMSharedInternals.findDOMNode = function (componentOrElement) { }; var internals$jscomp$inline_2523 = { bundleType: 0, - version: "19.2.0-native-fb-c60eebff-20250728", + version: "19.2.0-native-fb-6b22f31f-20250728", rendererPackageName: "react-dom", currentDispatcherRef: ReactSharedInternals, - reconcilerVersion: "19.2.0-native-fb-c60eebff-20250728" + reconcilerVersion: "19.2.0-native-fb-6b22f31f-20250728" }; if ("undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__) { var hook$jscomp$inline_2524 = __REACT_DEVTOOLS_GLOBAL_HOOK__; @@ -17253,4 +17253,4 @@ exports.hydrateRoot = function (container, initialChildren, options) { listenToAllSupportedEvents(container); return new ReactDOMHydrationRoot(initialChildren); }; -exports.version = "19.2.0-native-fb-c60eebff-20250728"; +exports.version = "19.2.0-native-fb-6b22f31f-20250728"; diff --git a/compiled-rn/facebook-fbsource/xplat/js/RKJSModules/vendor/react/react-dom/cjs/ReactDOMClient-profiling.js b/compiled-rn/facebook-fbsource/xplat/js/RKJSModules/vendor/react/react-dom/cjs/ReactDOMClient-profiling.js index 30c499a43c..19c93962e8 100644 --- a/compiled-rn/facebook-fbsource/xplat/js/RKJSModules/vendor/react/react-dom/cjs/ReactDOMClient-profiling.js +++ b/compiled-rn/facebook-fbsource/xplat/js/RKJSModules/vendor/react/react-dom/cjs/ReactDOMClient-profiling.js @@ -7,7 +7,7 @@ * @noflow * @nolint * @preventMunge - * @generated SignedSource<> + * @generated SignedSource<> */ /* @@ -19081,14 +19081,14 @@ ReactDOMHydrationRoot.prototype.unstable_scheduleHydration = function (target) { }; var isomorphicReactPackageVersion$jscomp$inline_2244 = React.version; if ( - "19.2.0-native-fb-c60eebff-20250728" !== + "19.2.0-native-fb-6b22f31f-20250728" !== isomorphicReactPackageVersion$jscomp$inline_2244 ) throw Error( formatProdErrorMessage( 527, isomorphicReactPackageVersion$jscomp$inline_2244, - "19.2.0-native-fb-c60eebff-20250728" + "19.2.0-native-fb-6b22f31f-20250728" ) ); ReactDOMSharedInternals.findDOMNode = function (componentOrElement) { @@ -19110,10 +19110,10 @@ ReactDOMSharedInternals.findDOMNode = function (componentOrElement) { }; var internals$jscomp$inline_2251 = { bundleType: 0, - version: "19.2.0-native-fb-c60eebff-20250728", + version: "19.2.0-native-fb-6b22f31f-20250728", rendererPackageName: "react-dom", currentDispatcherRef: ReactSharedInternals, - reconcilerVersion: "19.2.0-native-fb-c60eebff-20250728", + reconcilerVersion: "19.2.0-native-fb-6b22f31f-20250728", getLaneLabelMap: function () { for ( var map = new Map(), lane = 1, index$319 = 0; @@ -19226,4 +19226,4 @@ exports.hydrateRoot = function (container, initialChildren, options) { listenToAllSupportedEvents(container); return new ReactDOMHydrationRoot(initialChildren); }; -exports.version = "19.2.0-native-fb-c60eebff-20250728"; +exports.version = "19.2.0-native-fb-6b22f31f-20250728"; diff --git a/compiled-rn/facebook-fbsource/xplat/js/RKJSModules/vendor/react/react-dom/cjs/ReactDOMProfiling-dev.js b/compiled-rn/facebook-fbsource/xplat/js/RKJSModules/vendor/react/react-dom/cjs/ReactDOMProfiling-dev.js index ea5ec70237..e8581e54e8 100644 --- a/compiled-rn/facebook-fbsource/xplat/js/RKJSModules/vendor/react/react-dom/cjs/ReactDOMProfiling-dev.js +++ b/compiled-rn/facebook-fbsource/xplat/js/RKJSModules/vendor/react/react-dom/cjs/ReactDOMProfiling-dev.js @@ -7,7 +7,7 @@ * @noflow * @nolint * @preventMunge - * @generated SignedSource<<958fc23b2ac08b6c261eab9d2140ba38>> + * @generated SignedSource<<2f31ecace249d433b119a75010fc3940>> */ /* @@ -29068,11 +29068,11 @@ __DEV__ && }; (function () { var isomorphicReactPackageVersion = React.version; - if ("19.2.0-native-fb-c60eebff-20250728" !== isomorphicReactPackageVersion) + if ("19.2.0-native-fb-6b22f31f-20250728" !== isomorphicReactPackageVersion) throw Error( 'Incompatible React versions: The "react" and "react-dom" packages must have the exact same version. Instead got:\n - react: ' + (isomorphicReactPackageVersion + - "\n - react-dom: 19.2.0-native-fb-c60eebff-20250728\nLearn more: https://react.dev/warnings/version-mismatch") + "\n - react-dom: 19.2.0-native-fb-6b22f31f-20250728\nLearn more: https://react.dev/warnings/version-mismatch") ); })(); ("function" === typeof Map && @@ -29109,10 +29109,10 @@ __DEV__ && !(function () { var internals = { bundleType: 1, - version: "19.2.0-native-fb-c60eebff-20250728", + version: "19.2.0-native-fb-6b22f31f-20250728", rendererPackageName: "react-dom", currentDispatcherRef: ReactSharedInternals, - reconcilerVersion: "19.2.0-native-fb-c60eebff-20250728" + reconcilerVersion: "19.2.0-native-fb-6b22f31f-20250728" }; internals.overrideHookState = overrideHookState; internals.overrideHookStateDeletePath = overrideHookStateDeletePath; @@ -29566,7 +29566,7 @@ __DEV__ && exports.useFormStatus = function () { return resolveDispatcher().useHostTransitionStatus(); }; - exports.version = "19.2.0-native-fb-c60eebff-20250728"; + exports.version = "19.2.0-native-fb-6b22f31f-20250728"; "undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ && "function" === typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop && diff --git a/compiled-rn/facebook-fbsource/xplat/js/RKJSModules/vendor/react/react-dom/cjs/ReactDOMProfiling-prod.js b/compiled-rn/facebook-fbsource/xplat/js/RKJSModules/vendor/react/react-dom/cjs/ReactDOMProfiling-prod.js index bfa1b952de..586fa01108 100644 --- a/compiled-rn/facebook-fbsource/xplat/js/RKJSModules/vendor/react/react-dom/cjs/ReactDOMProfiling-prod.js +++ b/compiled-rn/facebook-fbsource/xplat/js/RKJSModules/vendor/react/react-dom/cjs/ReactDOMProfiling-prod.js @@ -7,7 +7,7 @@ * @noflow * @nolint * @preventMunge - * @generated SignedSource<> + * @generated SignedSource<<2beae47e80b49019c144d0b90c0f237e>> */ /* @@ -17134,14 +17134,14 @@ ReactDOMHydrationRoot.prototype.unstable_scheduleHydration = function (target) { }; var isomorphicReactPackageVersion$jscomp$inline_2005 = React.version; if ( - "19.2.0-native-fb-c60eebff-20250728" !== + "19.2.0-native-fb-6b22f31f-20250728" !== isomorphicReactPackageVersion$jscomp$inline_2005 ) throw Error( formatProdErrorMessage( 527, isomorphicReactPackageVersion$jscomp$inline_2005, - "19.2.0-native-fb-c60eebff-20250728" + "19.2.0-native-fb-6b22f31f-20250728" ) ); ReactDOMSharedInternals.findDOMNode = function (componentOrElement) { @@ -17163,10 +17163,10 @@ ReactDOMSharedInternals.findDOMNode = function (componentOrElement) { }; var internals$jscomp$inline_2526 = { bundleType: 0, - version: "19.2.0-native-fb-c60eebff-20250728", + version: "19.2.0-native-fb-6b22f31f-20250728", rendererPackageName: "react-dom", currentDispatcherRef: ReactSharedInternals, - reconcilerVersion: "19.2.0-native-fb-c60eebff-20250728" + reconcilerVersion: "19.2.0-native-fb-6b22f31f-20250728" }; if ("undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__) { var hook$jscomp$inline_2527 = __REACT_DEVTOOLS_GLOBAL_HOOK__; @@ -17417,4 +17417,4 @@ exports.useFormState = function (action, initialState, permalink) { exports.useFormStatus = function () { return ReactSharedInternals.H.useHostTransitionStatus(); }; -exports.version = "19.2.0-native-fb-c60eebff-20250728"; +exports.version = "19.2.0-native-fb-6b22f31f-20250728"; diff --git a/compiled-rn/facebook-fbsource/xplat/js/RKJSModules/vendor/react/react-dom/cjs/ReactDOMProfiling-profiling.js b/compiled-rn/facebook-fbsource/xplat/js/RKJSModules/vendor/react/react-dom/cjs/ReactDOMProfiling-profiling.js index 11f6daa493..62ffef280a 100644 --- a/compiled-rn/facebook-fbsource/xplat/js/RKJSModules/vendor/react/react-dom/cjs/ReactDOMProfiling-profiling.js +++ b/compiled-rn/facebook-fbsource/xplat/js/RKJSModules/vendor/react/react-dom/cjs/ReactDOMProfiling-profiling.js @@ -7,7 +7,7 @@ * @noflow * @nolint * @preventMunge - * @generated SignedSource<> + * @generated SignedSource<<3799e19751c2dd5e57f48623a094201c>> */ /* @@ -19096,14 +19096,14 @@ ReactDOMHydrationRoot.prototype.unstable_scheduleHydration = function (target) { }; var isomorphicReactPackageVersion$jscomp$inline_2245 = React.version; if ( - "19.2.0-native-fb-c60eebff-20250728" !== + "19.2.0-native-fb-6b22f31f-20250728" !== isomorphicReactPackageVersion$jscomp$inline_2245 ) throw Error( formatProdErrorMessage( 527, isomorphicReactPackageVersion$jscomp$inline_2245, - "19.2.0-native-fb-c60eebff-20250728" + "19.2.0-native-fb-6b22f31f-20250728" ) ); ReactDOMSharedInternals.findDOMNode = function (componentOrElement) { @@ -19125,10 +19125,10 @@ ReactDOMSharedInternals.findDOMNode = function (componentOrElement) { }; var internals$jscomp$inline_2252 = { bundleType: 0, - version: "19.2.0-native-fb-c60eebff-20250728", + version: "19.2.0-native-fb-6b22f31f-20250728", rendererPackageName: "react-dom", currentDispatcherRef: ReactSharedInternals, - reconcilerVersion: "19.2.0-native-fb-c60eebff-20250728", + reconcilerVersion: "19.2.0-native-fb-6b22f31f-20250728", getLaneLabelMap: function () { for ( var map = new Map(), lane = 1, index$319 = 0; @@ -19394,7 +19394,7 @@ exports.useFormState = function (action, initialState, permalink) { exports.useFormStatus = function () { return ReactSharedInternals.H.useHostTransitionStatus(); }; -exports.version = "19.2.0-native-fb-c60eebff-20250728"; +exports.version = "19.2.0-native-fb-6b22f31f-20250728"; "undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ && "function" === typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop && diff --git a/compiled-rn/facebook-fbsource/xplat/js/RKJSModules/vendor/react/react-test-renderer/cjs/ReactTestRenderer-dev.js b/compiled-rn/facebook-fbsource/xplat/js/RKJSModules/vendor/react/react-test-renderer/cjs/ReactTestRenderer-dev.js index 02ee125d32..78a3056b37 100644 --- a/compiled-rn/facebook-fbsource/xplat/js/RKJSModules/vendor/react/react-test-renderer/cjs/ReactTestRenderer-dev.js +++ b/compiled-rn/facebook-fbsource/xplat/js/RKJSModules/vendor/react/react-test-renderer/cjs/ReactTestRenderer-dev.js @@ -7,7 +7,7 @@ * @noflow * @nolint * @preventMunge - * @generated SignedSource<<79c3017ef84bb953912cab707878d317>> + * @generated SignedSource<> */ "use strict"; @@ -15726,10 +15726,10 @@ __DEV__ && (function () { var internals = { bundleType: 1, - version: "19.2.0-native-fb-c60eebff-20250728", + version: "19.2.0-native-fb-6b22f31f-20250728", rendererPackageName: "react-test-renderer", currentDispatcherRef: ReactSharedInternals, - reconcilerVersion: "19.2.0-native-fb-c60eebff-20250728" + reconcilerVersion: "19.2.0-native-fb-6b22f31f-20250728" }; internals.overrideHookState = overrideHookState; internals.overrideHookStateDeletePath = overrideHookStateDeletePath; @@ -15874,5 +15874,5 @@ __DEV__ && flushSyncWorkAcrossRoots_impl(0, !0)); } }; - exports.version = "19.2.0-native-fb-c60eebff-20250728"; + exports.version = "19.2.0-native-fb-6b22f31f-20250728"; })(); diff --git a/compiled-rn/facebook-fbsource/xplat/js/RKJSModules/vendor/react/react-test-renderer/cjs/ReactTestRenderer-prod.js b/compiled-rn/facebook-fbsource/xplat/js/RKJSModules/vendor/react/react-test-renderer/cjs/ReactTestRenderer-prod.js index 97219ab2bf..4ec1cf3b1c 100644 --- a/compiled-rn/facebook-fbsource/xplat/js/RKJSModules/vendor/react/react-test-renderer/cjs/ReactTestRenderer-prod.js +++ b/compiled-rn/facebook-fbsource/xplat/js/RKJSModules/vendor/react/react-test-renderer/cjs/ReactTestRenderer-prod.js @@ -7,7 +7,7 @@ * @noflow * @nolint * @preventMunge - * @generated SignedSource<<57749b493ecff8717821f9aeeb2b6271>> + * @generated SignedSource<<2567121a95d7e1e1d64a6501660fa9cb>> */ "use strict"; @@ -9907,10 +9907,10 @@ function wrapFiber(fiber) { } var internals$jscomp$inline_1434 = { bundleType: 0, - version: "19.2.0-native-fb-c60eebff-20250728", + version: "19.2.0-native-fb-6b22f31f-20250728", rendererPackageName: "react-test-renderer", currentDispatcherRef: ReactSharedInternals, - reconcilerVersion: "19.2.0-native-fb-c60eebff-20250728" + reconcilerVersion: "19.2.0-native-fb-6b22f31f-20250728" }; if ("undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__) { var hook$jscomp$inline_1435 = __REACT_DEVTOOLS_GLOBAL_HOOK__; @@ -10046,4 +10046,4 @@ exports.unstable_batchedUpdates = function (fn, a) { flushSyncWorkAcrossRoots_impl(0, !0)); } }; -exports.version = "19.2.0-native-fb-c60eebff-20250728"; +exports.version = "19.2.0-native-fb-6b22f31f-20250728"; diff --git a/compiled-rn/facebook-fbsource/xplat/js/RKJSModules/vendor/react/react-test-renderer/cjs/ReactTestRenderer-profiling.js b/compiled-rn/facebook-fbsource/xplat/js/RKJSModules/vendor/react/react-test-renderer/cjs/ReactTestRenderer-profiling.js index 1a28f1606c..6a1053932f 100644 --- a/compiled-rn/facebook-fbsource/xplat/js/RKJSModules/vendor/react/react-test-renderer/cjs/ReactTestRenderer-profiling.js +++ b/compiled-rn/facebook-fbsource/xplat/js/RKJSModules/vendor/react/react-test-renderer/cjs/ReactTestRenderer-profiling.js @@ -7,7 +7,7 @@ * @noflow * @nolint * @preventMunge - * @generated SignedSource<<89704f72860d3fbd1be95585c361ae15>> + * @generated SignedSource<> */ "use strict"; @@ -10527,10 +10527,10 @@ function wrapFiber(fiber) { } var internals$jscomp$inline_1241 = { bundleType: 0, - version: "19.2.0-native-fb-c60eebff-20250728", + version: "19.2.0-native-fb-6b22f31f-20250728", rendererPackageName: "react-test-renderer", currentDispatcherRef: ReactSharedInternals, - reconcilerVersion: "19.2.0-native-fb-c60eebff-20250728", + reconcilerVersion: "19.2.0-native-fb-6b22f31f-20250728", getLaneLabelMap: function () { for ( var map = new Map(), lane = 1, index$143 = 0; @@ -10681,4 +10681,4 @@ exports.unstable_batchedUpdates = function (fn, a) { flushSyncWorkAcrossRoots_impl(0, !0)); } }; -exports.version = "19.2.0-native-fb-c60eebff-20250728"; +exports.version = "19.2.0-native-fb-6b22f31f-20250728"; diff --git a/compiled-rn/facebook-fbsource/xplat/js/RKJSModules/vendor/react/react/cjs/React-dev.js b/compiled-rn/facebook-fbsource/xplat/js/RKJSModules/vendor/react/react/cjs/React-dev.js index 9fbed37263..d28c37fb5d 100644 --- a/compiled-rn/facebook-fbsource/xplat/js/RKJSModules/vendor/react/react/cjs/React-dev.js +++ b/compiled-rn/facebook-fbsource/xplat/js/RKJSModules/vendor/react/react/cjs/React-dev.js @@ -7,7 +7,7 @@ * @noflow * @nolint * @preventMunge - * @generated SignedSource<> + * @generated SignedSource<<9fd8c2f3de5e40e5fceda36a4485ba65>> */ "use strict"; @@ -1413,7 +1413,7 @@ __DEV__ && exports.useTransition = function () { return resolveDispatcher().useTransition(); }; - exports.version = "19.2.0-native-fb-c60eebff-20250728"; + exports.version = "19.2.0-native-fb-6b22f31f-20250728"; "undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ && "function" === typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop && diff --git a/compiled-rn/facebook-fbsource/xplat/js/RKJSModules/vendor/react/react/cjs/React-prod.js b/compiled-rn/facebook-fbsource/xplat/js/RKJSModules/vendor/react/react/cjs/React-prod.js index f41e99e293..802818040e 100644 --- a/compiled-rn/facebook-fbsource/xplat/js/RKJSModules/vendor/react/react/cjs/React-prod.js +++ b/compiled-rn/facebook-fbsource/xplat/js/RKJSModules/vendor/react/react/cjs/React-prod.js @@ -7,7 +7,7 @@ * @noflow * @nolint * @preventMunge - * @generated SignedSource<> + * @generated SignedSource<<25f93a06c6108875b4c6ed4cd1311218>> */ "use strict"; @@ -589,4 +589,4 @@ exports.useSyncExternalStore = function ( exports.useTransition = function () { return ReactSharedInternals.H.useTransition(); }; -exports.version = "19.2.0-native-fb-c60eebff-20250728"; +exports.version = "19.2.0-native-fb-6b22f31f-20250728"; diff --git a/compiled-rn/facebook-fbsource/xplat/js/RKJSModules/vendor/react/react/cjs/React-profiling.js b/compiled-rn/facebook-fbsource/xplat/js/RKJSModules/vendor/react/react/cjs/React-profiling.js index f78b9ffcd8..9ecd389a03 100644 --- a/compiled-rn/facebook-fbsource/xplat/js/RKJSModules/vendor/react/react/cjs/React-profiling.js +++ b/compiled-rn/facebook-fbsource/xplat/js/RKJSModules/vendor/react/react/cjs/React-profiling.js @@ -7,7 +7,7 @@ * @noflow * @nolint * @preventMunge - * @generated SignedSource<<0152a2a79d2462121d6600d3a16422aa>> + * @generated SignedSource<> */ "use strict"; @@ -593,7 +593,7 @@ exports.useSyncExternalStore = function ( exports.useTransition = function () { return ReactSharedInternals.H.useTransition(); }; -exports.version = "19.2.0-native-fb-c60eebff-20250728"; +exports.version = "19.2.0-native-fb-6b22f31f-20250728"; "undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ && "function" === typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop && diff --git a/compiled-rn/facebook-fbsource/xplat/js/react-native-github/Libraries/Renderer/REVISION b/compiled-rn/facebook-fbsource/xplat/js/react-native-github/Libraries/Renderer/REVISION index d369e07fd4..5372aaa9c0 100644 --- a/compiled-rn/facebook-fbsource/xplat/js/react-native-github/Libraries/Renderer/REVISION +++ b/compiled-rn/facebook-fbsource/xplat/js/react-native-github/Libraries/Renderer/REVISION @@ -1 +1 @@ -c60eebffea94a67f35c6ebbf7019e5b2145d4284 +6b22f31f1ac88cce1b38c67a5c97c7ab0e832823 diff --git a/compiled-rn/facebook-fbsource/xplat/js/react-native-github/Libraries/Renderer/implementations/ReactFabric-dev.fb.js b/compiled-rn/facebook-fbsource/xplat/js/react-native-github/Libraries/Renderer/implementations/ReactFabric-dev.fb.js index 379923ce52..15a75c586f 100644 --- a/compiled-rn/facebook-fbsource/xplat/js/react-native-github/Libraries/Renderer/implementations/ReactFabric-dev.fb.js +++ b/compiled-rn/facebook-fbsource/xplat/js/react-native-github/Libraries/Renderer/implementations/ReactFabric-dev.fb.js @@ -7,7 +7,7 @@ * @noflow * @nolint * @preventMunge - * @generated SignedSource<<944a038736093c27ac434824dd00d12b>> + * @generated SignedSource<> */ "use strict"; @@ -19231,10 +19231,10 @@ __DEV__ && (function () { var internals = { bundleType: 1, - version: "19.2.0-native-fb-c60eebff-20250728", + version: "19.2.0-native-fb-6b22f31f-20250728", rendererPackageName: "react-native-renderer", currentDispatcherRef: ReactSharedInternals, - reconcilerVersion: "19.2.0-native-fb-c60eebff-20250728" + reconcilerVersion: "19.2.0-native-fb-6b22f31f-20250728" }; null !== extraDevToolsConfig && (internals.rendererConfig = extraDevToolsConfig); diff --git a/compiled-rn/facebook-fbsource/xplat/js/react-native-github/Libraries/Renderer/implementations/ReactFabric-prod.fb.js b/compiled-rn/facebook-fbsource/xplat/js/react-native-github/Libraries/Renderer/implementations/ReactFabric-prod.fb.js index ebb5de8524..11f9ebeb81 100644 --- a/compiled-rn/facebook-fbsource/xplat/js/react-native-github/Libraries/Renderer/implementations/ReactFabric-prod.fb.js +++ b/compiled-rn/facebook-fbsource/xplat/js/react-native-github/Libraries/Renderer/implementations/ReactFabric-prod.fb.js @@ -7,7 +7,7 @@ * @noflow * @nolint * @preventMunge - * @generated SignedSource<> + * @generated SignedSource<> */ "use strict"; @@ -11011,10 +11011,10 @@ batchedUpdatesImpl = function (fn, a) { var roots = new Map(), internals$jscomp$inline_1237 = { bundleType: 0, - version: "19.2.0-native-fb-c60eebff-20250728", + version: "19.2.0-native-fb-6b22f31f-20250728", rendererPackageName: "react-native-renderer", currentDispatcherRef: ReactSharedInternals, - reconcilerVersion: "19.2.0-native-fb-c60eebff-20250728" + reconcilerVersion: "19.2.0-native-fb-6b22f31f-20250728" }; null !== extraDevToolsConfig && (internals$jscomp$inline_1237.rendererConfig = extraDevToolsConfig); diff --git a/compiled-rn/facebook-fbsource/xplat/js/react-native-github/Libraries/Renderer/implementations/ReactFabric-profiling.fb.js b/compiled-rn/facebook-fbsource/xplat/js/react-native-github/Libraries/Renderer/implementations/ReactFabric-profiling.fb.js index 22002a2043..8b1ed1df4a 100644 --- a/compiled-rn/facebook-fbsource/xplat/js/react-native-github/Libraries/Renderer/implementations/ReactFabric-profiling.fb.js +++ b/compiled-rn/facebook-fbsource/xplat/js/react-native-github/Libraries/Renderer/implementations/ReactFabric-profiling.fb.js @@ -7,7 +7,7 @@ * @noflow * @nolint * @preventMunge - * @generated SignedSource<<6cfa76103f123043504e741a4265a68c>> + * @generated SignedSource<> */ "use strict"; @@ -12940,10 +12940,10 @@ batchedUpdatesImpl = function (fn, a) { var roots = new Map(), internals$jscomp$inline_1472 = { bundleType: 0, - version: "19.2.0-native-fb-c60eebff-20250728", + version: "19.2.0-native-fb-6b22f31f-20250728", rendererPackageName: "react-native-renderer", currentDispatcherRef: ReactSharedInternals, - reconcilerVersion: "19.2.0-native-fb-c60eebff-20250728" + reconcilerVersion: "19.2.0-native-fb-6b22f31f-20250728" }; null !== extraDevToolsConfig && (internals$jscomp$inline_1472.rendererConfig = extraDevToolsConfig); diff --git a/compiled-rn/facebook-fbsource/xplat/js/react-native-github/Libraries/Renderer/implementations/ReactNativeRenderer-dev.fb.js b/compiled-rn/facebook-fbsource/xplat/js/react-native-github/Libraries/Renderer/implementations/ReactNativeRenderer-dev.fb.js index ba5f8d7efc..dd32223b84 100644 --- a/compiled-rn/facebook-fbsource/xplat/js/react-native-github/Libraries/Renderer/implementations/ReactNativeRenderer-dev.fb.js +++ b/compiled-rn/facebook-fbsource/xplat/js/react-native-github/Libraries/Renderer/implementations/ReactNativeRenderer-dev.fb.js @@ -7,7 +7,7 @@ * @noflow * @nolint * @preventMunge - * @generated SignedSource<> + * @generated SignedSource<<3af1d9a83987e743e543622a2bcef34a>> */ "use strict"; @@ -19589,11 +19589,11 @@ __DEV__ && shouldSuspendImpl = newShouldSuspendImpl; }; var isomorphicReactPackageVersion = React.version; - if ("19.2.0-native-fb-c60eebff-20250728" !== isomorphicReactPackageVersion) + if ("19.2.0-native-fb-6b22f31f-20250728" !== isomorphicReactPackageVersion) throw Error( 'Incompatible React versions: The "react" and "react-native-renderer" packages must have the exact same version. Instead got:\n - react: ' + (isomorphicReactPackageVersion + - "\n - react-native-renderer: 19.2.0-native-fb-c60eebff-20250728\nLearn more: https://react.dev/warnings/version-mismatch") + "\n - react-native-renderer: 19.2.0-native-fb-6b22f31f-20250728\nLearn more: https://react.dev/warnings/version-mismatch") ); if ( "function" !== @@ -19619,10 +19619,10 @@ __DEV__ && (function () { var internals = { bundleType: 1, - version: "19.2.0-native-fb-c60eebff-20250728", + version: "19.2.0-native-fb-6b22f31f-20250728", rendererPackageName: "react-native-renderer", currentDispatcherRef: ReactSharedInternals, - reconcilerVersion: "19.2.0-native-fb-c60eebff-20250728" + reconcilerVersion: "19.2.0-native-fb-6b22f31f-20250728" }; null !== extraDevToolsConfig && (internals.rendererConfig = extraDevToolsConfig); diff --git a/compiled-rn/facebook-fbsource/xplat/js/react-native-github/Libraries/Renderer/implementations/ReactNativeRenderer-prod.fb.js b/compiled-rn/facebook-fbsource/xplat/js/react-native-github/Libraries/Renderer/implementations/ReactNativeRenderer-prod.fb.js index e28bcc8a00..7e8d419e01 100644 --- a/compiled-rn/facebook-fbsource/xplat/js/react-native-github/Libraries/Renderer/implementations/ReactNativeRenderer-prod.fb.js +++ b/compiled-rn/facebook-fbsource/xplat/js/react-native-github/Libraries/Renderer/implementations/ReactNativeRenderer-prod.fb.js @@ -7,7 +7,7 @@ * @noflow * @nolint * @preventMunge - * @generated SignedSource<<125041a4b2c7b3b16ddcaae77a1c5560>> + * @generated SignedSource<> */ "use strict"; @@ -11237,11 +11237,11 @@ function updateContainer(element, container, parentComponent, callback) { return lane; } var isomorphicReactPackageVersion = React.version; -if ("19.2.0-native-fb-c60eebff-20250728" !== isomorphicReactPackageVersion) +if ("19.2.0-native-fb-6b22f31f-20250728" !== isomorphicReactPackageVersion) throw Error( 'Incompatible React versions: The "react" and "react-native-renderer" packages must have the exact same version. Instead got:\n - react: ' + (isomorphicReactPackageVersion + - "\n - react-native-renderer: 19.2.0-native-fb-c60eebff-20250728\nLearn more: https://react.dev/warnings/version-mismatch") + "\n - react-native-renderer: 19.2.0-native-fb-6b22f31f-20250728\nLearn more: https://react.dev/warnings/version-mismatch") ); if ( "function" !== @@ -11291,10 +11291,10 @@ batchedUpdatesImpl = function (fn, a) { var roots = new Map(), internals$jscomp$inline_1295 = { bundleType: 0, - version: "19.2.0-native-fb-c60eebff-20250728", + version: "19.2.0-native-fb-6b22f31f-20250728", rendererPackageName: "react-native-renderer", currentDispatcherRef: ReactSharedInternals, - reconcilerVersion: "19.2.0-native-fb-c60eebff-20250728" + reconcilerVersion: "19.2.0-native-fb-6b22f31f-20250728" }; null !== extraDevToolsConfig && (internals$jscomp$inline_1295.rendererConfig = extraDevToolsConfig); diff --git a/compiled-rn/facebook-fbsource/xplat/js/react-native-github/Libraries/Renderer/implementations/ReactNativeRenderer-profiling.fb.js b/compiled-rn/facebook-fbsource/xplat/js/react-native-github/Libraries/Renderer/implementations/ReactNativeRenderer-profiling.fb.js index 8dff9946dc..e8c924cfdf 100644 --- a/compiled-rn/facebook-fbsource/xplat/js/react-native-github/Libraries/Renderer/implementations/ReactNativeRenderer-profiling.fb.js +++ b/compiled-rn/facebook-fbsource/xplat/js/react-native-github/Libraries/Renderer/implementations/ReactNativeRenderer-profiling.fb.js @@ -7,7 +7,7 @@ * @noflow * @nolint * @preventMunge - * @generated SignedSource<<730539030a8bf7f99972f17fb5ba82a8>> + * @generated SignedSource<> */ "use strict"; @@ -13155,11 +13155,11 @@ function updateContainer(element, container, parentComponent, callback) { return lane; } var isomorphicReactPackageVersion = React.version; -if ("19.2.0-native-fb-c60eebff-20250728" !== isomorphicReactPackageVersion) +if ("19.2.0-native-fb-6b22f31f-20250728" !== isomorphicReactPackageVersion) throw Error( 'Incompatible React versions: The "react" and "react-native-renderer" packages must have the exact same version. Instead got:\n - react: ' + (isomorphicReactPackageVersion + - "\n - react-native-renderer: 19.2.0-native-fb-c60eebff-20250728\nLearn more: https://react.dev/warnings/version-mismatch") + "\n - react-native-renderer: 19.2.0-native-fb-6b22f31f-20250728\nLearn more: https://react.dev/warnings/version-mismatch") ); if ( "function" !== @@ -13209,10 +13209,10 @@ batchedUpdatesImpl = function (fn, a) { var roots = new Map(), internals$jscomp$inline_1530 = { bundleType: 0, - version: "19.2.0-native-fb-c60eebff-20250728", + version: "19.2.0-native-fb-6b22f31f-20250728", rendererPackageName: "react-native-renderer", currentDispatcherRef: ReactSharedInternals, - reconcilerVersion: "19.2.0-native-fb-c60eebff-20250728" + reconcilerVersion: "19.2.0-native-fb-6b22f31f-20250728" }; null !== extraDevToolsConfig && (internals$jscomp$inline_1530.rendererConfig = extraDevToolsConfig); diff --git a/compiled-rn/facebook-fbsource/xplat/js/tools/eslint-plugin-react-hooks/cjs/eslint-plugin-react-hooks.development.js b/compiled-rn/facebook-fbsource/xplat/js/tools/eslint-plugin-react-hooks/cjs/eslint-plugin-react-hooks.development.js index b4bbfa59e6..7bb7b7624b 100644 --- a/compiled-rn/facebook-fbsource/xplat/js/tools/eslint-plugin-react-hooks/cjs/eslint-plugin-react-hooks.development.js +++ b/compiled-rn/facebook-fbsource/xplat/js/tools/eslint-plugin-react-hooks/cjs/eslint-plugin-react-hooks.development.js @@ -12,7 +12,7 @@ * @lightSyntaxTransform * @preventMunge * @oncall react_core - * @generated SignedSource<> + * @generated SignedSource<<1e211c71e7a37149f580804368da78b4>> */ 'use strict'; @@ -43756,7 +43756,7 @@ function collectMaybeMemoDependencies(value, maybeDeps, optional) { } return null; } -function collectTemporaries$1(instr, env, sidemap) { +function collectTemporaries(instr, env, sidemap) { const { value, lvalue } = instr; switch (value.kind) { case 'FunctionExpression': { @@ -43853,43 +43853,69 @@ function getManualMemoizationReplacement(fn, loc, kind) { }; } } -function extractManualMemoizationArgs(instr, kind, sidemap) { +function extractManualMemoizationArgs(instr, kind, sidemap, errors) { const [fnPlace, depsListPlace] = instr.value.args; if (fnPlace == null) { - CompilerError.throwInvalidReact({ - reason: `Expected a callback function to be passed to ${kind}`, - loc: instr.value.loc, + errors.pushDiagnostic(CompilerDiagnostic.create({ + severity: ErrorSeverity.InvalidReact, + category: `Expected a callback function to be passed to ${kind}`, + description: `Expected a callback function to be passed to ${kind}`, suggestions: null, - }); + }).withDetail({ + kind: 'error', + loc: instr.value.loc, + message: `Expected a callback function to be passed to ${kind}`, + })); + return { fnPlace: null, depsList: null }; } if (fnPlace.kind === 'Spread' || (depsListPlace === null || depsListPlace === void 0 ? void 0 : depsListPlace.kind) === 'Spread') { - CompilerError.throwInvalidReact({ - reason: `Unexpected spread argument to ${kind}`, - loc: instr.value.loc, + errors.pushDiagnostic(CompilerDiagnostic.create({ + severity: ErrorSeverity.InvalidReact, + category: `Unexpected spread argument to ${kind}`, + description: `Unexpected spread argument to ${kind}`, suggestions: null, - }); + }).withDetail({ + kind: 'error', + loc: instr.value.loc, + message: `Unexpected spread argument to ${kind}`, + })); + return { fnPlace: null, depsList: null }; } let depsList = null; if (depsListPlace != null) { const maybeDepsList = sidemap.maybeDepsLists.get(depsListPlace.identifier.id); if (maybeDepsList == null) { - CompilerError.throwInvalidReact({ - reason: `Expected the dependency list for ${kind} to be an array literal`, + errors.pushDiagnostic(CompilerDiagnostic.create({ + severity: ErrorSeverity.InvalidReact, + category: `Expected the dependency list for ${kind} to be an array literal`, + description: `Expected the dependency list for ${kind} to be an array literal`, suggestions: null, + }).withDetail({ + kind: 'error', loc: depsListPlace.loc, - }); + message: `Expected the dependency list for ${kind} to be an array literal`, + })); + return { fnPlace, depsList: null }; } - depsList = maybeDepsList.map(dep => { + depsList = []; + for (const dep of maybeDepsList) { const maybeDep = sidemap.maybeDeps.get(dep.identifier.id); if (maybeDep == null) { - CompilerError.throwInvalidReact({ - reason: `Expected the dependency list to be an array of simple expressions (e.g. \`x\`, \`x.y.z\`, \`x?.y?.z\`)`, + errors.pushDiagnostic(CompilerDiagnostic.create({ + severity: ErrorSeverity.InvalidReact, + category: `Expected the dependency list to be an array of simple expressions (e.g. \`x\`, \`x.y.z\`, \`x?.y?.z\`)`, + description: `Expected the dependency list to be an array of simple expressions (e.g. \`x\`, \`x.y.z\`, \`x?.y?.z\`)`, suggestions: null, + }).withDetail({ + kind: 'error', loc: dep.loc, - }); + message: `Expected the dependency list to be an array of simple expressions (e.g. \`x\`, \`x.y.z\`, \`x?.y?.z\`)`, + })); } - return maybeDep; - }); + else { + depsList.push(maybeDep); + } + } } return { fnPlace, @@ -43897,6 +43923,8 @@ function extractManualMemoizationArgs(instr, kind, sidemap) { }; } function dropManualMemoization(func) { + var _a; + const errors = new CompilerError(); const isValidationEnabled = func.env.config.validatePreserveExistingMemoizationGuarantees || func.env.config.validateNoSetStateInRender || func.env.config.enablePreserveExistingMemoizationGuarantees; @@ -43921,15 +43949,44 @@ function dropManualMemoization(func) { : instr.value.property.identifier.id; const manualMemo = sidemap.manualMemos.get(id); if (manualMemo != null) { - const { fnPlace, depsList } = extractManualMemoizationArgs(instr, manualMemo.kind, sidemap); + const { fnPlace, depsList } = extractManualMemoizationArgs(instr, manualMemo.kind, sidemap, errors); + if (fnPlace == null) { + continue; + } + if (func.env.config.validateNoVoidUseMemo && + manualMemo.kind === 'useMemo') { + const funcToCheck = (_a = sidemap.functions.get(fnPlace.identifier.id)) === null || _a === void 0 ? void 0 : _a.value; + if (funcToCheck !== undefined && funcToCheck.loweredFunc.func) { + if (!hasNonVoidReturn(funcToCheck.loweredFunc.func)) { + errors.pushDiagnostic(CompilerDiagnostic.create({ + severity: ErrorSeverity.InvalidReact, + category: 'useMemo() callbacks must return a value', + description: `This ${manualMemo.loadInstr.value.kind === 'PropertyLoad' + ? 'React.useMemo' + : 'useMemo'} callback doesn't return a value. useMemo is for computing and caching values, not for arbitrary side effects.`, + suggestions: null, + }).withDetail({ + kind: 'error', + loc: instr.value.loc, + message: 'useMemo() callbacks must return a value', + })); + } + } + } instr.value = getManualMemoizationReplacement(fnPlace, instr.value.loc, manualMemo.kind); if (isValidationEnabled) { if (!sidemap.functions.has(fnPlace.identifier.id)) { - CompilerError.throwInvalidReact({ - reason: `Expected the first argument to be an inline function expression`, + errors.pushDiagnostic(CompilerDiagnostic.create({ + severity: ErrorSeverity.InvalidReact, + category: `Expected the first argument to be an inline function expression`, + description: `Expected the first argument to be an inline function expression`, suggestions: [], + }).withDetail({ + kind: 'error', loc: fnPlace.loc, - }); + message: `Expected the first argument to be an inline function expression`, + })); + continue; } const memoDecl = manualMemo.kind === 'useMemo' ? instr.lvalue @@ -43947,7 +44004,7 @@ function dropManualMemoization(func) { } } else { - collectTemporaries$1(instr, func.env, sidemap); + collectTemporaries(instr, func.env, sidemap); } } } @@ -43976,6 +44033,7 @@ function dropManualMemoization(func) { markInstructionIds(func.body); } } + return errors.asResult(); } function findOptionalPlaces(fn) { const optionals = new Set(); @@ -44019,6 +44077,17 @@ function findOptionalPlaces(fn) { } return optionals; } +function hasNonVoidReturn(func) { + for (const [, block] of func.body.blocks) { + if (block.terminal.kind === 'return') { + if (block.terminal.returnVariant === 'Explicit' || + block.terminal.returnVariant === 'Implicit') { + return true; + } + } + } + return false; +} class StableSidemap { constructor(env) { @@ -47619,107 +47688,6 @@ function visit(identifiers, place, kind) { identifiers.set(place.identifier.id, { place, kind }); } -function validateNoVoidUseMemo(fn) { - const errors = new CompilerError(); - const sidemap = { - useMemoHooks: new Map(), - funcExprs: new Map(), - react: new Set(), - }; - for (const [, block] of fn.body.blocks) { - for (const instr of block.instructions) { - collectTemporaries(instr, fn.env, sidemap); - } - } - for (const [, block] of fn.body.blocks) { - for (const instr of block.instructions) { - if (instr.value.kind === 'CallExpression') { - const callee = instr.value.callee.identifier; - const useMemoHook = sidemap.useMemoHooks.get(callee.id); - if (useMemoHook !== undefined && instr.value.args.length > 0) { - const firstArg = instr.value.args[0]; - if (firstArg.kind !== 'Identifier') { - continue; - } - let funcToCheck = sidemap.funcExprs.get(firstArg.identifier.id); - if (!funcToCheck) { - for (const [, searchBlock] of fn.body.blocks) { - for (const searchInstr of searchBlock.instructions) { - if (searchInstr.lvalue && - searchInstr.lvalue.identifier.id === firstArg.identifier.id && - searchInstr.value.kind === 'FunctionExpression') { - funcToCheck = searchInstr.value; - break; - } - } - if (funcToCheck) - break; - } - } - if (funcToCheck) { - const hasReturn = checkFunctionHasNonVoidReturn(funcToCheck.loweredFunc.func); - if (!hasReturn) { - errors.push({ - severity: ErrorSeverity.InvalidReact, - reason: `React Compiler has skipped optimizing this component because ${useMemoHook.name} doesn't return a value. ${useMemoHook.name} should only be used for memoizing values, not running arbitrary side effects.`, - loc: useMemoHook.loc, - suggestions: null, - description: null, - }); - } - } - } - } - } - } - return errors.asResult(); -} -function checkFunctionHasNonVoidReturn(func) { - for (const [, block] of func.body.blocks) { - if (block.terminal.kind === 'return') { - if (block.terminal.returnVariant === 'Explicit' || - block.terminal.returnVariant === 'Implicit') { - return true; - } - } - } - return false; -} -function collectTemporaries(instr, env, sidemap) { - const { value, lvalue } = instr; - switch (value.kind) { - case 'FunctionExpression': { - sidemap.funcExprs.set(lvalue.identifier.id, value); - break; - } - case 'LoadGlobal': { - const global = env.getGlobalDeclaration(value.binding, value.loc); - const hookKind = global !== null ? getHookKindForType(env, global) : null; - if (hookKind === 'useMemo') { - sidemap.useMemoHooks.set(lvalue.identifier.id, { - name: value.binding.name, - loc: instr.loc, - }); - } - else if (value.binding.name === 'React') { - sidemap.react.add(lvalue.identifier.id); - } - break; - } - case 'PropertyLoad': { - if (sidemap.react.has(value.object.identifier.id)) { - if (value.property === 'useMemo') { - sidemap.useMemoHooks.set(lvalue.identifier.id, { - name: value.property, - loc: instr.loc, - }); - } - } - break; - } - } -} - function computeUnconditionalBlocks(fn) { const unconditionalBlocks = new Set(); const dominators = computePostDominatorTree(fn, { @@ -50812,14 +50780,11 @@ function runWithEnvironment(func, env) { log({ kind: 'hir', name: 'PruneMaybeThrows', value: hir }); validateContextVariableLValues(hir); validateUseMemo(hir).unwrap(); - if (env.config.validateNoVoidUseMemo) { - validateNoVoidUseMemo(hir).unwrap(); - } if (env.isInferredMemoEnabled && !env.config.enablePreserveExistingManualUseMemo && !env.config.disableMemoizationForDebugging && !env.config.enableChangeDetectionForDebugging) { - dropManualMemoization(hir); + dropManualMemoization(hir).unwrap(); log({ kind: 'hir', name: 'DropManualMemoization', value: hir }); } inlineImmediatelyInvokedFunctionExpressions(hir); diff --git a/compiled-rn/facebook-fbsource/xplat/js/tools/eslint-plugin-react-hooks/cjs/eslint-plugin-react-hooks.production.js b/compiled-rn/facebook-fbsource/xplat/js/tools/eslint-plugin-react-hooks/cjs/eslint-plugin-react-hooks.production.js index abb35a4e4e..37e006f9ea 100644 --- a/compiled-rn/facebook-fbsource/xplat/js/tools/eslint-plugin-react-hooks/cjs/eslint-plugin-react-hooks.production.js +++ b/compiled-rn/facebook-fbsource/xplat/js/tools/eslint-plugin-react-hooks/cjs/eslint-plugin-react-hooks.production.js @@ -6,7 +6,7 @@ * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. - * @generated SignedSource<<13fc2c89ad924e5db2f9d8ea5ab6c907>> + * @generated SignedSource<<7d905134e4619bd8455489186c1eb4ad>> */ 'use strict'; @@ -43535,7 +43535,7 @@ function collectMaybeMemoDependencies(value, maybeDeps, optional) { } return null; } -function collectTemporaries$1(instr, env, sidemap) { +function collectTemporaries(instr, env, sidemap) { const { value, lvalue } = instr; switch (value.kind) { case 'FunctionExpression': { @@ -43632,43 +43632,69 @@ function getManualMemoizationReplacement(fn, loc, kind) { }; } } -function extractManualMemoizationArgs(instr, kind, sidemap) { +function extractManualMemoizationArgs(instr, kind, sidemap, errors) { const [fnPlace, depsListPlace] = instr.value.args; if (fnPlace == null) { - CompilerError.throwInvalidReact({ - reason: `Expected a callback function to be passed to ${kind}`, - loc: instr.value.loc, + errors.pushDiagnostic(CompilerDiagnostic.create({ + severity: ErrorSeverity.InvalidReact, + category: `Expected a callback function to be passed to ${kind}`, + description: `Expected a callback function to be passed to ${kind}`, suggestions: null, - }); + }).withDetail({ + kind: 'error', + loc: instr.value.loc, + message: `Expected a callback function to be passed to ${kind}`, + })); + return { fnPlace: null, depsList: null }; } if (fnPlace.kind === 'Spread' || (depsListPlace === null || depsListPlace === void 0 ? void 0 : depsListPlace.kind) === 'Spread') { - CompilerError.throwInvalidReact({ - reason: `Unexpected spread argument to ${kind}`, - loc: instr.value.loc, + errors.pushDiagnostic(CompilerDiagnostic.create({ + severity: ErrorSeverity.InvalidReact, + category: `Unexpected spread argument to ${kind}`, + description: `Unexpected spread argument to ${kind}`, suggestions: null, - }); + }).withDetail({ + kind: 'error', + loc: instr.value.loc, + message: `Unexpected spread argument to ${kind}`, + })); + return { fnPlace: null, depsList: null }; } let depsList = null; if (depsListPlace != null) { const maybeDepsList = sidemap.maybeDepsLists.get(depsListPlace.identifier.id); if (maybeDepsList == null) { - CompilerError.throwInvalidReact({ - reason: `Expected the dependency list for ${kind} to be an array literal`, + errors.pushDiagnostic(CompilerDiagnostic.create({ + severity: ErrorSeverity.InvalidReact, + category: `Expected the dependency list for ${kind} to be an array literal`, + description: `Expected the dependency list for ${kind} to be an array literal`, suggestions: null, + }).withDetail({ + kind: 'error', loc: depsListPlace.loc, - }); + message: `Expected the dependency list for ${kind} to be an array literal`, + })); + return { fnPlace, depsList: null }; } - depsList = maybeDepsList.map(dep => { + depsList = []; + for (const dep of maybeDepsList) { const maybeDep = sidemap.maybeDeps.get(dep.identifier.id); if (maybeDep == null) { - CompilerError.throwInvalidReact({ - reason: `Expected the dependency list to be an array of simple expressions (e.g. \`x\`, \`x.y.z\`, \`x?.y?.z\`)`, + errors.pushDiagnostic(CompilerDiagnostic.create({ + severity: ErrorSeverity.InvalidReact, + category: `Expected the dependency list to be an array of simple expressions (e.g. \`x\`, \`x.y.z\`, \`x?.y?.z\`)`, + description: `Expected the dependency list to be an array of simple expressions (e.g. \`x\`, \`x.y.z\`, \`x?.y?.z\`)`, suggestions: null, + }).withDetail({ + kind: 'error', loc: dep.loc, - }); + message: `Expected the dependency list to be an array of simple expressions (e.g. \`x\`, \`x.y.z\`, \`x?.y?.z\`)`, + })); } - return maybeDep; - }); + else { + depsList.push(maybeDep); + } + } } return { fnPlace, @@ -43676,6 +43702,8 @@ function extractManualMemoizationArgs(instr, kind, sidemap) { }; } function dropManualMemoization(func) { + var _a; + const errors = new CompilerError(); const isValidationEnabled = func.env.config.validatePreserveExistingMemoizationGuarantees || func.env.config.validateNoSetStateInRender || func.env.config.enablePreserveExistingMemoizationGuarantees; @@ -43700,15 +43728,44 @@ function dropManualMemoization(func) { : instr.value.property.identifier.id; const manualMemo = sidemap.manualMemos.get(id); if (manualMemo != null) { - const { fnPlace, depsList } = extractManualMemoizationArgs(instr, manualMemo.kind, sidemap); + const { fnPlace, depsList } = extractManualMemoizationArgs(instr, manualMemo.kind, sidemap, errors); + if (fnPlace == null) { + continue; + } + if (func.env.config.validateNoVoidUseMemo && + manualMemo.kind === 'useMemo') { + const funcToCheck = (_a = sidemap.functions.get(fnPlace.identifier.id)) === null || _a === void 0 ? void 0 : _a.value; + if (funcToCheck !== undefined && funcToCheck.loweredFunc.func) { + if (!hasNonVoidReturn(funcToCheck.loweredFunc.func)) { + errors.pushDiagnostic(CompilerDiagnostic.create({ + severity: ErrorSeverity.InvalidReact, + category: 'useMemo() callbacks must return a value', + description: `This ${manualMemo.loadInstr.value.kind === 'PropertyLoad' + ? 'React.useMemo' + : 'useMemo'} callback doesn't return a value. useMemo is for computing and caching values, not for arbitrary side effects.`, + suggestions: null, + }).withDetail({ + kind: 'error', + loc: instr.value.loc, + message: 'useMemo() callbacks must return a value', + })); + } + } + } instr.value = getManualMemoizationReplacement(fnPlace, instr.value.loc, manualMemo.kind); if (isValidationEnabled) { if (!sidemap.functions.has(fnPlace.identifier.id)) { - CompilerError.throwInvalidReact({ - reason: `Expected the first argument to be an inline function expression`, + errors.pushDiagnostic(CompilerDiagnostic.create({ + severity: ErrorSeverity.InvalidReact, + category: `Expected the first argument to be an inline function expression`, + description: `Expected the first argument to be an inline function expression`, suggestions: [], + }).withDetail({ + kind: 'error', loc: fnPlace.loc, - }); + message: `Expected the first argument to be an inline function expression`, + })); + continue; } const memoDecl = manualMemo.kind === 'useMemo' ? instr.lvalue @@ -43726,7 +43783,7 @@ function dropManualMemoization(func) { } } else { - collectTemporaries$1(instr, func.env, sidemap); + collectTemporaries(instr, func.env, sidemap); } } } @@ -43755,6 +43812,7 @@ function dropManualMemoization(func) { markInstructionIds(func.body); } } + return errors.asResult(); } function findOptionalPlaces(fn) { const optionals = new Set(); @@ -43798,6 +43856,17 @@ function findOptionalPlaces(fn) { } return optionals; } +function hasNonVoidReturn(func) { + for (const [, block] of func.body.blocks) { + if (block.terminal.kind === 'return') { + if (block.terminal.returnVariant === 'Explicit' || + block.terminal.returnVariant === 'Implicit') { + return true; + } + } + } + return false; +} class StableSidemap { constructor(env) { @@ -47398,107 +47467,6 @@ function visit(identifiers, place, kind) { identifiers.set(place.identifier.id, { place, kind }); } -function validateNoVoidUseMemo(fn) { - const errors = new CompilerError(); - const sidemap = { - useMemoHooks: new Map(), - funcExprs: new Map(), - react: new Set(), - }; - for (const [, block] of fn.body.blocks) { - for (const instr of block.instructions) { - collectTemporaries(instr, fn.env, sidemap); - } - } - for (const [, block] of fn.body.blocks) { - for (const instr of block.instructions) { - if (instr.value.kind === 'CallExpression') { - const callee = instr.value.callee.identifier; - const useMemoHook = sidemap.useMemoHooks.get(callee.id); - if (useMemoHook !== undefined && instr.value.args.length > 0) { - const firstArg = instr.value.args[0]; - if (firstArg.kind !== 'Identifier') { - continue; - } - let funcToCheck = sidemap.funcExprs.get(firstArg.identifier.id); - if (!funcToCheck) { - for (const [, searchBlock] of fn.body.blocks) { - for (const searchInstr of searchBlock.instructions) { - if (searchInstr.lvalue && - searchInstr.lvalue.identifier.id === firstArg.identifier.id && - searchInstr.value.kind === 'FunctionExpression') { - funcToCheck = searchInstr.value; - break; - } - } - if (funcToCheck) - break; - } - } - if (funcToCheck) { - const hasReturn = checkFunctionHasNonVoidReturn(funcToCheck.loweredFunc.func); - if (!hasReturn) { - errors.push({ - severity: ErrorSeverity.InvalidReact, - reason: `React Compiler has skipped optimizing this component because ${useMemoHook.name} doesn't return a value. ${useMemoHook.name} should only be used for memoizing values, not running arbitrary side effects.`, - loc: useMemoHook.loc, - suggestions: null, - description: null, - }); - } - } - } - } - } - } - return errors.asResult(); -} -function checkFunctionHasNonVoidReturn(func) { - for (const [, block] of func.body.blocks) { - if (block.terminal.kind === 'return') { - if (block.terminal.returnVariant === 'Explicit' || - block.terminal.returnVariant === 'Implicit') { - return true; - } - } - } - return false; -} -function collectTemporaries(instr, env, sidemap) { - const { value, lvalue } = instr; - switch (value.kind) { - case 'FunctionExpression': { - sidemap.funcExprs.set(lvalue.identifier.id, value); - break; - } - case 'LoadGlobal': { - const global = env.getGlobalDeclaration(value.binding, value.loc); - const hookKind = global !== null ? getHookKindForType(env, global) : null; - if (hookKind === 'useMemo') { - sidemap.useMemoHooks.set(lvalue.identifier.id, { - name: value.binding.name, - loc: instr.loc, - }); - } - else if (value.binding.name === 'React') { - sidemap.react.add(lvalue.identifier.id); - } - break; - } - case 'PropertyLoad': { - if (sidemap.react.has(value.object.identifier.id)) { - if (value.property === 'useMemo') { - sidemap.useMemoHooks.set(lvalue.identifier.id, { - name: value.property, - loc: instr.loc, - }); - } - } - break; - } - } -} - function computeUnconditionalBlocks(fn) { const unconditionalBlocks = new Set(); const dominators = computePostDominatorTree(fn, { @@ -50591,14 +50559,11 @@ function runWithEnvironment(func, env) { log({ kind: 'hir', name: 'PruneMaybeThrows', value: hir }); validateContextVariableLValues(hir); validateUseMemo(hir).unwrap(); - if (env.config.validateNoVoidUseMemo) { - validateNoVoidUseMemo(hir).unwrap(); - } if (env.isInferredMemoEnabled && !env.config.enablePreserveExistingManualUseMemo && !env.config.disableMemoizationForDebugging && !env.config.enableChangeDetectionForDebugging) { - dropManualMemoization(hir); + dropManualMemoization(hir).unwrap(); log({ kind: 'hir', name: 'DropManualMemoization', value: hir }); } inlineImmediatelyInvokedFunctionExpressions(hir); diff --git a/compiled-rn/facebook-fbsource/xplat/js/tools/eslint-plugin-react-hooks/package.json b/compiled-rn/facebook-fbsource/xplat/js/tools/eslint-plugin-react-hooks/package.json index 3f65b5f895..4a2a9d5e40 100644 --- a/compiled-rn/facebook-fbsource/xplat/js/tools/eslint-plugin-react-hooks/package.json +++ b/compiled-rn/facebook-fbsource/xplat/js/tools/eslint-plugin-react-hooks/package.json @@ -1,7 +1,7 @@ { "name": "eslint-plugin-react-hooks", "description": "ESLint rules for React Hooks", - "version": "0.0.0-experimental-c60eebff-20250728", + "version": "0.0.0-experimental-6b22f31f-20250728", "repository": { "type": "git", "url": "https://github.com/facebook/react.git",