react-doctor 0.4.1 → 0.4.2-dev.25cc69b
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/LICENSE +1 -1
- package/README.md +6 -74
- package/dist/cli.js +1414 -1294
- package/dist/index.d.ts +11 -1
- package/dist/index.js +41 -4
- package/dist/lsp.js +34 -4
- package/dist/skills/react-doctor/SKILL.md +2 -2
- package/dist/skills/{doctor-explain/SKILL.md → react-doctor/references/explain.md} +6 -9
- package/package.json +7 -7
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]="9c92e27f-f5cc-5567-8d2c-50a861beaec5")}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=9c92e27f-f5cc-5567-8d2c-50a861beaec5
|
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
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: react-doctor
|
|
3
3
|
description: Use when finishing a feature, fixing a bug, before committing React code, or when the user types `/doctor`, asks to scan, triage, or clean up React diagnostics. Covers lint, accessibility, bundle size, architecture. Includes a regression check and a full local-triage workflow that fetches the canonical playbook.
|
|
4
|
-
version: "1.
|
|
4
|
+
version: "1.2.0"
|
|
5
5
|
---
|
|
6
6
|
|
|
7
7
|
# React Doctor
|
|
@@ -34,7 +34,7 @@ Pair it with the matching per-rule prompts at `https://www.react.doctor/prompts/
|
|
|
34
34
|
|
|
35
35
|
## Configuring or explaining rules
|
|
36
36
|
|
|
37
|
-
When the user wants to understand a rule, disagrees with one, or wants to disable / tune which rules run (not fix code),
|
|
37
|
+
When the user wants to understand a rule, disagrees with one, or wants to disable / tune which rules run (not fix code), read [references/explain.md](references/explain.md) and follow it. Start with `npx react-doctor@latest rules explain <rule>`, then apply the narrowest control via `npx react-doctor@latest rules disable|set|category|ignore-tag …`, which edits your `doctor.config.*` (or `package.json#reactDoctor`).
|
|
38
38
|
|
|
39
39
|
## Command
|
|
40
40
|
|
|
@@ -1,14 +1,11 @@
|
|
|
1
|
-
|
|
2
|
-
name: doctor-explain
|
|
3
|
-
description: Explain React Doctor rules and configure which ones run via doctor.config.* (or package.json#reactDoctor). Use when the user types `/doctor-explain` or `/doctor-config`, asks why a rule fired, disagrees with a rule, wants to disable/enable a rule, silence a category or tag, tune CI/PR noise, or asks "what does this rule mean". Covers the `react-doctor rules` CLI (list, explain, set, enable, disable, category, ignore-tag) and how config layers combine: ignore.tags disables matching rules before linting, rules over categories sets severity, surfaces controls visibility only.
|
|
4
|
-
version: "1.0.0"
|
|
5
|
-
---
|
|
1
|
+
# Explaining and configuring rules
|
|
6
2
|
|
|
7
|
-
|
|
3
|
+
Explain React Doctor rules and edit `doctor.config.*` safely. Use this when a user
|
|
4
|
+
wants to understand a rule or change which rules run — not for fixing diagnostics
|
|
5
|
+
(that is the main `react-doctor` skill / `/doctor`).
|
|
8
6
|
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
Triggers: `/doctor-explain`, `/doctor-config`, "why did this rule fire", "I disagree with this rule", "turn this rule off", "stop flagging X", "too noisy", "disable design rules".
|
|
7
|
+
Triggers: "why did this rule fire", "I disagree with this rule", "turn this rule off",
|
|
8
|
+
"stop flagging X", "too noisy", "disable design rules".
|
|
12
9
|
|
|
13
10
|
## Workflow
|
|
14
11
|
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "react-doctor",
|
|
3
|
-
"version": "0.4.
|
|
4
|
-
"description": "
|
|
3
|
+
"version": "0.4.2-dev.25cc69b",
|
|
4
|
+
"description": "Your agent writes bad React. This catches it",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"accessibility",
|
|
7
7
|
"diagnostics",
|
|
@@ -21,7 +21,7 @@
|
|
|
21
21
|
"url": "https://github.com/millionco/react-doctor/issues"
|
|
22
22
|
},
|
|
23
23
|
"license": "MIT",
|
|
24
|
-
"author": "
|
|
24
|
+
"author": "Million Software, Inc",
|
|
25
25
|
"repository": {
|
|
26
26
|
"type": "git",
|
|
27
27
|
"url": "https://github.com/millionco/react-doctor.git",
|
|
@@ -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.25cc69b"
|
|
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/api": "0.2
|
|
78
|
-
"@react-doctor/core": "0.
|
|
79
|
-
"@react-doctor/language-server": "0.2
|
|
77
|
+
"@react-doctor/api": "0.4.2",
|
|
78
|
+
"@react-doctor/core": "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"
|