refactor(www): apply react-doctor fixes (72 → 91, 0 errors)#29
Merged
Conversation
Addresses 88 of 147 issues flagged by react-doctor, raising the score from 72 to 82 and eliminating all 5 errors. Changes: - Delete 13 unreachable components (incl. typing-animation.tsx, source of all 5 errors and a header/mobile-nav circular dep) - Drop unused fumadocs-ui dependency - Add pnpm-workspace.yaml with minimumReleaseAge and trustPolicy - Collapse w-N h-N -> size-N (14 occurrences) - Collapse px-6 py-6 -> p-6 in docs-sidebar and site-footer - Truncate SVG path decimals in icons.tsx and logo.tsx to 2dp
Continues the react-doctor cleanup, raising the score from 82 to 91 (zero errors). Addresses correctness, accessibility, performance, and dead-code findings. Changes: - icons.tsx: remove 8 unused icon exports (keep ArrowRightIcon) - logo.tsx: delete unused component - terminal.tsx: useContext -> use() (React 19), unexport internal-only TerminalStatus/TerminalClearButton - site-header.tsx: replace pathname-reset effect chain with onClick + key prop; convert wordmark img to next/image - page.tsx: motion -> LazyMotion + m (bundle); convert logo imgs to next/image; drop redundant inline style on macbook frame - builder.tsx: add button type, aria-labels on inputs, drop em dash - copy-button.tsx: add button type - code-block-command.tsx: extract ManagerIcon component, hoist EMPTY_ICONS - docs-sidebar.tsx / mdx-components.tsx: drop unused exports - file-tree.tsx: add tabIndex to interactive tree role - docs page: rename MDX -> MdxContent for pascal-case rule - route handlers: hoist static IO and constants to module scope - next.config.ts: type config, enable safe SVG for first-party next/image
Replaces dangerouslySetInnerHTML in CodeBlock and CodeLine with real React elements, resolving 2 of the 4 no-danger findings. Shiki's HAST output is converted to JSX via hast-util-to-jsx-runtime (already present transitively, now a direct dependency). The remaining 2 no-danger sites inject hardcoded, first-party SVG icon strings (no user input) and are left as-is to avoid hand-converting complex multi-gradient SVGs. Adds: - highlightCodeToReact() in lib/highlight-code.ts Deps: - hast-util-to-jsx-runtime (direct)
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Applies the full set of react-doctor fixes to the
www/site (scnstack.sh). Raises the score from 72 → 91 and eliminates all 5 errors; total issues drop from 147 → 29.Why
react-doctorflagged correctness, accessibility, performance, dead-code, and security issues across the docs/marketing site. This cleans up the high- and medium-value findings without changing any user-facing behaviour.Closes #
Type
refactor— Code restructuringchore— Maintenance / deps(Spans
chorequick-wins, afixfor warnings, and arefactorfor Shiki rendering — see commits.)Tour
Three commits, smallest to largest blast radius:
chore(www): apply react-doctor quick wins— delete 13 unreachable components (incl. theheader/mobile-navcircular dep), drop unusedfumadocs-uidep, addpnpm-workspace.yamlhardening,w-N h-N → size-N,px-6 py-6 → p-6, truncate SVG path decimals to 2dp.fix(www): resolve react-doctor warnings— React 19useContext → use(), replace a site-header effect chain withonClick+key,motion → LazyMotion + m(~30kb bundle), convert first-party SVG<img>→next/image, add buttontypes + inputaria-labels + treetabIndex, hoist static IO/constants to module scope, drop dead exports.refactor(www): render shiki output as react nodes— replacedangerouslySetInnerHTMLinCodeBlock/CodeLinewith real React nodes viahast-util-to-jsx-runtime(promoted from transitive to direct dep).Scope
All changes are confined to
www/. Thecreate-scn-stackCLI and its test suite are untouched.Deliberately not fixed (justified)
The remaining 29 are all warnings (zero errors):
no-danger×2 — hardcoded first-party SVG icon strings (no user input). Left as-is rather than hand-convert ~25 multi-gradient SVGs.no-fetch-in-effect×2 —SiteHeaderis a client component consumed by client pages; moving the fetch server-side is a structural refactor, not a non-breaking change. Avoided adding SWR/react-query.only-export-components— shadcnbutton.tsx(buttonVariantsis the ecosystem standard) and the fumadocsmdx-componentsmap.role="group"→<address>for a tree, all-capsMDX, sequential GitHub pagination flagged as parallelizable) and pre-existing structural items (no-giant-component).Testing
npm run lint(roottsc --noEmit) — passesnpm test— 62/62 passwww:pnpm exec tsc --noEmitclean,pnpm buildsucceeds (all 23 routes generate, docs code blocks render correctly)npx react-doctor@latest: 91/100, 0 errorsScreenshots
N/A — no visual changes (size/padding shorthands and SVG decimal truncation are visually identical; Shiki output is byte-equivalent rendered as React nodes).