react-doctor 0.4.1 → 0.4.2-dev.727894a
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 +6 -55
- package/dist/cli.js +66 -17
- package/dist/index.d.ts +11 -1
- package/dist/index.js +41 -4
- package/dist/lsp.js +34 -4
- package/package.json +5 -5
package/README.md
CHANGED
|
@@ -37,60 +37,11 @@ npx react-doctor@latest install
|
|
|
37
37
|
|
|
38
38
|
Works with Claude Code, Cursor, Codex, OpenCode, and many more.
|
|
39
39
|
|
|
40
|
-
### 3.
|
|
40
|
+
### 3. Run in CI
|
|
41
41
|
|
|
42
|
-
React Doctor
|
|
42
|
+
React Doctor CI (GitHub Actions) reviews every pull request automatically and reports only the issues your change introduced, not your existing backlog.
|
|
43
43
|
|
|
44
|
-
|
|
45
|
-
react-doctor experimental-lsp --stdio
|
|
46
|
-
```
|
|
47
|
-
|
|
48
|
-
> The editor language server is experimental — its protocol, caching, and diagnostics may change between releases, hence the `experimental-` prefix.
|
|
49
|
-
|
|
50
|
-
Companion extensions for VS Code/Cursor and Zed live under `packages/`; any other LSP client can run the command above directly over stdio.
|
|
51
|
-
|
|
52
|
-
### 4. Run in CI (GitHub Actions) for your team
|
|
53
|
-
|
|
54
|
-
[](https://github.com/marketplace/actions/react-doctor)
|
|
55
|
-
|
|
56
|
-
On a pull request the Action reports only the issues your change **introduced** — it scans the PR and the merge-base and reports the difference (like Codecov for coverage), leaving pre-existing findings alone. It posts inline review comments on the changed lines and a sticky summary with the new / fixed delta.
|
|
57
|
-
|
|
58
|
-
```yaml
|
|
59
|
-
name: React Doctor
|
|
60
|
-
|
|
61
|
-
on:
|
|
62
|
-
pull_request:
|
|
63
|
-
types: [opened, synchronize, reopened, ready_for_review]
|
|
64
|
-
|
|
65
|
-
permissions:
|
|
66
|
-
contents: read
|
|
67
|
-
pull-requests: write
|
|
68
|
-
issues: write
|
|
69
|
-
statuses: write # lets the action publish the score as a commit status
|
|
70
|
-
|
|
71
|
-
concurrency:
|
|
72
|
-
group: react-doctor-${{ github.event.pull_request.number || github.ref }}
|
|
73
|
-
cancel-in-progress: true
|
|
74
|
-
|
|
75
|
-
jobs:
|
|
76
|
-
react-doctor:
|
|
77
|
-
runs-on: ubuntu-latest
|
|
78
|
-
steps:
|
|
79
|
-
- uses: actions/checkout@v5
|
|
80
|
-
with:
|
|
81
|
-
fetch-depth: 0 # so React Doctor can diff against the merge-base for new-vs-existing
|
|
82
|
-
- uses: millionco/react-doctor@v2
|
|
83
|
-
```
|
|
84
|
-
|
|
85
|
-
`fetch-depth: 0` is recommended so the baseline comparison can read the base commit; without enough history the Action falls back to reporting every finding in the changed files.
|
|
86
|
-
|
|
87
|
-
`@v2` always resolves to the latest `v2.x` release of the Action. For hardened CI — recommended whenever the workflow is granted `pull-requests: write` — pin to a full commit SHA instead and let Dependabot or Renovate keep it current:
|
|
88
|
-
|
|
89
|
-
```yaml
|
|
90
|
-
- uses: millionco/react-doctor@75932719d11ef50e110eac01ce04acdc05fde074 # v2.0.1
|
|
91
|
-
```
|
|
92
|
-
|
|
93
|
-
[Add GitHub Action →](https://github.com/marketplace/actions/react-doctor)
|
|
44
|
+
[Add GitHub Action →](https://react.doctor/ci)
|
|
94
45
|
|
|
95
46
|
### 4. Configure rules in `doctor.config.ts`
|
|
96
47
|
|
|
@@ -98,14 +49,14 @@ Configure with a `doctor.config.ts` (or `.js`, `.mjs`, `.cjs`, `.json`, `.jsonc`
|
|
|
98
49
|
|
|
99
50
|
```ts
|
|
100
51
|
// doctor.config.ts
|
|
101
|
-
import
|
|
52
|
+
import { defineConfig } from "react-doctor/api";
|
|
102
53
|
|
|
103
|
-
export default {
|
|
54
|
+
export default defineConfig({
|
|
104
55
|
lint: true,
|
|
105
56
|
rules: {
|
|
106
57
|
"react-doctor/no-array-index-as-key": "off",
|
|
107
58
|
},
|
|
108
|
-
}
|
|
59
|
+
});
|
|
109
60
|
```
|
|
110
61
|
|
|
111
62
|
Prefer JSON? Use `doctor.config.json`:
|
package/dist/cli.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
|
|
2
|
-
!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="
|
|
2
|
+
!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="1486eaee-ed07-5eef-a9d7-51293140e237")}catch(e){}}();
|
|
3
3
|
import { createRequire } from "node:module";
|
|
4
4
|
import { execFile, execFileSync, spawn, spawnSync } from "node:child_process";
|
|
5
5
|
import * as path$1 from "node:path";
|
|
@@ -7629,6 +7629,35 @@ const loadPackageJsonConfig = (directory) => {
|
|
|
7629
7629
|
format: "package-json"
|
|
7630
7630
|
};
|
|
7631
7631
|
};
|
|
7632
|
+
const loadLegacyConfig = (directory) => {
|
|
7633
|
+
const legacyFilePath = path$1.join(directory, LEGACY_CONFIG_FILENAME);
|
|
7634
|
+
if (!isFile(legacyFilePath)) return {
|
|
7635
|
+
status: "absent",
|
|
7636
|
+
loaded: null
|
|
7637
|
+
};
|
|
7638
|
+
try {
|
|
7639
|
+
const parsed = readDataConfig(legacyFilePath);
|
|
7640
|
+
if (isPlainObject(parsed)) {
|
|
7641
|
+
warn(`${LEGACY_CONFIG_FILENAME} is deprecated — rename it to ${CONFIG_BASENAME}.json (or author a ${CONFIG_BASENAME}.ts). It is still read for now.`);
|
|
7642
|
+
return {
|
|
7643
|
+
status: "found",
|
|
7644
|
+
loaded: {
|
|
7645
|
+
config: validateConfigTypes(parsed),
|
|
7646
|
+
sourceDirectory: directory,
|
|
7647
|
+
configFilePath: legacyFilePath,
|
|
7648
|
+
format: "json"
|
|
7649
|
+
}
|
|
7650
|
+
};
|
|
7651
|
+
}
|
|
7652
|
+
warn(`${LEGACY_CONFIG_FILENAME} must contain an object, ignoring.`);
|
|
7653
|
+
} catch (error) {
|
|
7654
|
+
warn(`Failed to load ${LEGACY_CONFIG_FILENAME}: ${formatError(error)}`);
|
|
7655
|
+
}
|
|
7656
|
+
return {
|
|
7657
|
+
status: "invalid",
|
|
7658
|
+
loaded: null
|
|
7659
|
+
};
|
|
7660
|
+
};
|
|
7632
7661
|
const loadConfigFromDirectory = async (directory) => {
|
|
7633
7662
|
let sawBrokenConfigFile = false;
|
|
7634
7663
|
for (const extension of CONFIG_EXTENSIONS) {
|
|
@@ -7658,7 +7687,8 @@ const loadConfigFromDirectory = async (directory) => {
|
|
|
7658
7687
|
status: "found",
|
|
7659
7688
|
loaded: packageJsonConfig
|
|
7660
7689
|
};
|
|
7661
|
-
|
|
7690
|
+
const legacyResult = loadLegacyConfig(directory);
|
|
7691
|
+
if (legacyResult.status !== "absent") return legacyResult;
|
|
7662
7692
|
return {
|
|
7663
7693
|
status: sawBrokenConfigFile ? "invalid" : "absent",
|
|
7664
7694
|
loaded: null
|
|
@@ -7695,7 +7725,9 @@ const directoryHasCurrentConfig = (directory) => {
|
|
|
7695
7725
|
/**
|
|
7696
7726
|
* Walks up from `rootDirectory` (same boundary semantics as
|
|
7697
7727
|
* `loadConfigWithSource`) looking for a pre-migration
|
|
7698
|
-
* `react-doctor.config.json
|
|
7728
|
+
* `react-doctor.config.json`. The loader still reads this file as a deprecated
|
|
7729
|
+
* fallback (see `loadLegacyConfig`); this detector is what lets the interactive
|
|
7730
|
+
* CLI offer to rename it to a current-format config. Returns the first one
|
|
7699
7731
|
* found, or `null` when a current-format config supersedes it or none exists
|
|
7700
7732
|
* before a project boundary. Detection only — the CLI performs the rename.
|
|
7701
7733
|
*/
|
|
@@ -12215,7 +12247,7 @@ const makeNoopConsole = () => ({
|
|
|
12215
12247
|
});
|
|
12216
12248
|
//#endregion
|
|
12217
12249
|
//#region src/cli/utils/version.ts
|
|
12218
|
-
const VERSION = "0.4.
|
|
12250
|
+
const VERSION = "0.4.2-dev.727894a";
|
|
12219
12251
|
//#endregion
|
|
12220
12252
|
//#region src/cli/utils/json-mode.ts
|
|
12221
12253
|
let context = null;
|
|
@@ -12573,13 +12605,13 @@ const isDevVersion = (version) => version === "0.0.0" || version.includes("-");
|
|
|
12573
12605
|
* uploads source-map artifacts under, so stack frames symbolicate. Honors the
|
|
12574
12606
|
* standard `SENTRY_RELEASE` override.
|
|
12575
12607
|
*/
|
|
12576
|
-
const resolveSentryRelease = () => process.env.SENTRY_RELEASE || `react-doctor@0.4.
|
|
12608
|
+
const resolveSentryRelease = () => process.env.SENTRY_RELEASE || `react-doctor@0.4.2-dev.727894a`;
|
|
12577
12609
|
/**
|
|
12578
12610
|
* Deployment environment shown in Sentry's environment filter. Defaults to
|
|
12579
12611
|
* `production` for tagged releases and `development` for dev/unbuilt versions,
|
|
12580
12612
|
* overridable via the standard `SENTRY_ENVIRONMENT` env var.
|
|
12581
12613
|
*/
|
|
12582
|
-
const resolveSentryEnvironment = () => process.env.SENTRY_ENVIRONMENT || (isDevVersion("0.4.
|
|
12614
|
+
const resolveSentryEnvironment = () => process.env.SENTRY_ENVIRONMENT || (isDevVersion("0.4.2-dev.727894a") ? "development" : "production");
|
|
12583
12615
|
/**
|
|
12584
12616
|
* Performance-tracing sample rate in `[0, 1]`. Reads `SENTRY_TRACES_SAMPLE_RATE`
|
|
12585
12617
|
* (set to `0` to disable tracing) and falls back to
|
|
@@ -20273,8 +20305,8 @@ const buildChangedFilesDiffInfo = (changedFiles) => ({
|
|
|
20273
20305
|
* `react-doctor.config.json` to `doctor.config.ts` before config is loaded,
|
|
20274
20306
|
* so the scan reads the renamed file and the user is told once. CI, coding
|
|
20275
20307
|
* agents, JSON/score output, pre-commit (`--staged`) hooks, and non-TTY runs
|
|
20276
|
-
* are left untouched — the loader
|
|
20277
|
-
* never mutates the repo unattended.
|
|
20308
|
+
* are left untouched — the loader still reads the legacy file as a deprecated
|
|
20309
|
+
* fallback and warns — so a scan never mutates the repo unattended.
|
|
20278
20310
|
*/
|
|
20279
20311
|
const maybeMigrateLegacyConfig = (requestedDirectory, { isQuiet, isStaged }) => {
|
|
20280
20312
|
if (!(!isQuiet && !isStaged && process.stdout.isTTY === true && !isCiOrCodingAgentEnvironment())) return;
|
|
@@ -20636,13 +20668,27 @@ const resolveRuleConfigTarget = async (projectRoot) => {
|
|
|
20636
20668
|
config: isPlainObject(embedded) ? embedded : {}
|
|
20637
20669
|
};
|
|
20638
20670
|
}
|
|
20639
|
-
if (loaded.format === "json")
|
|
20640
|
-
|
|
20641
|
-
|
|
20642
|
-
|
|
20643
|
-
|
|
20644
|
-
|
|
20645
|
-
|
|
20671
|
+
if (loaded.format === "json") {
|
|
20672
|
+
if (path$1.basename(loaded.configFilePath) === "react-doctor.config.json") {
|
|
20673
|
+
const legacyConfig = readObjectFile(loaded.configFilePath) ?? {};
|
|
20674
|
+
delete legacyConfig.$schema;
|
|
20675
|
+
return {
|
|
20676
|
+
format: "json",
|
|
20677
|
+
filePath: path$1.join(loaded.sourceDirectory, NEW_CONFIG_FILENAME),
|
|
20678
|
+
directory: loaded.sourceDirectory,
|
|
20679
|
+
exists: false,
|
|
20680
|
+
config: legacyConfig,
|
|
20681
|
+
migratedFromFilePath: loaded.configFilePath
|
|
20682
|
+
};
|
|
20683
|
+
}
|
|
20684
|
+
return {
|
|
20685
|
+
format: "json",
|
|
20686
|
+
filePath: loaded.configFilePath,
|
|
20687
|
+
directory: loaded.sourceDirectory,
|
|
20688
|
+
exists: true,
|
|
20689
|
+
config: readObjectFile(loaded.configFilePath) ?? {}
|
|
20690
|
+
};
|
|
20691
|
+
}
|
|
20646
20692
|
return {
|
|
20647
20693
|
format: "module",
|
|
20648
20694
|
filePath: loaded.configFilePath,
|
|
@@ -20721,7 +20767,10 @@ const writeRuleConfig = async (target, nextConfig) => {
|
|
|
20721
20767
|
return { written };
|
|
20722
20768
|
}
|
|
20723
20769
|
if (target.format === "package-json") writePackageJsonConfig(target.filePath, nextConfig);
|
|
20724
|
-
else
|
|
20770
|
+
else {
|
|
20771
|
+
writeJsonConfig(target.filePath, nextConfig);
|
|
20772
|
+
if (target.migratedFromFilePath) fs$1.rmSync(target.migratedFromFilePath, { force: true });
|
|
20773
|
+
}
|
|
20725
20774
|
clearConfigCache();
|
|
20726
20775
|
return { written: true };
|
|
20727
20776
|
};
|
|
@@ -21472,4 +21521,4 @@ Promise.resolve().then(() => assertNoRemovedFlags(process.argv)).then(() => prog
|
|
|
21472
21521
|
export {};
|
|
21473
21522
|
|
|
21474
21523
|
//# sourceMappingURL=cli.js.map
|
|
21475
|
-
//# debugId=
|
|
21524
|
+
//# debugId=1486eaee-ed07-5eef-a9d7-51293140e237
|
package/dist/index.d.ts
CHANGED
|
@@ -942,6 +942,16 @@ declare const filterSourceFiles: (filePaths: string[]) => string[]; //#endregion
|
|
|
942
942
|
declare const summarizeDiagnostics: (diagnostics: Diagnostic[], worstScore?: number | null, worstScoreLabel?: string | null) => JsonReportSummary; //#endregion
|
|
943
943
|
//#region src/validate-config-types.d.ts
|
|
944
944
|
//#endregion
|
|
945
|
+
//#region src/utils/define-config.d.ts
|
|
946
|
+
/**
|
|
947
|
+
* Identity helper for authoring a typed `doctor.config.{ts,js,mjs,cjs}`.
|
|
948
|
+
* Gives editor autocomplete and type-checking for the config object without
|
|
949
|
+
* an explicit `satisfies ReactDoctorConfig` annotation; returns the config
|
|
950
|
+
* untouched so the loader sees the same plain object either way.
|
|
951
|
+
*/
|
|
952
|
+
declare const defineConfig: (config: ReactDoctorConfig) => ReactDoctorConfig; //#endregion
|
|
953
|
+
//#region src/utils/group-by.d.ts
|
|
954
|
+
//#endregion
|
|
945
955
|
//#region ../api/dist/index.d.ts
|
|
946
956
|
//#region src/diagnose.d.ts
|
|
947
957
|
declare const diagnose: (directory: string, options?: DiagnoseOptions) => Promise<DiagnoseResult>;
|
|
@@ -989,5 +999,5 @@ interface ToJsonReportOptions {
|
|
|
989
999
|
}
|
|
990
1000
|
declare const toJsonReport: (result: DiagnoseResult, options: ToJsonReportOptions) => JsonReport;
|
|
991
1001
|
//#endregion
|
|
992
|
-
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, diagnose, filterSourceFiles, getDiffInfo, isProjectDiscoveryError, isReactDoctorError, summarizeDiagnostics, toJsonReport };
|
|
1002
|
+
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 };
|
|
993
1003
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
|
|
2
|
-
!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="
|
|
2
|
+
!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="03c21420-4548-560c-9a26-8c22558218d8")}catch(e){}}();
|
|
3
3
|
import { createRequire } from "node:module";
|
|
4
4
|
import * as Schema from "effect/Schema";
|
|
5
5
|
import * as fs$1 from "node:fs";
|
|
@@ -4604,6 +4604,35 @@ const loadPackageJsonConfig = (directory) => {
|
|
|
4604
4604
|
format: "package-json"
|
|
4605
4605
|
};
|
|
4606
4606
|
};
|
|
4607
|
+
const loadLegacyConfig = (directory) => {
|
|
4608
|
+
const legacyFilePath = path$1.join(directory, LEGACY_CONFIG_FILENAME);
|
|
4609
|
+
if (!isFile(legacyFilePath)) return {
|
|
4610
|
+
status: "absent",
|
|
4611
|
+
loaded: null
|
|
4612
|
+
};
|
|
4613
|
+
try {
|
|
4614
|
+
const parsed = readDataConfig(legacyFilePath);
|
|
4615
|
+
if (isPlainObject(parsed)) {
|
|
4616
|
+
warn(`${LEGACY_CONFIG_FILENAME} is deprecated — rename it to ${CONFIG_BASENAME}.json (or author a ${CONFIG_BASENAME}.ts). It is still read for now.`);
|
|
4617
|
+
return {
|
|
4618
|
+
status: "found",
|
|
4619
|
+
loaded: {
|
|
4620
|
+
config: validateConfigTypes(parsed),
|
|
4621
|
+
sourceDirectory: directory,
|
|
4622
|
+
configFilePath: legacyFilePath,
|
|
4623
|
+
format: "json"
|
|
4624
|
+
}
|
|
4625
|
+
};
|
|
4626
|
+
}
|
|
4627
|
+
warn(`${LEGACY_CONFIG_FILENAME} must contain an object, ignoring.`);
|
|
4628
|
+
} catch (error) {
|
|
4629
|
+
warn(`Failed to load ${LEGACY_CONFIG_FILENAME}: ${formatError(error)}`);
|
|
4630
|
+
}
|
|
4631
|
+
return {
|
|
4632
|
+
status: "invalid",
|
|
4633
|
+
loaded: null
|
|
4634
|
+
};
|
|
4635
|
+
};
|
|
4607
4636
|
const loadConfigFromDirectory = async (directory) => {
|
|
4608
4637
|
let sawBrokenConfigFile = false;
|
|
4609
4638
|
for (const extension of CONFIG_EXTENSIONS) {
|
|
@@ -4633,7 +4662,8 @@ const loadConfigFromDirectory = async (directory) => {
|
|
|
4633
4662
|
status: "found",
|
|
4634
4663
|
loaded: packageJsonConfig
|
|
4635
4664
|
};
|
|
4636
|
-
|
|
4665
|
+
const legacyResult = loadLegacyConfig(directory);
|
|
4666
|
+
if (legacyResult.status !== "absent") return legacyResult;
|
|
4637
4667
|
return {
|
|
4638
4668
|
status: sawBrokenConfigFile ? "invalid" : "absent",
|
|
4639
4669
|
loaded: null
|
|
@@ -8885,6 +8915,13 @@ const filterSourceFiles = (filePaths) => filePaths.filter(isLintableSourceFile);
|
|
|
8885
8915
|
* other `clear*` helpers.
|
|
8886
8916
|
*/
|
|
8887
8917
|
const clearAutoSuppressionCaches = () => {};
|
|
8918
|
+
/**
|
|
8919
|
+
* Identity helper for authoring a typed `doctor.config.{ts,js,mjs,cjs}`.
|
|
8920
|
+
* Gives editor autocomplete and type-checking for the config object without
|
|
8921
|
+
* an explicit `satisfies ReactDoctorConfig` annotation; returns the config
|
|
8922
|
+
* untouched so the loader sees the same plain object either way.
|
|
8923
|
+
*/
|
|
8924
|
+
const defineConfig = (config) => config;
|
|
8888
8925
|
//#endregion
|
|
8889
8926
|
//#region ../api/dist/index.js
|
|
8890
8927
|
const buildDiagnoseLayer = (configLayer = Config.layerNode) => Layer.mergeAll(Project.layerNode, configLayer, DeadCode.layerNode, Files.layerNode, Git.layerNode, Linter.layerOxlint, LintPartialFailures.layerLive, Progress.layerNoop, Reporter.layerNoop, Score.layerHttp);
|
|
@@ -8950,7 +8987,7 @@ const toJsonReport = (result, options) => buildJsonReport({
|
|
|
8950
8987
|
totalElapsedMilliseconds: result.elapsedMilliseconds
|
|
8951
8988
|
});
|
|
8952
8989
|
//#endregion
|
|
8953
|
-
export { AmbiguousProjectError, NoReactDependencyError, NotADirectoryError, PackageJsonNotFoundError, ProjectNotFoundError, ReactDoctorError, buildJsonReport, buildJsonReportError, clearCaches, diagnose, filterSourceFiles, getDiffInfo, isProjectDiscoveryError, isReactDoctorError, summarizeDiagnostics, toJsonReport };
|
|
8990
|
+
export { AmbiguousProjectError, NoReactDependencyError, NotADirectoryError, PackageJsonNotFoundError, ProjectNotFoundError, ReactDoctorError, buildJsonReport, buildJsonReportError, clearCaches, defineConfig, diagnose, filterSourceFiles, getDiffInfo, isProjectDiscoveryError, isReactDoctorError, summarizeDiagnostics, toJsonReport };
|
|
8954
8991
|
|
|
8955
8992
|
//# sourceMappingURL=index.js.map
|
|
8956
|
-
//# debugId=
|
|
8993
|
+
//# debugId=03c21420-4548-560c-9a26-8c22558218d8
|
package/dist/lsp.js
CHANGED
|
@@ -4589,6 +4589,35 @@ const loadPackageJsonConfig = (directory) => {
|
|
|
4589
4589
|
format: "package-json"
|
|
4590
4590
|
};
|
|
4591
4591
|
};
|
|
4592
|
+
const loadLegacyConfig = (directory) => {
|
|
4593
|
+
const legacyFilePath = path$1.join(directory, LEGACY_CONFIG_FILENAME);
|
|
4594
|
+
if (!isFile(legacyFilePath)) return {
|
|
4595
|
+
status: "absent",
|
|
4596
|
+
loaded: null
|
|
4597
|
+
};
|
|
4598
|
+
try {
|
|
4599
|
+
const parsed = readDataConfig(legacyFilePath);
|
|
4600
|
+
if (isPlainObject(parsed)) {
|
|
4601
|
+
warn(`${LEGACY_CONFIG_FILENAME} is deprecated — rename it to ${CONFIG_BASENAME}.json (or author a ${CONFIG_BASENAME}.ts). It is still read for now.`);
|
|
4602
|
+
return {
|
|
4603
|
+
status: "found",
|
|
4604
|
+
loaded: {
|
|
4605
|
+
config: validateConfigTypes(parsed),
|
|
4606
|
+
sourceDirectory: directory,
|
|
4607
|
+
configFilePath: legacyFilePath,
|
|
4608
|
+
format: "json"
|
|
4609
|
+
}
|
|
4610
|
+
};
|
|
4611
|
+
}
|
|
4612
|
+
warn(`${LEGACY_CONFIG_FILENAME} must contain an object, ignoring.`);
|
|
4613
|
+
} catch (error) {
|
|
4614
|
+
warn(`Failed to load ${LEGACY_CONFIG_FILENAME}: ${formatError(error)}`);
|
|
4615
|
+
}
|
|
4616
|
+
return {
|
|
4617
|
+
status: "invalid",
|
|
4618
|
+
loaded: null
|
|
4619
|
+
};
|
|
4620
|
+
};
|
|
4592
4621
|
const loadConfigFromDirectory = async (directory) => {
|
|
4593
4622
|
let sawBrokenConfigFile = false;
|
|
4594
4623
|
for (const extension of CONFIG_EXTENSIONS) {
|
|
@@ -4618,7 +4647,8 @@ const loadConfigFromDirectory = async (directory) => {
|
|
|
4618
4647
|
status: "found",
|
|
4619
4648
|
loaded: packageJsonConfig
|
|
4620
4649
|
};
|
|
4621
|
-
|
|
4650
|
+
const legacyResult = loadLegacyConfig(directory);
|
|
4651
|
+
if (legacyResult.status !== "absent") return legacyResult;
|
|
4622
4652
|
return {
|
|
4623
4653
|
status: sawBrokenConfigFile ? "invalid" : "absent",
|
|
4624
4654
|
loaded: null
|
|
@@ -8736,7 +8766,7 @@ const getRuleMetadata = (plugin, rule) => {
|
|
|
8736
8766
|
/** Display name used in client-facing messages and progress titles. */
|
|
8737
8767
|
const SERVER_DISPLAY_NAME = "React Doctor";
|
|
8738
8768
|
/** Server version reported in `serverInfo`; injected at build, `dev` from source. */
|
|
8739
|
-
const SERVER_VERSION = "0.2
|
|
8769
|
+
const SERVER_VERSION = "0.4.2";
|
|
8740
8770
|
/** `Diagnostic.source` shown next to every published diagnostic. */
|
|
8741
8771
|
const DIAGNOSTIC_SOURCE = "react-doctor";
|
|
8742
8772
|
/**
|
|
@@ -10824,5 +10854,5 @@ const startLanguageServer = () => {
|
|
|
10824
10854
|
};
|
|
10825
10855
|
//#endregion
|
|
10826
10856
|
export { startLanguageServer };
|
|
10827
|
-
!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="
|
|
10828
|
-
//# debugId=
|
|
10857
|
+
!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="5715b6a9-c2ef-594e-8157-9c81132bc7fe")}catch(e){}}();
|
|
10858
|
+
//# debugId=5715b6a9-c2ef-594e-8157-9c81132bc7fe
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "react-doctor",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.2-dev.727894a",
|
|
4
4
|
"description": "Diagnose and fix React codebases for security, performance, correctness, accessibility, bundle-size, and architecture issues",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"accessibility",
|
|
@@ -66,7 +66,7 @@
|
|
|
66
66
|
"vscode-languageserver": "^9.0.1",
|
|
67
67
|
"vscode-languageserver-textdocument": "^1.0.12",
|
|
68
68
|
"vscode-uri": "^3.1.0",
|
|
69
|
-
"oxlint-plugin-react-doctor": "0.4.
|
|
69
|
+
"oxlint-plugin-react-doctor": "0.4.2-dev.727894a"
|
|
70
70
|
},
|
|
71
71
|
"devDependencies": {
|
|
72
72
|
"@types/babel__code-frame": "^7.27.0",
|
|
@@ -74,9 +74,9 @@
|
|
|
74
74
|
"@xterm/headless": "^6.0.0",
|
|
75
75
|
"commander": "^14.0.3",
|
|
76
76
|
"ora": "^9.4.0",
|
|
77
|
-
"@react-doctor/
|
|
78
|
-
"@react-doctor/
|
|
79
|
-
"@react-doctor/language-server": "0.2
|
|
77
|
+
"@react-doctor/core": "0.4.2",
|
|
78
|
+
"@react-doctor/api": "0.4.2",
|
|
79
|
+
"@react-doctor/language-server": "0.4.2"
|
|
80
80
|
},
|
|
81
81
|
"engines": {
|
|
82
82
|
"node": "^20.19.0 || >=22.12.0"
|