react-doctor 0.2.14-dev.9b64d98 → 0.2.14-dev.fe01e57

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.
@@ -5909,6 +5909,149 @@ const appendReanimatedSharedValueHint = (help, rule, project) => {
5909
5909
  if (!help) return REANIMATED_SHARED_VALUE_HINT;
5910
5910
  return `${help}\n\n${REANIMATED_SHARED_VALUE_HINT}`;
5911
5911
  };
5912
+ const REDACTED_PLACEHOLDER = "<redacted>";
5913
+ const KEEP_PREFIX = `$1${REDACTED_PLACEHOLDER}`;
5914
+ const KNOWN_SECRET_RULES = [
5915
+ {
5916
+ pattern: /-----BEGIN [A-Z ]*PRIVATE KEY-----[\s\S]*?-----END [A-Z ]*PRIVATE KEY-----/g,
5917
+ replacement: REDACTED_PLACEHOLDER
5918
+ },
5919
+ {
5920
+ pattern: /\beyJ[A-Za-z0-9_-]{8,}\.[A-Za-z0-9_-]{8,}\.[A-Za-z0-9_-]{8,}/g,
5921
+ replacement: REDACTED_PLACEHOLDER
5922
+ },
5923
+ {
5924
+ pattern: /(?<=:\/\/)[^\s/:@]+:[^\s/@]+(?=@)/g,
5925
+ replacement: REDACTED_PLACEHOLDER
5926
+ },
5927
+ {
5928
+ pattern: /\b(AKIA|AGPA|AIDA|AROA|AIPA|ANPA|ANVA|ASIA|A3T[A-Z0-9])[0-9A-Z]{16,}/g,
5929
+ replacement: KEEP_PREFIX
5930
+ },
5931
+ {
5932
+ pattern: /\b(gh[pousr]_)[A-Za-z0-9]{36,}/g,
5933
+ replacement: KEEP_PREFIX
5934
+ },
5935
+ {
5936
+ pattern: /\b(github_pat_)[A-Za-z0-9_]{22,}/g,
5937
+ replacement: KEEP_PREFIX
5938
+ },
5939
+ {
5940
+ pattern: /\b(glpat-)[A-Za-z0-9_-]{20,}/g,
5941
+ replacement: KEEP_PREFIX
5942
+ },
5943
+ {
5944
+ pattern: /\b(xox[baprs]-)[A-Za-z0-9-]{10,}/g,
5945
+ replacement: KEEP_PREFIX
5946
+ },
5947
+ {
5948
+ pattern: /(?<=hooks\.slack\.com\/services\/)[A-Za-z0-9/+_-]{20,}/g,
5949
+ replacement: REDACTED_PLACEHOLDER
5950
+ },
5951
+ {
5952
+ pattern: /\b((?:sk|rk)_(?:live|test)_)[0-9A-Za-z]{10,}/g,
5953
+ replacement: KEEP_PREFIX
5954
+ },
5955
+ {
5956
+ pattern: /\b(sk-(?:proj-|ant-)?)[A-Za-z0-9_-]{20,}/g,
5957
+ replacement: KEEP_PREFIX
5958
+ },
5959
+ {
5960
+ pattern: /\b(AIza)[0-9A-Za-z_-]{35,}/g,
5961
+ replacement: KEEP_PREFIX
5962
+ },
5963
+ {
5964
+ pattern: /\b(ya29\.)[0-9A-Za-z_-]{20,}/g,
5965
+ replacement: KEEP_PREFIX
5966
+ },
5967
+ {
5968
+ pattern: /\b(npm_)[A-Za-z0-9]{36,}/g,
5969
+ replacement: KEEP_PREFIX
5970
+ },
5971
+ {
5972
+ pattern: /\b(SG\.)[A-Za-z0-9_-]{22,}\.[A-Za-z0-9_-]{43,}/g,
5973
+ replacement: KEEP_PREFIX
5974
+ },
5975
+ {
5976
+ pattern: /\b(SK)[0-9a-fA-F]{32,}/g,
5977
+ replacement: KEEP_PREFIX
5978
+ },
5979
+ {
5980
+ pattern: /\b(dop_v1_)[a-f0-9]{64,}/g,
5981
+ replacement: KEEP_PREFIX
5982
+ },
5983
+ {
5984
+ pattern: /\b(shp(?:at|ca|pa|ss)_)[a-fA-F0-9]{32,}/g,
5985
+ replacement: KEEP_PREFIX
5986
+ },
5987
+ {
5988
+ pattern: /\b(sq0[a-z]{3}-)[0-9A-Za-z_-]{22,}/g,
5989
+ replacement: KEEP_PREFIX
5990
+ },
5991
+ {
5992
+ pattern: /\b([0-9]{8,10}:AA)[0-9A-Za-z_-]{32,}/g,
5993
+ replacement: KEEP_PREFIX
5994
+ },
5995
+ {
5996
+ pattern: /(?<=\bBearer\s)[A-Za-z0-9._~+/=-]{16,}/g,
5997
+ replacement: REDACTED_PLACEHOLDER
5998
+ },
5999
+ {
6000
+ pattern: /\b[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,}\b/g,
6001
+ replacement: REDACTED_PLACEHOLDER
6002
+ }
6003
+ ];
6004
+ const CANDIDATE_TOKEN_PATTERN = /[A-Za-z0-9_][A-Za-z0-9_-]*/g;
6005
+ const GIT_OBJECT_ID_PATTERN = /^(?:[0-9a-f]{40}|[0-9a-f]{64})$/;
6006
+ const UUID_PATTERN = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;
6007
+ const HAS_LETTER_PATTERN = /[A-Za-z]/;
6008
+ const HAS_DIGIT_PATTERN = /[0-9]/;
6009
+ const shannonEntropyBits = (value) => {
6010
+ const counts = /* @__PURE__ */ new Map();
6011
+ for (const char of value) counts.set(char, (counts.get(char) ?? 0) + 1);
6012
+ let bits = 0;
6013
+ for (const count of counts.values()) {
6014
+ const probability = count / value.length;
6015
+ bits -= probability * Math.log2(probability);
6016
+ }
6017
+ return bits;
6018
+ };
6019
+ const looksLikeHighEntropySecret = (token) => {
6020
+ if (token.length < 32) return false;
6021
+ if (!HAS_LETTER_PATTERN.test(token) || !HAS_DIGIT_PATTERN.test(token)) return false;
6022
+ if (GIT_OBJECT_ID_PATTERN.test(token) || UUID_PATTERN.test(token)) return false;
6023
+ return shannonEntropyBits(token) >= 3;
6024
+ };
6025
+ const redactHighEntropyTokens = (text) => text.replace(CANDIDATE_TOKEN_PATTERN, (token) => looksLikeHighEntropySecret(token) ? REDACTED_PLACEHOLDER : token);
6026
+ /**
6027
+ * Masks API keys, tokens, private keys, credentialed URLs, and emails
6028
+ * found anywhere inside a free-text string, returning the scrubbed text.
6029
+ * Applied to every diagnostic's `message` / `help` at construction time
6030
+ * so secrets never reach the terminal, the JSON report, or the score
6031
+ * API — react-doctor must never echo or transmit a user's secrets.
6032
+ *
6033
+ * Provider tokens keep their non-secret, type-identifying prefix (e.g.
6034
+ * `sk_live_<redacted>`, `ghp_<redacted>`, `AKIA<redacted>`) so the leaked
6035
+ * credential's type stays visible; structural or unknown-format secrets
6036
+ * with no meaningful prefix are masked whole.
6037
+ *
6038
+ * Runs the high-precision known-shape detectors first, then a generic
6039
+ * entropy-gated sweep for unknown-format secrets. Idempotent: the inert
6040
+ * `<redacted>` placeholder matches none of the detectors and is too
6041
+ * short for the generic sweep, so re-running leaves the text unchanged.
6042
+ *
6043
+ * Accepts `unknown` on purpose: callers feed it diagnostic `message` /
6044
+ * `help` that originate from oxlint JSON, which is only shape-checked at
6045
+ * the top level (the per-field `string` types are assumed, not validated).
6046
+ * A malformed non-string value returns `""` instead of throwing on
6047
+ * `.replace`, so one bad diagnostic can't abort parsing the whole batch.
6048
+ */
6049
+ const redactSensitiveText = (text) => {
6050
+ if (typeof text !== "string" || text === "") return "";
6051
+ let redacted = text;
6052
+ for (const rule of KNOWN_SECRET_RULES) redacted = redacted.replace(rule.pattern, rule.replacement);
6053
+ return redactHighEntropyTokens(redacted);
6054
+ };
5912
6055
  const REACT_MODULE_SOURCE = "react";
