react-doctor 0.5.5-dev.ea3b827 → 0.5.6-dev.0053a02

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]="e03b6154-4b3f-5b73-9f74-118d3b39e6b0")}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]="d18dc59a-0744-5f52-ae2e-98fddb52ed49")}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";
@@ -39986,12 +39986,11 @@ const collectKnipPatterns = (rootDirectory, settingName) => {
39986
39986
  if (!config) return [];
39987
39987
  return [...normalizePatternList(config[settingName]), ...collectKnipWorkspacePatterns(config.workspaces, settingName)];
39988
39988
  };
39989
- const collectDeadCodeIgnorePatterns = (rootDirectory, userConfig) => {
39989
+ const collectDeadCodeIgnorePatterns = (rootDirectory) => {
39990
39990
  const seen = /* @__PURE__ */ new Set();
39991
39991
  const sources = [
39992
39992
  readIgnoreFile(path.join(rootDirectory, ".gitignore")),
39993
39993
  collectIgnorePatterns(rootDirectory),
39994
- userConfig?.ignore?.files ?? [],
39995
39994
  collectKnipPatterns(rootDirectory, "ignore")
39996
39995
  ];
39997
39996
  for (const source of sources) for (const pattern of source) seen.add(pattern);
@@ -40269,11 +40268,10 @@ const runDeadCodeWorkerWithTimeout = (handle, timeoutMs) => new Promise((resolve
40269
40268
  });
40270
40269
  });
