Skip to content

Fix top React Doctor findings: pnpm hardening, dead files, tooling#196

Merged
aquarion merged 6 commits into
mainfrom
fix/react-doctor
Jul 11, 2026
Merged

Fix top React Doctor findings: pnpm hardening, dead files, tooling#196
aquarion merged 6 commits into
mainfrom
fix/react-doctor

Conversation

@aquarion

Copy link
Copy Markdown
Owner

Summary

  • Harden pnpm-workspace.yaml supply-chain settings (minimumReleaseAge, trustPolicy, blockExoticSubdeps) to narrow the window for freshly-published/malicious package versions
  • Delete 18 unreachable files: unused shadcn/ui scaffolding (alert, badge, card, collapsible, dropdown-menu, icon, input-otp, navigation-menu, placeholder-pattern, toggle/toggle-group) plus dead app-header/auth-card/auth-split layout variants never wired into routing
  • Verified the 2 effect-needs-cleanup findings (MatomoInit.tsx, use-flash-toast.ts) are false positives — router.on() already returns its own unsubscribe function as the effect's cleanup; the linter's matcher just doesn't recognize that pattern. No code change needed.
  • Install react-doctor pre-commit hook (blocks staged regressions) and CI workflow (advisory-only PR scan + main-branch trend tracking)

Remaining ~62 lower-severity findings (performance, accessibility, more maintainability) are left for a follow-up pass.

Test plan

  • npx tsc --noEmit — no errors
  • npx vitest run — 183/183 tests pass
  • npm run build — succeeds
  • npx react-doctor@latest --verbose — confirms require-pnpm-hardening and unused-file findings cleared (80 → 62 total issues)
  • Pre-commit hooks pass, including the new react-doctor hook

🤖 Generated with Claude Code

- pnpm-workspace.yaml: add minimumReleaseAge, trustPolicy, blockExoticSubdeps
  to narrow the supply-chain window for freshly-published/malicious versions
- Delete 18 unreachable files (unused shadcn/ui scaffolding, dead
  app-header/auth-card/auth-split layout variants never wired into routing)
- Verified 2 effect-needs-cleanup findings (MatomoInit.tsx, use-flash-toast.ts)
  are false positives: router.on() already returns its own unsubscribe
  function as the effect cleanup, the rule's matcher just doesn't recognize
  that pattern
- Install react-doctor pre-commit hook and CI workflow (advisory-only) for
  ongoing regression tracking

Remaining ~62 lower-severity findings (performance, accessibility, more
maintainability) left for a follow-up pass.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
@aquarion aquarion marked this pull request as ready for review July 11, 2026 17:52
Copilot AI review requested due to automatic review settings July 11, 2026 17:52

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR addresses high-severity React Doctor findings by tightening package-manager supply-chain settings, removing unreachable React/UI files, and adding React Doctor automation in local hooks and CI.

Changes:

  • Remove unused React layouts/components and unused shadcn/ui scaffolding files to eliminate unused-file findings.
  • Harden pnpm-workspace.yaml with additional security-related settings.
  • Add React Doctor automation via package.json script, a pre-commit hook, and a GitHub Actions workflow (plus agent skill docs).

Reviewed changes

Copilot reviewed 26 out of 27 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
resources/js/layouts/auth/auth-split-layout.tsx Deletes unused auth split layout.
resources/js/layouts/auth/auth-card-layout.tsx Deletes unused auth card layout.
resources/js/layouts/app/app-header-layout.tsx Deletes unused app header layout variant.
resources/js/hooks/use-clipboard.ts Deletes unused clipboard hook.
resources/js/components/ui/toggle.tsx Deletes unused UI component.
resources/js/components/ui/toggle-group.tsx Deletes unused UI component.
resources/js/components/ui/placeholder-pattern.tsx Deletes unused UI component.
resources/js/components/ui/navigation-menu.tsx Deletes unused UI component.
resources/js/components/ui/input-otp.tsx Deletes unused UI component.
resources/js/components/ui/icon.tsx Deletes unused UI component.
resources/js/components/ui/dropdown-menu.tsx Deletes unused UI component.
resources/js/components/ui/collapsible.tsx Deletes unused UI component.
resources/js/components/ui/card.tsx Deletes unused UI component.
resources/js/components/ui/badge.tsx Deletes unused UI component.
resources/js/components/ui/alert.tsx Deletes unused UI component.
resources/js/components/feed/MediaBackground.tsx Deletes unused feed component.
resources/js/components/app-header.tsx Deletes unused app header component.
resources/js/components/alert-error.tsx Deletes unused alert component.
pnpm-workspace.yaml Adds pnpm hardening settings.
package.json Adds doctor script and react-doctor dev dependency.
.pre-commit-config.yaml Adds local react-doctor pre-commit hook.
.github/workflows/react-doctor.yml Adds CI workflow to run React Doctor on PRs and main.
.claude/skills/react-doctor/SKILL.md Adds React Doctor agent skill documentation.
.claude/skills/react-doctor/references/explain.md Adds rule explanation/config guidance for the skill.
.agents/skills/react-doctor/SKILL.md Adds React Doctor agent skill documentation (agents path).
.agents/skills/react-doctor/references/explain.md Adds rule explanation/config guidance (agents path).

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread .pre-commit-config.yaml Outdated
Comment on lines +56 to +58
- id: react-doctor
name: react-doctor
entry: sh -c 'react_doctor_output=$(mktemp "${TMPDIR:-/tmp}/react-doctor-hook.XXXXXX"); if react-doctor --staged --blocking warning > "$react_doctor_output" 2>&1; then rm -f "$react_doctor_output"; else cat "$react_doctor_output" >&2; rm -f "$react_doctor_output"; printf "%s\n" "React Doctor found staged regressions." "Run react-doctor --staged --blocking warning to inspect." "Want them fixed? Ask your agent to run that command and resolve the findings." >&2; fi'
Comment thread package.json Outdated
aquarion and others added 5 commits July 11, 2026 22:33
language: system just shelled out to whatever react-doctor resolved to
on PATH — missing entirely on a fresh clone, or silently a different
version than package.json's ^0.7.4 devDependency. Switch to language:
node with additional_dependencies pinned to react-doctor@0.7.4, so
pre-commit installs it into its own isolated env, same fix as the
graphify hook on fix/graphify.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
The mktemp/if-else entry's exit status was whatever the last command
in the branch returned - in the failure branch that was printf, which
always succeeds. So the hook printed a warning on regressions but let
every commit through regardless of react-doctor's exit code.

Replaced with a plain command-substitution + explicit exit 0/1, which
also drops the temp-file bookkeeping entirely.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
…it.sh

Move the check out of the YAML entry string into a real script,
matching the existing bin/ convention (dev-server.sh, vite-dev.sh).
Same behavior as before, just readable and shellcheck-able instead of
a one-line bash -c blob.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
No bashisms in the script (just $(), a brace group, and printf/echo),
so plain POSIX sh is sufficient. Verified syntax and both exit paths
under dash.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
…tor version

npx react-doctor@latest always fetches whatever's newest instead of
the vetted ^0.7.4 devDependency, so npm run doctor could silently run
a different (unvetted) version than the rest of the project's tooling.
npm resolves devDependency bins automatically, so plain "react-doctor"
uses the pinned local install.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
@aquarion aquarion merged commit e2dadba into main Jul 11, 2026
7 checks passed
@aquarion aquarion deleted the fix/react-doctor branch July 11, 2026 21:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants