react-doctor 0.5.1-dev.2f26228 → 0.5.1-dev.3de9106
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 +405 -158
- package/dist/index.d.ts +92 -46
- package/dist/index.js +251 -57
- package/dist/lsp.js +153 -52
- package/package.json +4 -4
package/dist/index.d.ts
CHANGED
|
@@ -9116,11 +9116,11 @@ interface SurfaceControls {
|
|
|
9116
9116
|
*
|
|
9117
9117
|
* Mirrors how Socket Firewall's free tier (`sfw`) works: each direct
|
|
9118
9118
|
* dependency's PURL is looked up against Socket's keyless
|
|
9119
|
-
* `firewall-api.socket.dev/purl/<purl>` endpoint, which returns
|
|
9120
|
-
*
|
|
9121
|
-
*
|
|
9122
|
-
*
|
|
9123
|
-
* 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.
|
|
9124
9124
|
*/
|
|
9125
9125
|
interface SupplyChainConfig {
|
|
9126
9126
|
/**
|
|
@@ -9132,8 +9132,9 @@ interface SupplyChainConfig {
|
|
|
9132
9132
|
enabled?: boolean;
|
|
9133
9133
|
/**
|
|
9134
9134
|
* Minimum acceptable Socket score on a 0–100 scale. A direct dependency
|
|
9135
|
-
* whose Socket
|
|
9136
|
-
*
|
|
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.
|
|
9137
9138
|
*/
|
|
9138
9139
|
minScore?: number;
|
|
9139
9140
|
/**
|
|
@@ -9236,6 +9237,22 @@ interface ReactDoctorConfig {
|
|
|
9236
9237
|
* requested directory).
|
|
9237
9238
|
*/
|
|
9238
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[];
|
|
9239
9256
|
textComponents?: string[];
|
|
9240
9257
|
/**
|
|
9241
9258
|
* Names of components that safely route string-only children through a
|
|
@@ -9435,6 +9452,7 @@ interface DiagnosticRelatedLocation {
|
|
|
9435
9452
|
endColumn?: number;
|
|
9436
9453
|
message: string;
|
|
9437
9454
|
}
|
|
9455
|
+
type DiagnosticFileContext = "test" | "story" | "production";
|
|
9438
9456
|
interface Diagnostic {
|
|
9439
9457
|
filePath: string;
|
|
9440
9458
|
plugin: string;
|
|
@@ -9461,6 +9479,12 @@ interface Diagnostic {
|
|
|
9461
9479
|
/** 1-indexed end column of the primary span, when derivable. */
|
|
9462
9480
|
endColumn?: number;
|
|
9463
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">;
|
|
9464
9488
|
suppressionHint?: string;
|
|
9465
9489
|
/** Secondary source locations (oxlint's non-primary labels). */
|
|
9466
9490
|
relatedLocations?: DiagnosticRelatedLocation[];
|
|
@@ -9600,12 +9624,55 @@ interface DiagnoseResult {
|
|
|
9600
9624
|
elapsedMilliseconds: number;
|
|
9601
9625
|
}
|
|
9602
9626
|
/**
|
|
9603
|
-
* A single project to scan as part of a `
|
|
9627
|
+
* A single project to scan as part of a `diagnose({ projects })` batch.
|
|
9604
9628
|
* Scan options (`deadCode`, `lint`, etc.) are flat on the entry and
|
|
9605
9629
|
* layer on top of the global defaults — omitted fields fall through.
|
|
9606
|
-
* `config` is a full `ReactDoctorConfig` override that replaces the
|
|
9607
|
-
* on-disk `doctor.config.*` for this project's scan.
|
|
9608
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
|
|
9609
9676
|
//#endregion
|
|
9610
9677
|
//#region src/types/inspect.d.ts
|
|
9611
9678
|
interface InspectResult {
|
|
@@ -10026,41 +10093,20 @@ declare const defineConfig: (config: ReactDoctorConfig) => ReactDoctorConfig; //
|
|
|
10026
10093
|
//#endregion
|
|
10027
10094
|
//#region ../api/dist/index.d.ts
|
|
10028
10095
|
//#region src/diagnose.d.ts
|
|
10029
|
-
|
|
10030
|
-
/**
|
|
10031
|
-
|
|
10032
|
-
|
|
10033
|
-
|
|
10034
|
-
|
|
10035
|
-
|
|
10036
|
-
|
|
10037
|
-
|
|
10038
|
-
|
|
10039
|
-
|
|
10040
|
-
|
|
10041
|
-
|
|
10042
|
-
|
|
10043
|
-
* ```ts
|
|
10044
|
-
* const result = await diagnoseProjects({
|
|
10045
|
-
* projects: [
|
|
10046
|
-
* { directory: "packages/app" },
|
|
10047
|
-
* { directory: "packages/shared", deadCode: false },
|
|
10048
|
-
* { directory: "packages/admin", config: {
|
|
10049
|
-
* rules: { "react-doctor/no-array-index-as-key": "off" },
|
|
10050
|
-
* }},
|
|
10051
|
-
* ],
|
|
10052
|
-
* concurrency: 4,
|
|
10053
|
-
* });
|
|
10054
|
-
*
|
|
10055
|
-
* for (const project of result.projects) {
|
|
10056
|
-
* if (project.ok) {
|
|
10057
|
-
* console.log(project.directory, project.score);
|
|
10058
|
-
* } else {
|
|
10059
|
-
* console.error(project.directory, project.error);
|
|
10060
|
-
* }
|
|
10061
|
-
* }
|
|
10062
|
-
* ```
|
|
10063
|
-
*/
|
|
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
|
|
10064
10110
|
//#endregion
|
|
10065
10111
|
//#region src/index.d.ts
|
|
10066
10112
|
declare const clearCaches: () => void;
|
|
@@ -10071,5 +10117,5 @@ interface ToJsonReportOptions {
|
|
|
10071
10117
|
}
|
|
10072
10118
|
declare const toJsonReport: (result: DiagnoseResult, options: ToJsonReportOptions) => JsonReport;
|
|
10073
10119
|
//#endregion
|
|
10074
|
-
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 };
|
|
10075
10121
|
//# sourceMappingURL=index.d.ts.map
|