react-doctor 0.2.18-dev.f375dbb → 0.3.0-dev.7593271

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/dist/index.d.ts CHANGED
@@ -1,9 +1,17 @@
1
1
  import * as Schema from "effect/Schema";
2
- import fs from "node:fs";
3
2
  import * as Cause from "effect/Cause";
4
3
  //#region ../core/dist/index.d.ts
5
4
  //#region src/types/config.d.ts
6
- type FailOnLevel = "error" | "warning" | "none";
5
+ /**
6
+ * Severity threshold at which a scan blocks CI (exits non-zero). Controlled
7
+ * by `blocking` / `--blocking` (default `"error"`):
8
+ *
9
+ * - `"error"` — block when an `"error"`-severity diagnostic reaches the
10
+ * `ciFailure` surface. The default.
11
+ * - `"warning"` — block on any diagnostic (warnings included).
12
+ * - `"none"` — never block; the scan is advisory (still reports + scores).
13
+ */
14
+ type BlockingLevel = "error" | "warning" | "none";
7
15
  interface ReactDoctorIgnoreOverride {
8
16
  /** Glob patterns the override applies to (e.g. `["src/legacy/**"]`). */
9
17
  files: string[];
@@ -47,9 +55,11 @@ interface ReactDoctorIgnoreConfig {
47
55
  * (sets `outputSurface: "prComment"`).
48
56
  * - `score` — diagnostics shipped to the React Doctor score API
49
57
  * (or counted toward local score calculations).
50
- * - `ciFailure` — diagnostics that count toward the `--fail-on` exit
51
- * code gate. A diagnostic excluded from this surface never fails the
52
- * build, regardless of severity.
58
+ * - `ciFailure` — diagnostics that count toward the CI exit-code gate.
59
+ * react-doctor blocks (exits non-zero) when a diagnostic at or above the
60
+ * `blocking` threshold reaches this surface (default: `"error"`). A
61
+ * diagnostic excluded from this surface never fails the build,
62
+ * regardless of severity.
53
63
  *
54
64
  * Defaults: design rules (tag `"design"`) are excluded from `prComment`,
55
65
  * `score`, and `ciFailure` so style cleanup doesn't dilute meaningful
@@ -123,8 +133,9 @@ interface ReactDoctorConfig {
123
133
  verbose?: boolean;
124
134
  /**
125
135
  * Whether to surface `"warning"`-severity diagnostics. Default: `true`
126
- * — every warning reaches every surface (CLI, PR comment, score,
127
- * `--fail-on`).
136
+ * — every warning reaches every surface (CLI, PR comment, score, the
137
+ * CI gate). Warnings only flip the exit code when `blocking` is set to
138
+ * `"warning"`; at the default `"error"` threshold they stay advisory.
128
139
  *
129
140
  * Set to `false` to surface only `"error"`-severity findings. This is the
130
141
  * master toggle and runs after per-rule / per-category severity
@@ -133,7 +144,23 @@ interface ReactDoctorConfig {
133
144
  */
134
145
  warnings?: boolean;
135
146
  diff?: boolean | string;
136
- failOn?: FailOnLevel;
147
+ /**
148
+ * Severity threshold at which the scan blocks CI (exits non-zero).
149
+ * Default: `"error"` — only `"error"`-severity diagnostics on the
150
+ * `ciFailure` surface fail the build. Set to `"warning"` to also block
151
+ * on warnings, or `"none"` to keep the scan advisory (it still reports
152
+ * findings and a score, but always exits `0`).
153
+ *
154
+ * The GitHub Action exposes the same control as its `blocking`
155
+ * input, and the CLI as `--blocking <level>`. Flags win over config.
156
+ */
157
+ blocking?: BlockingLevel;
158
+ /**
159
+ * @deprecated Renamed to `blocking` (same values + default). Still
160
+ * honored as an alias when `blocking` is unset, but using it emits a
161
+ * one-time deprecation warning. Prefer `blocking`.
162
+ */
163
+ failOn?: BlockingLevel;
137
164
  customRulesOnly?: boolean;
138
165
  share?: boolean;
139
166
  noScore?: boolean;
@@ -231,7 +258,7 @@ interface ReactDoctorConfig {
231
258
  * Per-surface include/exclude controls. Each `DiagnosticSurface` is
232
259
  * resolved independently against rule tags, category, and id so a
233
260
  * single rule can be visible locally yet hidden from PR comments,
234
- * neutralized from the score, and excluded from `--fail-on` — all
261
+ * neutralized from the score, and excluded from the CI gate — all
235
262
  * without touching the rule's severity or activation.
236
263
  *
237
264
  * Defaults (applied before user overrides):
@@ -256,7 +283,7 @@ interface ReactDoctorConfig {
256
283
  * `"off"` skips registration in the generated lint config so the
257
284
  * rule never runs; `"error"` / `"warn"` re-stamp the registered
258
285
  * severity and the post-lint diagnostic, so downstream consumers
259
- * (`--fail-on`, the score, the printed list) all see the
286
+ * (the CI gate, the score, the printed list) all see the
260
287
  * user-chosen severity.
261
288
  *
262
289
  * For visibility-only changes (silence on PR comments but keep on
@@ -335,6 +362,25 @@ interface ReactDoctorConfig {
335
362
  plugins?: string[];
336
363
  } //#endregion
337
364
  //#region src/types/diagnostic.d.ts
365
+ /**
366
+ * A secondary source location attached to a diagnostic (oxlint's
367
+ * non-primary labels). Editors render these as
368
+ * `Diagnostic.relatedInformation` so a user can jump from, say, a
369
+ * `no-derived-state` finding to the originating prop declaration.
370
+ * Positions mirror `Diagnostic` semantics: `line` / `column` are
371
+ * 1-indexed, and `offset` / `length` are UTF-8 byte spans from oxlint
372
+ * when available (preferred for precise ranges).
373
+ */
374
+ interface DiagnosticRelatedLocation {
375
+ filePath: string;
376
+ line: number;
377
+ column: number;
378
+ offset?: number;
379
+ length?: number;
380
+ endLine?: number;
381
+ endColumn?: number;
382
+ message: string;
383
+ }
338
384
  interface Diagnostic {
339
385
  filePath: string;
340
386
  plugin: string;
@@ -346,8 +392,24 @@ interface Diagnostic {
346
392
  url?: string;
347
393
  line: number;
348
394
  column: number;
395
+ /**
396
+ * UTF-8 byte offset of the diagnostic's primary span start, straight
397
+ * from oxlint's label span. Optional because environment / dead-code
398
+ * diagnostics carry no source span. Editors (LSP) convert this into a
399
+ * precise range via the in-memory document; non-editor consumers can
400
+ * ignore it.
401
+ */
402
+ offset?: number;
403
+ /** UTF-8 byte length of the primary span (pairs with `offset`). */
404
+ length?: number;
405
+ /** 1-indexed end line of the primary span, when derivable. */
406
+ endLine?: number;
407
+ /** 1-indexed end column of the primary span, when derivable. */
408
+ endColumn?: number;
349
409
  category: string;
350
410
  suppressionHint?: string;
411
+ /** Secondary source locations (oxlint's non-primary labels). */
412
+ relatedLocations?: DiagnosticRelatedLocation[];
351
413
  }
352
414
  //#endregion
353
415
  //#region src/types/project-info.d.ts
@@ -407,6 +469,15 @@ interface ProjectInfo {
407
469
  * rule) and the ported expo-doctor checks.
408
470
  */
409
471
  expoVersion: string | null;
472
+ /**
473
+ * The declared `@shopify/flash-list` package version spec, or `null` when
474
+ * absent. FlashList v2 removed the need for `estimatedItemSize`, so this
475
+ * lets the RN list sizing rule stay scoped to versions where the prop is
476
+ * still useful.
477
+ */
478
+ shopifyFlashListVersion: string | null;
479
+ /** Parsed major from `shopifyFlashListVersion`, or `null` when absent/unparseable. */
480
+ shopifyFlashListMajorVersion: number | null;
410
481
  /**
411
482
  * `true` when the project (or any of its workspace packages) declares
412
483
  * `react-native-reanimated`. Lets diagnostics surface reanimated's
@@ -507,6 +578,16 @@ interface InspectResult {
507
578
  * summary to report combined scan time.
508
579
  */
509
580
  scanElapsedMilliseconds?: number;
581
+ /**
582
+ * Present only for a baseline run (`InspectOptions.baseline` set). The
583
+ * `diagnostics` above are then the *introduced* findings only; this
584
+ * carries the comparison totals for Codecov-style delta reporting.
585
+ */
586
+ baselineDelta?: {
587
+ /** The commit the base content was read from (resolved merge-base). */baseRef: string; /** Findings present at base but gone at head — resolved by the change. */
588
+ fixedCount: number; /** Total findings at base (over the same files), for context. */
589
+ baseTotalCount: number;
590
+ };
510
591
  }
511
592
  /**
512
593
  * Options accepted by `inspect()`. Mixes two concern groups; ordered
@@ -535,10 +616,34 @@ interface DiffInfo {
535
616
  */
536
617
  currentBranch: string | null;
537
618
  baseBranch: string;
619
+ /**
620
+ * Resolved base commit SHA, when known (the GitHub Action forwards
621
+ * `pull_request.base.sha`). Preferred over `baseBranch` for baseline
622
+ * merge-base resolution because a branch name often doesn't resolve in a
623
+ * shallow PR checkout, whereas the fetched SHA always does.
624
+ */
625
+ baseSha?: string;
626
+ /**
627
+ * The commit the changed-file diff was computed against (see
628
+ * `GitDiffSelection.diffBaseRef`). Baseline mode reads base content from
629
+ * here so a two-dot `A..B` range reads from `A` directly instead of being
630
+ * incorrectly merge-based with HEAD.
631
+ */
632
+ diffBaseRef?: string;
538
633
  changedFiles: string[];
539
634
  isCurrentChanges?: boolean;
540
635
  }
541
- type JsonReportMode = "full" | "diff" | "staged";
636
+ type JsonReportMode = "full" | "diff" | "staged" | "baseline";
637
+ interface JsonReportBaselineInfo {
638
+ /** Resolved base commit (merge-base) the head was compared against. */
639
+ baseRef: string;
640
+ /** Count of introduced findings (equals `summary.totalDiagnosticCount`). */
641
+ newCount: number;
642
+ /** Count of findings the change resolved (present at base, gone at head). */
643
+ fixedCount: number;
644
+ /** Total findings at base over the same files, for context. */
645
+ baseTotalCount: number;
646
+ }
542
647
  interface JsonReportDiffInfo {
543
648
  baseBranch: string;
544
649
  /** `null` when `HEAD` is detached — see `DiffInfo.currentBranch`. */
@@ -568,8 +673,15 @@ interface JsonReportError {
568
673
  message: string;
569
674
  name: string;
570
675
  chain: string[];
676
+ /**
677
+ * Sentry event id for the crash, when the run reported one (CLI crash
678
+ * path in CI). Lets the GitHub Action surface a quotable reference so a
679
+ * failed scan can be traced back to its Sentry event. `null` for expected
680
+ * user errors and synthetic fallbacks that never hit Sentry.
681
+ */
682
+ sentryEventId?: string | null;
571
683
  }
572
- interface JsonReport {
684
+ interface JsonReportV1$1 {
573
685
  schemaVersion: 1;
574
686
  version: string;
575
687
  ok: boolean;
@@ -585,7 +697,20 @@ interface JsonReport {
585
697
  summary: JsonReportSummary;
586
698
  elapsedMilliseconds: number;
587
699
  error: JsonReportError | null;
588
- } //#endregion
700
+ }
701
+ /**
702
+ * Baseline (PR-introduced-issues-only) report. Structurally a superset of v1
703
+ * — every v1 field is present with identical meaning, so consumers that only
704
+ * read `summary` / `diagnostics` / `ok` work unchanged — plus a `baseline`
705
+ * block and `mode: "baseline"`. Here `diagnostics` (and `summary`'s counts)
706
+ * are the *introduced* findings only; `summary.score` is still the head
707
+ * scan's project-health score. New consumers branch on `schemaVersion === 2`.
708
+ */
709
+ interface JsonReportV2 extends Omit<JsonReportV1$1, "schemaVersion"> {
710
+ schemaVersion: 2;
711
+ baseline: JsonReportBaselineInfo;
712
+ }
713
+ type JsonReport = JsonReportV1$1 | JsonReportV2; //#endregion
589
714
  //#region src/types/prompts.d.ts
590
715
  //#endregion
591
716
  //#region src/project-info/errors.d.ts
@@ -764,6 +889,8 @@ interface BuildJsonReportErrorInput {
764
889
  error: unknown;
765
890
  elapsedMilliseconds: number;
766
891
  mode?: JsonReportMode;
892
+ /** Sentry event id for the crash, when the run reported one. */
893
+ sentryEventId?: string | null;
767
894
  }
768
895
  declare const buildJsonReportError: (input: BuildJsonReportErrorInput) => JsonReport; //#endregion
769
896
  //#region src/build-json-report.d.ts
@@ -777,6 +904,16 @@ interface BuildJsonReportInput {
777
904
  result: InspectResult;
778
905
  }>;
779
906
  totalElapsedMilliseconds: number;
907
+ /**
908
+ * Present for a baseline run — `scans[].result.diagnostics` are then the
909
+ * introduced findings only. Emits a `schemaVersion: 2` report with the
910
+ * delta totals and `mode: "baseline"`.
911
+ */
912
+ baseline?: {
913
+ baseRef: string;
914
+ fixedCount: number;
915
+ baseTotalCount: number;
916
+ };
780
917
  }
781
918
  declare const buildJsonReport: (input: BuildJsonReportInput) => JsonReport; //#endregion
782
919
  //#region src/build-skipped-checks.d.ts