react-doctor 0.8.0 → 0.8.1-dev.0b0b5ac

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
@@ -8980,6 +8980,84 @@ declare namespace Annotations {
8980
8980
  }
8981
8981
  //#endregion
8982
8982
  //#region ../core/dist/index.d.ts
8983
+ /**
8984
+ * A secondary source location attached to a diagnostic (oxlint's
8985
+ * non-primary labels). Editors render these as
8986
+ * `Diagnostic.relatedInformation` so a user can jump from, say, a
8987
+ * `no-derived-state` finding to the originating prop declaration.
8988
+ * Positions mirror `Diagnostic` semantics: `line` / `column` are
8989
+ * 1-indexed, and `offset` / `length` are UTF-8 byte spans from oxlint
8990
+ * when available (preferred for precise ranges).
8991
+ */
8992
+ interface DiagnosticRelatedLocation {
8993
+ filePath: string;
8994
+ line: number;
8995
+ column: number;
8996
+ offset?: number;
8997
+ length?: number;
8998
+ endLine?: number;
8999
+ endColumn?: number;
9000
+ message: string;
9001
+ }
9002
+ type DiagnosticFileContext = "test" | "story" | "production";
9003
+ interface Diagnostic {
9004
+ filePath: string;
9005
+ plugin: string;
9006
+ rule: string;
9007
+ severity: "error" | "warning";
9008
+ title?: string;
9009
+ message: string;
9010
+ help: string;
9011
+ url?: string;
9012
+ line: number;
9013
+ column: number;
9014
+ /**
9015
+ * UTF-8 byte offset of the diagnostic's primary span start, straight
9016
+ * from oxlint's label span. Optional because environment / dead-code
9017
+ * diagnostics carry no source span. Editors (LSP) convert this into a
9018
+ * precise range via the in-memory document; non-editor consumers can
9019
+ * ignore it.
9020
+ */
9021
+ offset?: number;
9022
+ /** UTF-8 byte length of the primary span (pairs with `offset`). */
9023
+ length?: number;
9024
+ /** 1-indexed end line of the primary span, when derivable. */
9025
+ endLine?: number;
9026
+ /** 1-indexed end column of the primary span, when derivable. */
9027
+ endColumn?: number;
9028
+ category: string;
9029
+ /**
9030
+ * Set when the finding's identity is the flagged element itself (a missing
9031
+ * attribute, a wrong element) rather than the flagged line's text — every
9032
+ * Accessibility-category finding, plus rules that opt in via their
9033
+ * `matchByOccurrence` metadata flag. After strict evidence matching,
9034
+ * `computeDiagnosticDelta` may match these by same-file `(plugin/rule,
9035
+ * message)` occurrence count, so reformatting the flagged element doesn't
9036
+ * reclassify a pre-existing finding as new. Resolved at diagnostic creation,
9037
+ * where rule metadata is available. Absent means diagnosed-source-sensitive
9038
+ * matching (the default).
9039
+ */
9040
+ matchByOccurrence?: boolean;
9041
+ /**
9042
+ * Set when the file never ships to users (`"test"` / `"story"`), so
9043
+ * renderers can label the site instead of implying production impact.
9044
+ * Omitted for production files (the default).
9045
+ */
9046
+ fileContext?: Exclude<DiagnosticFileContext, "production">;
9047
+ suppressionHint?: string;
9048
+ /** Secondary source locations (oxlint's non-primary labels). */
9049
+ relatedLocations?: DiagnosticRelatedLocation[];
9050
+ /**
9051
+ * Stable id shared by every finding that a single fix resolves together —
9052
+ * e.g. four `useEffect`s that reset state on one prop change all clear with
9053
+ * one `key` prop. Set only when ≥2 findings share a root cause; absent for
9054
+ * standalone findings. A consumer that turns findings into work items should
9055
+ * group by it so one fix reads as one task, not N. Presentation-only and
9056
+ * score-neutral — the score never reads it.
9057
+ */
9058
+ fixGroupId?: string;
9059
+ }
9060
+ //#endregion
8983
9061
  //#region src/types/config.d.ts
8984
9062
  /**
8985
9063
  * Severity threshold at which a scan blocks CI (exits non-zero). Controlled
@@ -9057,9 +9135,9 @@ interface ReactDoctorIgnoreConfig {
9057
9135
  * Defaults: design rules (tag `"design"`) are excluded from `prComment`,
9058
9136
  * `score`, and `ciFailure` so style cleanup doesn't dilute meaningful
9059
9137
  * React findings. Diagnostics stamped with `fileContext: "test" | "story"`
9060
- * are excluded from `score` and `ciFailure`. Both remain in `cli`, and an
9061
- * explicit rule, category, or tag include promotes a diagnostic back onto
9062
- * the selected surface.
9138
+ * are excluded from `score` and `ciFailure`. Both remain in `cli`. Explicit
9139
+ * rule, category, or tag includes promote matching diagnostics, while
9140
+ * `includeFileContexts` restores a context without bypassing other exclusions.
9063
9141
  */
