fix(portal): pass Next.js 16's React-strict lint rules in M10.2
ci / shared (pull_request) Successful in 13s
ci / test (pull_request) Failing after 5m3s
ci / e2e (pull_request) Has been skipped
ci / image (pull_request) Has been skipped

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:
Sharang Parnerkar
2026-06-04 17:30:24 +02:00
parent 0797f8f99c
commit 582355a1f2
4 changed files with 40 additions and 16 deletions
+8 -1
View File
@@ -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",
],
},
];