Skip to content

feat(cli): expose --why as documented public alias for --explain#198

Merged
aidenybai merged 1 commit into
mainfrom
cursor/feat-suppression-audit-2f41
May 10, 2026
Merged

feat(cli): expose --why as documented public alias for --explain#198
aidenybai merged 1 commit into
mainfrom
cursor/feat-suppression-audit-2f41

Conversation

@aidenybai
Copy link
Copy Markdown
Member

Closes #161.

Status

The MVP requested by #161 — a single-site suppression diagnosis at react-doctor --why <file:line> — has been implemented since #165 as a hidden alias for --explain. The reporter (writing at v0.0.47) wouldn't have seen it. Promoting it to a documented option closes the discovery gap.

What's changed

  • --why <file:line> is now a normal commander option instead of hideHelp(), so it surfaces in react-doctor --help.
  • README's CLI reference and Inline suppressions section now explain the full audit story:
    • --explain / --why classify a single site (covers every status in the issue's classifier table — MISSING, WRONG_RULE, GAP_CODE, ADJACENT_BUT_FAILED, etc.).
    • --verbose already prints the same suppressionHint next to every flagged site.
    • --json already attaches suppressionHint to each diagnostic.
    • Combined, a single scan doubles as a suppression audit without a separate --audit-suppressions flag.

Verification

$ react-doctor --help | grep -E "explain|why"
  --explain <file:line>         diagnose why a rule fired or why a suppression
  --why <file:line>             alias for --explain

$ react-doctor --why src/Bad.tsx:8
⚠ react-doctor/no-derived-state-effect (warning) — Derived state in useEffect — compute during render instead
  Suppression diagnosis: A react-doctor-disable-next-line for react-doctor/no-derived-state-effect sits at line 5,
  but 2 lines of code separate it from the diagnostic on line 8. Move the comment immediately above line 8, or
  extract the surrounding code into a helper so the suppression is adjacent.

Drive-by: removes the now-unused Option import that the previous addOption(...).hideHelp() wiring left behind.

Test Files  51 passed (51)
     Tests  683 passed (683)
Open in Web Open in Cursor 

The MVP requested by #161 — a single-site suppression diagnosis at
`react-doctor --why <file:line>` — was already implemented as a
hidden alias for `--explain`. Promote it to a documented option so
users can reach it without reading the source.

Updates the README's CLI reference and suppressions section to make
the discovery story explicit:

- `--explain <file:line>` (and its `--why` alias) classify what the
  scanner sees at a single location, matching every status in the
  issue's classifier table (MISSING, WRONG_RULE, GAP_CODE, etc.).
- `--verbose` mode already surfaces the same suppression hint
  inline next to every flagged site, and `--json` mode includes it
  on each diagnostic as `suppressionHint`. A single scan therefore
  doubles as a suppression audit without a separate flag, which
  covers the "Bonus" and most of the "Maximum" goals from the
  request.

Removes the unused `Option` import that the previous
`addOption(...).hideHelp()` wiring left behind.

Co-authored-by: Aiden Bai <aidenybai@users.noreply.github.com>
@vercel
Copy link
Copy Markdown

vercel Bot commented May 10, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
react-doctor-website Ready Ready Preview, Comment May 10, 2026 3:53am

@reactreview
Copy link
Copy Markdown

reactreview Bot commented May 10, 2026

Merging this PR does not change React health

➡️ 0 score
❌ 0 errors
⚠️ 0 warnings

BASE HEAD Change
Score 0 0 0
Errors 26 26 0
Warnings 261 261 0
Analysis details

analyzed in 0.7s · nextjs · React 19.2.5 · TypeScript · 210 source files · powered by react-doctor

@aidenybai aidenybai marked this pull request as ready for review May 10, 2026 04:09
@aidenybai aidenybai merged commit d95c939 into main May 10, 2026
7 checks passed
@aidenybai aidenybai deleted the cursor/feat-suppression-audit-2f41 branch May 10, 2026 04:44
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.

Feature request: native suppression-audit CLI / --why <file:line>

2 participants