react-doctor 0.7.5-dev.22bb155 → 0.7.5-dev.3aef25a

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 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]="72ed96f2-03b8-5285-a0e9-be502d986219")}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]="ae04f94d-a8b9-5f9b-8653-00aca7511b67")}catch(e){}}();
3
3
  import { createRequire } from "node:module";
4
4
  import * as NodeChildProcess from "node:child_process";
5
5
  import { execFile, execFileSync, spawn, spawnSync } from "node:child_process";
@@ -42812,6 +42812,23 @@ const resolveTsConfigRelativePath = (rootDirectory) => {
42812
42812
  for (const filename of TSCONFIG_FILENAMES) if (NFS.existsSync(Path.join(rootDirectory, filename))) return `./${filename}`;
42813
42813
  return null;
42814
42814
  };
42815
+ const DERIVED_STATE_RULE_PRIORITY = new Map([
42816
+ ["no-initialize-state", 0],
42817
+ ["no-adjust-state-on-prop-change", 1],
42818
+ ["no-derived-state", 2],
42819
+ ["no-derived-state-effect", 3]
42820
+ ]);
42821
+ const doDiagnosticSpansOverlap = (first, second) => {
42822
+ if (first.filePath !== second.filePath || first.plugin !== second.plugin) return false;
42823
+ if (first.offset !== void 0 && second.offset !== void 0) {
42824
+ const firstEnd = first.offset + Math.max(first.length ?? 1, 1);
42825
+ const secondEnd = second.offset + Math.max(second.length ?? 1, 1);
42826
+ return first.offset < secondEnd && second.offset < firstEnd;
42827
+ }
42828
+ const firstEndLine = first.endLine ?? first.line;
42829
+ const secondEndLine = second.endLine ?? second.line;
42830
+ return first.line <= secondEndLine && second.line <= firstEndLine;
42831
+ };
42815
42832
  const dedupeDiagnostics = (diagnostics) => {
42816
42833
  const seenKeys = /* @__PURE__ */ new Set();
42817
42834
  const uniqueDiagnostics = [];
@@ -42819,6 +42836,16 @@ const dedupeDiagnostics = (diagnostics) => {
42819
42836
  const key = `${diagnostic.filePath}\u0000${diagnostic.line}\u0000${diagnostic.column}\u0000${diagnostic.plugin}\u0000${diagnostic.rule}\u0000${diagnostic.severity}\u0000${diagnostic.message}`;
42820
42837
  if (seenKeys.has(key)) continue;
42821
42838
  seenKeys.add(key);
42839
+ const priority = DERIVED_STATE_RULE_PRIORITY.get(diagnostic.rule);
42840
+ if (priority !== void 0) {
42841
+ const overlappingDiagnosticIndex = uniqueDiagnostics.findIndex((candidate) => candidate.rule !== diagnostic.rule && candidate.severity === diagnostic.severity && DERIVED_STATE_RULE_PRIORITY.has(candidate.rule) && doDiagnosticSpansOverlap(candidate, diagnostic));
42842
+ if (overlappingDiagnosticIndex >= 0) {
42843
+ const existingDiagnostic = uniqueDiagnostics[overlappingDiagnosticIndex];
42844
+ const existingPriority = existingDiagnostic ? DERIVED_STATE_RULE_PRIORITY.get(existingDiagnostic.rule) : void 0;
42845
+ if (existingPriority !== void 0 && priority < existingPriority) uniqueDiagnostics[overlappingDiagnosticIndex] = diagnostic;
42846
+ continue;
42847
+ }
42848
+ }
42822
42849
  uniqueDiagnostics.push(diagnostic);
42823
42850
  }
42824
42851
  return uniqueDiagnostics;
@@ -46638,7 +46665,7 @@ const makeNoopConsole = () => ({
46638
46665
  });
46639
46666
  //#endregion
46640
46667
  //#region src/cli/utils/version.ts
46641
- const VERSION = "0.7.5-dev.22bb155";
46668
+ const VERSION = "0.7.5-dev.3aef25a";
46642
46669
  //#endregion
46643
46670
  //#region src/cli/utils/json-mode.ts
46644
46671
  let context = null;
@@ -47007,13 +47034,13 @@ const isDevVersion = (version) => version === "0.0.0" || version.includes("-");
47007
47034
  * uploads source-map artifacts under, so stack frames symbolicate. Honors the
47008
47035
  * standard `SENTRY_RELEASE` override.
47009
47036
  */
47010
- const resolveSentryRelease = () => process.env.SENTRY_RELEASE || `react-doctor@0.7.5-dev.22bb155`;
47037
+ const resolveSentryRelease = () => process.env.SENTRY_RELEASE || `react-doctor@0.7.5-dev.3aef25a`;
47011
47038
  /**
47012
47039
  * Deployment environment shown in Sentry's environment filter. Defaults to
47013
47040
  * `production` for tagged releases and `development` for dev/unbuilt versions,
47014
47041
  * overridable via the standard `SENTRY_ENVIRONMENT` env var.
47015
47042
  */
47016
- const resolveSentryEnvironment = () => process.env.SENTRY_ENVIRONMENT || (isDevVersion("0.7.5-dev.22bb155") ? "development" : "production");
47043
+ const resolveSentryEnvironment = () => process.env.SENTRY_ENVIRONMENT || (isDevVersion("0.7.5-dev.3aef25a") ? "development" : "production");
47017
47044
  /**
47018
47045
  * Performance-tracing sample rate in `[0, 1]`. Reads `SENTRY_TRACES_SAMPLE_RATE`
47019
47046
  * (set to `0` to disable tracing) and falls back to
@@ -65202,4 +65229,4 @@ Promise.resolve().then(() => assertNoRemovedFlags(process.argv)).then(() => prog
65202
65229
  export {};
65203
65230
 
65204
65231
  //# sourceMappingURL=cli.js.map
65205
- //# debugId=72ed96f2-03b8-5285-a0e9-be502d986219
65232
+ //# debugId=ae04f94d-a8b9-5f9b-8653-00aca7511b67
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]="6430a76b-a36a-5cf5-9ca0-cc1ca8952f41")}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]="b0ea8023-5fc8-5320-8f5d-c1be54da737e")}catch(e){}}();
3
3
  import { r as __toESM$1, t as __commonJSMin$1 } from "./chunk-N93fKeF6.js";
4
4
  import { createRequire } from "node:module";
5
5
  import reactDoctorPlugin, { ALL_REACT_DOCTOR_RULE_KEYS, CROSS_FILE_DEPENDENCY_COLLECTORS, CROSS_FILE_RULE_IDS, FRAMEWORK_SPECIFIC_RULE_KEYS, FRAMEWORK_TOKENS, MOTION_LIBRARY_PACKAGES, REACT_COMPILER_RULES, REACT_DOCTOR_RULES, classifySecurityScanFile, collectCrossFileDependencyProbes, resetManifestCaches, shouldReadSecurityScanContent } from "oxlint-plugin-react-doctor";
@@ -39569,6 +39569,23 @@ const resolveTsConfigRelativePath = (rootDirectory) => {
39569
39569
  for (const filename of TSCONFIG_FILENAMES) if (NFS.existsSync(Path.join(rootDirectory, filename))) return `./${filename}`;
39570
39570
  return null;
39571
39571
  };
39572
+ const DERIVED_STATE_RULE_PRIORITY = new Map([
39573
+ ["no-initialize-state", 0],
39574
+ ["no-adjust-state-on-prop-change", 1],
39575
+ ["no-derived-state", 2],
39576
+ ["no-derived-state-effect", 3]
39577
+ ]);
39578
+ const doDiagnosticSpansOverlap = (first, second) => {
39579
+ if (first.filePath !== second.filePath || first.plugin !== second.plugin) return false;
39580
+ if (first.offset !== void 0 && second.offset !== void 0) {
39581
+ const firstEnd = first.offset + Math.max(first.length ?? 1, 1);
39582
+ const secondEnd = second.offset + Math.max(second.length ?? 1, 1);
39583
+ return first.offset < secondEnd && second.offset < firstEnd;
39584
+ }
39585
+ const firstEndLine = first.endLine ?? first.line;
39586
+ const secondEndLine = second.endLine ?? second.line;
39587
+ return first.line <= secondEndLine && second.line <= firstEndLine;
39588
+ };
39572
39589
  const dedupeDiagnostics = (diagnostics) => {
39573
39590
  const seenKeys = /* @__PURE__ */ new Set();
39574
39591
  const uniqueDiagnostics = [];
@@ -39576,6 +39593,16 @@ const dedupeDiagnostics = (diagnostics) => {
39576
39593
  const key = `${diagnostic.filePath}\u0000${diagnostic.line}\u0000${diagnostic.column}\u0000${diagnostic.plugin}\u0000${diagnostic.rule}\u0000${diagnostic.severity}\u0000${diagnostic.message}`;
39577
39594
  if (seenKeys.has(key)) continue;
39578
39595
  seenKeys.add(key);
39596
+ const priority = DERIVED_STATE_RULE_PRIORITY.get(diagnostic.rule);
39597
+ if (priority !== void 0) {
39598
+ const overlappingDiagnosticIndex = uniqueDiagnostics.findIndex((candidate) => candidate.rule !== diagnostic.rule && candidate.severity === diagnostic.severity && DERIVED_STATE_RULE_PRIORITY.has(candidate.rule) && doDiagnosticSpansOverlap(candidate, diagnostic));
39599
+ if (overlappingDiagnosticIndex >= 0) {
39600
+ const existingDiagnostic = uniqueDiagnostics[overlappingDiagnosticIndex];
39601
+ const existingPriority = existingDiagnostic ? DERIVED_STATE_RULE_PRIORITY.get(existingDiagnostic.rule) : void 0;
39602
+ if (existingPriority !== void 0 && priority < existingPriority) uniqueDiagnostics[overlappingDiagnosticIndex] = diagnostic;
39603
+ continue;
39604
+ }
39605
+ }
39579
39606
  uniqueDiagnostics.push(diagnostic);
39580
39607
  }
39581
39608
  return uniqueDiagnostics;
@@ -43181,4 +43208,4 @@ const toJsonReport = (result, options) => buildJsonReport({
43181
43208
  export { AmbiguousProjectError, NoReactDependencyError, NotADirectoryError, PackageJsonNotFoundError, ProjectNotFoundError, ReactDoctorError, buildJsonReport, buildJsonReportError, clearCaches, defineConfig, diagnose, filterSourceFiles, getDiffInfo, hasReactRuntime, isProjectDiscoveryError, isReactDoctorError, summarizeDiagnostics, toJsonReport };
43182
43209
 
43183
43210
  //# sourceMappingURL=index.js.map
43184
- //# debugId=6430a76b-a36a-5cf5-9ca0-cc1ca8952f41
43211
+ //# debugId=b0ea8023-5fc8-5320-8f5d-c1be54da737e
package/dist/lsp.js CHANGED
@@ -39547,6 +39547,23 @@ const resolveTsConfigRelativePath = (rootDirectory) => {
39547
39547
  for (const filename of TSCONFIG_FILENAMES) if (NFS.existsSync(Path.join(rootDirectory, filename))) return `./${filename}`;
39548
39548
  return null;
39549
39549
  };
39550
+ const DERIVED_STATE_RULE_PRIORITY = new Map([
39551
+ ["no-initialize-state", 0],
39552
+ ["no-adjust-state-on-prop-change", 1],
39553
+ ["no-derived-state", 2],
39554
+ ["no-derived-state-effect", 3]
39555
+ ]);
39556
+ const doDiagnosticSpansOverlap = (first, second) => {
39557
+ if (first.filePath !== second.filePath || first.plugin !== second.plugin) return false;
39558
+ if (first.offset !== void 0 && second.offset !== void 0) {
39559
+ const firstEnd = first.offset + Math.max(first.length ?? 1, 1);
39560
+ const secondEnd = second.offset + Math.max(second.length ?? 1, 1);
39561
+ return first.offset < secondEnd && second.offset < firstEnd;
39562
+ }
39563
+ const firstEndLine = first.endLine ?? first.line;
39564
+ const secondEndLine = second.endLine ?? second.line;
39565
+ return first.line <= secondEndLine && second.line <= firstEndLine;
39566
+ };
39550
39567
  const dedupeDiagnostics = (diagnostics) => {
39551
39568
  const seenKeys = /* @__PURE__ */ new Set();
39552
39569
  const uniqueDiagnostics = [];
@@ -39554,6 +39571,16 @@ const dedupeDiagnostics = (diagnostics) => {
39554
39571
  const key = `${diagnostic.filePath}\u0000${diagnostic.line}\u0000${diagnostic.column}\u0000${diagnostic.plugin}\u0000${diagnostic.rule}\u0000${diagnostic.severity}\u0000${diagnostic.message}`;
39555
39572
  if (seenKeys.has(key)) continue;
39556
39573
  seenKeys.add(key);
39574
+ const priority = DERIVED_STATE_RULE_PRIORITY.get(diagnostic.rule);
39575
+ if (priority !== void 0) {
39576
+ const overlappingDiagnosticIndex = uniqueDiagnostics.findIndex((candidate) => candidate.rule !== diagnostic.rule && candidate.severity === diagnostic.severity && DERIVED_STATE_RULE_PRIORITY.has(candidate.rule) && doDiagnosticSpansOverlap(candidate, diagnostic));
39577
+ if (overlappingDiagnosticIndex >= 0) {
39578
+ const existingDiagnostic = uniqueDiagnostics[overlappingDiagnosticIndex];
39579
+ const existingPriority = existingDiagnostic ? DERIVED_STATE_RULE_PRIORITY.get(existingDiagnostic.rule) : void 0;
39580
+ if (existingPriority !== void 0 && priority < existingPriority) uniqueDiagnostics[overlappingDiagnosticIndex] = diagnostic;
39581
+ continue;
39582
+ }
39583
+ }
39557
39584
  uniqueDiagnostics.push(diagnostic);
39558
39585
  }
39559
39586
  return uniqueDiagnostics;
@@ -44825,5 +44852,5 @@ const startLanguageServer = () => {
44825
44852
  };
44826
44853
  //#endregion
44827
44854
  export { startLanguageServer };
44828
- !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]="7af68c1a-91df-56eb-982a-161195d345fc")}catch(e){}}();
44829
- //# debugId=7af68c1a-91df-56eb-982a-161195d345fc
44855
+ !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]="80aebdc6-08f5-57d2-81df-db47e00fbfaf")}catch(e){}}();
44856
+ //# debugId=80aebdc6-08f5-57d2-81df-db47e00fbfaf
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-doctor",
3
- "version": "0.7.5-dev.22bb155",
3
+ "version": "0.7.5-dev.3aef25a",
4
4
  "description": "Your agent writes bad React. This catches it",
5
5
  "keywords": [
6
6
  "accessibility",
@@ -65,8 +65,8 @@
65
65
  "vscode-languageserver-textdocument": "^1.0.12",
66
66
  "vscode-uri": "^3.1.0",
67
67
  "yaml": "^2.9.0",
68
- "oxlint-plugin-react-doctor": "0.7.5-dev.22bb155",
69
- "deslop-js": "0.7.5"
68
+ "deslop-js": "0.7.5",
69
+ "oxlint-plugin-react-doctor": "0.7.5-dev.3aef25a"
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.7.5",
77
78
  "@react-doctor/core": "0.7.5",
78
- "@react-doctor/language-server": "0.7.5",
79
- "@react-doctor/api": "0.7.5"
79
+ "@react-doctor/language-server": "0.7.5"
80
80
  },
81
81
  "engines": {
82
82
  "node": "^20.19.0 || >=22.13.0"