5913
6056
  const REQUIRE_IDENTIFIER = "require";
5914
6057
  const USE_IDENTIFIER = "use";
@@ -6230,6 +6373,13 @@ const getRuleRecommendation = (ruleName, project) => {
6230
6373
  };
6231
6374
  const getRuleCategory = (ruleName) => reactDoctorPlugin.rules[ruleName]?.category;
6232
6375
  const cleanDiagnosticMessage = (message, help, plugin, rule, project) => {
6376
+ const cleaned = resolveCleanedDiagnostic(typeof message === "string" ? message : "", typeof help === "string" ? help : "", plugin, rule, project);
6377
+ return {
6378
+ message: redactSensitiveText(cleaned.message),
6379
+ help: redactSensitiveText(cleaned.help)
6380
+ };
6381
+ };
6382
+ const resolveCleanedDiagnostic = (message, help, plugin, rule, project) => {
6233
6383
  if (plugin === "react-hooks-js") return {
6234
6384
  message: REACT_COMPILER_MESSAGE,
6235
6385
  help: appendReanimatedSharedValueHint(message.replace(FILEPATH_WITH_LOCATION_PATTERN, "").trim() || help, rule, project)
@@ -6434,11 +6584,14 @@ const spawnLintBatches = async (input) => {
6434
6584
  onFileProgress(scannedFileCount + batchFileIndex, totalFileCount);
6435
6585
  }
6436
6586
  }, 50) : null;
