react-doctor 0.5.1-dev.94f9f4f → 0.5.1-dev.9cc6555
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/cli.js +678 -230
- package/dist/index.d.ts +132 -48
- package/dist/index.js +244 -39
- package/dist/lsp.js +146 -34
- package/dist/skills/react-doctor/SKILL.md +10 -9
- package/package.json +5 -5
package/dist/index.d.ts
CHANGED
|
@@ -8989,6 +8989,20 @@ declare namespace Annotations {
|
|
|
8989
8989
|
* - `"none"` — never block; the scan is advisory (still reports + scores).
|
|
8990
8990
|
*/
|
|
8991
8991
|
type BlockingLevel = "error" | "warning" | "none";
|
|
8992
|
+
/**
|
|
8993
|
+
* How much of the project a scan looks at and reports on — the single knob the
|
|
8994
|
+
* CLI `--scope` flag, the GitHub Action `scope` input, and this config field
|
|
8995
|
+
* all share. Ordered widest to narrowest:
|
|
8996
|
+
*
|
|
8997
|
+
* - `"full"` — whole project, every issue (the default). Whole-project checks
|
|
8998
|
+
* (dead-code, environment, supply-chain) run only at this scope.
|
|
8999
|
+
* - `"files"` — only the files changed vs the base, with ALL issues in them
|
|
9000
|
+
* (no compare-to-main). What `--staged` and an uncommitted `--diff` do today.
|
|
9001
|
+
* - `"changed"` — only issues the change INTRODUCED vs the base (the baseline
|
|
9002
|
+
* delta). What `--diff <base>` and the action's `scope: changed` do today.
|
|
9003
|
+
* - `"lines"` — only issues on the lines the change actually touched.
|
|
9004
|
+
*/
|
|
9005
|
+
type ScopeValue = "full" | "files" | "changed" | "lines";
|
|
8992
9006
|
interface ReactDoctorIgnoreOverride {
|
|
8993
9007
|
/** Glob patterns the override applies to (e.g. `["src/legacy/**"]`). */
|
|
8994
9008
|
files: string[];
|
|
@@ -9102,11 +9116,11 @@ interface SurfaceControls {
|
|
|
9102
9116
|
*
|
|
9103
9117
|
* Mirrors how Socket Firewall's free tier (`sfw`) works: each direct
|
|
9104
9118
|
* dependency's PURL is looked up against Socket's keyless
|
|
9105
|
-
* `firewall-api.socket.dev/purl/<purl>` endpoint, which returns
|
|
9106
|
-
*
|
|
9107
|
-
*
|
|
9108
|
-
*
|
|
9109
|
-
* finding does.
|
|
9119
|
+
* `firewall-api.socket.dev/purl/<purl>` endpoint, which returns per-axis
|
|
9120
|
+
* scores (0–100 once normalized). A dependency whose worst security axis
|
|
9121
|
+
* (supply chain or vulnerability) scores below `minScore` produces a
|
|
9122
|
+
* diagnostic; at the default `severity: "error"` it fails the scan
|
|
9123
|
+
* (non-zero CI exit), the same way an error-severity lint finding does.
|
|
9110
9124
|
*/
|
|
9111
9125
|
interface SupplyChainConfig {
|
|
9112
9126
|
/**
|
|
@@ -9118,8 +9132,9 @@ interface SupplyChainConfig {
|
|
|
9118
9132
|
enabled?: boolean;
|
|
9119
9133
|
/**
|
|
9120
9134
|
* Minimum acceptable Socket score on a 0–100 scale. A direct dependency
|
|
9121
|
-
* whose Socket
|
|
9122
|
-
*
|
|
9135
|
+
* whose worst Socket *security* axis — supply chain or vulnerability — is
|
|
9136
|
+
* below this is flagged; the quality / maintenance / license axes never
|
|
9137
|
+
* gate. Default: `50`. Values outside `0..100` are clamped.
|
|
9123
9138
|
*/
|
|
9124
9139
|
minScore?: number;
|
|
9125
9140
|
/**
|
|
@@ -9166,6 +9181,23 @@ interface ReactDoctorConfig {
|
|
|
9166
9181
|
* `rules` / `categories`) still shows even when `warnings` is `false`.
|
|
9167
9182
|
*/
|
|
9168
9183
|
warnings?: boolean;
|
|
9184
|
+
/**
|
|
9185
|
+
* Scan scope. Defaults to `"full"`. See `ScopeValue` for the four values.
|
|
9186
|
+
* The CLI `--scope` flag and the GitHub Action `scope` input set the same
|
|
9187
|
+
* thing; flags win over config.
|
|
9188
|
+
*/
|
|
9189
|
+
scope?: ScopeValue;
|
|
9190
|
+
/**
|
|
9191
|
+
* Base git ref the `"files"` / `"changed"` / `"lines"` scopes compare
|
|
9192
|
+
* against. Auto-detected from the default branch / merge-base when unset.
|
|
9193
|
+
*/
|
|
9194
|
+
base?: string;
|
|
9195
|
+
/**
|
|
9196
|
+
* @deprecated Use `scope` instead. Still honored as an alias when `scope`
|
|
9197
|
+
* is unset: `diff: "<base>"` / `diff: true` → `scope: "changed"`,
|
|
9198
|
+
* `diff: false` → `scope: "full"`. Using it emits a one-time deprecation
|
|
9199
|
+
* warning. Prefer `scope` (+ `base`).
|
|
9200
|
+
*/
|
|
9169
9201
|
diff?: boolean | string;
|
|
9170
9202
|
/**
|
|
9171
9203
|
* Severity threshold at which the scan blocks CI (exits non-zero).
|
|
@@ -9205,6 +9237,22 @@ interface ReactDoctorConfig {
|
|
|
9205
9237
|
* requested directory).
|
|
9206
9238
|
*/
|
|
9207
9239
|
rootDir?: string;
|
|
9240
|
+
/**
|
|
9241
|
+
* Projects to scan and score separately — the config-file equivalent of
|
|
9242
|
+
* the CLI `--project` flag, for repos that always want per-module scoring
|
|
9243
|
+
* (e.g. a monorepo dashboard tracking each module's score daily) without
|
|
9244
|
+
* passing the flag on every run.
|
|
9245
|
+
*
|
|
9246
|
+
* Entries resolve exactly like `--project` values: workspace package
|
|
9247
|
+
* names (or directory basenames) first, then directory paths relative to
|
|
9248
|
+
* the scanned root. `"*"` selects every discovered workspace project.
|
|
9249
|
+
* Invalid entries fail the run with the same error as the flag.
|
|
9250
|
+
*
|
|
9251
|
+
* Precedence: an explicit `--project` flag overrides this list. Only the
|
|
9252
|
+
* config at the invocation root is consulted — `projects` inside a
|
|
9253
|
+
* module's own config is ignored (modules can't redirect the scan).
|
|
9254
|
+
*/
|
|
9255
|
+
projects?: string[];
|
|
9208
9256
|
textComponents?: string[];
|
|
9209
9257
|
/**
|
|
9210
9258
|
* Names of components that safely route string-only children through a
|
|
@@ -9404,6 +9452,7 @@ interface DiagnosticRelatedLocation {
|
|
|
9404
9452
|
endColumn?: number;
|
|
9405
9453
|
message: string;
|
|
9406
9454
|
}
|
|
9455
|
+
type DiagnosticFileContext = "test" | "story" | "production";
|
|
9407
9456
|
interface Diagnostic {
|
|
9408
9457
|
filePath: string;
|
|
9409
9458
|
plugin: string;
|
|
@@ -9430,6 +9479,12 @@ interface Diagnostic {
|
|
|
9430
9479
|
/** 1-indexed end column of the primary span, when derivable. */
|
|
9431
9480
|
endColumn?: number;
|
|
9432
9481
|
category: string;
|
|
9482
|
+
/**
|
|
9483
|
+
* Set when the file never ships to users (`"test"` / `"story"`), so
|
|
9484
|
+
* renderers can label the site instead of implying production impact.
|
|
9485
|
+
* Omitted for production files (the default).
|
|
9486
|
+
*/
|
|
9487
|
+
fileContext?: Exclude<DiagnosticFileContext, "production">;
|
|
9433
9488
|
suppressionHint?: string;
|
|
9434
9489
|
/** Secondary source locations (oxlint's non-primary labels). */
|
|
9435
9490
|
relatedLocations?: DiagnosticRelatedLocation[];
|
|
@@ -9569,12 +9624,55 @@ interface DiagnoseResult {
|
|
|
9569
9624
|
elapsedMilliseconds: number;
|
|
9570
9625
|
}
|
|
9571
9626
|
/**
|
|
9572
|
-
* A single project to scan as part of a `
|
|
9627
|
+
* A single project to scan as part of a `diagnose({ projects })` batch.
|
|
9573
9628
|
* Scan options (`deadCode`, `lint`, etc.) are flat on the entry and
|
|
9574
9629
|
* layer on top of the global defaults — omitted fields fall through.
|
|
9575
|
-
* `config` is a full `ReactDoctorConfig` override that replaces the
|
|
9576
|
-
* on-disk `doctor.config.*` for this project's scan.
|
|
9577
9630
|
*/
|
|
9631
|
+
interface ProjectDefinition extends DiagnoseOptions {
|
|
9632
|
+
directory: string;
|
|
9633
|
+
/**
|
|
9634
|
+
* Per-project config overrides, layered additively (see
|
|
9635
|
+
* `mergeReactDoctorConfigs`) on top of the project's on-disk
|
|
9636
|
+
* `doctor.config.*` and the batch-level `DiagnoseProjectsInput.config`
|
|
9637
|
+
* — so disabling one rule here keeps every base rule intact.
|
|
9638
|
+
*/
|
|
9639
|
+
config?: ReactDoctorConfig;
|
|
9640
|
+
}
|
|
9641
|
+
interface ProjectResultOk extends DiagnoseResult {
|
|
9642
|
+
ok: true;
|
|
9643
|
+
directory: string;
|
|
9644
|
+
}
|
|
9645
|
+
interface ProjectResultError {
|
|
9646
|
+
ok: false;
|
|
9647
|
+
directory: string;
|
|
9648
|
+
error: Error;
|
|
9649
|
+
}
|
|
9650
|
+
type ProjectResult = ProjectResultOk | ProjectResultError;
|
|
9651
|
+
interface DiagnoseProjectsInput extends DiagnoseOptions {
|
|
9652
|
+
projects: ProjectDefinition[];
|
|
9653
|
+
/**
|
|
9654
|
+
* Config overrides applied to every project in the batch, layered
|
|
9655
|
+
* additively (see `mergeReactDoctorConfigs`) between each project's
|
|
9656
|
+
* on-disk `doctor.config.*` and its `ProjectDefinition.config` — one
|
|
9657
|
+
* base rule set for the batch, overridden per project only where needed.
|
|
9658
|
+
*/
|
|
9659
|
+
config?: ReactDoctorConfig;
|
|
9660
|
+
/**
|
|
9661
|
+
* Maximum number of projects to scan concurrently. Defaults to
|
|
9662
|
+
* `DEFAULT_PROJECT_SCAN_CONCURRENCY` (4) — each project scan fans out
|
|
9663
|
+
* its own lint workers, so the batch is bounded rather than fully
|
|
9664
|
+
* parallel. Set to `1` for sequential execution. Values below 1 are
|
|
9665
|
+
* clamped to 1.
|
|
9666
|
+
*/
|
|
9667
|
+
concurrency?: number;
|
|
9668
|
+
}
|
|
9669
|
+
interface DiagnoseProjectsResult {
|
|
9670
|
+
projects: ProjectResult[];
|
|
9671
|
+
diagnostics: Diagnostic[];
|
|
9672
|
+
score: ScoreResult | null;
|
|
9673
|
+
elapsedMilliseconds: number;
|
|
9674
|
+
} //#endregion
|
|
9675
|
+
//#region src/types/handle-error.d.ts
|
|
9578
9676
|
//#endregion
|
|
9579
9677
|
//#region src/types/inspect.d.ts
|
|
9580
9678
|
interface InspectResult {
|
|
@@ -9969,8 +10067,15 @@ declare const buildJsonReport: (input: BuildJsonReportInput) => JsonReport; //#e
|
|
|
9969
10067
|
* `GitBaseBranchMissing`) as clean user errors instead of crashes.
|
|
9970
10068
|
*/
|
|
9971
10069
|
declare const getDiffInfo: (directory: string, explicitBaseBranch?: string) => Promise<DiffInfo | null>;
|
|
9972
|
-
declare const filterSourceFiles: (filePaths: string[]) => string[];
|
|
9973
|
-
|
|
10070
|
+
declare const filterSourceFiles: (filePaths: string[]) => string[];
|
|
10071
|
+
/**
|
|
10072
|
+
* Programmatic façade over `Git.changedLineRanges` (the `lines` scope). Diffs
|
|
10073
|
+
* `files` with `--unified=0` against `baseRef` (or the index when `cached`),
|
|
10074
|
+
* returning per-file changed line ranges relative to `directory`. Returns
|
|
10075
|
+
* `null` when the ranges can't be computed (git unavailable / unsafe ref /
|
|
10076
|
+
* non-zero exit) so the caller degrades to file-level scope; an empty array
|
|
10077
|
+
* means git succeeded but the files added no lines.
|
|
10078
|
+
*/
|
|
9974
10079
|
//#endregion
|
|
9975
10080
|
//#region src/summarize-diagnostics.d.ts
|
|
9976
10081
|
declare const summarizeDiagnostics: (diagnostics: Diagnostic[], worstScore?: number | null, worstScoreLabel?: string | null) => JsonReportSummary; //#endregion
|
|
@@ -9988,41 +10093,20 @@ declare const defineConfig: (config: ReactDoctorConfig) => ReactDoctorConfig; //
|
|
|
9988
10093
|
//#endregion
|
|
9989
10094
|
//#region ../api/dist/index.d.ts
|
|
9990
10095
|
//#region src/diagnose.d.ts
|
|
9991
|
-
|
|
9992
|
-
/**
|
|
9993
|
-
|
|
9994
|
-
|
|
9995
|
-
|
|
9996
|
-
|
|
9997
|
-
|
|
9998
|
-
|
|
9999
|
-
|
|
10000
|
-
|
|
10001
|
-
|
|
10002
|
-
|
|
10003
|
-
|
|
10004
|
-
|
|
10005
|
-
* ```ts
|
|
10006
|
-
* const result = await diagnoseProjects({
|
|
10007
|
-
* projects: [
|
|
10008
|
-
* { directory: "packages/app" },
|
|
10009
|
-
* { directory: "packages/shared", deadCode: false },
|
|
10010
|
-
* { directory: "packages/admin", config: {
|
|
10011
|
-
* rules: { "react-doctor/no-array-index-as-key": "off" },
|
|
10012
|
-
* }},
|
|
10013
|
-
* ],
|
|
10014
|
-
* concurrency: 4,
|
|
10015
|
-
* });
|
|
10016
|
-
*
|
|
10017
|
-
* for (const project of result.projects) {
|
|
10018
|
-
* if (project.ok) {
|
|
10019
|
-
* console.log(project.directory, project.score);
|
|
10020
|
-
* } else {
|
|
10021
|
-
* console.error(project.directory, project.error);
|
|
10022
|
-
* }
|
|
10023
|
-
* }
|
|
10024
|
-
* ```
|
|
10025
|
-
*/
|
|
10096
|
+
interface Diagnose {
|
|
10097
|
+
/** Scan a single project directory and return diagnostics + score. */
|
|
10098
|
+
(directory: string, options?: DiagnoseOptions): Promise<DiagnoseResult>;
|
|
10099
|
+
/**
|
|
10100
|
+
* Scan multiple projects in parallel — each through the same pipeline as
|
|
10101
|
+
* the single-directory form — and return per-project results plus an
|
|
10102
|
+
* aggregate worst-of score. A failing project (e.g. no `package.json`)
|
|
10103
|
+
* comes back with `ok: false` instead of aborting the batch. Per-project
|
|
10104
|
+
* `config` layers on the batch `config`, which layers on each project's
|
|
10105
|
+
* on-disk config (see `mergeReactDoctorConfigs`).
|
|
10106
|
+
*/
|
|
10107
|
+
(input: DiagnoseProjectsInput): Promise<DiagnoseProjectsResult>;
|
|
10108
|
+
}
|
|
10109
|
+
declare const diagnose: Diagnose; //#endregion
|
|
10026
10110
|
//#endregion
|
|
10027
10111
|
//#region src/index.d.ts
|
|
10028
10112
|
declare const clearCaches: () => void;
|
|
@@ -10033,5 +10117,5 @@ interface ToJsonReportOptions {
|
|
|
10033
10117
|
}
|
|
10034
10118
|
declare const toJsonReport: (result: DiagnoseResult, options: ToJsonReportOptions) => JsonReport;
|
|
10035
10119
|
//#endregion
|
|
10036
|
-
export { AmbiguousProjectError, type DiagnoseOptions, type DiagnoseResult, type Diagnostic, type DiffInfo, type JsonReport, type JsonReportDiffInfo, type JsonReportError, type JsonReportMode, type JsonReportProjectEntry, type JsonReportSummary, NoReactDependencyError, NotADirectoryError, PackageJsonNotFoundError, type ProjectInfo, ProjectNotFoundError, type ReactDoctorConfig, ReactDoctorError, type ScoreResult, buildJsonReport, buildJsonReportError, clearCaches, defineConfig, diagnose, filterSourceFiles, getDiffInfo, isProjectDiscoveryError, isReactDoctorError, summarizeDiagnostics, toJsonReport };
|
|
10120
|
+
export { AmbiguousProjectError, type DiagnoseOptions, type DiagnoseProjectsInput, type DiagnoseProjectsResult, type DiagnoseResult, type Diagnostic, type DiffInfo, type JsonReport, type JsonReportDiffInfo, type JsonReportError, type JsonReportMode, type JsonReportProjectEntry, type JsonReportSummary, NoReactDependencyError, NotADirectoryError, PackageJsonNotFoundError, type ProjectDefinition, type ProjectInfo, ProjectNotFoundError, type ProjectResult, type ProjectResultError, type ProjectResultOk, type ReactDoctorConfig, ReactDoctorError, type ScoreResult, buildJsonReport, buildJsonReportError, clearCaches, defineConfig, diagnose, filterSourceFiles, getDiffInfo, isProjectDiscoveryError, isReactDoctorError, summarizeDiagnostics, toJsonReport };
|
|
10037
10121
|
//# sourceMappingURL=index.d.ts.map
|