Skip to content

Run react-doctor and fix issues #475

Closed

Description

@fregante

This can be automated. If you have some tokens just assign your agent.

https://www.react.doctor

Activity

  1. fregante commented on Oct 3, 2026

    @fregante
    MemberAuthor
  2. linked a pull request that will close this issuerefactor: address react doctor findings #491on Oct 6, 2026
  3. fregante commented on Oct 7, 2026

    @fregante
    MemberAuthor

    After #491 there are still a number of unsolved react-doctor issues.

    This is the result of react-doctor --category bugs --json

    {
      "schemaVersion": 3,
      "sourceRevision": "2382d79ea87c6e15f4d1b89184bcc7257812b8d6",
      "mode": "full",
      "reactDetected": true,
      "version": "0.9.17",
      "ok": true,
      "diff": null,
      "projects": [
        {
          "sourceFilterConfigHash": "bccba9af786c396a5fb90c4b05d568dfa2361741e7b91c1c423877cbaa48bf12",
          "framework": "vite",
          "project": {
            "projectName": "npmgraph",
            "reactVersion": "^19.3.0",
            "reactMajorVersion": 19,
            "tailwindVersion": null,
            "zodVersion": null,
            "zodMajorVersion": null,
            "mobxVersion": null,
            "mobxMajorVersion": null,
            "hasMobxReact": false,
            "mobxReactVersion": null,
            "hasMobxReactLite": false,
            "mobxReactLiteVersion": null,
            "hasMobxStateTree": false,
            "hasMobxReactObserver": false,
            "zustandVersion": null,
            "zustandMajorVersion": null,
            "framework": "vite",
            "hasTypeScript": true,
            "hasReactCompiler": false,
            "hasReactCompilerLintPlugin": false,
            "hasTanStackQuery": false,
            "hasI18nLibrary": false,
            "hasRadixUi": false,
            "hasBaseUi": false,
            "hasReactAriaComponents": false,
            "hasTanstackTable": false,
            "hasTanstackVirtual": false,
            "hasTanstackForm": false,
            "tanstackQueryVersion": null,
            "styledComponentsVersion": null,
            "valtioVersion": null,
            "valtioMajorVersion": null,
            "hasRemotion": false,
            "remotionVersion": null,
            "remotionMajorVersion": null,
            "hasThree": false,
            "threeVersion": null,
            "threeRelease": null,
            "hasReactThreeFiber": false,
            "reactThreeFiberVersion": null,
            "reactThreeFiberMajorVersion": null,
            "hasSsrDependency": false,
            "preactVersion": null,
            "preactMajorVersion": null,
            "hasReactNativeWorkspace": false,
            "nextjsVersion": null,
            "nextjsMajorVersion": null,
            "reactRouterVersion": null,
            "hasReactRouterFramework": false,
            "expoVersion": null,
            "shopifyFlashListVersion": null,
            "shopifyFlashListMajorVersion": null,
            "hasReanimated": false,
            "reanimatedVersion": null,
            "hasShadcnUi": false,
            "isPreES2023Target": false,
            "isStaticExport": false,
            "sourceFileCount": 119
          },
          "diagnostics": [
            {
              "filePath": "components/Flash/Flash.tsx",
              "plugin": "react-doctor",
              "rule": "prefer-use-sync-external-store",
              "severity": "warning",
              "title": "Hand-rolled external store subscription",
              "message": "Your users can see stale or torn values because useState \"layout\" syncs an outside store through a useEffect.",
              "help": "Replace the `useState(getSnapshot())` + `useEffect(() => store.subscribe(() => setSnapshot(getSnapshot())))` pair with `useSyncExternalStore(store.subscribe, getSnapshot)`. The hook gets this right during concurrent rendering and on the server; the hand-rolled version doesn't.",
              "line": 22,
              "column": 9,
              "offset": 565,
              "length": 66,
              "endLine": 22,
              "category": "Bugs",
              "fingerprint": "015492b81950c03ba77a5be09a950b77d3565915ae3dd13d3d2828c48b0b7902",
              "id": "components/Flash/Flash.tsx::22:9::react-doctor/prefer-use-sync-external-store::f0b26706216c996e0d76cb97ebea3be522c4c9ae29c449c8d9856394aea9f5cd",
              "normalizedFilePath": "components/Flash/Flash.tsx",
              "tags": [
                "test-noise"
              ]
            },
            {
              "filePath": "components/InfoPane/RegistryInput.tsx",
              "plugin": "react-doctor",
              "rule": "no-fetch-in-effect",
              "severity": "warning",
              "title": "Data fetching inside an effect",
              "message": "fetch() inside useEffect can race, double-fire, or leak. Use a data-fetching layer or Server Component instead.",
              "help": "Use a data-fetching layer or Server Component so fetches do not race, double-fire, or leak from `useEffect`.",
              "line": 48,
              "column": 3,
              "offset": 1270,
              "length": 455,
              "endLine": 64,
              "category": "Bugs",
              "fingerprint": "227c6fe741837e8e6b2a26656ec082ed28519503281d7ed7d40bef3f6855375e",
              "id": "components/InfoPane/RegistryInput.tsx::48:3::react-doctor/no-fetch-in-effect::fc2c1ab700771426177ce3cf5938405c255e9fdbf84c44282ad5330ef851af88",
              "normalizedFilePath": "components/InfoPane/RegistryInput.tsx",
              "tags": []
            },
            {
              "filePath": "components/ui/Gravatar.tsx",
              "plugin": "react-doctor",
              "rule": "no-set-state-after-await-in-effect",
              "severity": "warning",
              "title": "State update after await in an effect",
              "message": "This setter runs after `await`, so overlapping re-runs of the effect can resolve out of order and write stale state; gate it behind a cancellation/ignore flag or return a cleanup that cancels the work.",
              "help": "In a `useEffect` whose dependencies can change, guard any setter call that runs after an `await` behind a cancellation/ignore flag, or return a cleanup that cancels the async work.",
              "line": 25,
              "column": 3,
              "offset": 553,
              "length": 286,
              "endLine": 38,
              "category": "Bugs",
              "fingerprint": "14a85370568a6f0fe2bf4b45ce02faf06ddc421f62737b6483422d78c14a374f",
              "id": "components/ui/Gravatar.tsx::25:3::react-doctor/no-set-state-after-await-in-effect::f8a3098c4187a026148f3bba5017161009b7e72f71596f3e13984bda065d0ef0",
              "normalizedFilePath": "components/ui/Gravatar.tsx",
              "tags": []
            },
            {
              "filePath": "lambdas/npmRegistryProxyWithCors.js",
              "plugin": "react-doctor",
              "rule": "no-fetch-response-used-without-status-check",
              "severity": "warning",
              "title": "fetch Response consumed without status check",
              "message": "`fetch()` resolves (does not reject) on HTTP 4xx/5xx, so this unchecked body read may treat an HTTP error payload like a successful response. Check `response.ok`/`response.status`, or deliberately handle the API's error payload, before reading the body.",
              "help": "Check `response.ok` (or `response.status`) before consuming a `fetch` Response with `.json()`/`.text()`/`.blob()`. `fetch` resolves on HTTP 4xx/5xx, so an unchecked response parses the error body as success or crashes on an always-truthy guard.",
              "line": 41,
              "column": 28,
              "offset": 1182,
              "length": 46,
              "endLine": 41,
              "category": "Bugs",
              "fingerprint": "7ecf9664f8861b1e3b486594ba39448737bb5cb37514d369aa7ca3df693dccb0",
              "id": "lambdas/npmRegistryProxyWithCors.js::41:28::react-doctor/no-fetch-response-used-without-status-check::16e1208188bbd3fba56ebfbda112b48489f7e63a91839b9b8e3137335a8226d4",
              "normalizedFilePath": "lambdas/npmRegistryProxyWithCors.js",
              "tags": [
                "test-noise"
              ]
            }
          ],
          "score": {
            "score": 48,
            "label": "Critical",
            "rules": {
              "react-doctor/prefer-use-sync-external-store": {
                "priority": 56,
                "tier": "P2"
              },
              "react-doctor/click-events-have-key-events": {
                "priority": 42,
                "tier": "P3"
              },
              "react-doctor/no-static-element-interactions": {
                "priority": 48,
                "tier": "P3"
              },
              "react-doctor/no-create-object-url-without-revoke": {
                "priority": null,
                "tier": "P3"
              },
              "react-doctor/no-fetch-in-effect": {
                "priority": 54,
                "tier": "P2"
              },
              "react-doctor/no-high-complexity-react-function": {
                "priority": null,
                "tier": "P3"
              },
              "react-doctor/no-set-state-after-await-in-effect": {
                "priority": null,
                "tier": "P3"
              },
              "react-doctor/no-fetch-response-used-without-status-check": {
                "priority": null,
                "tier": "P3"
              },
              "react-doctor/no-eval": {
                "priority": 91,
                "tier": "P0"
              }
            }
          },
          "skippedChecks": [],
          "analyzedFiles": [
            "components/App/App.tsx",
            "components/App/Loader.tsx",
            "components/AppHeader.tsx",
            "components/ErrorsBanner.tsx",
            "components/Flash/Flash.tsx",
            "components/GitHubCorner.tsx",
            "components/GraphDiagram/GraphDiagram.tsx",
            "components/GraphDiagram/GraphDiagramDownloadButton.tsx",
            "components/GraphDiagram/GraphDiagramZoomButtons.tsx",
            "components/InfoPane/FilePicker.tsx",
            "components/InfoPane/InfoPane.tsx",
            "components/InfoPane/QueryInput.tsx",
            "components/InfoPane/RegistryInput.tsx",
            "components/InputHelp.tsx",
            "components/Inspector.tsx",
            "components/Intro.tsx",
            "components/Logo.tsx",
            "components/ModulePane/ModuleBundleSize.tsx",
            "components/ModulePane/ModuleBundleStats.tsx",
            "components/ModulePane/ModulePane.tsx",
            "components/ModulePane/ModuleTreeMap.tsx",
            "components/ModulePane/ModuleVersionInfo.tsx",
            "components/ModulePane/ReleaseTimeline.tsx",
            "components/PreviewWidget.tsx",
            "components/ReportPane/ColorizeInput.tsx",
            "components/ReportPane/ReportItem.tsx",
            "components/ReportPane/ReportPane.tsx",
            "components/ReportPane/analyzers/Analyzer.tsx",
            "components/ReportPane/analyzers/analyzeLicenses.ts",
            "components/ReportPane/analyzers/analyzeMaintainers.tsx",
            "components/ReportPane/analyzers/analyzeModules.ts",
            "components/ReportPane/analyzers/analyzePeerDependencies.tsx",
            "components/ReportPane/reporters/licensesAll.tsx",
            "components/ReportPane/reporters/licensesKeyword.tsx",
            "components/ReportPane/reporters/licensesMissing.tsx",
            "components/ReportPane/reporters/maintainersAll.tsx",
            "components/ReportPane/reporters/maintainersSolo.tsx",
            "components/ReportPane/reporters/moduleReplacements.tsx",
            "components/ReportPane/reporters/moduleVulnerabilities.tsx",
            "components/ReportPane/reporters/modulesAll.tsx",
            "components/ReportPane/reporters/modulesDeprecated.tsx",
            "components/ReportPane/reporters/modulesRepeated.tsx",
            "components/ReportPane/reporters/peerDependenciesAll.tsx",
            "components/SettingsPane/CollapsedDependencies.tsx",
            "components/SettingsPane/SettingsPane.tsx",
            "components/Unsupported.tsx",
            "components/colorizers/BusFactorColorizer.tsx",
            "components/colorizers/LegendColor.tsx",
            "components/colorizers/ModuleTypeColorizer.tsx",
            "components/colorizers/OutdatedColorizer.tsx",
            "components/colorizers/index.ts",
            "components/colorizers/types.ts",
            "components/ui/ExternalLink.tsx",
            "components/ui/Gravatar.tsx",
            "components/ui/Icons.tsx",
            "components/ui/Pane.tsx",
            "components/ui/QueryLink.tsx",
            "components/ui/Section.tsx",
            "components/ui/Selectable.tsx",
            "components/ui/Splitter.tsx",
            "components/ui/Tabs.tsx",
            "components/ui/Tag.tsx",
            "components/ui/Toggle.tsx",
            "eslint.config.js",
            "globals.d.ts",
            "hooks/useActivity.ts",
            "hooks/useCollapse.ts",
            "hooks/useExternalInput.ts",
            "hooks/useGraphSelection.ts",
            "hooks/useHashParam.ts",
            "hooks/useKeyboardShortcuts.ts",
            "hooks/useLocation.ts",
            "hooks/useMeasure.ts",
            "hooks/usePrevious.ts",
            "hooks/useQuery.ts",
            "hooks/useRegistry.ts",
            "hooks/useTightScreen.ts",
            "index.html",
            "lambdas/npmRegistryProxyWithCors.js",
            "lambdas/npmRegistryProxyWithCors.test.js",
            "lib/DiagramTitle.tsx",
            "lib/GlobalStore.ts",
            "lib/HttpError.ts",
            "lib/LoadActivity.ts",
            "lib/Module.test.ts",
            "lib/Module.ts",
            "lib/ModuleCache.ts",
            "lib/PackumentCache.ts",
            "lib/bugsnag.ts",
            "lib/constants.ts",
            "lib/createAbortable.ts",
            "lib/dom.ts",
            "lib/fetch-types.ts",
            "lib/fetchJson.ts",
            "lib/flash.ts",
            "lib/graph-serialize.ts",
            "lib/graph-types.ts",
            "lib/graph-util.test.ts",
            "lib/graph-util.ts",
            "lib/guards.ts",
            "lib/human.ts",
            "lib/index.tsx",
            "lib/licenses.ts",
            "lib/module-util.ts",
            "lib/overrides-util.ts",
            "lib/peer-dependency-util.test.ts",
            "lib/peer-dependency-util.ts",
            "lib/read-file.ts",
            "lib/registry-util.ts",
            "lib/repo-util.test.ts",
            "lib/repo-util.ts",
            "lib/resolve.test.ts",
            "lib/selectVersion.test.ts",
            "lib/selectVersion.ts",
            "lib/types.d.ts",
            "lib/url-util.ts",
            "scripts/fetch-licenses.js",
            "smoke.test.ts",
            "vitest.config.ts"
          ],
          "analyzedFileCount": 119,
          "complete": true,
          "scannedFileCount": 119,
          "elapsedMilliseconds": 27.93883299999999
        }
      ],
      "diagnostics": [
        {
          "filePath": "components/Flash/Flash.tsx",
          "plugin": "react-doctor",
          "rule": "prefer-use-sync-external-store",
          "severity": "warning",
          "title": "Hand-rolled external store subscription",
          "message": "Your users can see stale or torn values because useState \"layout\" syncs an outside store through a useEffect.",
          "help": "Replace the `useState(getSnapshot())` + `useEffect(() => store.subscribe(() => setSnapshot(getSnapshot())))` pair with `useSyncExternalStore(store.subscribe, getSnapshot)`. The hook gets this right during concurrent rendering and on the server; the hand-rolled version doesn't.",
          "line": 22,
          "column": 9,
          "offset": 565,
          "length": 66,
          "endLine": 22,
          "category": "Bugs",
          "fingerprint": "015492b81950c03ba77a5be09a950b77d3565915ae3dd13d3d2828c48b0b7902",
          "id": "components/Flash/Flash.tsx::22:9::react-doctor/prefer-use-sync-external-store::f0b26706216c996e0d76cb97ebea3be522c4c9ae29c449c8d9856394aea9f5cd",
          "normalizedFilePath": "components/Flash/Flash.tsx",
          "tags": [
            "test-noise"
          ]
        },
        {
          "filePath": "components/InfoPane/RegistryInput.tsx",
          "plugin": "react-doctor",
          "rule": "no-fetch-in-effect",
          "severity": "warning",
          "title": "Data fetching inside an effect",
          "message": "fetch() inside useEffect can race, double-fire, or leak. Use a data-fetching layer or Server Component instead.",
          "help": "Use a data-fetching layer or Server Component so fetches do not race, double-fire, or leak from `useEffect`.",
          "line": 48,
          "column": 3,
          "offset": 1270,
          "length": 455,
          "endLine": 64,
          "category": "Bugs",
          "fingerprint": "227c6fe741837e8e6b2a26656ec082ed28519503281d7ed7d40bef3f6855375e",
          "id": "components/InfoPane/RegistryInput.tsx::48:3::react-doctor/no-fetch-in-effect::fc2c1ab700771426177ce3cf5938405c255e9fdbf84c44282ad5330ef851af88",
          "normalizedFilePath": "components/InfoPane/RegistryInput.tsx",
          "tags": []
        },
        {
          "filePath": "components/ui/Gravatar.tsx",
          "plugin": "react-doctor",
          "rule": "no-set-state-after-await-in-effect",
          "severity": "warning",
          "title": "State update after await in an effect",
          "message": "This setter runs after `await`, so overlapping re-runs of the effect can resolve out of order and write stale state; gate it behind a cancellation/ignore flag or return a cleanup that cancels the work.",
          "help": "In a `useEffect` whose dependencies can change, guard any setter call that runs after an `await` behind a cancellation/ignore flag, or return a cleanup that cancels the async work.",
          "line": 25,
          "column": 3,
          "offset": 553,
          "length": 286,
          "endLine": 38,
          "category": "Bugs",
          "fingerprint": "14a85370568a6f0fe2bf4b45ce02faf06ddc421f62737b6483422d78c14a374f",
          "id": "components/ui/Gravatar.tsx::25:3::react-doctor/no-set-state-after-await-in-effect::f8a3098c4187a026148f3bba5017161009b7e72f71596f3e13984bda065d0ef0",
          "normalizedFilePath": "components/ui/Gravatar.tsx",
          "tags": []
        },
        {
          "filePath": "lambdas/npmRegistryProxyWithCors.js",
          "plugin": "react-doctor",
          "rule": "no-fetch-response-used-without-status-check",
          "severity": "warning",
          "title": "fetch Response consumed without status check",
          "message": "`fetch()` resolves (does not reject) on HTTP 4xx/5xx, so this unchecked body read may treat an HTTP error payload like a successful response. Check `response.ok`/`response.status`, or deliberately handle the API's error payload, before reading the body.",
          "help": "Check `response.ok` (or `response.status`) before consuming a `fetch` Response with `.json()`/`.text()`/`.blob()`. `fetch` resolves on HTTP 4xx/5xx, so an unchecked response parses the error body as success or crashes on an always-truthy guard.",
          "line": 41,
          "column": 28,
          "offset": 1182,
          "length": 46,
          "endLine": 41,
          "category": "Bugs",
          "fingerprint": "7ecf9664f8861b1e3b486594ba39448737bb5cb37514d369aa7ca3df693dccb0",
          "id": "lambdas/npmRegistryProxyWithCors.js::41:28::react-doctor/no-fetch-response-used-without-status-check::16e1208188bbd3fba56ebfbda112b48489f7e63a91839b9b8e3137335a8226d4",
          "normalizedFilePath": "lambdas/npmRegistryProxyWithCors.js",
          "tags": [
            "test-noise"
          ]
        }
      ],
      "summary": {
        "errorCount": 0,
        "warningCount": 4,
        "affectedFileCount": 4,
        "totalDiagnosticCount": 4,
        "score": 48,
        "scoreLabel": "Critical"
      },
      "elapsedMilliseconds": 86.08920800000004,
      "error": null
    }
  4. fregante commented on Oct 10, 2026

    @fregante
    MemberAuthor

    This is effectively done. There are a couple more false negatives.

    I think it's overall positive but for the most part it just doesn't recognize a lot of patterns.

    I'll have to decide whether to include it on CI or just run it once a year. In any case the inline exceptions with explanations are useful to avoid falling into them again.

  5. linked a pull request that will close this issuechore: add react-doctor as an eslint plugin #538on Oct 10, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions