fix(portal): pass Next.js 16's React-strict lint rules in M10.2
CI on PR #13 failed at `pnpm lint --max-warnings 0`. Four findings, all new-in-N16 react-strict checks: * ThemeToggle.tsx — "Calling setState synchronously within an effect" Rewrites the theme reader to use `useSyncExternalStore` with a `MutationObserver` on `<html data-theme>`. SSR snapshot stays "light" (matches the root layout); the head script and the toggle just write the attribute, the observer pushes the change into React. Drops the `mounted` flag because the icon now mirrors the DOM truthfully. * WorkflowEditor.tsx — "Cannot access refs during render" `stateRef.current = { pan, zoom }` was a direct ref-mutation in the component body so the global mousemove handler could read the latest viewport without re-subscribing. Moves the mirror into a `useEffect` keyed on `[pan, zoom]` — same semantics, satisfies the rule. * MockWorker.tsx — drops an unused `eslint-disable-next-line no-console` (the `no-console` rule isn't enabled). * public/mockServiceWorker.js — auto-generated by `msw init`; adds it to the eslint flat-config `ignores` so the lint pass never crosses it. Local: `pnpm lint` + `pnpm typecheck` both clean. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
+8
-1
@@ -6,7 +6,14 @@ const config = [
|
||||
...nextWebVitals,
|
||||
...nextTypescript,
|
||||
{
|
||||
ignores: [".next/**", "node_modules/**", "coverage/**", "next-env.d.ts"],
|
||||
ignores: [
|
||||
".next/**",
|
||||
"node_modules/**",
|
||||
"coverage/**",
|
||||
"next-env.d.ts",
|
||||
// Auto-generated by `msw init` — patched on every MSW upgrade.
|
||||
"public/mockServiceWorker.js",
|
||||
],
|
||||
},
|
||||
];
|
||||
|
||||
|
||||
Reference in New Issue
Block a user