9064
9142
  type DiagnosticSurface = "cli" | "prComment" | "score" | "ciFailure";
9065
9143
  /**
@@ -9089,6 +9167,11 @@ interface SeverityBuckets {
9089
9167
  "compiler-cleanup"?: RuleSeverityOverride;
9090
9168
  }
9091
9169
  interface SurfaceControls {
9170
+ /**
9171
+ * Non-production file contexts to retain on this surface. This restores
9172
+ * test or story findings without overriding unrelated tag exclusions.
9173
+ */
9174
+ includeFileContexts?: Array<Exclude<DiagnosticFileContext, "production">>;
9092
9175
  /**
9093
9176
  * Tag names whose diagnostics should be force-included on the surface,
9094
9177
  * even if a default or category-level exclusion would otherwise drop
@@ -9353,9 +9436,9 @@ interface ReactDoctorConfig {
9353
9436
  * - `score` and `ciFailure` exclude test/story file contexts unless explicitly included
9354
9437
  *
9355
9438
  * Pass any controls block, including an empty `{}`, to keep the defaults.
9356
- * Your include/exclude entries layer on top. Includes always win over
9357
- * excludes. For example, you can promote one high-signal `design-*` rule
9358
- * back into the score or PR-comment surface.
9439
+ * Your include/exclude entries layer on top. Rule, category, and tag includes
9440
+ * win over their exclusions. Included file contexts still respect unrelated
9441
+ * exclusions, so restoring story findings does not restore every design rule.
9359
9442
  */
9360
9443
  surfaces?: Partial<Record<DiagnosticSurface, SurfaceControls>>;
9361
9444
  /**
@@ -9449,84 +9532,6 @@ interface ReactDoctorConfig {
9449
9532
  */
9450
9533
  plugins?: string[];
9451
9534
  } //#endregion
9452
- //#region src/types/diagnostic.d.ts
9453
- /**
9454
- * A secondary source location attached to a diagnostic (oxlint's
9455
- * non-primary labels). Editors render these as
9456
- * `Diagnostic.relatedInformation` so a user can jump from, say, a
9457
- * `no-derived-state` finding to the originating prop declaration.
9458
- * Positions mirror `Diagnostic` semantics: `line` / `column` are
9459
- * 1-indexed, and `offset` / `length` are UTF-8 byte spans from oxlint
9460
- * when available (preferred for precise ranges).
9461
- */
9462
- interface DiagnosticRelatedLocation {
9463
- filePath: string;
9464
- line: number;
9465
- column: number;
9466
- offset?: number;
9467
- length?: number;
9468
- endLine?: number;
9469
- endColumn?: number;
9470
- message: string;
9471
- }
9472
- type DiagnosticFileContext = "test" | "story" | "production";
9473
- interface Diagnostic {
9474
- filePath: string;
9475
- plugin: string;
9476
- rule: string;
9477
- severity: "error" | "warning";
9478
- title?: string;
9479
- message: string;
9480
- help: string;
9481
- url?: string;
9482
- line: number;
9483
- column: number;
9484
- /**
9485
- * UTF-8 byte offset of the diagnostic's primary span start, straight
9486
- * from oxlint's label span. Optional because environment / dead-code
9487
- * diagnostics carry no source span. Editors (LSP) convert this into a
9488
- * precise range via the in-memory document; non-editor consumers can
9489
- * ignore it.
9490
- */
9491
- offset?: number;
9492
- /** UTF-8 byte length of the primary span (pairs with `offset`). */
9493
- length?: number;
9494
- /** 1-indexed end line of the primary span, when derivable. */
9495
- endLine?: number;
9496
- /** 1-indexed end column of the primary span, when derivable. */
9497
- endColumn?: number;
9498
- category: string;
9499
- /**
9500
- * Set when the finding's identity is the flagged element itself (a missing
9501
- * attribute, a wrong element) rather than the flagged line's text — every
9502
- * Accessibility-category finding, plus rules that opt in via their
9503
- * `matchByOccurrence` metadata flag. `computeDiagnosticDelta` matches these
9504
- * by `(filePath, plugin/rule)` occurrence count, so reformatting the flagged
9505
- * line doesn't reclassify a pre-existing finding as new. Resolved at
9506
- * diagnostic creation, where rule metadata is available. Absent means
9507
- * line-text-sensitive matching (the default).
9508
- */
9509
- matchByOccurrence?: boolean;
9510
- /**
9511
- * Set when the file never ships to users (`"test"` / `"story"`), so
9512
- * renderers can label the site instead of implying production impact.
9513
- * Omitted for production files (the default).
9514
- */
9515
- fileContext?: Exclude<DiagnosticFileContext, "production">;
9516
- suppressionHint?: string;
9517
- /** Secondary source locations (oxlint's non-primary labels). */
9518
- relatedLocations?: DiagnosticRelatedLocation[];
9519
- /**
9520
- * Stable id shared by every finding that a single fix resolves together —
9521
- * e.g. four `useEffect`s that reset state on one prop change all clear with
9522
- * one `key` prop. Set only when ≥2 findings share a root cause; absent for
9523
- * standalone findings. A consumer that turns findings into work items should
9524
- * group by it so one fix reads as one task, not N. Presentation-only and
9525
- * score-neutral — the score never reads it.
9526
- */
9527
- fixGroupId?: string;
9528
- }
9529
- //#endregion
9530
9535
  //#region src/types/project-info.d.ts
