react-doctor 0.2.14-dev.7b4ddf7 → 0.2.14-dev.938376
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.
- package/README.md +21 -0
- package/dist/cli.js +12608 -3512
- package/dist/index.d.ts +95 -14
- package/dist/index.js +1095 -229
- package/package.json +9 -5
- package/dist/cli-logger-CSZagq1E.js +0 -7564
- package/dist/rolldown-runtime-uZX_iqCz.js +0 -35
package/dist/index.d.ts
CHANGED
|
@@ -20,9 +20,9 @@ interface ReactDoctorIgnoreConfig {
|
|
|
20
20
|
* locally but excluded from PR comments, the score, or the CI gate:
|
|
21
21
|
*
|
|
22
22
|
* - `cli` — local terminal output from `react-doctor` (`printDiagnostics`).
|
|
23
|
-
* - `prComment` —
|
|
24
|
-
*
|
|
25
|
-
*
|
|
23
|
+
* - `prComment` — diagnostics destined for a sticky pull-request
|
|
24
|
+
* summary comment. Selected by running the CLI with `--pr-comment`
|
|
25
|
+
* (sets `outputSurface: "prComment"`).
|
|
26
26
|
* - `score` — diagnostics shipped to the React Doctor score API
|
|
27
27
|
* (or counted toward local score calculations).
|
|
28
28
|
* - `ciFailure` — diagnostics that count toward the `--fail-on` exit
|
|
@@ -53,6 +53,14 @@ type RuleSeverityOverride = "error" | "warn" | "off";
|
|
|
53
53
|
* `rules` and `categories` fields on `ReactDoctorConfig`. Per-rule
|
|
54
54
|
* wins over per-category when both match the same diagnostic.
|
|
55
55
|
*/
|
|
56
|
+
/**
|
|
57
|
+
* Closed set of severity buckets. Spelled out (rather than
|
|
58
|
+
* `Record<string, …>`) so an unknown/typo'd bucket key is a type error
|
|
59
|
+
* instead of a silent no-op.
|
|
60
|
+
*/
|
|
61
|
+
interface SeverityBuckets {
|
|
62
|
+
"compiler-cleanup"?: RuleSeverityOverride;
|
|
63
|
+
}
|
|
56
64
|
interface SurfaceControls {
|
|
57
65
|
/**
|
|
58
66
|
* Tag names whose diagnostics should be force-included on the surface,
|
|
@@ -66,9 +74,9 @@ interface SurfaceControls {
|
|
|
66
74
|
* `["test-noise"]`) for a single channel without touching others.
|
|
67
75
|
*/
|
|
68
76
|
excludeTags?: string[];
|
|
69
|
-
/** Category names (e.g. `"
|
|
77
|
+
/** Category names (e.g. `"Maintainability"`) to force-include. */
|
|
70
78
|
includeCategories?: string[];
|
|
71
|
-
/** Category names (e.g. `"
|
|
79
|
+
/** Category names (e.g. `"Maintainability"`) to exclude. */
|
|
72
80
|
excludeCategories?: string[];
|
|
73
81
|
/**
|
|
74
82
|
* Fully-qualified rule keys (`"<plugin>/<rule>"`, e.g.
|
|
@@ -85,12 +93,23 @@ interface ReactDoctorConfig {
|
|
|
85
93
|
/**
|
|
86
94
|
* Whether to run dead-code analysis (via `deslop-js`) alongside lint.
|
|
87
95
|
* Reports unused files, unused exports, unused dependencies, and
|
|
88
|
-
* circular imports under the "
|
|
96
|
+
* circular imports under the "Maintainability" category. Default: `true`.
|
|
89
97
|
* Always skipped in `--diff` / `--staged` modes because reachability
|
|
90
98
|
* is a whole-project property.
|
|
91
99
|
*/
|
|
92
100
|
deadCode?: boolean;
|
|
93
101
|
verbose?: boolean;
|
|
102
|
+
/**
|
|
103
|
+
* Whether to surface `"warning"`-severity diagnostics. Default: `true`
|
|
104
|
+
* — every warning reaches every surface (CLI, PR comment, score,
|
|
105
|
+
* `--fail-on`).
|
|
106
|
+
*
|
|
107
|
+
* Set to `false` to surface only `"error"`-severity findings. This is the
|
|
108
|
+
* master toggle and runs after per-rule / per-category severity
|
|
109
|
+
* overrides: a rule the user explicitly restamps to `"warn"` (via
|
|
110
|
+
* `rules` / `categories`) still shows even when `warnings` is `false`.
|
|
111
|
+
*/
|
|
112
|
+
warnings?: boolean;
|
|
94
113
|
diff?: boolean | string;
|
|
95
114
|
failOn?: FailOnLevel;
|
|
96
115
|
customRulesOnly?: boolean;
|
|
@@ -229,15 +248,12 @@ interface ReactDoctorConfig {
|
|
|
229
248
|
rules?: Record<string, RuleSeverityOverride>;
|
|
230
249
|
/**
|
|
231
250
|
* Per-category severity map. Mirrors oxlint's top-level
|
|
232
|
-
* `categories` field, but keyed by React Doctor's
|
|
233
|
-
*
|
|
234
|
-
* `"
|
|
235
|
-
* `"Accessibility"`, `"Performance"`, `"Correctness"`,
|
|
236
|
-
* `"Next.js"`, `"Preact"`, `"TanStack Query"`,
|
|
237
|
-
* `"TanStack Start"`, …).
|
|
251
|
+
* `categories` field, but keyed by React Doctor's five user-facing
|
|
252
|
+
* buckets: `"Security"`, `"Bugs"`, `"Performance"`,
|
|
253
|
+
* `"Accessibility"`, `"Maintainability"`.
|
|
238
254
|
*
|
|
239
255
|
* ```json
|
|
240
|
-
* { "categories": { "
|
|
256
|
+
* { "categories": { "Maintainability": "off", "Performance": "warn" } }
|
|
241
257
|
* ```
|
|
242
258
|
*
|
|
243
259
|
* To silence a whole tag-defined rule family (e.g. `"design"`,
|
|
@@ -245,6 +261,20 @@ interface ReactDoctorConfig {
|
|
|
245
261
|
* single category, use `ignore.tags` instead.
|
|
246
262
|
*/
|
|
247
263
|
categories?: Record<string, RuleSeverityOverride>;
|
|
264
|
+
/**
|
|
265
|
+
* Per-bucket severity map. Buckets are curated rule families with a
|
|
266
|
+
* shared gating story (not categories). Today the only bucket is
|
|
267
|
+
* `"compiler-cleanup"`: the redundant-memoization rule
|
|
268
|
+
* (`react-compiler-no-manual-memoization`) that ships as a warning once
|
|
269
|
+
* React Compiler is detected. Set it to `"error"` to re-enable strictness.
|
|
270
|
+
*
|
|
271
|
+
* ```json
|
|
272
|
+
* { "buckets": { "compiler-cleanup": "error" } }
|
|
273
|
+
* ```
|
|
274
|
+
*
|
|
275
|
+
* A per-rule override in `rules` still wins over a bucket entry.
|
|
276
|
+
*/
|
|
277
|
+
buckets?: SeverityBuckets;
|
|
248
278
|
/**
|
|
249
279
|
* User-defined oxlint plugins to load alongside the built-in
|
|
250
280
|
* `react-doctor` plugin. Each entry is either:
|
|
@@ -288,6 +318,7 @@ interface Diagnostic {
|
|
|
288
318
|
plugin: string;
|
|
289
319
|
rule: string;
|
|
290
320
|
severity: "error" | "warning";
|
|
321
|
+
title?: string;
|
|
291
322
|
message: string;
|
|
292
323
|
help: string;
|
|
293
324
|
url?: string;
|
|
@@ -338,6 +369,22 @@ interface ProjectInfo {
|
|
|
338
369
|
* — no `rn-*` rules load for the project at all.
|
|
339
370
|
*/
|
|
340
371
|
hasReactNativeWorkspace: boolean;
|
|
372
|
+
/**
|
|
373
|
+
* The declared `expo` package version spec (e.g. `"~51.0.0"`), looked up
|
|
374
|
+
* in the project or any of its workspace packages, or `null` when `expo`
|
|
375
|
+
* isn't a dependency. Doubles as react-doctor's "is this an Expo project?"
|
|
376
|
+
* signal (`expoVersion !== null`) and its SDK-version source — the `expo`
|
|
377
|
+
* major tracks the Expo SDK release one-to-one — paralleling how
|
|
378
|
+
* `reactVersion` models the React runtime.
|
|
379
|
+
*
|
|
380
|
+
* Keyed off the dependency rather than `framework === "expo"` because
|
|
381
|
+
* `detectFramework` returns the first matching package, so a project
|
|
382
|
+
* declaring both `expo` and a web bundler (`vite` / `next`) classifies as
|
|
383
|
+
* the web framework yet is still an Expo project. Drives the `expo`
|
|
384
|
+
* capability in `buildCapabilities` (which gates every Expo-specific
|
|
385
|
+
* rule) and the ported expo-doctor checks.
|
|
386
|
+
*/
|
|
387
|
+
expoVersion: string | null;
|
|
341
388
|
/**
|
|
342
389
|
* `true` when the project (or any of its workspace packages) declares
|
|
343
390
|
* `react-native-reanimated`. Lets diagnostics surface reanimated's
|
|
@@ -349,9 +396,15 @@ interface ProjectInfo {
|
|
|
349
396
|
}
|
|
350
397
|
//#endregion
|
|
351
398
|
//#region src/types/score.d.ts
|
|
399
|
+
type RuleTier = "P0" | "P1" | "P2" | "P3";
|
|
400
|
+
interface RulePriority {
|
|
401
|
+
readonly priority: number | null;
|
|
402
|
+
readonly tier: RuleTier;
|
|
403
|
+
}
|
|
352
404
|
interface ScoreResult {
|
|
353
405
|
score: number;
|
|
354
406
|
label: string;
|
|
407
|
+
readonly rules?: Readonly<Record<string, RulePriority>>;
|
|
355
408
|
} //#endregion
|
|
356
409
|
//#region src/types/diagnose.d.ts
|
|
357
410
|
interface DiagnoseOptions {
|
|
@@ -365,6 +418,12 @@ interface DiagnoseOptions {
|
|
|
365
418
|
* See that field's docs for the full contract.
|
|
366
419
|
*/
|
|
367
420
|
respectInlineDisables?: boolean;
|
|
421
|
+
/**
|
|
422
|
+
* Per-call override for `ReactDoctorConfig.warnings`. See that field's
|
|
423
|
+
* docs — `"warning"`-severity diagnostics surface by default unless this
|
|
424
|
+
* (or the config) opts out via `false`.
|
|
425
|
+
*/
|
|
426
|
+
warnings?: boolean;
|
|
368
427
|
}
|
|
369
428
|
interface DiagnoseResult {
|
|
370
429
|
diagnostics: Diagnostic[];
|
|
@@ -404,6 +463,28 @@ interface InspectResult {
|
|
|
404
463
|
skippedCheckReasons?: Record<string, string>;
|
|
405
464
|
project: ProjectInfo;
|
|
406
465
|
elapsedMilliseconds: number;
|
|
466
|
+
/**
|
|
467
|
+
* Number of files the scan reported. Distinct from
|
|
468
|
+
* `project.sourceFileCount` in diff / staged mode (where only changed
|
|
469
|
+
* files are scanned). Optional so non-orchestrator constructors keep
|
|
470
|
+
* working; the multi-project summary falls back to
|
|
471
|
+
* `project.sourceFileCount` when absent.
|
|
472
|
+
*/
|
|
473
|
+
scannedFileCount?: number;
|
|
474
|
+
/**
|
|
475
|
+
* Absolute paths of every file the scan considered. Lets the
|
|
476
|
+
* multi-project summary count UNIQUE files across projects instead of
|
|
477
|
+
* summing per-project counts, which double-counts shared files when one
|
|
478
|
+
* workspace package's tree is nested inside another's.
|
|
479
|
+
*/
|
|
480
|
+
scannedFilePaths?: ReadonlyArray<string>;
|
|
481
|
+
/**
|
|
482
|
+
* Wall-clock duration of the scan phase, in milliseconds. Distinct
|
|
483
|
+
* from `elapsedMilliseconds` (which spans the full `inspect()` call
|
|
484
|
+
* including score fetch + rendering). Used by the multi-project
|
|
485
|
+
* summary to report combined scan time.
|
|
486
|
+
*/
|
|
487
|
+
scanElapsedMilliseconds?: number;
|
|
407
488
|
}
|
|
408
489
|
/**
|
|
409
490
|
* Options accepted by `inspect()`. Mixes two concern groups; ordered
|
|
@@ -661,7 +742,7 @@ interface BuildJsonReportInput {
|
|
|
661
742
|
totalElapsedMilliseconds: number;
|
|
662
743
|
}
|
|
663
744
|
declare const buildJsonReport: (input: BuildJsonReportInput) => JsonReport; //#endregion
|
|
664
|
-
//#region src/
|
|
745
|
+
//#region src/build-skipped-checks.d.ts
|
|
665
746
|
//#endregion
|
|
666
747
|
//#region src/get-diff-files.d.ts
|
|
667
748
|
/**
|