react-doctor 0.4.1 → 0.4.2-dev.155cde2

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
@@ -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]="f737dd06-c590-5a34-8fb0-b8aa0278cc0d")}catch(e){}}();
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
- if (isFile(path$1.join(directory, LEGACY_CONFIG_FILENAME))) warn(`${LEGACY_CONFIG_FILENAME} is no longer read — rename it to ${CONFIG_BASENAME}.json (or author a ${CONFIG_BASENAME}.ts).`);
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=f737dd06-c590-5a34-8fb0-b8aa0278cc0d
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
- if (isFile(path$1.join(directory, LEGACY_CONFIG_FILENAME))) warn(`${LEGACY_CONFIG_FILENAME} is no longer read — rename it to ${CONFIG_BASENAME}.json (or author a ${CONFIG_BASENAME}.ts).`);
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.13";
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]="8723a353-8e8c-5ecc-8264-6fbb48af2b40")}catch(e){}}();
10828
- //# debugId=8723a353-8e8c-5ecc-8264-6fbb48af2b40
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,7 +1,7 @@
1
1
  {
2
2
  "name": "react-doctor",
3
- "version": "0.4.1",
4
- "description": "Diagnose and fix React codebases for security, performance, correctness, accessibility, bundle-size, and architecture issues",
3
+ "version": "0.4.2-dev.155cde2",
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": "Aiden Bai",
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.1"
69
+ "oxlint-plugin-react-doctor": "0.4.2-dev.155cde2"
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.21",
78
- "@react-doctor/core": "0.3.1",
79
- "@react-doctor/language-server": "0.2.13"
77
+ "@react-doctor/language-server": "0.4.2",
78
+ "@react-doctor/core": "0.4.2",
79
+ "@react-doctor/api": "0.4.2"
80
80
  },
81
81
  "engines": {
82
82
  "node": "^20.19.0 || >=22.12.0"