40271
40270
  const checkDeadCode = async (options) => {
40272
- const { userConfig } = options;
40273
40271
  const rootDirectory = toCanonicalPath(options.rootDirectory);
40274
40272
  if (!NFS.existsSync(Path.join(rootDirectory, "package.json"))) return [];
40275
40273
  const entryPatterns = collectDeadCodeEntryPatterns(rootDirectory);
40276
- const ignorePatterns = collectDeadCodeIgnorePatterns(rootDirectory, userConfig);
40274
+ const ignorePatterns = collectDeadCodeIgnorePatterns(rootDirectory);
40277
40275
  const result = parseDeadCodeWorkerResult(await runDeadCodeWorkerWithTimeout((options.createWorker ?? createDeadCodeWorker)({
40278
40276
  rootDirectory,
40279
40277
  entryPatterns,
@@ -41322,8 +41320,8 @@ const buildUserPluginRules = (userPlugin, severityControls) => {
41322
41320
  }
41323
41321
  return enabled;
41324
41322
  };
41325
- const createOxlintConfig = ({ pluginPath, project, customRulesOnly = false, extendsPaths = [], ignoredTags = /* @__PURE__ */ new Set(), serverAuthFunctionNames, severityControls, userPlugins = [] }) => {
41326
- const reactHooksJsPlugin = resolveReactHooksJsPlugin(project.hasReactCompiler, customRulesOnly);
41323
+ const createOxlintConfig = ({ pluginPath, project, customRulesOnly = false, extendsPaths = [], ignoredTags = /* @__PURE__ */ new Set(), serverAuthFunctionNames, severityControls, userPlugins = [], disableReactHooksJsPlugin = false }) => {
41324
+ const reactHooksJsPlugin = disableReactHooksJsPlugin ? null : resolveReactHooksJsPlugin(project.hasReactCompiler, customRulesOnly);
41327
41325
  const reactCompilerRules = reactHooksJsPlugin ? applyRuleSeverityControls(filterRulesToAvailable(REACT_COMPILER_RULES, "react-hooks-js", reactHooksJsPlugin.availableRuleNames), severityControls) : {};
41328
41326
  const jsPlugins = [];
41329
41327
  if (reactHooksJsPlugin) jsPlugins.push(reactHooksJsPlugin.entry);
@@ -42020,9 +42018,9 @@ const parseOxlintOutput = (stdout, project, rootDirectory) => {
42020
42018
  try {
42021
42019
  parsed = JSON.parse(sanitizedStdout);
42022
42020
  } catch {
42023
- throw new ReactDoctorError({ reason: new OxlintOutputUnparseable({ preview: stdout.slice(0, 200) }) });
42021
+ throw new ReactDoctorError({ reason: new OxlintOutputUnparseable({ preview: stdout.slice(0, 600) }) });
42024
42022
  }
42025
- if (!isOxlintOutput(parsed)) throw new ReactDoctorError({ reason: new OxlintOutputUnparseable({ preview: stdout.slice(0, 200) }) });
42023
+ if (!isOxlintOutput(parsed)) throw new ReactDoctorError({ reason: new OxlintOutputUnparseable({ preview: stdout.slice(0, 600) }) });
42026
42024
  const minifiedFileCache = /* @__PURE__ */ new Map();
42027
42025
  const isMinifiedDiagnosticFile = (filename) => {
42028
42026
  const absolutePath = Path.isAbsolute(filename) ? filename : Path.resolve(rootDirectory || ".", filename);
@@ -42313,6 +42311,28 @@ const writeOxlintConfig = (configPath, configToWrite) => {
42313
42311
  NFS.closeSync(fileHandle);
42314
42312
  }
42315
42313
  };
42314
+ const REACT_HOOKS_JS_DROP_PREFIX = "React Compiler rules (react-hooks-js/*) skipped — eslint-plugin-react-hooks failed to load in this environment";
42315
+ /**
42316
+ * Detects an oxlint config-load crash caused by the optional
42317
+ * `react-hooks-js` (eslint-plugin-react-hooks) React Compiler plugin and
42318
+ * builds the partial-failure note for it; returns `null` when the failure
42319
+ * was anything else.
42320
+ *
42321
+ * oxlint prints a framed error to stdout (not stderr) and exits non-zero
42322
+ * when a `jsPlugins` entry can't be imported; that non-JSON stdout
42323
+ * surfaces as `OxlintOutputUnparseable`. Because oxlint fails the WHOLE
42324
+ * config load on it, leaving the plugin in would drop every curated
42325
+ * react-doctor diagnostic too — so the caller retries with the plugin
42326
+ * stripped (issue #833). Both markers sit at the start of oxlint's
42327
+ * message, so they survive the `preview` slice even for deep pnpm paths.
42328
+ */
42329
+ const reactHooksJsPluginDropNote = (error) => {
42330
+ if (!(error instanceof ReactDoctorError) || error.reason._tag !== "OxlintOutputUnparseable") return null;
42331
+ const { preview } = error.reason;
42332
+ if (!preview.includes("Failed to load JS plugin") || !preview.includes("eslint-plugin-react-hooks")) return null;
42333
+ const underlyingReason = preview.match(/Error:[^\n]*/)?.[0]?.trim();
42334
+ return `${REACT_HOOKS_JS_DROP_PREFIX}${underlyingReason ? `: ${underlyingReason}` : ""}. Other rules ran normally.`;
42335
+ };
42316
42336
  /**
42317
42337
  * The oxlint runner. Composed of three pieces in `runners/oxlint/`:
42318
42338
  *
@@ -42340,15 +42360,16 @@ const runOxlint = async (options) => {
42340
42360
  const pluginPath = resolvePluginPath();
42341
42361
  const extendsPaths = (adoptExistingLintConfig && !customRulesOnly ? detectUserLintConfigPaths(rootDirectory) : []).filter(canOxlintExtendConfig);
42342
42362
  const userPlugins = resolveUserPlugins(userConfig?.plugins, configSourceDirectory);
42343
- const buildConfig = (extendsForThisAttempt) => createOxlintConfig({
42363
+ const buildConfig = (overrides) => createOxlintConfig({
42344
42364
  pluginPath,
42345
42365
  project,
42346
42366
  customRulesOnly,
42347
- extendsPaths: extendsForThisAttempt,
42367
+ extendsPaths: overrides.extendsPaths,
42348
42368
  ignoredTags,
42349
42369
  serverAuthFunctionNames,
42350
42370
  severityControls,
42351
- userPlugins
42371
+ userPlugins,
42372
+ disableReactHooksJsPlugin: overrides.disableReactHooksJsPlugin
42352
42373
  });
42353
42374
  const restoreDisableDirectives = respectInlineDisables ? () => {} : await neutralizeDisableDirectives(rootDirectory, includePaths);
42354
42375
  const configDirectory = NFS.mkdtempSync(Path.join(os.tmpdir(), "react-doctor-oxlintrc-"));
@@ -42384,12 +42405,22 @@ const runOxlint = async (options) => {
42384
42405
  outputMaxBytes,
42385
42406
  concurrency: options.concurrency
42386
42407
  });
42387
- writeOxlintConfig(configPath, buildConfig(extendsPaths));
42408
+ writeOxlintConfig(configPath, buildConfig({ extendsPaths }));
42388
42409
  try {
42389
42410
  return await runBatches();
42390
42411
  } catch (error) {
42412
+ const reactHooksJsDropNote = reactHooksJsPluginDropNote(error);
42413
+ if (reactHooksJsDropNote !== null) {
42414
+ writeOxlintConfig(configPath, buildConfig({
42415
+ extendsPaths,
42416
+ disableReactHooksJsPlugin: true
42417
+ }));
42418
+ const diagnostics = await runBatches();
42419
+ onPartialFailure?.(reactHooksJsDropNote);
42420
+ return diagnostics;
42421
+ }
42391
42422
  if (extendsPaths.length === 0) throw error;
42392
- writeOxlintConfig(configPath, buildConfig([]));
42423
+ writeOxlintConfig(configPath, buildConfig({ extendsPaths: [] }));
42393
42424
  return await runBatches();
42394
42425
  }
42395
42426
  } finally {
@@ -43172,8 +43203,10 @@ const runInspect = (input, hooks = {}) => gen(function* () {
43172
43203
  const lintFailureState = yield* get$2(lintFailure);
43173
43204
  yield* afterLint(lintFailureState.didFail);
43174
43205
  if (lintFailureState.didFail) yield* scanProgress.fail(formatLintFailText(lintFailureState.reasonTag, process.version));
43206
+ const totalFileCount = lastReportedTotalFileCount || (lintIncludePaths?.length ?? project.sourceFileCount);
43207
+ const scannedFilesLabel = `${totalFileCount} ${totalFileCount === 1 ? "file" : "files"}`;
43175
43208
  const shouldRunDeadCode = input.runDeadCode && !isDiffMode && (showWarnings || deadCodeMaySurfaceWhenWarningsHidden(resolvedConfig.config));
43176
- const deadCodeCollected = lintFailureState.didFail || !shouldRunDeadCode ? [] : yield* scanProgress.update("Analyzing dead code...").pipe(andThen(runCollect(applyPerElementPipeline(deadCodeService.run({
43209
+ const deadCodeCollected = lintFailureState.didFail || !shouldRunDeadCode ? [] : yield* scanProgress.update(`Scanned ${scannedFilesLabel}, analyzing dead code...`).pipe(andThen(runCollect(applyPerElementPipeline(deadCodeService.run({
43177
43210
  rootDirectory: scanDirectory,
43178
43211
  userConfig: resolvedConfig.config
43179
43212
  }).pipe(catchTag("ReactDoctorError", (error) => unwrap(gen(function* () {
@@ -43186,10 +43219,9 @@ const runInspect = (input, hooks = {}) => gen(function* () {
43186
43219
  const deadCodeFailureState = yield* get$2(deadCodeFailure);
43187
43220
  const scanElapsedMilliseconds = Date.now() - scanStartTime;
43188
43221
  const scanElapsedSeconds = (scanElapsedMilliseconds / 1e3).toFixed(1);
43189
- const totalFileCount = lastReportedTotalFileCount || (lintIncludePaths?.length ?? project.sourceFileCount);
43190
43222
  if (!lintFailureState.didFail) if (deadCodeFailureState.didFail) yield* scanProgress.fail(DEAD_CODE_FAIL_TEXT);
43191
43223
  else if (input.suppressScanSummary) yield* scanProgress.stop();
43192
- else yield* scanProgress.succeed(`Scanned ${totalFileCount} ${totalFileCount === 1 ? "file" : "files"} in ${scanElapsedSeconds}s${workerCountSuffix}`);
43224
+ else yield* scanProgress.succeed(`Scanned ${scannedFilesLabel} in ${scanElapsedSeconds}s${workerCountSuffix}`);
43193
43225
  yield* reporterService.finalize;
43194
43226
  const finalDiagnostics = [
43195
43227
  ...envCollected,
@@ -43971,7 +44003,7 @@ const makeNoopConsole = () => ({
43971
44003
  });
43972
44004
  //#endregion
43973
44005
  //#region src/cli/utils/version.ts
43974
- const VERSION = "0.5.5-dev.ea3b827";
44006
+ const VERSION = "0.5.6-dev.0053a02";
43975
44007
  //#endregion
43976
44008
  //#region src/cli/utils/json-mode.ts
43977
44009
  let context = null;
@@ -44329,13 +44361,13 @@ const isDevVersion = (version) => version === "0.0.0" || version.includes("-");
44329
44361
  * uploads source-map artifacts under, so stack frames symbolicate. Honors the
44330
44362
  * standard `SENTRY_RELEASE` override.
44331
44363
  */
44332
- const resolveSentryRelease = () => process.env.SENTRY_RELEASE || `react-doctor@0.5.5-dev.ea3b827`;
44364
+ const resolveSentryRelease = () => process.env.SENTRY_RELEASE || `react-doctor@0.5.6-dev.0053a02`;
44333
44365
  /**
44334
44366
  * Deployment environment shown in Sentry's environment filter. Defaults to
44335
44367
  * `production` for tagged releases and `development` for dev/unbuilt versions,
44336
44368
  * overridable via the standard `SENTRY_ENVIRONMENT` env var.
44337
44369
  */
44338
- const resolveSentryEnvironment = () => process.env.SENTRY_ENVIRONMENT || (isDevVersion("0.5.5-dev.ea3b827") ? "development" : "production");
44370
+ const resolveSentryEnvironment = () => process.env.SENTRY_ENVIRONMENT || (isDevVersion("0.5.6-dev.0053a02") ? "development" : "production");
44339
44371
  /**
44340
44372
  * Performance-tracing sample rate in `[0, 1]`. Reads `SENTRY_TRACES_SAMPLE_RATE`
44341
44373
  * (set to `0` to disable tracing) and falls back to
@@ -48117,7 +48149,7 @@ const AGENT_GUIDANCE_LINES = [
48117
48149
  "Investigate deeply where relevant: race conditions, security-sensitive flows, state propagation, multi-file refactors, and downstream dependency chains.",
48118
48150
  "Ignore pure style preferences, theoretical issues without real impact, missing features, and unrelated pre-existing code.",
48119
48151
  "Start with high-confidence fixes that preserve behavior. Leave low-confidence or product-dependent changes as notes.",
48120
- "Run `npx react-doctor@latest --verbose --diff` before and after changes, plus relevant tests after each focused batch.",
48152
+ "Run `npx react-doctor@latest --verbose --scope changed` before and after changes, plus relevant tests after each focused batch.",
48121
48153
  "When available, spawn subagents or isolated worktrees for independent rule families, then review and merge only the best safe fixes.",
48122
48154
  "Split unrelated, broad, or behavior-changing work into separate PRs/branches instead of one large cleanup.",
48123
48155
  "For confirmed issues that cannot be fixed now, create GitHub issues with the rule, file/line, confidence, impact, and proposed fix.",
@@ -50759,22 +50791,22 @@ const buildAgentHookScript = () => [
50759
50791
  "",
50760
50792
  "run_react_doctor() {",
50761
50793
  " if [ -x ./node_modules/.bin/react-doctor ]; then",
50762
- " ./node_modules/.bin/react-doctor --verbose --diff --blocking warning --no-score",
50794
+ " ./node_modules/.bin/react-doctor --verbose --scope changed --blocking warning --no-score",
50763
50795
  " return",
50764
50796
  " fi",
50765
50797
  "",
50766
50798
  " if command -v react-doctor >/dev/null 2>&1; then",
50767
- " react-doctor --verbose --diff --blocking warning --no-score",
50799
+ " react-doctor --verbose --scope changed --blocking warning --no-score",
50768
50800
  " return",
50769
50801
  " fi",
50770
50802
  "",
50771
50803
  " if command -v pnpm >/dev/null 2>&1; then",
50772
- " pnpm dlx react-doctor@latest --verbose --diff --blocking warning --no-score",
50804
+ " pnpm dlx react-doctor@latest --verbose --scope changed --blocking warning --no-score",
50773
50805
  " return",
50774
50806
  " fi",
50775
50807
  "",
50776
50808
  " if command -v npx >/dev/null 2>&1; then",
50777
- " npx --yes react-doctor@latest --verbose --diff --blocking warning --no-score",
50809
+ " npx --yes react-doctor@latest --verbose --scope changed --blocking warning --no-score",
50778
50810
  " return",
50779
50811
  " fi",
50780
50812
  "",
@@ -53871,7 +53903,7 @@ ${highlighter.dim("Examples:")}
53871
53903
  ${formatExampleLines([
53872
53904
  ["react-doctor", "scan the current project"],
53873
53905
  ["react-doctor ./apps/web", "scan a specific directory"],
53874
- ["react-doctor --diff main", "scan only files changed vs. main"],
53906
+ ["react-doctor --scope changed --base main", "scan only new issues vs. main"],
53875
53907
  ["react-doctor --project modules/a,modules/b", "score each module separately (names or paths)"],
53876
53908
  ["react-doctor --staged", "scan staged files (pre-commit hook)"],
53877
53909
  ["react-doctor --category Security", "show only one diagnostic category"],
@@ -53947,4 +53979,4 @@ Promise.resolve().then(() => assertNoRemovedFlags(process.argv)).then(() => prog
53947
53979
  export {};
53948
53980
 
53949
53981
  //# sourceMappingURL=cli.js.map
53950
- //# debugId=e03b6154-4b3f-5b73-9f74-118d3b39e6b0
53982
+ //# debugId=d18dc59a-0744-5f52-ae2e-98fddb52ed49
package/dist/index.d.ts CHANGED
@@ -9280,9 +9280,10 @@ interface ReactDoctorConfig {
9280
9280
  * list, user-provided names are treated as distinctive and never
9281
9281
  * subject to receiver-object disambiguation.
9282
9282
  *
9283
- * Use this to teach react-doctor about custom auth guards in
9284
- * codebases that wrap their auth library — e.g. a project-local
9285
- * `requireWorkspaceMember` or `ensureSignedIn`.
9283
+ * Common guard conventions are already recognized automatically
9284
+ * (`requireAdmin`, `ensureSignedIn`, `getCurrentUser`, `hasRole`, …),
9285
+ * so this is only needed for domain-specific guards whose names carry
9286
+ * no auth noun — e.g. a project-local `requireWorkspaceMember`.
9286
9287
  */
9287
9288
  serverAuthFunctionNames?: string[];
9288
9289
  /**
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]="0b246e36-6877-5145-9560-a392af70ee30")}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]="4e83db09-9255-525f-b6fd-405784826e7d")}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 * as NFS from "node:fs";
@@ -36750,12 +36750,11 @@ const collectKnipPatterns = (rootDirectory, settingName) => {
36750
36750
  if (!config) return [];
36751
36751
  return [...normalizePatternList(config[settingName]), ...collectKnipWorkspacePatterns(config.workspaces, settingName)];
36752
36752
  };
36753
- const collectDeadCodeIgnorePatterns = (rootDirectory, userConfig) => {
36753
+ const collectDeadCodeIgnorePatterns = (rootDirectory) => {
36754
36754
  const seen = /* @__PURE__ */ new Set();
36755
36755
  const sources = [
36756
36756
  readIgnoreFile(path.join(rootDirectory, ".gitignore")),
36757
36757
  collectIgnorePatterns(rootDirectory),
36758
- userConfig?.ignore?.files ?? [],
36759
36758
  collectKnipPatterns(rootDirectory, "ignore")
36760
36759
  ];
36761
36760
  for (const source of sources) for (const pattern of source) seen.add(pattern);
@@ -37033,11 +37032,10 @@ const runDeadCodeWorkerWithTimeout = (handle, timeoutMs) => new Promise((resolve
37033
37032
  });
37034
37033
  });
37035
37034
  const checkDeadCode = async (options) => {
37036
- const { userConfig } = options;
37037
37035
  const rootDirectory = toCanonicalPath(options.rootDirectory);
37038
37036
  if (!NFS.existsSync(Path.join(rootDirectory, "package.json"))) return [];
37039
37037
  const entryPatterns = collectDeadCodeEntryPatterns(rootDirectory);
37040
- const ignorePatterns = collectDeadCodeIgnorePatterns(rootDirectory, userConfig);
37038
+ const ignorePatterns = collectDeadCodeIgnorePatterns(rootDirectory);
37041
37039
  const result = parseDeadCodeWorkerResult(await runDeadCodeWorkerWithTimeout((options.createWorker ?? createDeadCodeWorker)({
37042
37040
  rootDirectory,
37043
37041
  entryPatterns,
@@ -38086,8 +38084,8 @@ const buildUserPluginRules = (userPlugin, severityControls) => {
38086
38084
  }
38087
38085
  return enabled;
38088
38086
  };
38089
- const createOxlintConfig = ({ pluginPath, project, customRulesOnly = false, extendsPaths = [], ignoredTags = /* @__PURE__ */ new Set(), serverAuthFunctionNames, severityControls, userPlugins = [] }) => {
38090
- const reactHooksJsPlugin = resolveReactHooksJsPlugin(project.hasReactCompiler, customRulesOnly);
38087
+ const createOxlintConfig = ({ pluginPath, project, customRulesOnly = false, extendsPaths = [], ignoredTags = /* @__PURE__ */ new Set(), serverAuthFunctionNames, severityControls, userPlugins = [], disableReactHooksJsPlugin = false }) => {
38088
+ const reactHooksJsPlugin = disableReactHooksJsPlugin ? null : resolveReactHooksJsPlugin(project.hasReactCompiler, customRulesOnly);
38091
38089
  const reactCompilerRules = reactHooksJsPlugin ? applyRuleSeverityControls(filterRulesToAvailable(REACT_COMPILER_RULES, "react-hooks-js", reactHooksJsPlugin.availableRuleNames), severityControls) : {};
38092
38090
  const jsPlugins = [];
38093
38091
  if (reactHooksJsPlugin) jsPlugins.push(reactHooksJsPlugin.entry);
@@ -38784,9 +38782,9 @@ const parseOxlintOutput = (stdout, project, rootDirectory) => {
38784
38782
  try {
38785
38783
  parsed = JSON.parse(sanitizedStdout);
38786
38784
  } catch {
38787
- throw new ReactDoctorError({ reason: new OxlintOutputUnparseable({ preview: stdout.slice(0, 200) }) });
38785
+ throw new ReactDoctorError({ reason: new OxlintOutputUnparseable({ preview: stdout.slice(0, 600) }) });
38788
38786
  }
38789
- if (!isOxlintOutput(parsed)) throw new ReactDoctorError({ reason: new OxlintOutputUnparseable({ preview: stdout.slice(0, 200) }) });
38787
+ if (!isOxlintOutput(parsed)) throw new ReactDoctorError({ reason: new OxlintOutputUnparseable({ preview: stdout.slice(0, 600) }) });
38790
38788
  const minifiedFileCache = /* @__PURE__ */ new Map();
38791
38789
  const isMinifiedDiagnosticFile = (filename) => {
38792
38790
  const absolutePath = Path.isAbsolute(filename) ? filename : Path.resolve(rootDirectory || ".", filename);
@@ -39077,6 +39075,28 @@ const writeOxlintConfig = (configPath, configToWrite) => {
39077
39075
  NFS.closeSync(fileHandle);
39078
39076
  }
39079
39077
  };
39078
+ const REACT_HOOKS_JS_DROP_PREFIX = "React Compiler rules (react-hooks-js/*) skipped — eslint-plugin-react-hooks failed to load in this environment";
39079
+ /**
39080
+ * Detects an oxlint config-load crash caused by the optional
39081
+ * `react-hooks-js` (eslint-plugin-react-hooks) React Compiler plugin and
39082
+ * builds the partial-failure note for it; returns `null` when the failure
39083
+ * was anything else.
39084
+ *
39085
+ * oxlint prints a framed error to stdout (not stderr) and exits non-zero
39086
+ * when a `jsPlugins` entry can't be imported; that non-JSON stdout
39087
+ * surfaces as `OxlintOutputUnparseable`. Because oxlint fails the WHOLE
39088
+ * config load on it, leaving the plugin in would drop every curated
39089
+ * react-doctor diagnostic too — so the caller retries with the plugin
39090
+ * stripped (issue #833). Both markers sit at the start of oxlint's
39091
+ * message, so they survive the `preview` slice even for deep pnpm paths.
39092
+ */
39093
+ const reactHooksJsPluginDropNote = (error) => {
39094
+ if (!(error instanceof ReactDoctorError) || error.reason._tag !== "OxlintOutputUnparseable") return null;
39095
+ const { preview } = error.reason;
39096
+ if (!preview.includes("Failed to load JS plugin") || !preview.includes("eslint-plugin-react-hooks")) return null;
39097
+ const underlyingReason = preview.match(/Error:[^\n]*/)?.[0]?.trim();
39098
+ return `${REACT_HOOKS_JS_DROP_PREFIX}${underlyingReason ? `: ${underlyingReason}` : ""}. Other rules ran normally.`;
39099
+ };
39080
39100
  /**
39081
39101
  * The oxlint runner. Composed of three pieces in `runners/oxlint/`:
39082
39102
  *
@@ -39104,15 +39124,16 @@ const runOxlint = async (options) => {
39104
39124
  const pluginPath = resolvePluginPath();
39105
39125
  const extendsPaths = (adoptExistingLintConfig && !customRulesOnly ? detectUserLintConfigPaths(rootDirectory) : []).filter(canOxlintExtendConfig);
39106
39126
  const userPlugins = resolveUserPlugins(userConfig?.plugins, configSourceDirectory);
39107
- const buildConfig = (extendsForThisAttempt) => createOxlintConfig({
39127
+ const buildConfig = (overrides) => createOxlintConfig({
39108
39128
  pluginPath,
39109
39129
  project,
39110
39130
  customRulesOnly,
39111
- extendsPaths: extendsForThisAttempt,
39131
+ extendsPaths: overrides.extendsPaths,
39112
39132
  ignoredTags,
39113
39133
  serverAuthFunctionNames,
39114
39134
  severityControls,
39115
- userPlugins
39135
+ userPlugins,
39136
+ disableReactHooksJsPlugin: overrides.disableReactHooksJsPlugin
39116
39137
  });
39117
39138
  const restoreDisableDirectives = respectInlineDisables ? () => {} : await neutralizeDisableDirectives(rootDirectory, includePaths);
39118
39139
  const configDirectory = NFS.mkdtempSync(Path.join(os.tmpdir(), "react-doctor-oxlintrc-"));
@@ -39148,12 +39169,22 @@ const runOxlint = async (options) => {
39148
39169
  outputMaxBytes,
39149
39170
  concurrency: options.concurrency
39150
39171
  });
39151
- writeOxlintConfig(configPath, buildConfig(extendsPaths));
39172
+ writeOxlintConfig(configPath, buildConfig({ extendsPaths }));
39152
39173
  try {
39153
39174
  return await runBatches();
39154
39175
  } catch (error) {
39176
+ const reactHooksJsDropNote = reactHooksJsPluginDropNote(error);
39177
+ if (reactHooksJsDropNote !== null) {
39178
+ writeOxlintConfig(configPath, buildConfig({
39179
+ extendsPaths,
39180
+ disableReactHooksJsPlugin: true
39181
+ }));
39182
+ const diagnostics = await runBatches();
39183
+ onPartialFailure?.(reactHooksJsDropNote);
39184
+ return diagnostics;
39185
+ }
39155
39186
  if (extendsPaths.length === 0) throw error;
39156
- writeOxlintConfig(configPath, buildConfig([]));
39187
+ writeOxlintConfig(configPath, buildConfig({ extendsPaths: [] }));
39157
39188
  return await runBatches();
39158
39189
  }
39159
39190
  } finally {
@@ -39936,8 +39967,10 @@ const runInspect = (input, hooks = {}) => gen(function* () {
39936
39967
  const lintFailureState = yield* get$2(lintFailure);
39937
39968
  yield* afterLint(lintFailureState.didFail);
39938
39969
  if (lintFailureState.didFail) yield* scanProgress.fail(formatLintFailText(lintFailureState.reasonTag, process.version));
39970
+ const totalFileCount = lastReportedTotalFileCount || (lintIncludePaths?.length ?? project.sourceFileCount);
39971
+ const scannedFilesLabel = `${totalFileCount} ${totalFileCount === 1 ? "file" : "files"}`;
39939
39972
  const shouldRunDeadCode = input.runDeadCode && !isDiffMode && (showWarnings || deadCodeMaySurfaceWhenWarningsHidden(resolvedConfig.config));
39940
- const deadCodeCollected = lintFailureState.didFail || !shouldRunDeadCode ? [] : yield* scanProgress.update("Analyzing dead code...").pipe(andThen(runCollect(applyPerElementPipeline(deadCodeService.run({
39973
+ const deadCodeCollected = lintFailureState.didFail || !shouldRunDeadCode ? [] : yield* scanProgress.update(`Scanned ${scannedFilesLabel}, analyzing dead code...`).pipe(andThen(runCollect(applyPerElementPipeline(deadCodeService.run({
39941
39974
  rootDirectory: scanDirectory,
39942
39975
  userConfig: resolvedConfig.config
39943
39976
  }).pipe(catchTag("ReactDoctorError", (error) => unwrap(gen(function* () {
@@ -39950,10 +39983,9 @@ const runInspect = (input, hooks = {}) => gen(function* () {
39950
39983
  const deadCodeFailureState = yield* get$2(deadCodeFailure);
39951
39984
  const scanElapsedMilliseconds = Date.now() - scanStartTime;
39952
39985
  const scanElapsedSeconds = (scanElapsedMilliseconds / 1e3).toFixed(1);
39953
- const totalFileCount = lastReportedTotalFileCount || (lintIncludePaths?.length ?? project.sourceFileCount);
39954
39986
  if (!lintFailureState.didFail) if (deadCodeFailureState.didFail) yield* scanProgress.fail(DEAD_CODE_FAIL_TEXT);
39955
39987
  else if (input.suppressScanSummary) yield* scanProgress.stop();
39956
- else yield* scanProgress.succeed(`Scanned ${totalFileCount} ${totalFileCount === 1 ? "file" : "files"} in ${scanElapsedSeconds}s${workerCountSuffix}`);
39988
+ else yield* scanProgress.succeed(`Scanned ${scannedFilesLabel} in ${scanElapsedSeconds}s${workerCountSuffix}`);
39957
39989
  yield* reporterService.finalize;
39958
39990
  const finalDiagnostics = [
39959
39991
  ...envCollected,
@@ -40572,4 +40604,4 @@ const toJsonReport = (result, options) => buildJsonReport({
40572
40604
  export { AmbiguousProjectError, NoReactDependencyError, NotADirectoryError, PackageJsonNotFoundError, ProjectNotFoundError, ReactDoctorError, buildJsonReport, buildJsonReportError, clearCaches, defineConfig, diagnose, filterSourceFiles, getDiffInfo, isProjectDiscoveryError, isReactDoctorError, summarizeDiagnostics, toJsonReport };
40573
40605
 
40574
40606
  //# sourceMappingURL=index.js.map
40575
- //# debugId=0b246e36-6877-5145-9560-a392af70ee30
40607
+ //# debugId=4e83db09-9255-525f-b6fd-405784826e7d
package/dist/lsp.js CHANGED
@@ -36736,12 +36736,11 @@ const collectKnipPatterns = (rootDirectory, settingName) => {
36736
36736
  if (!config) return [];
36737
36737
  return [...normalizePatternList(config[settingName]), ...collectKnipWorkspacePatterns(config.workspaces, settingName)];
36738
36738
  };
36739
- const collectDeadCodeIgnorePatterns = (rootDirectory, userConfig) => {
36739
+ const collectDeadCodeIgnorePatterns = (rootDirectory) => {
36740
36740
  const seen = /* @__PURE__ */ new Set();
36741
36741
  const sources = [
36742
36742
  readIgnoreFile(path.join(rootDirectory, ".gitignore")),
36743
36743
  collectIgnorePatterns(rootDirectory),
36744
- userConfig?.ignore?.files ?? [],
36745
36744
  collectKnipPatterns(rootDirectory, "ignore")
36746
36745
  ];
36747
36746
  for (const source of sources) for (const pattern of source) seen.add(pattern);
@@ -37019,11 +37018,10 @@ const runDeadCodeWorkerWithTimeout = (handle, timeoutMs) => new Promise((resolve
37019
37018
  });
37020
37019
  });
37021
37020
  const checkDeadCode = async (options) => {
37022
- const { userConfig } = options;
37023
37021
  const rootDirectory = toCanonicalPath(options.rootDirectory);
37024
37022
  if (!NFS.existsSync(Path.join(rootDirectory, "package.json"))) return [];
37025
37023
  const entryPatterns = collectDeadCodeEntryPatterns(rootDirectory);
37026
- const ignorePatterns = collectDeadCodeIgnorePatterns(rootDirectory, userConfig);
37024
+ const ignorePatterns = collectDeadCodeIgnorePatterns(rootDirectory);
37027
37025
  const result = parseDeadCodeWorkerResult(await runDeadCodeWorkerWithTimeout((options.createWorker ?? createDeadCodeWorker)({
37028
37026
  rootDirectory,
37029
37027
  entryPatterns,
@@ -38072,8 +38070,8 @@ const buildUserPluginRules = (userPlugin, severityControls) => {
38072
38070
  }
38073
38071
  return enabled;
38074
38072
  };
38075
- const createOxlintConfig = ({ pluginPath, project, customRulesOnly = false, extendsPaths = [], ignoredTags = /* @__PURE__ */ new Set(), serverAuthFunctionNames, severityControls, userPlugins = [] }) => {
38076
- const reactHooksJsPlugin = resolveReactHooksJsPlugin(project.hasReactCompiler, customRulesOnly);
38073
+ const createOxlintConfig = ({ pluginPath, project, customRulesOnly = false, extendsPaths = [], ignoredTags = /* @__PURE__ */ new Set(), serverAuthFunctionNames, severityControls, userPlugins = [], disableReactHooksJsPlugin = false }) => {
38074
+ const reactHooksJsPlugin = disableReactHooksJsPlugin ? null : resolveReactHooksJsPlugin(project.hasReactCompiler, customRulesOnly);
38077
38075
  const reactCompilerRules = reactHooksJsPlugin ? applyRuleSeverityControls(filterRulesToAvailable(REACT_COMPILER_RULES, "react-hooks-js", reactHooksJsPlugin.availableRuleNames), severityControls) : {};
38078
38076
  const jsPlugins = [];
38079
38077
  if (reactHooksJsPlugin) jsPlugins.push(reactHooksJsPlugin.entry);
@@ -38770,9 +38768,9 @@ const parseOxlintOutput = (stdout, project, rootDirectory) => {
38770
38768
  try {
38771
38769
  parsed = JSON.parse(sanitizedStdout);
38772
38770
  } catch {
38773
- throw new ReactDoctorError({ reason: new OxlintOutputUnparseable({ preview: stdout.slice(0, 200) }) });
38771
+ throw new ReactDoctorError({ reason: new OxlintOutputUnparseable({ preview: stdout.slice(0, 600) }) });
38774
38772
  }
38775
- if (!isOxlintOutput(parsed)) throw new ReactDoctorError({ reason: new OxlintOutputUnparseable({ preview: stdout.slice(0, 200) }) });
38773
+ if (!isOxlintOutput(parsed)) throw new ReactDoctorError({ reason: new OxlintOutputUnparseable({ preview: stdout.slice(0, 600) }) });
38776
38774
  const minifiedFileCache = /* @__PURE__ */ new Map();
38777
38775
  const isMinifiedDiagnosticFile = (filename) => {
38778
38776
  const absolutePath = Path.isAbsolute(filename) ? filename : Path.resolve(rootDirectory || ".", filename);
@@ -39063,6 +39061,28 @@ const writeOxlintConfig = (configPath, configToWrite) => {
39063
39061
  NFS.closeSync(fileHandle);
39064
39062
  }
39065
39063
  };
39064
+ const REACT_HOOKS_JS_DROP_PREFIX = "React Compiler rules (react-hooks-js/*) skipped — eslint-plugin-react-hooks failed to load in this environment";
39065
+ /**
39066
+ * Detects an oxlint config-load crash caused by the optional
39067
+ * `react-hooks-js` (eslint-plugin-react-hooks) React Compiler plugin and
39068
+ * builds the partial-failure note for it; returns `null` when the failure
39069
+ * was anything else.
39070
+ *
39071
+ * oxlint prints a framed error to stdout (not stderr) and exits non-zero
39072
+ * when a `jsPlugins` entry can't be imported; that non-JSON stdout
39073
+ * surfaces as `OxlintOutputUnparseable`. Because oxlint fails the WHOLE
39074
+ * config load on it, leaving the plugin in would drop every curated
39075
+ * react-doctor diagnostic too — so the caller retries with the plugin
39076
+ * stripped (issue #833). Both markers sit at the start of oxlint's
39077
+ * message, so they survive the `preview` slice even for deep pnpm paths.
39078
+ */
39079
+ const reactHooksJsPluginDropNote = (error) => {
39080
+ if (!(error instanceof ReactDoctorError) || error.reason._tag !== "OxlintOutputUnparseable") return null;
39081
+ const { preview } = error.reason;
39082
+ if (!preview.includes("Failed to load JS plugin") || !preview.includes("eslint-plugin-react-hooks")) return null;
39083
+ const underlyingReason = preview.match(/Error:[^\n]*/)?.[0]?.trim();
39084
+ return `${REACT_HOOKS_JS_DROP_PREFIX}${underlyingReason ? `: ${underlyingReason}` : ""}. Other rules ran normally.`;
39085
+ };
39066
39086
  /**
39067
39087
  * The oxlint runner. Composed of three pieces in `runners/oxlint/`:
39068
39088
  *
@@ -39090,15 +39110,16 @@ const runOxlint = async (options) => {
39090
39110
  const pluginPath = resolvePluginPath();
39091
39111
  const extendsPaths = (adoptExistingLintConfig && !customRulesOnly ? detectUserLintConfigPaths(rootDirectory) : []).filter(canOxlintExtendConfig);
39092
39112
  const userPlugins = resolveUserPlugins(userConfig?.plugins, configSourceDirectory);
39093
- const buildConfig = (extendsForThisAttempt) => createOxlintConfig({
39113
+ const buildConfig = (overrides) => createOxlintConfig({
39094
39114
  pluginPath,
39095
39115
  project,
39096
39116
  customRulesOnly,
39097
- extendsPaths: extendsForThisAttempt,
39117
+ extendsPaths: overrides.extendsPaths,
39098
39118
  ignoredTags,
39099
39119
  serverAuthFunctionNames,
39100
39120
  severityControls,
39101
- userPlugins
39121
+ userPlugins,
39122
+ disableReactHooksJsPlugin: overrides.disableReactHooksJsPlugin
39102
39123
  });
39103
39124
  const restoreDisableDirectives = respectInlineDisables ? () => {} : await neutralizeDisableDirectives(rootDirectory, includePaths);
39104
39125
  const configDirectory = NFS.mkdtempSync(Path.join(os.tmpdir(), "react-doctor-oxlintrc-"));
@@ -39134,12 +39155,22 @@ const runOxlint = async (options) => {
39134
39155
  outputMaxBytes,
39135
39156
  concurrency: options.concurrency
39136
39157
  });
39137
- writeOxlintConfig(configPath, buildConfig(extendsPaths));
39158
+ writeOxlintConfig(configPath, buildConfig({ extendsPaths }));
39138
39159
  try {
39139
39160
  return await runBatches();
39140
39161
  } catch (error) {
39162
+ const reactHooksJsDropNote = reactHooksJsPluginDropNote(error);
39163
+ if (reactHooksJsDropNote !== null) {
39164
+ writeOxlintConfig(configPath, buildConfig({
39165
+ extendsPaths,
39166
+ disableReactHooksJsPlugin: true
39167
+ }));
39168
+ const diagnostics = await runBatches();
39169
+ onPartialFailure?.(reactHooksJsDropNote);
39170
+ return diagnostics;
39171
+ }
39141
39172
  if (extendsPaths.length === 0) throw error;
39142
- writeOxlintConfig(configPath, buildConfig([]));
39173
+ writeOxlintConfig(configPath, buildConfig({ extendsPaths: [] }));
39143
39174
  return await runBatches();
39144
39175
  }
39145
39176
  } finally {
@@ -39922,8 +39953,10 @@ const runInspect = (input, hooks = {}) => gen(function* () {
39922
39953
  const lintFailureState = yield* get$2(lintFailure);
39923
39954
  yield* afterLint(lintFailureState.didFail);
39924
39955
  if (lintFailureState.didFail) yield* scanProgress.fail(formatLintFailText(lintFailureState.reasonTag, process.version));
39956
+ const totalFileCount = lastReportedTotalFileCount || (lintIncludePaths?.length ?? project.sourceFileCount);
39957
+ const scannedFilesLabel = `${totalFileCount} ${totalFileCount === 1 ? "file" : "files"}`;
39925
39958
  const shouldRunDeadCode = input.runDeadCode && !isDiffMode && (showWarnings || deadCodeMaySurfaceWhenWarningsHidden(resolvedConfig.config));
39926
- const deadCodeCollected = lintFailureState.didFail || !shouldRunDeadCode ? [] : yield* scanProgress.update("Analyzing dead code...").pipe(andThen(runCollect(applyPerElementPipeline(deadCodeService.run({
39959
+ const deadCodeCollected = lintFailureState.didFail || !shouldRunDeadCode ? [] : yield* scanProgress.update(`Scanned ${scannedFilesLabel}, analyzing dead code...`).pipe(andThen(runCollect(applyPerElementPipeline(deadCodeService.run({
39927
39960
  rootDirectory: scanDirectory,
39928
39961
  userConfig: resolvedConfig.config
39929
39962
  }).pipe(catchTag("ReactDoctorError", (error) => unwrap(gen(function* () {
@@ -39936,10 +39969,9 @@ const runInspect = (input, hooks = {}) => gen(function* () {
39936
39969
  const deadCodeFailureState = yield* get$2(deadCodeFailure);
39937
39970
  const scanElapsedMilliseconds = Date.now() - scanStartTime;
39938
39971
  const scanElapsedSeconds = (scanElapsedMilliseconds / 1e3).toFixed(1);
39939
- const totalFileCount = lastReportedTotalFileCount || (lintIncludePaths?.length ?? project.sourceFileCount);
39940
39972
  if (!lintFailureState.didFail) if (deadCodeFailureState.didFail) yield* scanProgress.fail(DEAD_CODE_FAIL_TEXT);
39941
39973
  else if (input.suppressScanSummary) yield* scanProgress.stop();
39942
- else yield* scanProgress.succeed(`Scanned ${totalFileCount} ${totalFileCount === 1 ? "file" : "files"} in ${scanElapsedSeconds}s${workerCountSuffix}`);
39974
+ else yield* scanProgress.succeed(`Scanned ${scannedFilesLabel} in ${scanElapsedSeconds}s${workerCountSuffix}`);
39943
39975
  yield* reporterService.finalize;
39944
39976
  const finalDiagnostics = [
39945
39977
  ...envCollected,
@@ -40310,7 +40342,7 @@ const computeConfigFingerprint = (projectDirectory, version) => {
40310
40342
  /** Display name used in client-facing messages and progress titles. */
40311
40343
  const SERVER_DISPLAY_NAME = "React Doctor";
40312
40344
  /** Server version reported in `serverInfo`; injected at build, `dev` from source. */
40313
- const SERVER_VERSION = "0.5.5";
40345
+ const SERVER_VERSION = "0.5.6";
40314
40346
  /** `Diagnostic.source` shown next to every published diagnostic. */
40315
40347
  const DIAGNOSTIC_SOURCE = "react-doctor";
40316
40348
  /**
@@ -42357,5 +42389,5 @@ const startLanguageServer = () => {
42357
42389
  };
42358
42390
  //#endregion
42359
42391
  export { startLanguageServer };
42360
- !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]="6648983d-3832-5f00-93a7-24daacde01bb")}catch(e){}}();
42361
- //# debugId=6648983d-3832-5f00-93a7-24daacde01bb
42392
+ !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]="7deadb2d-94c2-54e2-bd0d-808ee8d4c380")}catch(e){}}();
42393
+ //# debugId=7deadb2d-94c2-54e2-bd0d-808ee8d4c380
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-doctor",
3
- "version": "0.5.5-dev.ea3b827",
3
+ "version": "0.5.6-dev.0053a02",
4
4
  "description": "Your agent writes bad React. This catches it",
5
5
  "keywords": [
6
6
  "accessibility",
@@ -64,7 +64,7 @@
64
64
  "vscode-languageserver": "^9.0.1",
65
65
  "vscode-languageserver-textdocument": "^1.0.12",
66
66
  "vscode-uri": "^3.1.0",
67
- "oxlint-plugin-react-doctor": "0.5.5-dev.ea3b827"
67
+ "oxlint-plugin-react-doctor": "0.5.6-dev.0053a02"
68
68
  },
69
69
  "devDependencies": {
70
70
  "@types/babel__code-frame": "^7.27.0",
@@ -72,9 +72,9 @@
72
72
  "@xterm/headless": "^6.0.0",
73
73
  "commander": "^14.0.3",
74
74
  "ora": "^9.4.0",
75
- "@react-doctor/language-server": "0.5.5",
76
- "@react-doctor/api": "0.5.5",
77
- "@react-doctor/core": "0.5.5"
75
+ "@react-doctor/api": "0.5.6",
76
+ "@react-doctor/language-server": "0.5.6",
77
+ "@react-doctor/core": "0.5.6"
78
78
  },
79
79
  "engines": {
80
80
  "node": "^20.19.0 || >=22.13.0"