6437
- const batchDiagnostics = await spawnLintBatch(batch);
6438
- if (progressInterval !== null) clearInterval(progressInterval);
6439
- allDiagnostics.push(...batchDiagnostics);
6440
- scannedFileCount += batch.length;
6441
- onFileProgress?.(scannedFileCount, totalFileCount);
6587
+ try {
6588
+ const batchDiagnostics = await spawnLintBatch(batch);
6589
+ allDiagnostics.push(...batchDiagnostics);
6590
+ scannedFileCount += batch.length;
6591
+ onFileProgress?.(scannedFileCount, totalFileCount);
6592
+ } finally {
6593
+ if (progressInterval !== null) clearInterval(progressInterval);
6594
+ }
6442
6595
  }
6443
6596
  if (droppedFiles.length > 0 && onPartialFailure) {
6444
6597
  const previewFiles = droppedFiles.slice(0, 3).join(", ");
@@ -7561,4 +7714,4 @@ const cliLogger = {
7561
7714
  //#endregion
7562
7715
  export { isMonorepoRoot as A, filterDiagnosticsForSurface as C, getDiffInfo as D, formatReactDoctorError as E, restoreLegacyThrow as F, runInspect as I, toRelativePath as L, layerOtlp as M, listWorkspacePackages as N, groupBy as O, resolveScanTarget as P, discoverReactSubprojects as S, formatErrorChain as T, Score as _, DeadCode as a, buildJsonReportError as b, LintPartialFailures as c, OXLINT_NODE_REQUIREMENT as d, Progress as f, SKILL_NAME as g, SHARE_BASE_URL as h, Config as i, isReactDoctorError as j, highlighter as k, Linter as l, Reporter as m, cli_logger_exports as n, Files as o, Project as p, CANONICAL_GITHUB_URL as r, Git as s, cliLogger as t, NodeResolver as u, StagedFiles as v, filterSourceFiles as w, buildRulePromptUrl as x, buildJsonReport as y };
7563
7716
 
7564
- //# sourceMappingURL=cli-logger-CSZagq1E.js.map
7717
+ //# sourceMappingURL=cli-logger-CgcUrJb_.js.map
package/dist/cli.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import { i as __toESM, n as __exportAll, r as __require, t as __commonJSMin } from "./rolldown-runtime-uZX_iqCz.js";
2
- import { A as isMonorepoRoot, C as filterDiagnosticsForSurface, D as getDiffInfo, E as formatReactDoctorError, F as restoreLegacyThrow, I as runInspect, L as toRelativePath, M as layerOtlp, N as listWorkspacePackages, O as groupBy, P as resolveScanTarget, S as discoverReactSubprojects, T as formatErrorChain, _ as Score, a as DeadCode, b as buildJsonReportError, c as LintPartialFailures, d as OXLINT_NODE_REQUIREMENT, f as Progress, g as SKILL_NAME, h as SHARE_BASE_URL, i as Config, j as isReactDoctorError, k as highlighter, l as Linter, m as Reporter, o as Files, p as Project, r as CANONICAL_GITHUB_URL, s as Git, t as cliLogger, u as NodeResolver, v as StagedFiles, w as filterSourceFiles, x as buildRulePromptUrl, y as buildJsonReport } from "./cli-logger-CSZagq1E.js";
2
+ import { A as isMonorepoRoot, C as filterDiagnosticsForSurface, D as getDiffInfo, E as formatReactDoctorError, F as restoreLegacyThrow, I as runInspect, L as toRelativePath, M as layerOtlp, N as listWorkspacePackages, O as groupBy, P as resolveScanTarget, S as discoverReactSubprojects, T as formatErrorChain, _ as Score, a as DeadCode, b as buildJsonReportError, c as LintPartialFailures, d as OXLINT_NODE_REQUIREMENT, f as Progress, g as SKILL_NAME, h as SHARE_BASE_URL, i as Config, j as isReactDoctorError, k as highlighter, l as Linter, m as Reporter, o as Files, p as Project, r as CANONICAL_GITHUB_URL, s as Git, t as cliLogger, u as NodeResolver, v as StagedFiles, w as filterSourceFiles, x as buildRulePromptUrl, y as buildJsonReport } from "./cli-logger-CgcUrJb_.js";
3
3
  import { createRequire } from "node:module";
4
4
  import { execFileSync, execSync } from "node:child_process";
5
5
  import path, { join } from "node:path";
@@ -6680,7 +6680,7 @@ const resolveOxlintNodeEffect = (isLintEnabled, isQuiet) => Effect.gen(function*
6680
6680
  const resolveOxlintNode = (isLintEnabled, isQuiet) => Effect.runPromise(resolveOxlintNodeEffect(isLintEnabled, isQuiet).pipe(Effect.provide(NodeResolver.layerNode)));
6681
6681
  //#endregion
6682
6682
  //#region src/cli/utils/version.ts
6683
- const VERSION = "0.2.14-dev.9b64d98";
6683
+ const VERSION = "0.2.14-dev.fe01e57";
6684
6684
  //#endregion
6685
6685
  //#region src/inspect.ts
6686
6686
  const silentConsole = makeNoopConsole();
@@ -7501,7 +7501,7 @@ const warnSetupPromptFailure = async (options, error) => {
7501
7501
  return;
7502
7502
  }
7503
7503
  try {
7504
- const { cliLogger } = await import("./cli-logger-CSZagq1E.js").then((n) => n.n);
7504
+ const { cliLogger } = await import("./cli-logger-CgcUrJb_.js").then((n) => n.n);
7505
7505
  cliLogger.warn(message);
7506
7506
  } catch {}
7507
7507
  };
package/dist/index.d.ts CHANGED
@@ -20,9 +20,9 @@ interface ReactDoctorIgnoreConfig {
20
20
  * locally but excluded from PR comments, the score, or the CI gate:
21
21
  *
22
22
  * - `cli` — local terminal output from `react-doctor` (`printDiagnostics`).
23
- * - `prComment` — output captured by the GitHub Action for the sticky
24
- * PR comment. Enabled when the CLI is run with `--pr-comment` (the
25
- * action sets this automatically when `github-token` is provided).
23
+ * - `prComment` — diagnostics destined for a sticky pull-request
24
+ * summary comment. Selected by running the CLI with `--pr-comment`
25
+ * (sets `outputSurface: "prComment"`).
26
26
  * - `score` — diagnostics shipped to the React Doctor score API
27
27
  * (or counted toward local score calculations).
28
28
  * - `ciFailure` — diagnostics that count toward the `--fail-on` exit
package/dist/index.js CHANGED
@@ -5939,6 +5939,149 @@ const appendReanimatedSharedValueHint = (help, rule, project) => {
5939
5939
  if (!help) return REANIMATED_SHARED_VALUE_HINT;
5940
5940
  return `${help}\n\n${REANIMATED_SHARED_VALUE_HINT}`;
5941
5941
  };
5942
+ const REDACTED_PLACEHOLDER = "<redacted>";
5943
+ const KEEP_PREFIX = `$1${REDACTED_PLACEHOLDER}`;
5944
+ const KNOWN_SECRET_RULES = [
5945
+ {
5946
+ pattern: /-----BEGIN [A-Z ]*PRIVATE KEY-----[\s\S]*?-----END [A-Z ]*PRIVATE KEY-----/g,
5947
+ replacement: REDACTED_PLACEHOLDER
5948
+ },
5949
+ {
5950
+ pattern: /\beyJ[A-Za-z0-9_-]{8,}\.[A-Za-z0-9_-]{8,}\.[A-Za-z0-9_-]{8,}/g,
5951
+ replacement: REDACTED_PLACEHOLDER
5952
+ },
5953
+ {
5954
+ pattern: /(?<=:\/\/)[^\s/:@]+:[^\s/@]+(?=@)/g,
5955
+ replacement: REDACTED_PLACEHOLDER
5956
+ },
5957
+ {
5958
+ pattern: /\b(AKIA|AGPA|AIDA|AROA|AIPA|ANPA|ANVA|ASIA|A3T[A-Z0-9])[0-9A-Z]{16,}/g,
5959
+ replacement: KEEP_PREFIX
5960
+ },
5961
+ {
5962
+ pattern: /\b(gh[pousr]_)[A-Za-z0-9]{36,}/g,
5963
+ replacement: KEEP_PREFIX
5964
+ },
5965
+ {
5966
+ pattern: /\b(github_pat_)[A-Za-z0-9_]{22,}/g,
5967
+ replacement: KEEP_PREFIX
5968
+ },
5969
+ {
5970
+ pattern: /\b(glpat-)[A-Za-z0-9_-]{20,}/g,
5971
+ replacement: KEEP_PREFIX
5972
+ },
5973
+ {
5974
+ pattern: /\b(xox[baprs]-)[A-Za-z0-9-]{10,}/g,
5975
+ replacement: KEEP_PREFIX
5976
+ },
5977
+ {
5978
+ pattern: /(?<=hooks\.slack\.com\/services\/)[A-Za-z0-9/+_-]{20,}/g,
5979
+ replacement: REDACTED_PLACEHOLDER
5980
+ },
5981
+ {
5982
+ pattern: /\b((?:sk|rk)_(?:live|test)_)[0-9A-Za-z]{10,}/g,
5983
+ replacement: KEEP_PREFIX
5984
+ },
5985
+ {
5986
+ pattern: /\b(sk-(?:proj-|ant-)?)[A-Za-z0-9_-]{20,}/g,
5987
+ replacement: KEEP_PREFIX
5988
+ },
5989
+ {
5990
+ pattern: /\b(AIza)[0-9A-Za-z_-]{35,}/g,
5991
+ replacement: KEEP_PREFIX
5992
+ },
5993
+ {
5994
+ pattern: /\b(ya29\.)[0-9A-Za-z_-]{20,}/g,
5995
+ replacement: KEEP_PREFIX
5996
+ },
5997
+ {
5998
+ pattern: /\b(npm_)[A-Za-z0-9]{36,}/g,
5999
+ replacement: KEEP_PREFIX
6000
+ },
6001
+ {
6002
+ pattern: /\b(SG\.)[A-Za-z0-9_-]{22,}\.[A-Za-z0-9_-]{43,}/g,
6003
+ replacement: KEEP_PREFIX
6004
+ },
6005
+ {
6006
+ pattern: /\b(SK)[0-9a-fA-F]{32,}/g,
6007
+ replacement: KEEP_PREFIX
6008
+ },
6009
+ {
6010
+ pattern: /\b(dop_v1_)[a-f0-9]{64,}/g,
6011
+ replacement: KEEP_PREFIX
6012
+ },
6013
+ {
6014
+ pattern: /\b(shp(?:at|ca|pa|ss)_)[a-fA-F0-9]{32,}/g,
6015
+ replacement: KEEP_PREFIX
6016
+ },
6017
+ {
6018
+ pattern: /\b(sq0[a-z]{3}-)[0-9A-Za-z_-]{22,}/g,
6019
+ replacement: KEEP_PREFIX
6020
+ },
6021
+ {
6022
+ pattern: /\b([0-9]{8,10}:AA)[0-9A-Za-z_-]{32,}/g,
6023
+ replacement: KEEP_PREFIX
6024
+ },
6025
+ {
6026
+ pattern: /(?<=\bBearer\s)[A-Za-z0-9._~+/=-]{16,}/g,
6027
+ replacement: REDACTED_PLACEHOLDER
6028
+ },
6029
+ {
6030
+ pattern: /\b[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,}\b/g,
6031
+ replacement: REDACTED_PLACEHOLDER
6032
+ }
6033
+ ];
6034
+ const CANDIDATE_TOKEN_PATTERN = /[A-Za-z0-9_][A-Za-z0-9_-]*/g;
6035
+ const GIT_OBJECT_ID_PATTERN = /^(?:[0-9a-f]{40}|[0-9a-f]{64})$/;
6036
+ const UUID_PATTERN = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;
6037
+ const HAS_LETTER_PATTERN = /[A-Za-z]/;
6038
+ const HAS_DIGIT_PATTERN = /[0-9]/;
6039
+ const shannonEntropyBits = (value) => {
6040
+ const counts = /* @__PURE__ */ new Map();
6041
+ for (const char of value) counts.set(char, (counts.get(char) ?? 0) + 1);
6042
+ let bits = 0;
6043
+ for (const count of counts.values()) {
6044
+ const probability = count / value.length;
6045
+ bits -= probability * Math.log2(probability);
6046
+ }
6047
+ return bits;
6048
+ };
6049
+ const looksLikeHighEntropySecret = (token) => {
6050
+ if (token.length < 32) return false;
6051
+ if (!HAS_LETTER_PATTERN.test(token) || !HAS_DIGIT_PATTERN.test(token)) return false;
6052
+ if (GIT_OBJECT_ID_PATTERN.test(token) || UUID_PATTERN.test(token)) return false;
6053
+ return shannonEntropyBits(token) >= 3;
6054
+ };
6055
+ const redactHighEntropyTokens = (text) => text.replace(CANDIDATE_TOKEN_PATTERN, (token) => looksLikeHighEntropySecret(token) ? REDACTED_PLACEHOLDER : token);
6056
+ /**
6057
+ * Masks API keys, tokens, private keys, credentialed URLs, and emails
6058
+ * found anywhere inside a free-text string, returning the scrubbed text.
6059
+ * Applied to every diagnostic's `message` / `help` at construction time
6060
+ * so secrets never reach the terminal, the JSON report, or the score
6061
+ * API — react-doctor must never echo or transmit a user's secrets.
6062
+ *
6063
+ * Provider tokens keep their non-secret, type-identifying prefix (e.g.
6064
+ * `sk_live_<redacted>`, `ghp_<redacted>`, `AKIA<redacted>`) so the leaked
6065
+ * credential's type stays visible; structural or unknown-format secrets
6066
+ * with no meaningful prefix are masked whole.
6067
+ *
6068
+ * Runs the high-precision known-shape detectors first, then a generic
6069
+ * entropy-gated sweep for unknown-format secrets. Idempotent: the inert
6070
+ * `<redacted>` placeholder matches none of the detectors and is too
6071
+ * short for the generic sweep, so re-running leaves the text unchanged.
6072
+ *
6073
+ * Accepts `unknown` on purpose: callers feed it diagnostic `message` /
6074
+ * `help` that originate from oxlint JSON, which is only shape-checked at
6075
+ * the top level (the per-field `string` types are assumed, not validated).
6076
+ * A malformed non-string value returns `""` instead of throwing on
6077
+ * `.replace`, so one bad diagnostic can't abort parsing the whole batch.
6078
+ */
6079
+ const redactSensitiveText = (text) => {
6080
+ if (typeof text !== "string" || text === "") return "";
6081
+ let redacted = text;
6082
+ for (const rule of KNOWN_SECRET_RULES) redacted = redacted.replace(rule.pattern, rule.replacement);
6083
+ return redactHighEntropyTokens(redacted);
6084
+ };
5942
6085
  const REACT_MODULE_SOURCE = "react";
5943
6086
  const REQUIRE_IDENTIFIER = "require";
5944
6087
  const USE_IDENTIFIER = "use";
@@ -6260,6 +6403,13 @@ const getRuleRecommendation = (ruleName, project) => {
6260
6403
  };
6261
6404
  const getRuleCategory = (ruleName) => reactDoctorPlugin.rules[ruleName]?.category;
6262
6405
  const cleanDiagnosticMessage = (message, help, plugin, rule, project) => {
6406
+ const cleaned = resolveCleanedDiagnostic(typeof message === "string" ? message : "", typeof help === "string" ? help : "", plugin, rule, project);
6407
+ return {
6408
+ message: redactSensitiveText(cleaned.message),
6409
+ help: redactSensitiveText(cleaned.help)
6410
+ };
6411
+ };
6412
+ const resolveCleanedDiagnostic = (message, help, plugin, rule, project) => {
6263
6413
  if (plugin === "react-hooks-js") return {
6264
6414
  message: REACT_COMPILER_MESSAGE,
6265
6415
  help: appendReanimatedSharedValueHint(message.replace(FILEPATH_WITH_LOCATION_PATTERN, "").trim() || help, rule, project)
@@ -6464,11 +6614,14 @@ const spawnLintBatches = async (input) => {
6464
6614
  onFileProgress(scannedFileCount + batchFileIndex, totalFileCount);
6465
6615
  }
6466
6616
  }, 50) : null;
6467
- const batchDiagnostics = await spawnLintBatch(batch);
6468
- if (progressInterval !== null) clearInterval(progressInterval);
6469
- allDiagnostics.push(...batchDiagnostics);
6470
- scannedFileCount += batch.length;
6471
- onFileProgress?.(scannedFileCount, totalFileCount);
6617
+ try {
6618
+ const batchDiagnostics = await spawnLintBatch(batch);
6619
+ allDiagnostics.push(...batchDiagnostics);
6620
+ scannedFileCount += batch.length;
6621
+ onFileProgress?.(scannedFileCount, totalFileCount);
6622
+ } finally {
6623
+ if (progressInterval !== null) clearInterval(progressInterval);
6624
+ }
6472
6625
  }
6473
6626
  if (droppedFiles.length > 0 && onPartialFailure) {
6474
6627
  const previewFiles = droppedFiles.slice(0, 3).join(", ");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-doctor",
3
- "version": "0.2.14-dev.9b64d98",
3
+ "version": "0.2.14-dev.fe01e57",
4
4
  "description": "Diagnose and fix React codebases for security, performance, correctness, accessibility, bundle-size, and architecture issues",
5
5
  "keywords": [
6
6
  "accessibility",
@@ -52,20 +52,20 @@
52
52
  "@effect/platform-node-shared": "4.0.0-beta.70",
53
53
  "agent-install": "0.0.5",
54
54
  "conf": "^15.1.0",
55
- "deslop-js": "^0.0.13",
55
+ "deslop-js": "^0.0.14",
56
56
  "effect": "4.0.0-beta.70",
57
57
  "eslint-plugin-react-hooks": "^7.1.1",
58
58
  "oxlint": "^1.66.0",
59
59
  "prompts": "^2.4.2",
60
60
  "typescript": ">=5.0.4 <7",
61
- "oxlint-plugin-react-doctor": "0.2.14-dev.9b64d98"
61
+ "oxlint-plugin-react-doctor": "0.2.14-dev.fe01e57"
62
62
  },
63
63
  "devDependencies": {
64
64
  "@types/prompts": "^2.4.9",
65
65
  "commander": "^14.0.3",
66
66
  "ora": "^9.4.0",
67
- "@react-doctor/core": "0.2.14",
68
- "@react-doctor/api": "0.2.14"
67
+ "@react-doctor/api": "0.2.14",
68
+ "@react-doctor/core": "0.2.14"
69
69
  },
70
70
  "engines": {
71
71
  "node": "^20.19.0 || >=22.12.0"