react-doctor 0.5.6-dev.0a7edbd → 0.5.6-dev.424d8f9
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 +59 -21
- package/dist/index.js +50 -12
- package/dist/lsp.js +50 -12
- package/package.json +2 -2
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]="
|
|
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]="fc691f8f-4aa6-5f96-8491-8e4e53439952")}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";
|
|
@@ -39692,10 +39692,15 @@ const buildCapabilities = (project) => {
|
|
|
39692
39692
|
}
|
|
39693
39693
|
if (project.tailwindVersion !== null) {
|
|
39694
39694
|
capabilities.add("tailwind");
|
|
39695
|
-
|
|
39695
|
+
const tailwind = parseTailwindMajorMinor(project.tailwindVersion);
|
|
39696
|
+
if (isTailwindAtLeast(tailwind, {
|
|
39696
39697
|
major: 3,
|
|
39697
39698
|
minor: 4
|
|
39698
39699
|
})) capabilities.add("tailwind:3.4");
|
|
39700
|
+
if (tailwind !== null && isTailwindAtLeast(tailwind, {
|
|
39701
|
+
major: 4,
|
|
39702
|
+
minor: 0
|
|
39703
|
+
})) capabilities.add("tailwind:4");
|
|
39699
39704
|
}
|
|
39700
39705
|
if (project.zodVersion !== null) {
|
|
39701
39706
|
capabilities.add("zod");
|
|
@@ -41320,8 +41325,8 @@ const buildUserPluginRules = (userPlugin, severityControls) => {
|
|
|
41320
41325
|
}
|
|
41321
41326
|
return enabled;
|
|
41322
41327
|
};
|
|
41323
|
-
const createOxlintConfig = ({ pluginPath, project, customRulesOnly = false, extendsPaths = [], ignoredTags = /* @__PURE__ */ new Set(), serverAuthFunctionNames, severityControls, userPlugins = [] }) => {
|
|
41324
|
-
const reactHooksJsPlugin = resolveReactHooksJsPlugin(project.hasReactCompiler, customRulesOnly);
|
|
41328
|
+
const createOxlintConfig = ({ pluginPath, project, customRulesOnly = false, extendsPaths = [], ignoredTags = /* @__PURE__ */ new Set(), serverAuthFunctionNames, severityControls, userPlugins = [], disableReactHooksJsPlugin = false }) => {
|
|
41329
|
+
const reactHooksJsPlugin = disableReactHooksJsPlugin ? null : resolveReactHooksJsPlugin(project.hasReactCompiler, customRulesOnly);
|
|
41325
41330
|
const reactCompilerRules = reactHooksJsPlugin ? applyRuleSeverityControls(filterRulesToAvailable(REACT_COMPILER_RULES, "react-hooks-js", reactHooksJsPlugin.availableRuleNames), severityControls) : {};
|
|
41326
41331
|
const jsPlugins = [];
|
|
41327
41332
|
if (reactHooksJsPlugin) jsPlugins.push(reactHooksJsPlugin.entry);
|
|
@@ -42018,9 +42023,9 @@ const parseOxlintOutput = (stdout, project, rootDirectory) => {
|
|
|
42018
42023
|
try {
|
|
42019
42024
|
parsed = JSON.parse(sanitizedStdout);
|
|
42020
42025
|
} catch {
|
|
42021
|
-
throw new ReactDoctorError({ reason: new OxlintOutputUnparseable({ preview: stdout.slice(0,
|
|
42026
|
+
throw new ReactDoctorError({ reason: new OxlintOutputUnparseable({ preview: stdout.slice(0, 600) }) });
|
|
42022
42027
|
}
|
|
42023
|
-
if (!isOxlintOutput(parsed)) throw new ReactDoctorError({ reason: new OxlintOutputUnparseable({ preview: stdout.slice(0,
|
|
42028
|
+
if (!isOxlintOutput(parsed)) throw new ReactDoctorError({ reason: new OxlintOutputUnparseable({ preview: stdout.slice(0, 600) }) });
|
|
42024
42029
|
const minifiedFileCache = /* @__PURE__ */ new Map();
|
|
42025
42030
|
const isMinifiedDiagnosticFile = (filename) => {
|
|
42026
42031
|
const absolutePath = Path.isAbsolute(filename) ? filename : Path.resolve(rootDirectory || ".", filename);
|
|
@@ -42311,6 +42316,28 @@ const writeOxlintConfig = (configPath, configToWrite) => {
|
|
|
42311
42316
|
NFS.closeSync(fileHandle);
|
|
42312
42317
|
}
|
|
42313
42318
|
};
|
|
42319
|
+
const REACT_HOOKS_JS_DROP_PREFIX = "React Compiler rules (react-hooks-js/*) skipped — eslint-plugin-react-hooks failed to load in this environment";
|
|
42320
|
+
/**
|
|
42321
|
+
* Detects an oxlint config-load crash caused by the optional
|
|
42322
|
+
* `react-hooks-js` (eslint-plugin-react-hooks) React Compiler plugin and
|
|
42323
|
+
* builds the partial-failure note for it; returns `null` when the failure
|
|
42324
|
+
* was anything else.
|
|
42325
|
+
*
|
|
42326
|
+
* oxlint prints a framed error to stdout (not stderr) and exits non-zero
|
|
42327
|
+
* when a `jsPlugins` entry can't be imported; that non-JSON stdout
|
|
42328
|
+
* surfaces as `OxlintOutputUnparseable`. Because oxlint fails the WHOLE
|
|
42329
|
+
* config load on it, leaving the plugin in would drop every curated
|
|
42330
|
+
* react-doctor diagnostic too — so the caller retries with the plugin
|
|
42331
|
+
* stripped (issue #833). Both markers sit at the start of oxlint's
|
|
42332
|
+
* message, so they survive the `preview` slice even for deep pnpm paths.
|
|
42333
|
+
*/
|
|
42334
|
+
const reactHooksJsPluginDropNote = (error) => {
|
|
42335
|
+
if (!(error instanceof ReactDoctorError) || error.reason._tag !== "OxlintOutputUnparseable") return null;
|
|
42336
|
+
const { preview } = error.reason;
|
|
42337
|
+
if (!preview.includes("Failed to load JS plugin") || !preview.includes("eslint-plugin-react-hooks")) return null;
|
|
42338
|
+
const underlyingReason = preview.match(/Error:[^\n]*/)?.[0]?.trim();
|
|
42339
|
+
return `${REACT_HOOKS_JS_DROP_PREFIX}${underlyingReason ? `: ${underlyingReason}` : ""}. Other rules ran normally.`;
|
|
42340
|
+
};
|
|
42314
42341
|
/**
|
|
42315
42342
|
* The oxlint runner. Composed of three pieces in `runners/oxlint/`:
|
|
42316
42343
|
*
|
|
@@ -42338,15 +42365,16 @@ const runOxlint = async (options) => {
|
|
|
42338
42365
|
const pluginPath = resolvePluginPath();
|
|
42339
42366
|
const extendsPaths = (adoptExistingLintConfig && !customRulesOnly ? detectUserLintConfigPaths(rootDirectory) : []).filter(canOxlintExtendConfig);
|
|
42340
42367
|
const userPlugins = resolveUserPlugins(userConfig?.plugins, configSourceDirectory);
|
|
42341
|
-
const buildConfig = (
|
|
42368
|
+
const buildConfig = (overrides) => createOxlintConfig({
|
|
42342
42369
|
pluginPath,
|
|
42343
42370
|
project,
|
|
42344
42371
|
customRulesOnly,
|
|
42345
|
-
extendsPaths:
|
|
42372
|
+
extendsPaths: overrides.extendsPaths,
|
|
42346
42373
|
ignoredTags,
|
|
42347
42374
|
serverAuthFunctionNames,
|
|
42348
42375
|
severityControls,
|
|
42349
|
-
userPlugins
|
|
42376
|
+
userPlugins,
|
|
42377
|
+
disableReactHooksJsPlugin: overrides.disableReactHooksJsPlugin
|
|
42350
42378
|
});
|
|
42351
42379
|
const restoreDisableDirectives = respectInlineDisables ? () => {} : await neutralizeDisableDirectives(rootDirectory, includePaths);
|
|
42352
42380
|
const configDirectory = NFS.mkdtempSync(Path.join(os.tmpdir(), "react-doctor-oxlintrc-"));
|
|
@@ -42382,12 +42410,22 @@ const runOxlint = async (options) => {
|
|
|
42382
42410
|
outputMaxBytes,
|
|
42383
42411
|
concurrency: options.concurrency
|
|
42384
42412
|
});
|
|
42385
|
-
writeOxlintConfig(configPath, buildConfig(extendsPaths));
|
|
42413
|
+
writeOxlintConfig(configPath, buildConfig({ extendsPaths }));
|
|
42386
42414
|
try {
|
|
42387
42415
|
return await runBatches();
|
|
42388
42416
|
} catch (error) {
|
|
42417
|
+
const reactHooksJsDropNote = reactHooksJsPluginDropNote(error);
|
|
42418
|
+
if (reactHooksJsDropNote !== null) {
|
|
42419
|
+
writeOxlintConfig(configPath, buildConfig({
|
|
42420
|
+
extendsPaths,
|
|
42421
|
+
disableReactHooksJsPlugin: true
|
|
42422
|
+
}));
|
|
42423
|
+
const diagnostics = await runBatches();
|
|
42424
|
+
onPartialFailure?.(reactHooksJsDropNote);
|
|
42425
|
+
return diagnostics;
|
|
42426
|
+
}
|
|
42389
42427
|
if (extendsPaths.length === 0) throw error;
|
|
42390
|
-
writeOxlintConfig(configPath, buildConfig([]));
|
|
42428
|
+
writeOxlintConfig(configPath, buildConfig({ extendsPaths: [] }));
|
|
42391
42429
|
return await runBatches();
|
|
42392
42430
|
}
|
|
42393
42431
|
} finally {
|
|
@@ -43970,7 +44008,7 @@ const makeNoopConsole = () => ({
|
|
|
43970
44008
|
});
|
|
43971
44009
|
//#endregion
|
|
43972
44010
|
//#region src/cli/utils/version.ts
|
|
43973
|
-
const VERSION = "0.5.6-dev.
|
|
44011
|
+
const VERSION = "0.5.6-dev.424d8f9";
|
|
43974
44012
|
//#endregion
|
|
43975
44013
|
//#region src/cli/utils/json-mode.ts
|
|
43976
44014
|
let context = null;
|
|
@@ -44328,13 +44366,13 @@ const isDevVersion = (version) => version === "0.0.0" || version.includes("-");
|
|
|
44328
44366
|
* uploads source-map artifacts under, so stack frames symbolicate. Honors the
|
|
44329
44367
|
* standard `SENTRY_RELEASE` override.
|
|
44330
44368
|
*/
|
|
44331
|
-
const resolveSentryRelease = () => process.env.SENTRY_RELEASE || `react-doctor@0.5.6-dev.
|
|
44369
|
+
const resolveSentryRelease = () => process.env.SENTRY_RELEASE || `react-doctor@0.5.6-dev.424d8f9`;
|
|
44332
44370
|
/**
|
|
44333
44371
|
* Deployment environment shown in Sentry's environment filter. Defaults to
|
|
44334
44372
|
* `production` for tagged releases and `development` for dev/unbuilt versions,
|
|
44335
44373
|
* overridable via the standard `SENTRY_ENVIRONMENT` env var.
|
|
44336
44374
|
*/
|
|
44337
|
-
const resolveSentryEnvironment = () => process.env.SENTRY_ENVIRONMENT || (isDevVersion("0.5.6-dev.
|
|
44375
|
+
const resolveSentryEnvironment = () => process.env.SENTRY_ENVIRONMENT || (isDevVersion("0.5.6-dev.424d8f9") ? "development" : "production");
|
|
44338
44376
|
/**
|
|
44339
44377
|
* Performance-tracing sample rate in `[0, 1]`. Reads `SENTRY_TRACES_SAMPLE_RATE`
|
|
44340
44378
|
* (set to `0` to disable tracing) and falls back to
|
|
@@ -48116,7 +48154,7 @@ const AGENT_GUIDANCE_LINES = [
|
|
|
48116
48154
|
"Investigate deeply where relevant: race conditions, security-sensitive flows, state propagation, multi-file refactors, and downstream dependency chains.",
|
|
48117
48155
|
"Ignore pure style preferences, theoretical issues without real impact, missing features, and unrelated pre-existing code.",
|
|
48118
48156
|
"Start with high-confidence fixes that preserve behavior. Leave low-confidence or product-dependent changes as notes.",
|
|
48119
|
-
"Run `npx react-doctor@latest --verbose --
|
|
48157
|
+
"Run `npx react-doctor@latest --verbose --scope changed` before and after changes, plus relevant tests after each focused batch.",
|
|
48120
48158
|
"When available, spawn subagents or isolated worktrees for independent rule families, then review and merge only the best safe fixes.",
|
|
48121
48159
|
"Split unrelated, broad, or behavior-changing work into separate PRs/branches instead of one large cleanup.",
|
|
48122
48160
|
"For confirmed issues that cannot be fixed now, create GitHub issues with the rule, file/line, confidence, impact, and proposed fix.",
|
|
@@ -50758,22 +50796,22 @@ const buildAgentHookScript = () => [
|
|
|
50758
50796
|
"",
|
|
50759
50797
|
"run_react_doctor() {",
|
|
50760
50798
|
" if [ -x ./node_modules/.bin/react-doctor ]; then",
|
|
50761
|
-
" ./node_modules/.bin/react-doctor --verbose --
|
|
50799
|
+
" ./node_modules/.bin/react-doctor --verbose --scope changed --blocking warning --no-score",
|
|
50762
50800
|
" return",
|
|
50763
50801
|
" fi",
|
|
50764
50802
|
"",
|
|
50765
50803
|
" if command -v react-doctor >/dev/null 2>&1; then",
|
|
50766
|
-
" react-doctor --verbose --
|
|
50804
|
+
" react-doctor --verbose --scope changed --blocking warning --no-score",
|
|
50767
50805
|
" return",
|
|
50768
50806
|
" fi",
|
|
50769
50807
|
"",
|
|
50770
50808
|
" if command -v pnpm >/dev/null 2>&1; then",
|
|
50771
|
-
" pnpm dlx react-doctor@latest --verbose --
|
|
50809
|
+
" pnpm dlx react-doctor@latest --verbose --scope changed --blocking warning --no-score",
|
|
50772
50810
|
" return",
|
|
50773
50811
|
" fi",
|
|
50774
50812
|
"",
|
|
50775
50813
|
" if command -v npx >/dev/null 2>&1; then",
|
|
50776
|
-
" npx --yes react-doctor@latest --verbose --
|
|
50814
|
+
" npx --yes react-doctor@latest --verbose --scope changed --blocking warning --no-score",
|
|
50777
50815
|
" return",
|
|
50778
50816
|
" fi",
|
|
50779
50817
|
"",
|
|
@@ -53870,7 +53908,7 @@ ${highlighter.dim("Examples:")}
|
|
|
53870
53908
|
${formatExampleLines([
|
|
53871
53909
|
["react-doctor", "scan the current project"],
|
|
53872
53910
|
["react-doctor ./apps/web", "scan a specific directory"],
|
|
53873
|
-
["react-doctor --
|
|
53911
|
+
["react-doctor --scope changed --base main", "scan only new issues vs. main"],
|
|
53874
53912
|
["react-doctor --project modules/a,modules/b", "score each module separately (names or paths)"],
|
|
53875
53913
|
["react-doctor --staged", "scan staged files (pre-commit hook)"],
|
|
53876
53914
|
["react-doctor --category Security", "show only one diagnostic category"],
|
|
@@ -53946,4 +53984,4 @@ Promise.resolve().then(() => assertNoRemovedFlags(process.argv)).then(() => prog
|
|
|
53946
53984
|
export {};
|
|
53947
53985
|
|
|
53948
53986
|
//# sourceMappingURL=cli.js.map
|
|
53949
|
-
//# debugId=
|
|
53987
|
+
//# debugId=fc691f8f-4aa6-5f96-8491-8e4e53439952
|
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]="3b9fafb6-a936-52a2-96df-a26760fdafc1")}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";
|
|
@@ -36472,10 +36472,15 @@ const buildCapabilities = (project) => {
|
|
|
36472
36472
|
}
|
|
36473
36473
|
if (project.tailwindVersion !== null) {
|
|
36474
36474
|
capabilities.add("tailwind");
|
|
36475
|
-
|
|
36475
|
+
const tailwind = parseTailwindMajorMinor(project.tailwindVersion);
|
|
36476
|
+
if (isTailwindAtLeast(tailwind, {
|
|
36476
36477
|
major: 3,
|
|
36477
36478
|
minor: 4
|
|
36478
36479
|
})) capabilities.add("tailwind:3.4");
|
|
36480
|
+
if (tailwind !== null && isTailwindAtLeast(tailwind, {
|
|
36481
|
+
major: 4,
|
|
36482
|
+
minor: 0
|
|
36483
|
+
})) capabilities.add("tailwind:4");
|
|
36479
36484
|
}
|
|
36480
36485
|
if (project.zodVersion !== null) {
|
|
36481
36486
|
capabilities.add("zod");
|
|
@@ -38084,8 +38089,8 @@ const buildUserPluginRules = (userPlugin, severityControls) => {
|
|
|
38084
38089
|
}
|
|
38085
38090
|
return enabled;
|
|
38086
38091
|
};
|
|
38087
|
-
const createOxlintConfig = ({ pluginPath, project, customRulesOnly = false, extendsPaths = [], ignoredTags = /* @__PURE__ */ new Set(), serverAuthFunctionNames, severityControls, userPlugins = [] }) => {
|
|
38088
|
-
const reactHooksJsPlugin = resolveReactHooksJsPlugin(project.hasReactCompiler, customRulesOnly);
|
|
38092
|
+
const createOxlintConfig = ({ pluginPath, project, customRulesOnly = false, extendsPaths = [], ignoredTags = /* @__PURE__ */ new Set(), serverAuthFunctionNames, severityControls, userPlugins = [], disableReactHooksJsPlugin = false }) => {
|
|
38093
|
+
const reactHooksJsPlugin = disableReactHooksJsPlugin ? null : resolveReactHooksJsPlugin(project.hasReactCompiler, customRulesOnly);
|
|
38089
38094
|
const reactCompilerRules = reactHooksJsPlugin ? applyRuleSeverityControls(filterRulesToAvailable(REACT_COMPILER_RULES, "react-hooks-js", reactHooksJsPlugin.availableRuleNames), severityControls) : {};
|
|
38090
38095
|
const jsPlugins = [];
|
|
38091
38096
|
if (reactHooksJsPlugin) jsPlugins.push(reactHooksJsPlugin.entry);
|
|
@@ -38782,9 +38787,9 @@ const parseOxlintOutput = (stdout, project, rootDirectory) => {
|
|
|
38782
38787
|
try {
|
|
38783
38788
|
parsed = JSON.parse(sanitizedStdout);
|
|
38784
38789
|
} catch {
|
|
38785
|
-
throw new ReactDoctorError({ reason: new OxlintOutputUnparseable({ preview: stdout.slice(0,
|
|
38790
|
+
throw new ReactDoctorError({ reason: new OxlintOutputUnparseable({ preview: stdout.slice(0, 600) }) });
|
|
38786
38791
|
}
|
|
38787
|
-
if (!isOxlintOutput(parsed)) throw new ReactDoctorError({ reason: new OxlintOutputUnparseable({ preview: stdout.slice(0,
|
|
38792
|
+
if (!isOxlintOutput(parsed)) throw new ReactDoctorError({ reason: new OxlintOutputUnparseable({ preview: stdout.slice(0, 600) }) });
|
|
38788
38793
|
const minifiedFileCache = /* @__PURE__ */ new Map();
|
|
38789
38794
|
const isMinifiedDiagnosticFile = (filename) => {
|
|
38790
38795
|
const absolutePath = Path.isAbsolute(filename) ? filename : Path.resolve(rootDirectory || ".", filename);
|
|
@@ -39075,6 +39080,28 @@ const writeOxlintConfig = (configPath, configToWrite) => {
|
|
|
39075
39080
|
NFS.closeSync(fileHandle);
|
|
39076
39081
|
}
|
|
39077
39082
|
};
|
|
39083
|
+
const REACT_HOOKS_JS_DROP_PREFIX = "React Compiler rules (react-hooks-js/*) skipped — eslint-plugin-react-hooks failed to load in this environment";
|
|
39084
|
+
/**
|
|
39085
|
+
* Detects an oxlint config-load crash caused by the optional
|
|
39086
|
+
* `react-hooks-js` (eslint-plugin-react-hooks) React Compiler plugin and
|
|
39087
|
+
* builds the partial-failure note for it; returns `null` when the failure
|
|
39088
|
+
* was anything else.
|
|
39089
|
+
*
|
|
39090
|
+
* oxlint prints a framed error to stdout (not stderr) and exits non-zero
|
|
39091
|
+
* when a `jsPlugins` entry can't be imported; that non-JSON stdout
|
|
39092
|
+
* surfaces as `OxlintOutputUnparseable`. Because oxlint fails the WHOLE
|
|
39093
|
+
* config load on it, leaving the plugin in would drop every curated
|
|
39094
|
+
* react-doctor diagnostic too — so the caller retries with the plugin
|
|
39095
|
+
* stripped (issue #833). Both markers sit at the start of oxlint's
|
|
39096
|
+
* message, so they survive the `preview` slice even for deep pnpm paths.
|
|
39097
|
+
*/
|
|
39098
|
+
const reactHooksJsPluginDropNote = (error) => {
|
|
39099
|
+
if (!(error instanceof ReactDoctorError) || error.reason._tag !== "OxlintOutputUnparseable") return null;
|
|
39100
|
+
const { preview } = error.reason;
|
|
39101
|
+
if (!preview.includes("Failed to load JS plugin") || !preview.includes("eslint-plugin-react-hooks")) return null;
|
|
39102
|
+
const underlyingReason = preview.match(/Error:[^\n]*/)?.[0]?.trim();
|
|
39103
|
+
return `${REACT_HOOKS_JS_DROP_PREFIX}${underlyingReason ? `: ${underlyingReason}` : ""}. Other rules ran normally.`;
|
|
39104
|
+
};
|
|
39078
39105
|
/**
|
|
39079
39106
|
* The oxlint runner. Composed of three pieces in `runners/oxlint/`:
|
|
39080
39107
|
*
|
|
@@ -39102,15 +39129,16 @@ const runOxlint = async (options) => {
|
|
|
39102
39129
|
const pluginPath = resolvePluginPath();
|
|
39103
39130
|
const extendsPaths = (adoptExistingLintConfig && !customRulesOnly ? detectUserLintConfigPaths(rootDirectory) : []).filter(canOxlintExtendConfig);
|
|
39104
39131
|
const userPlugins = resolveUserPlugins(userConfig?.plugins, configSourceDirectory);
|
|
39105
|
-
const buildConfig = (
|
|
39132
|
+
const buildConfig = (overrides) => createOxlintConfig({
|
|
39106
39133
|
pluginPath,
|
|
39107
39134
|
project,
|
|
39108
39135
|
customRulesOnly,
|
|
39109
|
-
extendsPaths:
|
|
39136
|
+
extendsPaths: overrides.extendsPaths,
|
|
39110
39137
|
ignoredTags,
|
|
39111
39138
|
serverAuthFunctionNames,
|
|
39112
39139
|
severityControls,
|
|
39113
|
-
userPlugins
|
|
39140
|
+
userPlugins,
|
|
39141
|
+
disableReactHooksJsPlugin: overrides.disableReactHooksJsPlugin
|
|
39114
39142
|
});
|
|
39115
39143
|
const restoreDisableDirectives = respectInlineDisables ? () => {} : await neutralizeDisableDirectives(rootDirectory, includePaths);
|
|
39116
39144
|
const configDirectory = NFS.mkdtempSync(Path.join(os.tmpdir(), "react-doctor-oxlintrc-"));
|
|
@@ -39146,12 +39174,22 @@ const runOxlint = async (options) => {
|
|
|
39146
39174
|
outputMaxBytes,
|
|
39147
39175
|
concurrency: options.concurrency
|
|
39148
39176
|
});
|
|
39149
|
-
writeOxlintConfig(configPath, buildConfig(extendsPaths));
|
|
39177
|
+
writeOxlintConfig(configPath, buildConfig({ extendsPaths }));
|
|
39150
39178
|
try {
|
|
39151
39179
|
return await runBatches();
|
|
39152
39180
|
} catch (error) {
|
|
39181
|
+
const reactHooksJsDropNote = reactHooksJsPluginDropNote(error);
|
|
39182
|
+
if (reactHooksJsDropNote !== null) {
|
|
39183
|
+
writeOxlintConfig(configPath, buildConfig({
|
|
39184
|
+
extendsPaths,
|
|
39185
|
+
disableReactHooksJsPlugin: true
|
|
39186
|
+
}));
|
|
39187
|
+
const diagnostics = await runBatches();
|
|
39188
|
+
onPartialFailure?.(reactHooksJsDropNote);
|
|
39189
|
+
return diagnostics;
|
|
39190
|
+
}
|
|
39153
39191
|
if (extendsPaths.length === 0) throw error;
|
|
39154
|
-
writeOxlintConfig(configPath, buildConfig([]));
|
|
39192
|
+
writeOxlintConfig(configPath, buildConfig({ extendsPaths: [] }));
|
|
39155
39193
|
return await runBatches();
|
|
39156
39194
|
}
|
|
39157
39195
|
} finally {
|
|
@@ -40571,4 +40609,4 @@ const toJsonReport = (result, options) => buildJsonReport({
|
|
|
40571
40609
|
export { AmbiguousProjectError, NoReactDependencyError, NotADirectoryError, PackageJsonNotFoundError, ProjectNotFoundError, ReactDoctorError, buildJsonReport, buildJsonReportError, clearCaches, defineConfig, diagnose, filterSourceFiles, getDiffInfo, isProjectDiscoveryError, isReactDoctorError, summarizeDiagnostics, toJsonReport };
|
|
40572
40610
|
|
|
40573
40611
|
//# sourceMappingURL=index.js.map
|
|
40574
|
-
//# debugId=
|
|
40612
|
+
//# debugId=3b9fafb6-a936-52a2-96df-a26760fdafc1
|
package/dist/lsp.js
CHANGED
|
@@ -36458,10 +36458,15 @@ const buildCapabilities = (project) => {
|
|
|
36458
36458
|
}
|
|
36459
36459
|
if (project.tailwindVersion !== null) {
|
|
36460
36460
|
capabilities.add("tailwind");
|
|
36461
|
-
|
|
36461
|
+
const tailwind = parseTailwindMajorMinor(project.tailwindVersion);
|
|
36462
|
+
if (isTailwindAtLeast(tailwind, {
|
|
36462
36463
|
major: 3,
|
|
36463
36464
|
minor: 4
|
|
36464
36465
|
})) capabilities.add("tailwind:3.4");
|
|
36466
|
+
if (tailwind !== null && isTailwindAtLeast(tailwind, {
|
|
36467
|
+
major: 4,
|
|
36468
|
+
minor: 0
|
|
36469
|
+
})) capabilities.add("tailwind:4");
|
|
36465
36470
|
}
|
|
36466
36471
|
if (project.zodVersion !== null) {
|
|
36467
36472
|
capabilities.add("zod");
|
|
@@ -38070,8 +38075,8 @@ const buildUserPluginRules = (userPlugin, severityControls) => {
|
|
|
38070
38075
|
}
|
|
38071
38076
|
return enabled;
|
|
38072
38077
|
};
|
|
38073
|
-
const createOxlintConfig = ({ pluginPath, project, customRulesOnly = false, extendsPaths = [], ignoredTags = /* @__PURE__ */ new Set(), serverAuthFunctionNames, severityControls, userPlugins = [] }) => {
|
|
38074
|
-
const reactHooksJsPlugin = resolveReactHooksJsPlugin(project.hasReactCompiler, customRulesOnly);
|
|
38078
|
+
const createOxlintConfig = ({ pluginPath, project, customRulesOnly = false, extendsPaths = [], ignoredTags = /* @__PURE__ */ new Set(), serverAuthFunctionNames, severityControls, userPlugins = [], disableReactHooksJsPlugin = false }) => {
|
|
38079
|
+
const reactHooksJsPlugin = disableReactHooksJsPlugin ? null : resolveReactHooksJsPlugin(project.hasReactCompiler, customRulesOnly);
|
|
38075
38080
|
const reactCompilerRules = reactHooksJsPlugin ? applyRuleSeverityControls(filterRulesToAvailable(REACT_COMPILER_RULES, "react-hooks-js", reactHooksJsPlugin.availableRuleNames), severityControls) : {};
|
|
38076
38081
|
const jsPlugins = [];
|
|
38077
38082
|
if (reactHooksJsPlugin) jsPlugins.push(reactHooksJsPlugin.entry);
|
|
@@ -38768,9 +38773,9 @@ const parseOxlintOutput = (stdout, project, rootDirectory) => {
|
|
|
38768
38773
|
try {
|
|
38769
38774
|
parsed = JSON.parse(sanitizedStdout);
|
|
38770
38775
|
} catch {
|
|
38771
|
-
throw new ReactDoctorError({ reason: new OxlintOutputUnparseable({ preview: stdout.slice(0,
|
|
38776
|
+
throw new ReactDoctorError({ reason: new OxlintOutputUnparseable({ preview: stdout.slice(0, 600) }) });
|
|
38772
38777
|
}
|
|
38773
|
-
if (!isOxlintOutput(parsed)) throw new ReactDoctorError({ reason: new OxlintOutputUnparseable({ preview: stdout.slice(0,
|
|
38778
|
+
if (!isOxlintOutput(parsed)) throw new ReactDoctorError({ reason: new OxlintOutputUnparseable({ preview: stdout.slice(0, 600) }) });
|
|
38774
38779
|
const minifiedFileCache = /* @__PURE__ */ new Map();
|
|
38775
38780
|
const isMinifiedDiagnosticFile = (filename) => {
|
|
38776
38781
|
const absolutePath = Path.isAbsolute(filename) ? filename : Path.resolve(rootDirectory || ".", filename);
|
|
@@ -39061,6 +39066,28 @@ const writeOxlintConfig = (configPath, configToWrite) => {
|
|
|
39061
39066
|
NFS.closeSync(fileHandle);
|
|
39062
39067
|
}
|
|
39063
39068
|
};
|
|
39069
|
+
const REACT_HOOKS_JS_DROP_PREFIX = "React Compiler rules (react-hooks-js/*) skipped — eslint-plugin-react-hooks failed to load in this environment";
|
|
39070
|
+
/**
|
|
39071
|
+
* Detects an oxlint config-load crash caused by the optional
|
|
39072
|
+
* `react-hooks-js` (eslint-plugin-react-hooks) React Compiler plugin and
|
|
39073
|
+
* builds the partial-failure note for it; returns `null` when the failure
|
|
39074
|
+
* was anything else.
|
|
39075
|
+
*
|
|
39076
|
+
* oxlint prints a framed error to stdout (not stderr) and exits non-zero
|
|
39077
|
+
* when a `jsPlugins` entry can't be imported; that non-JSON stdout
|
|
39078
|
+
* surfaces as `OxlintOutputUnparseable`. Because oxlint fails the WHOLE
|
|
39079
|
+
* config load on it, leaving the plugin in would drop every curated
|
|
39080
|
+
* react-doctor diagnostic too — so the caller retries with the plugin
|
|
39081
|
+
* stripped (issue #833). Both markers sit at the start of oxlint's
|
|
39082
|
+
* message, so they survive the `preview` slice even for deep pnpm paths.
|
|
39083
|
+
*/
|
|
39084
|
+
const reactHooksJsPluginDropNote = (error) => {
|
|
39085
|
+
if (!(error instanceof ReactDoctorError) || error.reason._tag !== "OxlintOutputUnparseable") return null;
|
|
39086
|
+
const { preview } = error.reason;
|
|
39087
|
+
if (!preview.includes("Failed to load JS plugin") || !preview.includes("eslint-plugin-react-hooks")) return null;
|
|
39088
|
+
const underlyingReason = preview.match(/Error:[^\n]*/)?.[0]?.trim();
|
|
39089
|
+
return `${REACT_HOOKS_JS_DROP_PREFIX}${underlyingReason ? `: ${underlyingReason}` : ""}. Other rules ran normally.`;
|
|
39090
|
+
};
|
|
39064
39091
|
/**
|
|
39065
39092
|
* The oxlint runner. Composed of three pieces in `runners/oxlint/`:
|
|
39066
39093
|
*
|
|
@@ -39088,15 +39115,16 @@ const runOxlint = async (options) => {
|
|
|
39088
39115
|
const pluginPath = resolvePluginPath();
|
|
39089
39116
|
const extendsPaths = (adoptExistingLintConfig && !customRulesOnly ? detectUserLintConfigPaths(rootDirectory) : []).filter(canOxlintExtendConfig);
|
|
39090
39117
|
const userPlugins = resolveUserPlugins(userConfig?.plugins, configSourceDirectory);
|
|
39091
|
-
const buildConfig = (
|
|
39118
|
+
const buildConfig = (overrides) => createOxlintConfig({
|
|
39092
39119
|
pluginPath,
|
|
39093
39120
|
project,
|
|
39094
39121
|
customRulesOnly,
|
|
39095
|
-
extendsPaths:
|
|
39122
|
+
extendsPaths: overrides.extendsPaths,
|
|
39096
39123
|
ignoredTags,
|
|
39097
39124
|
serverAuthFunctionNames,
|
|
39098
39125
|
severityControls,
|
|
39099
|
-
userPlugins
|
|
39126
|
+
userPlugins,
|
|
39127
|
+
disableReactHooksJsPlugin: overrides.disableReactHooksJsPlugin
|
|
39100
39128
|
});
|
|
39101
39129
|
const restoreDisableDirectives = respectInlineDisables ? () => {} : await neutralizeDisableDirectives(rootDirectory, includePaths);
|
|
39102
39130
|
const configDirectory = NFS.mkdtempSync(Path.join(os.tmpdir(), "react-doctor-oxlintrc-"));
|
|
@@ -39132,12 +39160,22 @@ const runOxlint = async (options) => {
|
|
|
39132
39160
|
outputMaxBytes,
|
|
39133
39161
|
concurrency: options.concurrency
|
|
39134
39162
|
});
|
|
39135
|
-
writeOxlintConfig(configPath, buildConfig(extendsPaths));
|
|
39163
|
+
writeOxlintConfig(configPath, buildConfig({ extendsPaths }));
|
|
39136
39164
|
try {
|
|
39137
39165
|
return await runBatches();
|
|
39138
39166
|
} catch (error) {
|
|
39167
|
+
const reactHooksJsDropNote = reactHooksJsPluginDropNote(error);
|
|
39168
|
+
if (reactHooksJsDropNote !== null) {
|
|
39169
|
+
writeOxlintConfig(configPath, buildConfig({
|
|
39170
|
+
extendsPaths,
|
|
39171
|
+
disableReactHooksJsPlugin: true
|
|
39172
|
+
}));
|
|
39173
|
+
const diagnostics = await runBatches();
|
|
39174
|
+
onPartialFailure?.(reactHooksJsDropNote);
|
|
39175
|
+
return diagnostics;
|
|
39176
|
+
}
|
|
39139
39177
|
if (extendsPaths.length === 0) throw error;
|
|
39140
|
-
writeOxlintConfig(configPath, buildConfig([]));
|
|
39178
|
+
writeOxlintConfig(configPath, buildConfig({ extendsPaths: [] }));
|
|
39141
39179
|
return await runBatches();
|
|
39142
39180
|
}
|
|
39143
39181
|
} finally {
|
|
@@ -42356,5 +42394,5 @@ const startLanguageServer = () => {
|
|
|
42356
42394
|
};
|
|
42357
42395
|
//#endregion
|
|
42358
42396
|
export { startLanguageServer };
|
|
42359
|
-
!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]="
|
|
42360
|
-
//# debugId=
|
|
42397
|
+
!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]="90262051-3b30-5292-8128-962466deb4ac")}catch(e){}}();
|
|
42398
|
+
//# debugId=90262051-3b30-5292-8128-962466deb4ac
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "react-doctor",
|
|
3
|
-
"version": "0.5.6-dev.
|
|
3
|
+
"version": "0.5.6-dev.424d8f9",
|
|
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.6-dev.
|
|
67
|
+
"oxlint-plugin-react-doctor": "0.5.6-dev.424d8f9"
|
|
68
68
|
},
|
|
69
69
|
"devDependencies": {
|
|
70
70
|
"@types/babel__code-frame": "^7.27.0",
|