react-doctor 0.2.14-dev.6d53182 → 0.2.14-dev.75c1f99

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,75 @@
1
+ ---
2
+ name: doctor-explain
3
+ description: Explain React Doctor rules and configure which ones run via doctor.config.* (or package.json#reactDoctor). Use when the user types `/doctor-explain` or `/doctor-config`, asks why a rule fired, disagrees with a rule, wants to disable/enable a rule, silence a category or tag, tune CI/PR noise, or asks "what does this rule mean". Covers the `react-doctor rules` CLI (list, explain, set, enable, disable, category, ignore-tag) and how config layers combine: ignore.tags disables matching rules before linting, rules over categories sets severity, surfaces controls visibility only.
4
+ version: "1.0.0"
5
+ ---
6
+
7
+ # Doctor Explain
8
+
9
+ Explains React Doctor rules and edits `doctor.config.*` safely. Use this when a user wants to understand a rule or change which rules run — not for fixing diagnostics (that is the `react-doctor` skill / `/doctor`).
10
+
11
+ Triggers: `/doctor-explain`, `/doctor-config`, "why did this rule fire", "I disagree with this rule", "turn this rule off", "stop flagging X", "too noisy", "disable design rules".
12
+
13
+ ## Workflow
14
+
15
+ 1. Identify the rule key from the diagnostic (e.g. `react-doctor/no-array-index-as-key`).
16
+ 2. Explain it before changing anything:
17
+
18
+ ```bash
19
+ npx react-doctor@latest rules explain react-doctor/no-array-index-as-key
20
+ ```
21
+
22
+ 3. Pick the narrowest control that matches the user's intent (see decision guide).
23
+ 4. Apply it with a `rules` subcommand (edits your `doctor.config.*` or `package.json#reactDoctor` in place, preserving other fields and formatting).
24
+ 5. Validate the change did what they wanted:
25
+
26
+ ```bash
27
+ npx react-doctor@latest --verbose --diff
28
+ ```
29
+
30
+ ## Commands
31
+
32
+ ```bash
33
+ npx react-doctor@latest rules list # every rule + its effective severity
34
+ npx react-doctor@latest rules list --configured # only what your config changed
35
+ npx react-doctor@latest rules list --category Performance # filter by category
36
+ npx react-doctor@latest rules explain <rule> # why it matters + how to configure
37
+ npx react-doctor@latest rules disable <rule> # rule never runs
38
+ npx react-doctor@latest rules enable <rule> # turn back on at its recommended severity
39
+ npx react-doctor@latest rules set <rule> warn # off | warn | error
40
+ npx react-doctor@latest rules category "React Native" off # whole category
41
+ npx react-doctor@latest rules ignore-tag design # skip a rule family (design, test-noise, …)
42
+ npx react-doctor@latest rules unignore-tag design
43
+ ```
44
+
45
+ Rule references accept the full key (`react-doctor/no-danger`), the bare id (`no-danger`), or a legacy key (`react/no-danger`).
46
+
47
+ ## Decision guide
48
+
49
+ Match the control to the intent — prefer the narrowest one:
50
+
51
+ - **User disagrees with one rule / it's a false positive for them** → `rules disable <rule>` (sets `rules.<key> = "off"`; the rule stops running everywhere). This is the default for "I don't want this rule".
52
+ - **Rule is fine but wrong severity** → `rules set <rule> warn` or `rules set <rule> error`.
53
+ - **A disabled-by-default rule they want on** → `rules enable <rule>`.
54
+ - **A whole area is unwanted** (e.g. all React Native rules) → `rules category "<Category>" off`.
55
+ - **A behavioral family is noisy** (`design`, `test-noise`, `migration-hint`) → `rules ignore-tag <tag>`.
56
+ - **Keep it locally but hide from PR comment / score / CI gate only** → do NOT disable. Edit `surfaces` in your config (`surfaces.prComment.excludeRules`, `surfaces.score.excludeTags`, `surfaces.ciFailure.excludeCategories`). The rule still shows in local `cli` output.
57
+
58
+ How the layers combine: `ignore.tags` disables every rule carrying that tag **before** linting, so a tagged rule stays off even if `rules`/`categories` set it to `warn`/`error` (a rule-level override cannot re-enable a tag-ignored rule). For rules that aren't tag-disabled, `rules` overrides `categories` overrides the rule's default. `surfaces` is visibility-only and never changes whether a rule runs.
59
+
60
+ ## Config shape
61
+
62
+ Config lives in `doctor.config.ts` (or `.js`/`.mjs`/`.cjs`/`.json`/`.jsonc`), or the `reactDoctor` key in `package.json`. The `rules` commands edit whichever exists — TS/JS edits preserve formatting (via magicast) — and create `doctor.config.json` when none does, stamping `$schema`:
63
+
64
+ ```ts
65
+ // doctor.config.ts
66
+ export default {
67
+ rules: { "react-doctor/no-array-index-as-key": "off" },
68
+ categories: { "React Native": "warn" },
69
+ ignore: { tags: ["design"] },
70
+ };
71
+ ```
72
+
73
+ ## Educating the user
74
+
75
+ When explaining a rule, lead with the "Why it matters" guidance from `rules explain` and, when they want depth, the per-rule recipe at `https://www.react.doctor/prompts/rules/<plugin>/<rule>.md`. Only after they understand it should you offer to disable it — many "bad" rules are catching real issues.
@@ -32,6 +32,10 @@ The playbook is the single source of truth — a scan → filter → triage →
32
32
 
33
33
  Pair it with the matching per-rule prompts at `https://www.react.doctor/prompts/rules/<plugin>/<rule>.md` (fetched on demand inside the playbook) so each fix uses the canonical, reviewer-tested recipe.
34
34
 
35
+ ## Configuring or explaining rules
36
+
37
+ When the user wants to understand a rule, disagrees with one, or wants to disable / tune which rules run (not fix code), use the `doctor-explain` skill (alias `/doctor-config`). Start with `npx react-doctor@latest rules explain <rule>`, then apply the narrowest control via `npx react-doctor@latest rules disable|set|category|ignore-tag …`, which edits your `doctor.config.*` (or `package.json#reactDoctor`).
38
+
35
39
  ## Command
36
40
 
37
41
  ```bash
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-doctor",
3
- "version": "0.2.14-dev.6d53182",
3
+ "version": "0.2.14-dev.75c1f99",
4
4
  "description": "Diagnose and fix React codebases for security, performance, correctness, accessibility, bundle-size, and architecture issues",
5
5
  "keywords": [
6
6
  "accessibility",
@@ -49,19 +49,26 @@
49
49
  }
50
50
  },
51
51
  "dependencies": {
52
+ "@babel/code-frame": "^7.29.0",
52
53
  "@effect/platform-node-shared": "4.0.0-beta.70",
54
+ "@sentry/node": "^10.54.0",
53
55
  "agent-install": "0.0.5",
54
56
  "conf": "^15.1.0",
55
- "deslop-js": "^0.0.13",
57
+ "confbox": "^0.2.4",
58
+ "deslop-js": "^0.0.14",
56
59
  "effect": "4.0.0-beta.70",
57
60
  "eslint-plugin-react-hooks": "^7.1.1",
61
+ "jiti": "^2.7.0",
62
+ "magicast": "^0.5.3",
58
63
  "oxlint": "^1.66.0",
59
64
  "prompts": "^2.4.2",
60
65
  "typescript": ">=5.0.4 <7",
61
- "oxlint-plugin-react-doctor": "0.2.14-dev.6d53182"
66
+ "oxlint-plugin-react-doctor": "0.2.14-dev.75c1f99"
62
67
  },
63
68
  "devDependencies": {
69
+ "@types/babel__code-frame": "^7.27.0",
64
70
  "@types/prompts": "^2.4.9",
71
+ "@xterm/headless": "^6.0.0",
65
72
  "commander": "^14.0.3",
66
73
  "ora": "^9.4.0",
67
74
  "@react-doctor/api": "0.2.14",