Skip to content

chore: add React Doctor advisory scanning - #23

Merged
piotr-graczyk-dev merged 2 commits into
mainfrom
chore/react-doctor-phase-a
Jun 29, 2026
Merged

chore: add React Doctor advisory scanning#23
piotr-graczyk-dev merged 2 commits into
mainfrom
chore/react-doctor-phase-a

Conversation

@jkasprzyk17

Copy link
Copy Markdown
Contributor

Summary

  • Adds SHA-pinned .github/workflows/react-doctor.yml in advisory mode (blocking: none, scope: full)
  • Scans both monorepo workspaces: package/ and example/
  • Adds bun run doctor script (npx react-doctor@latest)
  • Documents React Doctor usage and CI behavior in CONTRIBUTING.md

Closes #5 (Phase A only — enforcement and branch protection deferred).

Baseline (local advisory scan)

Initial full scan before merge (React Doctor v0.5.8):

Project Score Warnings
react-native-nitro-maps (package/) 88 / 100 (Great) 3
react-native-nitro-maps-example (example/) 90 / 100 (Great) 2
Total 88 / 100 (Great) 5 (1 performance, 4 maintainability)

Share link: https://react.doctor/share?p=react-native-nitro-maps&s=88&w=5&f=5

CI will confirm these numbers on the first workflow run. Follow-up work (Phase B): remove blocking/scope overrides and address or explicitly accept baseline findings.

Test plan

  • bun run doctor runs successfully from monorepo root
  • Workflow YAML targets package,example with fetch-depth: 0
  • React Doctor CI workflow completes on this PR (advisory, non-blocking)
  • Existing quality CI job unchanged

Made with Cursor

Integrate React Doctor for React security and performance scanning in
advisory mode: SHA-pinned GitHub Actions workflow, local doctor script,
and CONTRIBUTING docs. Closes #5 (Phase A).
@coderabbitai

coderabbitai Bot commented Jun 26, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 0c25363a-e523-48f0-b924-3110d17374f5

📥 Commits

Reviewing files that changed from the base of the PR and between 8fbcd34 and c810621.

📒 Files selected for processing (2)
  • .github/workflows/ci.yml
  • .github/workflows/react-doctor.yml
🚧 Files skipped from review as they are similar to previous changes (1)
  • .github/workflows/react-doctor.yml

📝 Walkthrough

Summary by CodeRabbit

  • New Features

    • Added a new doctor command for running React Doctor locally.
    • Introduced a React Doctor check in CI for pull requests and main-branch pushes.
  • Documentation

    • Updated contributor docs with setup, usage, and CI behavior details for React Doctor.
    • Clarified that React Doctor complements existing quality checks and covers both the library and example app.
  • Bug Fixes

    • Adjusted CI checkout behavior to avoid saving credentials during the quality job.

Walkthrough

Adds a local React Doctor command, documents its scope and usage, and adds a React Doctor workflow plus a checkout credential change in CI.

Changes

React Doctor rollout

Layer / File(s) Summary
Local command and usage
package.json, CONTRIBUTING.md
Adds doctor as a local React Doctor command and documents running it from the repo root, the scanned package/ and example/ workspaces, and its relationship to lint, typecheck, and build checks.
Workflow and CI behavior
.github/workflows/react-doctor.yml, .github/workflows/ci.yml, CONTRIBUTING.md
Adds a React Doctor GitHub Actions workflow for pull requests and pushes to main, updates checkout to stop persisting credentials in the quality job, and documents the PR and main-branch reporting behavior.

Sequence Diagram(s)

sequenceDiagram
  participant PullRequest
  participant GitHubActionsWorkflow as GitHub Actions workflow
  participant RepositoryCheckout as actions/checkout
  participant ReactDoctor as millionco/react-doctor@v2
  PullRequest->>GitHubActionsWorkflow: trigger pull_request or push to main
  GitHubActionsWorkflow->>RepositoryCheckout: check out the repository
  GitHubActionsWorkflow->>ReactDoctor: run with project package,example, blocking none, scope full
  ReactDoctor-->>GitHubActionsWorkflow: report findings and health score