9531
9536
  type Framework = FrameworkToken;
9532
9537
  interface ProjectInfo {
@@ -9538,11 +9543,38 @@ interface ProjectInfo {
9538
9543
  zodVersion: string | null;
9539
9544
  /** Parsed major from `zodVersion`, or `null` when absent/unparseable. Mirrors `reactMajorVersion`. */
9540
9545
  zodMajorVersion: number | null;
9546
+ /** Declared MobX core version spec. Optional so existing `ProjectInfo` consumers remain source-compatible. */
9547
+ mobxVersion?: string | null;
9548
+ /** Parsed major from `mobxVersion`, or `null` when absent/unparseable. */
9549
+ mobxMajorVersion?: number | null;
9550
+ hasMobxReact?: boolean;
9551
+ hasMobxReactLite?: boolean;
9552
+ hasMobxStateTree?: boolean;
9553
+ hasMobxReactObserver?: boolean;
9554
+ /** Declared Zustand version spec. Optional so existing `ProjectInfo` consumers remain source-compatible. */
9555
+ zustandVersion?: string | null;
9556
+ /** Parsed major from `zustandVersion`, or `null` when absent/unparseable. */
9557
+ zustandMajorVersion?: number | null;
9541
9558
  framework: Framework;
9542
9559
  hasTypeScript: boolean;
9543
9560
  hasReactCompiler: boolean;
9544
9561
  hasReactCompilerLintPlugin?: boolean;
9545
9562
  hasTanStackQuery: boolean;
9563
+ hasRemotion?: boolean;
9564
+ remotionVersion?: string | null;
9565
+ remotionMajorVersion?: number | null;
9566
+ hasI18nLibrary?: boolean;
9567
+ tanstackQueryVersion?: string | null;
9568
+ styledComponentsVersion?: string | null;
9569
+ /**
9570
+ * The declared `valtio` version spec, or `null` when no package in the
9571
+ * analyzed project declares Valtio. `useSnapshot` has kept the same
9572
+ * render-read contract across Valtio 1 and 2, so presence alone drives the
9573
+ * `valtio` capability and its parsed major-version ladder.
9574
+ */
9575
+ valtioVersion: string | null;
9576
+ /** Parsed major from `valtioVersion`, or `null` when absent/unparseable. */
9577
+ valtioMajorVersion: number | null;
9546
9578
  /**
9547
9579
  * `true` when the project or a workspace declares a Vite-based SSR runtime
9548
9580
  * such as React Router's Node adapter, Vike, or vite-plugin-ssr.
@@ -9843,7 +9875,8 @@ interface InspectResult {
9843
9875
  baselineDelta?: {
9844
9876
  /** 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. */
9845
9877
  fixedCount: number; /** Total findings at base (over the same files), for context. */
9846
- baseTotalCount: number;
9878
+ baseTotalCount: number; /** Pre-existing findings matched after moving to a different file. */
9879
+ crossFileMatchCount?: number;
9847
9880
  };
9848
9881
  }
9849
9882
  /**
@@ -10259,15 +10292,7 @@ declare const buildJsonReport: (input: BuildJsonReportInput) => JsonReportV3$1;
10259
10292
  * `GitBaseBranchMissing`) as clean user errors instead of crashes.
10260
10293
  */
10261
10294
  declare const getDiffInfo: (directory: string, explicitBaseBranch?: string, includeUntracked?: boolean) => Promise<DiffInfo | null>;
10262
- declare const filterSourceFiles: (filePaths: string[]) => string[];
10263
- /**
10264
- * Programmatic façade over `Git.changedLineRanges` (the `lines` scope). Diffs
10265
- * `files` with `--unified=0` against `baseRef` (or the index when `cached`),
10266
- * returning per-file changed line ranges relative to `directory`. Returns
10267
- * `null` when the ranges can't be computed (git unavailable / unsafe ref /
10268
- * non-zero exit) so the caller degrades to file-level scope; an empty array
10269
- * means git succeeded but the files added no lines.
10270
- */
10295
+ declare const filterSourceFiles: (filePaths: ReadonlyArray<string>) => string[];
10271
10296
  //#endregion
10272
10297
  //#region src/summarize-diagnostics.d.ts
10273
10298
  declare const summarizeDiagnostics: (diagnostics: Diagnostic[], worstScore?: number | null, worstScoreLabel?: string | null) => JsonReportSummary; //#endregion