fix(core-eslint): activate React rules-of-hooks for all TSX surfaces
next.js and react-internal.js are plain re-exports of base, so no rules-of-hooks checking was active anywhere despite three React apps and core-ui. Wire eslint-plugin-react-hooks in base.js scoped to **/*.tsx (non-React packages untouched). Fixes the one violation it surfaced: web-tanstack's root route called Route.useLoaderData inside an anonymous component callback — extracted to a named RootComponent. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
@@ -1,6 +1,17 @@
|
||||
import { Outlet, createRootRoute } from "@tanstack/react-router";
|
||||
import { getNonce } from "@repo/core-shared/security/tanstack";
|
||||
|
||||
function RootComponent() {
|
||||
const { nonce } = Route.useLoaderData();
|
||||
return (
|
||||
<>
|
||||
{/* nonce exposed to client so instrumentation-client.ts can read it */}
|
||||
<meta name="csp-nonce" content={nonce} />
|
||||
<Outlet />
|
||||
</>
|
||||
);
|
||||
}
|
||||
|
||||
export const Route = createRootRoute({
|
||||
loader: async () => {
|
||||
try {
|
||||
@@ -12,14 +23,5 @@ export const Route = createRootRoute({
|
||||
return { nonce: "" };
|
||||
}
|
||||
},
|
||||
component: () => {
|
||||
const { nonce } = Route.useLoaderData();
|
||||
return (
|
||||
<>
|
||||
{/* nonce exposed to client so instrumentation-client.ts can read it */}
|
||||
<meta name="csp-nonce" content={nonce} />
|
||||
<Outlet />
|
||||
</>
|
||||
);
|
||||
},
|
||||
component: RootComponent,
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user