Loading

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

🚥 Pre-merge checks | ✅ 3 | ❌ 2

❌ Failed checks (2 warnings)

Check name Status Explanation Resolution
Linked Issues check ⚠️ Warning Most React Doctor requirements are met, but the PR also changes the quality CI workflow the issue said should stay unchanged. Revert the .github/workflows/ci.yml tweak or split it out, then keep the React Doctor rollout as the only scope of this PR.
Out of Scope Changes check ⚠️ Warning The persist-credentials: false tweak in .github/workflows/ci.yml is unrelated to the React Doctor rollout and looks like extra scope. Remove the CI workflow tweak or move it to a separate PR if it is needed.
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title is concise, uses a type prefix, and clearly describes the React Doctor advisory scan addition.
Description check ✅ Passed The description is directly about the React Doctor workflow, local script, docs, and rollout plan.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

Comment @coderabbitai help to get the list of available commands.

@github-actions

github-actions Bot commented Jun 26, 2026

Copy link
Copy Markdown

React Doctor found 6 issues in 6 files · 6 warnings · score 87 / 100 (Great) · full project

6 warnings

App.tsx

  • ⚠️ L2 React 19 API migration can break callers no-react19-deprecated-apis

examples/advancedFeatures.ts

  • ⚠️ L115 unused-export

src/components/MapView.tsx

  • ⚠️ L1 React 19 API migration can break callers no-react19-deprecated-apis

src/hooks/index.ts

  • ⚠️ L0 unused-file

src/hooks/useCollectedOverlays.ts

  • ⚠️ L195 Ref initializer runs on every render rerender-lazy-ref-init

src/providers.ts

  • ⚠️ L11 unused-export

Reviewed by React Doctor for commit c810621. See inline comments for fixes.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🧹 Nitpick comments (1)
package.json (1)

15-15: 🔒 Security & Privacy | 🔵 Trivial | ⚡ Quick win

Avoid a moving @latest target in the script.

bun run doctor will fetch whatever React Doctor happens to be current on npm each time, so local scans can drift from CI and break without a repo change. Pin the version or install it as a devDependency if that drift is not intentional.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@package.json` at line 15, The doctor script currently points at a moving npx
react-doctor@latest target, which can make local and CI behavior diverge. Update
the package.json doctor entry to use a pinned React Doctor version or switch to
a devDependency-backed invocation so the script resolves the same tool version
consistently. Locate the change in the doctor script definition and keep the
command stable rather than relying on `@latest`.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In @.github/workflows/react-doctor.yml:
- Around line 23-29: The Checkout step in the React Doctor workflow is still
persisting Git credentials, which leaves the GITHUB_TOKEN in .git/config for the
later third-party action to access. Update the actions/checkout configuration to
disable credential persistence by setting persist-credentials to false in the
Checkout step. Use the existing Checkout and React Doctor job steps as the
location reference.

---

Nitpick comments:
In `@package.json`:
- Line 15: The doctor script currently points at a moving npx
react-doctor@latest target, which can make local and CI behavior diverge. Update
the package.json doctor entry to use a pinned React Doctor version or switch to
a devDependency-backed invocation so the script resolves the same tool version
consistently. Locate the change in the doctor script definition and keep the
command stable rather than relying on `@latest`.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: e5539ec7-57be-4bc4-b559-6b71b6e0f2da

📥 Commits

Reviewing files that changed from the base of the PR and between 5d60983 and 8fbcd34.

📒 Files selected for processing (3)
  • .github/workflows/react-doctor.yml
  • CONTRIBUTING.md
  • package.json

Comment thread .github/workflows/react-doctor.yml
@jkasprzyk17 jkasprzyk17 changed the title chore: add React Doctor advisory scanning (Phase A) chore: add React Doctor advisory scanning Jun 26, 2026

@piotr-graczyk-dev piotr-graczyk-dev 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.

@piotr-graczyk-dev
piotr-graczyk-dev merged commit 4bdd855 into main Jun 29, 2026
5 checks passed
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.

Add React Doctor for React security and performance scanning

2 participants