react-doctor 0.4.2-dev.829655c → 0.4.2-dev.a59499b
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 +102 -49
- package/dist/index.js +10 -8
- package/dist/lsp.js +13 -9
- 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]="e5cd8a39-286b-53d3-8951-268670de9a6a")}catch(e){}}();
|
|
3
3
|
import { createRequire } from "node:module";
|
|
4
4
|
import { execFile, execFileSync, spawn, spawnSync } from "node:child_process";
|
|
5
5
|
import * as path$1 from "node:path";
|
|
@@ -5151,8 +5151,8 @@ const isFile = (filePath) => {
|
|
|
5151
5151
|
return false;
|
|
5152
5152
|
}
|
|
5153
5153
|
};
|
|
5154
|
-
const SOURCE_FILE_PATTERN = /\.(tsx?|jsx
|
|
5155
|
-
const GENERATED_BUNDLE_FILE_PATTERN = /\.(iife|umd|global|min)\.js$/i;
|
|
5154
|
+
const SOURCE_FILE_PATTERN = /\.(tsx?|jsx?|mts|mjs)$/;
|
|
5155
|
+
const GENERATED_BUNDLE_FILE_PATTERN = /\.(iife|umd|global|min)\.m?js$/i;
|
|
5156
5156
|
const MINIFIED_SNIFF_BYTES = 65536;
|
|
5157
5157
|
const GIT_LS_FILES_MAX_BUFFER_BYTES = 50 * 1024 * 1024;
|
|
5158
5158
|
const IGNORED_DIRECTORIES = new Set([
|
|
@@ -8555,7 +8555,9 @@ const setColorEnabled = (enabled) => {
|
|
|
8555
8555
|
highlighter.gray = colors.gray;
|
|
8556
8556
|
highlighter.bold = colors.bold;
|
|
8557
8557
|
};
|
|
8558
|
-
const
|
|
8558
|
+
const NEXT_ENTRY_FILE_PATTERN = /^(?:\.\/)?(?:src\/)?(?:middleware|proxy)\.(?:tsx?|jsx?|mts|mjs)$/;
|
|
8559
|
+
const shouldIncludeExplicitLintPath = (filePath, project) => JSX_FILE_PATTERN.test(filePath) || project?.framework === "nextjs" && NEXT_ENTRY_FILE_PATTERN.test(filePath);
|
|
8560
|
+
const computeExplicitLintIncludePaths = (includePaths, project) => includePaths.length > 0 ? includePaths.filter((filePath) => shouldIncludeExplicitLintPath(filePath, project)) : void 0;
|
|
8559
8561
|
const LINGUIST_ATTRIBUTE_PATTERN = /^linguist-(?:vendored|generated)(?:=([a-zA-Z0-9]+))?$/i;
|
|
8560
8562
|
const FALSY_VALUES = new Set([
|
|
8561
8563
|
"false",
|
|
@@ -9105,11 +9107,11 @@ const listSourceFilesViaFilesystem = (rootDirectory) => {
|
|
|
9105
9107
|
return filePaths;
|
|
9106
9108
|
};
|
|
9107
9109
|
const listSourceFiles = (rootDirectory) => excludeMinifiedFiles(rootDirectory, listSourceFilesViaGit(rootDirectory) ?? listSourceFilesViaFilesystem(rootDirectory));
|
|
9108
|
-
const resolveLintIncludePaths = (rootDirectory, userConfig) => {
|
|
9110
|
+
const resolveLintIncludePaths = (rootDirectory, userConfig, project) => {
|
|
9109
9111
|
if (!Array.isArray(userConfig?.ignore?.files) || userConfig.ignore.files.length === 0) return;
|
|
9110
9112
|
const ignoredPatterns = compileIgnoredFilePatterns(userConfig);
|
|
9111
9113
|
return listSourceFiles(rootDirectory).filter((filePath) => {
|
|
9112
|
-
if (!
|
|
9114
|
+
if (!shouldIncludeExplicitLintPath(filePath, project)) return false;
|
|
9113
9115
|
return !isFileIgnoredByPatterns(filePath, rootDirectory, ignoredPatterns);
|
|
9114
9116
|
});
|
|
9115
9117
|
};
|
|
@@ -11461,7 +11463,7 @@ const runInspect = (input, hooks = {}) => Effect.gen(function* () {
|
|
|
11461
11463
|
directory: scanDirectory,
|
|
11462
11464
|
repo
|
|
11463
11465
|
}).pipe(Effect.orElseSucceed(() => null)) : Effect.succeed(null));
|
|
11464
|
-
const lintIncludePaths = (input.skipJsxIncludeFilter ? input.includePaths.length > 0 ? [...input.includePaths] : void 0 :
|
|
11466
|
+
const lintIncludePaths = (input.skipJsxIncludeFilter ? input.includePaths.length > 0 ? [...input.includePaths] : void 0 : computeExplicitLintIncludePaths([...input.includePaths], project)) ?? resolveLintIncludePaths(scanDirectory, resolvedConfig.config, project);
|
|
11465
11467
|
const scannedFilePaths = input.suppressScanSummary ? (lintIncludePaths ?? (yield* filesService.listSourceFiles(scanDirectory))).map((relativePath) => path$1.resolve(scanDirectory, relativePath)) : [];
|
|
11466
11468
|
const beforeLint = hooks.beforeLint ?? NO_HOOKS.beforeLint;
|
|
11467
11469
|
const afterLint = hooks.afterLint ?? NO_HOOKS.afterLint;
|
|
@@ -12247,7 +12249,7 @@ const makeNoopConsole = () => ({
|
|
|
12247
12249
|
});
|
|
12248
12250
|
//#endregion
|
|
12249
12251
|
//#region src/cli/utils/version.ts
|
|
12250
|
-
const VERSION = "0.4.2-dev.
|
|
12252
|
+
const VERSION = "0.4.2-dev.a59499b";
|
|
12251
12253
|
//#endregion
|
|
12252
12254
|
//#region src/cli/utils/json-mode.ts
|
|
12253
12255
|
let context = null;
|
|
@@ -12605,13 +12607,13 @@ const isDevVersion = (version) => version === "0.0.0" || version.includes("-");
|
|
|
12605
12607
|
* uploads source-map artifacts under, so stack frames symbolicate. Honors the
|
|
12606
12608
|
* standard `SENTRY_RELEASE` override.
|
|
12607
12609
|
*/
|
|
12608
|
-
const resolveSentryRelease = () => process.env.SENTRY_RELEASE || `react-doctor@0.4.2-dev.
|
|
12610
|
+
const resolveSentryRelease = () => process.env.SENTRY_RELEASE || `react-doctor@0.4.2-dev.a59499b`;
|
|
12609
12611
|
/**
|
|
12610
12612
|
* Deployment environment shown in Sentry's environment filter. Defaults to
|
|
12611
12613
|
* `production` for tagged releases and `development` for dev/unbuilt versions,
|
|
12612
12614
|
* overridable via the standard `SENTRY_ENVIRONMENT` env var.
|
|
12613
12615
|
*/
|
|
12614
|
-
const resolveSentryEnvironment = () => process.env.SENTRY_ENVIRONMENT || (isDevVersion("0.4.2-dev.
|
|
12616
|
+
const resolveSentryEnvironment = () => process.env.SENTRY_ENVIRONMENT || (isDevVersion("0.4.2-dev.a59499b") ? "development" : "production");
|
|
12615
12617
|
/**
|
|
12616
12618
|
* Performance-tracing sample rate in `[0, 1]`. Reads `SENTRY_TRACES_SAMPLE_RATE`
|
|
12617
12619
|
* (set to `0` to disable tracing) and falls back to
|
|
@@ -15874,13 +15876,14 @@ const buildRuntimeLayers = (input) => {
|
|
|
15874
15876
|
const linterLayer = input.shouldSkipLint ? Linter.layerOf([]) : Linter.layerOxlint;
|
|
15875
15877
|
const deadCodeLayer = input.shouldRunDeadCode ? DeadCode.layerNode : DeadCode.layerOf([]);
|
|
15876
15878
|
const scoreLayer = input.shouldComputeScore ? Score.layerHttp : Score.layerOf(null);
|
|
15879
|
+
const projectLayer = input.projectInfoOverride === void 0 ? Project.layerNode : Project.layerOf(input.projectInfoOverride);
|
|
15877
15880
|
const progressLayer = input.shouldShowProgressSpinners ? Progress.layerOra(buildSpinnerProgressHandle) : Progress.layerNoop;
|
|
15878
15881
|
const configLayer = input.hasConfigOverride ? Config.layerOf({
|
|
15879
15882
|
config: input.userConfig,
|
|
15880
15883
|
resolvedDirectory: input.directory,
|
|
15881
15884
|
configSourceDirectory: input.configSourceDirectory
|
|
15882
15885
|
}) : Config.layerNode;
|
|
15883
|
-
const baseLayers = Layer.mergeAll(
|
|
15886
|
+
const baseLayers = Layer.mergeAll(projectLayer, configLayer, Files.layerNode, Git.layerNode, linterLayer, LintPartialFailures.layerLive, deadCodeLayer, progressLayer, Reporter.layerNoop, scoreLayer);
|
|
15884
15887
|
return input.oxlintConcurrency === void 0 ? baseLayers : Layer.mergeAll(baseLayers, Layer.succeed(OxlintConcurrency, input.oxlintConcurrency));
|
|
15885
15888
|
};
|
|
15886
15889
|
//#endregion
|
|
@@ -16806,6 +16809,9 @@ const computeProjectedScore = async (topErrorSource, rescoreSource, currentScore
|
|
|
16806
16809
|
if (!potentialScore || potentialScore.score <= currentScore.score) return null;
|
|
16807
16810
|
return potentialScore.score;
|
|
16808
16811
|
};
|
|
16812
|
+
//#endregion
|
|
16813
|
+
//#region src/cli/utils/filter-diagnostics-by-categories.ts
|
|
16814
|
+
const filterDiagnosticsByCategories = (diagnostics, categories) => categories.size === 0 ? [...diagnostics] : diagnostics.filter((diagnostic) => categories.has(diagnostic.category));
|
|
16809
16815
|
const FORCE_ONBOARDING_ENV_VAR = "REACT_DOCTOR_FORCE_ONBOARDING";
|
|
16810
16816
|
const FALSY_FLAG_VALUES = new Set([
|
|
16811
16817
|
"",
|
|
@@ -17236,11 +17242,47 @@ const resolveOxlintNodeEffect = (isLintEnabled, isQuiet) => Effect.gen(function*
|
|
|
17236
17242
|
});
|
|
17237
17243
|
const resolveOxlintNode = (isLintEnabled, isQuiet) => Effect.runPromise(resolveOxlintNodeEffect(isLintEnabled, isQuiet).pipe(Effect.provide(NodeResolver.layerNode)));
|
|
17238
17244
|
//#endregion
|
|
17245
|
+
//#region src/cli/utils/cli-input-error.ts
|
|
17246
|
+
/**
|
|
17247
|
+
* A mistake in *how the CLI was invoked* — a malformed `<file>:<line>`
|
|
17248
|
+
* argument, mutually exclusive flags, or an unknown `--project` name. This is
|
|
17249
|
+
* user input, not a react-doctor bug, so `isExpectedUserError` routes it
|
|
17250
|
+
* through `handleUserError`: a clean, single-line message with no Sentry
|
|
17251
|
+
* report and no "Something went wrong, open a prefilled issue" block.
|
|
17252
|
+
*
|
|
17253
|
+
* The `message` is rendered verbatim, so it must read as a complete,
|
|
17254
|
+
* human-readable sentence that tells the user how to fix their invocation.
|
|
17255
|
+
*/
|
|
17256
|
+
var CliInputError = class extends Error {
|
|
17257
|
+
name = "CliInputError";
|
|
17258
|
+
};
|
|
17259
|
+
//#endregion
|
|
17260
|
+
//#region src/cli/utils/resolve-cli-categories.ts
|
|
17261
|
+
const categoryByLowercase = new Map(DIAGNOSTIC_CATEGORY_BUCKETS.map((category) => [category.toLowerCase(), category]));
|
|
17262
|
+
const knownCategoryList = DIAGNOSTIC_CATEGORY_BUCKETS.join(", ");
|
|
17263
|
+
const splitCategoryFlagValue = (value) => value.split(",").map((category) => category.trim()).filter((category) => category.length > 0);
|
|
17264
|
+
const resolveCliCategories = (categoryFlag) => {
|
|
17265
|
+
const rawCategoryValues = categoryFlag === void 0 ? [] : Array.isArray(categoryFlag) ? categoryFlag : [categoryFlag];
|
|
17266
|
+
const resolvedCategories = [];
|
|
17267
|
+
const seenCategories = /* @__PURE__ */ new Set();
|
|
17268
|
+
for (const rawCategoryValue of rawCategoryValues) for (const categoryQuery of splitCategoryFlagValue(rawCategoryValue)) {
|
|
17269
|
+
const matchedCategory = categoryByLowercase.get(categoryQuery.toLowerCase());
|
|
17270
|
+
if (matchedCategory === void 0) throw new CliInputError(`Unknown category "${categoryQuery}". Expected one of: ${knownCategoryList}.`);
|
|
17271
|
+
if (!seenCategories.has(matchedCategory)) {
|
|
17272
|
+
seenCategories.add(matchedCategory);
|
|
17273
|
+
resolvedCategories.push(matchedCategory);
|
|
17274
|
+
}
|
|
17275
|
+
}
|
|
17276
|
+
if (rawCategoryValues.length > 0 && resolvedCategories.length === 0) throw new CliInputError(`--category requires one of: ${knownCategoryList}.`);
|
|
17277
|
+
return resolvedCategories.length > 0 ? resolvedCategories : void 0;
|
|
17278
|
+
};
|
|
17279
|
+
//#endregion
|
|
17239
17280
|
//#region src/inspect.ts
|
|
17240
17281
|
const silentConsole = makeNoopConsole();
|
|
17241
17282
|
const runConsole = (effect) => {
|
|
17242
17283
|
Effect.runSync(effect);
|
|
17243
17284
|
};
|
|
17285
|
+
const formatCategorySelection = (categoryFilters) => [...categoryFilters].join(", ");
|
|
17244
17286
|
const buildIgnoredTags = (userConfig) => {
|
|
17245
17287
|
const tags = /* @__PURE__ */ new Set();
|
|
17246
17288
|
if (userConfig?.ignore?.tags) for (const tag of userConfig.ignore.tags) tags.add(tag);
|
|
@@ -17261,6 +17303,7 @@ const mergeInspectOptions = (inputOptions, userConfig) => ({
|
|
|
17261
17303
|
share: userConfig?.share ?? true,
|
|
17262
17304
|
respectInlineDisables: inputOptions.respectInlineDisables ?? userConfig?.respectInlineDisables ?? true,
|
|
17263
17305
|
warnings: inputOptions.warnings ?? userConfig?.warnings ?? true,
|
|
17306
|
+
categoryFilters: new Set(resolveCliCategories(inputOptions.categoryFilters) ?? []),
|
|
17264
17307
|
adoptExistingLintConfig: userConfig?.adoptExistingLintConfig ?? true,
|
|
17265
17308
|
ignoredTags: buildIgnoredTags(userConfig),
|
|
17266
17309
|
outputSurface: inputOptions.outputSurface ?? "cli",
|
|
@@ -17347,6 +17390,7 @@ const runBaselineComparison = async (params) => {
|
|
|
17347
17390
|
hasConfigOverride: true,
|
|
17348
17391
|
userConfig: params.userConfig,
|
|
17349
17392
|
configSourceDirectory: null,
|
|
17393
|
+
projectInfoOverride: params.headProjectInfo,
|
|
17350
17394
|
shouldSkipLint: !params.options.lint || !params.resolvedNodeBinaryPath,
|
|
17351
17395
|
shouldRunDeadCode: false,
|
|
17352
17396
|
shouldComputeScore: false,
|
|
@@ -17446,6 +17490,7 @@ const runInspectWithRuntime = async (directory, options, userConfig, hasConfigOv
|
|
|
17446
17490
|
directory,
|
|
17447
17491
|
options,
|
|
17448
17492
|
userConfig,
|
|
17493
|
+
headProjectInfo: output.project,
|
|
17449
17494
|
headDiagnostics: output.diagnostics,
|
|
17450
17495
|
resolvedNodeBinaryPath,
|
|
17451
17496
|
baselineRef: options.baseline.ref
|
|
@@ -17544,14 +17589,16 @@ const finalizeAndRender = (input) => Effect.gen(function* () {
|
|
|
17544
17589
|
const animateRender = !options.silent && !options.verbose && canAnimateOnboarding(process.stdout);
|
|
17545
17590
|
const pause = onboardingSectionPause(animateRender);
|
|
17546
17591
|
const surfaceDiagnostics = filterDiagnosticsForSurface([...diagnostics], options.outputSurface, userConfig);
|
|
17592
|
+
const printedDiagnostics = filterDiagnosticsByCategories(surfaceDiagnostics, options.categoryFilters);
|
|
17547
17593
|
const demotedDiagnosticCount = diagnostics.length - surfaceDiagnostics.length;
|
|
17548
17594
|
const lintSourceFileCount = options.includePaths.length > 0 ? options.includePaths.length : project.sourceFileCount;
|
|
17549
|
-
if (
|
|
17595
|
+
if (printedDiagnostics.length === 0) {
|
|
17550
17596
|
yield* pause;
|
|
17551
17597
|
if (hasSkippedChecks) {
|
|
17552
17598
|
const skippedLabel = skippedChecks.join(" and ");
|
|
17553
17599
|
yield* Console.warn(highlighter.warn(`No issues detected, but ${skippedLabel} checks failed — results are incomplete.`));
|
|
17554
|
-
} else if (
|
|
17600
|
+
} else if (options.categoryFilters.size > 0) yield* Console.log(highlighter.success(`No issues found in category ${formatCategorySelection(options.categoryFilters)}!`));
|
|
17601
|
+
else if (demotedDiagnosticCount > 0) yield* Console.log(highlighter.success(`No issues found! (${demotedDiagnosticCount} demoted from the ${options.outputSurface} surface — see config.surfaces.)`));
|
|
17555
17602
|
else yield* Console.log(highlighter.success("No issues found!"));
|
|
17556
17603
|
yield* Console.log("");
|
|
17557
17604
|
yield* pause;
|
|
@@ -17564,20 +17611,20 @@ const finalizeAndRender = (input) => Effect.gen(function* () {
|
|
|
17564
17611
|
}
|
|
17565
17612
|
yield* pause;
|
|
17566
17613
|
yield* Console.log("");
|
|
17567
|
-
yield* printDiagnostics([...
|
|
17614
|
+
yield* printDiagnostics([...printedDiagnostics], options.verbose, directory, buildRulePriorityMap([score]), isCodingAgentEnvironment(), {
|
|
17568
17615
|
sectionPause: pause,
|
|
17569
17616
|
animateCountUp: animateRender
|
|
17570
17617
|
});
|
|
17571
17618
|
if (options.isNonInteractiveEnvironment && options.outputSurface !== "prComment") yield* printAgentGuidance();
|
|
17572
|
-
if (demotedDiagnosticCount > 0) {
|
|
17619
|
+
if (options.categoryFilters.size === 0 && demotedDiagnosticCount > 0) {
|
|
17573
17620
|
yield* Console.log(highlighter.gray(` ${demotedDiagnosticCount} demoted from the ${options.outputSurface} surface (e.g. design cleanup) — run \`npx react-doctor@latest .\` locally for the full list.`));
|
|
17574
17621
|
yield* Console.log("");
|
|
17575
17622
|
}
|
|
17576
|
-
const potentialScore = score ? yield* Effect.promise(() => computeProjectedScore([...
|
|
17623
|
+
const potentialScore = score ? yield* Effect.promise(() => computeProjectedScore([...printedDiagnostics], [...surfaceDiagnostics], score)) : null;
|
|
17577
17624
|
const shouldShowShareLink = !options.noScore && options.share && !options.isCi;
|
|
17578
17625
|
yield* pause;
|
|
17579
17626
|
yield* printSummary({
|
|
17580
|
-
diagnostics: [...
|
|
17627
|
+
diagnostics: [...printedDiagnostics],
|
|
17581
17628
|
elapsedMilliseconds,
|
|
17582
17629
|
scoreResult: score,
|
|
17583
17630
|
potentialScore,
|
|
@@ -17593,7 +17640,7 @@ const finalizeAndRender = (input) => Effect.gen(function* () {
|
|
|
17593
17640
|
}
|
|
17594
17641
|
yield* pause;
|
|
17595
17642
|
yield* printFooter({
|
|
17596
|
-
diagnostics: [...
|
|
17643
|
+
diagnostics: [...printedDiagnostics],
|
|
17597
17644
|
scoreResult: score,
|
|
17598
17645
|
projectName: project.projectName,
|
|
17599
17646
|
isOffline: !shouldShowShareLink
|
|
@@ -17724,21 +17771,6 @@ const handleUserError = (error, options = {}) => {
|
|
|
17724
17771
|
process.exitCode = 1;
|
|
17725
17772
|
};
|
|
17726
17773
|
//#endregion
|
|
17727
|
-
//#region src/cli/utils/cli-input-error.ts
|
|
17728
|
-
/**
|
|
17729
|
-
* A mistake in *how the CLI was invoked* — a malformed `<file>:<line>`
|
|
17730
|
-
* argument, mutually exclusive flags, or an unknown `--project` name. This is
|
|
17731
|
-
* user input, not a react-doctor bug, so `isExpectedUserError` routes it
|
|
17732
|
-
* through `handleUserError`: a clean, single-line message with no Sentry
|
|
17733
|
-
* report and no "Something went wrong, open a prefilled issue" block.
|
|
17734
|
-
*
|
|
17735
|
-
* The `message` is rendered verbatim, so it must read as a complete,
|
|
17736
|
-
* human-readable sentence that tells the user how to fix their invocation.
|
|
17737
|
-
*/
|
|
17738
|
-
var CliInputError = class extends Error {
|
|
17739
|
-
name = "CliInputError";
|
|
17740
|
-
};
|
|
17741
|
-
//#endregion
|
|
17742
17774
|
//#region src/cli/utils/is-expected-user-error.ts
|
|
17743
17775
|
/**
|
|
17744
17776
|
* Whether `error` is an expected, user-actionable failure — the user's project
|
|
@@ -19927,8 +19959,9 @@ const findLowestScoredScan = (completedScans) => {
|
|
|
19927
19959
|
};
|
|
19928
19960
|
const printMultiProjectSummary = (input) => Effect.gen(function* () {
|
|
19929
19961
|
const { completedScans, userConfig, verbose, isOffline, projectName } = input;
|
|
19962
|
+
const categoryFilters = input.categoryFilters ?? /* @__PURE__ */ new Set();
|
|
19930
19963
|
const animateRender = !verbose && canAnimateOnboarding(process.stdout);
|
|
19931
|
-
const
|
|
19964
|
+
const displayDiagnostics = filterDiagnosticsByCategories(filterDiagnosticsForSurface(completedScans.flatMap((scan) => scan.result.diagnostics), "cli", userConfig), categoryFilters);
|
|
19932
19965
|
const projectRootByDiagnostic = /* @__PURE__ */ new WeakMap();
|
|
19933
19966
|
for (const scan of completedScans) for (const diagnostic of scan.result.diagnostics) projectRootByDiagnostic.set(diagnostic, scan.result.project.rootDirectory);
|
|
19934
19967
|
const resolveDiagnosticSourceRoot = (diagnostic) => projectRootByDiagnostic.get(diagnostic) ?? "";
|
|
@@ -19942,29 +19975,30 @@ const printMultiProjectSummary = (input) => Effect.gen(function* () {
|
|
|
19942
19975
|
const totalScannedFileCount = uniqueScannedFilePaths.size + fileCountFromScansWithoutPaths;
|
|
19943
19976
|
const totalScanElapsedMilliseconds = completedScans.reduce((sum, scan) => sum + (scan.result.scanElapsedMilliseconds ?? scan.result.elapsedMilliseconds), 0);
|
|
19944
19977
|
yield* Console.log(`${highlighter.success("✔")} Scanned ${totalScannedFileCount} ${totalScannedFileCount === 1 ? "file" : "files"} in ${formatElapsedTime(totalScanElapsedMilliseconds)}`);
|
|
19945
|
-
if (
|
|
19978
|
+
if (displayDiagnostics.length > 0) {
|
|
19946
19979
|
yield* Console.log("");
|
|
19947
|
-
yield* printDiagnostics(
|
|
19980
|
+
yield* printDiagnostics(displayDiagnostics, verbose, resolveDiagnosticSourceRoot, buildRulePriorityMap(completedScans.map((scan) => scan.result.score)), isCodingAgentEnvironment(), { animateCountUp: animateRender });
|
|
19948
19981
|
}
|
|
19949
19982
|
const lowestScoredScan = findLowestScoredScan(completedScans);
|
|
19950
19983
|
const aggregateScore = lowestScoredScan?.result.score ?? null;
|
|
19951
19984
|
const totalSourceFileCount = completedScans.reduce((sum, scan) => sum + scan.result.project.sourceFileCount, 0);
|
|
19952
19985
|
yield* printSummary({
|
|
19953
|
-
diagnostics:
|
|
19986
|
+
diagnostics: displayDiagnostics,
|
|
19954
19987
|
elapsedMilliseconds: completedScans.reduce((sum, scan) => sum + scan.result.elapsedMilliseconds, 0),
|
|
19955
19988
|
scoreResult: aggregateScore,
|
|
19956
|
-
potentialScore: lowestScoredScan ? yield* Effect.promise(() => computeProjectedScore(
|
|
19989
|
+
potentialScore: lowestScoredScan ? yield* Effect.promise(() => computeProjectedScore(displayDiagnostics, filterDiagnosticsForSurface(lowestScoredScan.result.diagnostics, "cli", userConfig), lowestScoredScan.result.score)) : null,
|
|
19957
19990
|
totalSourceFileCount,
|
|
19958
19991
|
noScoreMessage: "Score unavailable.",
|
|
19959
19992
|
verbose,
|
|
19960
19993
|
animateProjection: animateRender
|
|
19961
19994
|
});
|
|
19962
19995
|
const entries = completedScans.map((scan) => {
|
|
19963
|
-
const
|
|
19996
|
+
const projectDiagnostics = filterDiagnosticsByCategories(filterDiagnosticsForSurface([...scan.result.diagnostics], "cli", userConfig), categoryFilters);
|
|
19997
|
+
const errorCount = projectDiagnostics.filter((diagnostic) => diagnostic.severity === "error").length;
|
|
19964
19998
|
return {
|
|
19965
19999
|
projectName: scan.result.project.projectName,
|
|
19966
20000
|
score: scan.result.score?.score ?? null,
|
|
19967
|
-
issueCount:
|
|
20001
|
+
issueCount: projectDiagnostics.length,
|
|
19968
20002
|
errorCount
|
|
19969
20003
|
};
|
|
19970
20004
|
});
|
|
@@ -19972,7 +20006,7 @@ const printMultiProjectSummary = (input) => Effect.gen(function* () {
|
|
|
19972
20006
|
yield* Console.log("");
|
|
19973
20007
|
for (const entry of entries) yield* Console.log(buildSummaryLine(entry, longestProjectNameLength));
|
|
19974
20008
|
yield* printFooter({
|
|
19975
|
-
diagnostics:
|
|
20009
|
+
diagnostics: displayDiagnostics,
|
|
19976
20010
|
scoreResult: aggregateScore,
|
|
19977
20011
|
projectName,
|
|
19978
20012
|
isOffline
|
|
@@ -20062,7 +20096,8 @@ const resolveCliInspectOptions = (flags, userConfig) => {
|
|
|
20062
20096
|
noScore: flags.score === false || flags.telemetry === false || (userConfig?.noScore ?? false),
|
|
20063
20097
|
isCi: isCiEnvironment(),
|
|
20064
20098
|
silent: Boolean(flags.json),
|
|
20065
|
-
concurrency: resolveParallelFlag(flags.parallel)
|
|
20099
|
+
concurrency: resolveParallelFlag(flags.parallel),
|
|
20100
|
+
categoryFilters: resolveCliCategories(flags.category)
|
|
20066
20101
|
};
|
|
20067
20102
|
};
|
|
20068
20103
|
//#endregion
|
|
@@ -20315,6 +20350,16 @@ const validateModeFlags = (flags) => {
|
|
|
20315
20350
|
};
|
|
20316
20351
|
//#endregion
|
|
20317
20352
|
//#region src/cli/commands/inspect.ts
|
|
20353
|
+
const filterCompletedScansByCategories = (completedScans, categoryFilters) => {
|
|
20354
|
+
if (categoryFilters.size === 0) return [...completedScans];
|
|
20355
|
+
return completedScans.map((scan) => ({
|
|
20356
|
+
...scan,
|
|
20357
|
+
result: {
|
|
20358
|
+
...scan.result,
|
|
20359
|
+
diagnostics: filterDiagnosticsByCategories(scan.result.diagnostics, categoryFilters)
|
|
20360
|
+
}
|
|
20361
|
+
}));
|
|
20362
|
+
};
|
|
20318
20363
|
/**
|
|
20319
20364
|
* Post-scan finalization shared by the staged-arm and project-loop
|
|
20320
20365
|
* paths of `inspectAction`: emit the JSON report (when in JSON mode)
|
|
@@ -20327,6 +20372,7 @@ const finalizeScans = (input) => {
|
|
|
20327
20372
|
const baselineComputed = input.completedScans.length > 0 && input.completedScans.every((scan) => scan.result.baselineDelta !== void 0);
|
|
20328
20373
|
const baselineDegraded = input.baselineIntended && !baselineComputed;
|
|
20329
20374
|
const mode = baselineDegraded ? "diff" : input.mode;
|
|
20375
|
+
const jsonCompletedScans = filterCompletedScansByCategories(input.completedScans, input.categoryFilters);
|
|
20330
20376
|
if (input.isJsonMode) {
|
|
20331
20377
|
const baseline = baselineComputed && baselineDeltas.length > 0 ? {
|
|
20332
20378
|
baseRef: baselineDeltas[0].baseRef,
|
|
@@ -20338,7 +20384,7 @@ const finalizeScans = (input) => {
|
|
|
20338
20384
|
directory: input.resolvedDirectory,
|
|
20339
20385
|
mode,
|
|
20340
20386
|
diff: input.diff,
|
|
20341
|
-
scans:
|
|
20387
|
+
scans: jsonCompletedScans,
|
|
20342
20388
|
totalElapsedMilliseconds: performance.now() - input.startTime,
|
|
20343
20389
|
baseline
|
|
20344
20390
|
}));
|
|
@@ -20412,6 +20458,7 @@ const inspectAction = async (directory, flags) => {
|
|
|
20412
20458
|
await Effect.runPromise(playWelcomeScene({ speedMultiplier: isReturningUser ? 2 : 1 }));
|
|
20413
20459
|
} else Effect.runSync(printBrandedHeader);
|
|
20414
20460
|
const scanOptions = resolveCliInspectOptions(flags, userConfig);
|
|
20461
|
+
const categoryFilters = new Set(scanOptions.categoryFilters ?? []);
|
|
20415
20462
|
const skipPrompts = shouldSkipPrompts({
|
|
20416
20463
|
yes: flags.yes,
|
|
20417
20464
|
json: flags.json
|
|
@@ -20472,6 +20519,7 @@ const inspectAction = async (directory, flags) => {
|
|
|
20472
20519
|
isJsonMode,
|
|
20473
20520
|
isScoreOnly,
|
|
20474
20521
|
flags,
|
|
20522
|
+
categoryFilters,
|
|
20475
20523
|
userConfig,
|
|
20476
20524
|
resolvedDirectory,
|
|
20477
20525
|
startTime
|
|
@@ -20531,6 +20579,7 @@ const inspectAction = async (directory, flags) => {
|
|
|
20531
20579
|
const shouldShowShareLink = !scanOptions.noScore && (userConfig?.share ?? true) && !scanOptions.isCi;
|
|
20532
20580
|
await Effect.runPromise(printMultiProjectSummary({
|
|
20533
20581
|
completedScans,
|
|
20582
|
+
categoryFilters,
|
|
20534
20583
|
userConfig,
|
|
20535
20584
|
verbose: Boolean(flags.verbose),
|
|
20536
20585
|
isOffline: !shouldShowShareLink,
|
|
@@ -20546,14 +20595,15 @@ const inspectAction = async (directory, flags) => {
|
|
|
20546
20595
|
isJsonMode,
|
|
20547
20596
|
isScoreOnly,
|
|
20548
20597
|
flags,
|
|
20598
|
+
categoryFilters,
|
|
20549
20599
|
userConfig,
|
|
20550
20600
|
resolvedDirectory,
|
|
20551
20601
|
startTime
|
|
20552
20602
|
});
|
|
20553
|
-
const
|
|
20554
|
-
if (!isQuiet && !skipPrompts && process.stdout.isTTY === true && !isCiOrCodingAgentEnvironment() &&
|
|
20603
|
+
const selectedSurfaceDiagnostics = filterDiagnosticsByCategories(filterDiagnosticsForSurface(allDiagnostics, scanOptions.outputSurface ?? "cli", userConfig), categoryFilters);
|
|
20604
|
+
if (!isQuiet && !skipPrompts && process.stdout.isTTY === true && !isCiOrCodingAgentEnvironment() && selectedSurfaceDiagnostics.length > 0) {
|
|
20555
20605
|
await handoffToAgent({
|
|
20556
|
-
diagnostics:
|
|
20606
|
+
diagnostics: selectedSurfaceDiagnostics,
|
|
20557
20607
|
projectName: path$1.basename(resolvedDirectory),
|
|
20558
20608
|
rootDirectory: resolvedDirectory,
|
|
20559
20609
|
interactive: true
|
|
@@ -20984,7 +21034,7 @@ const rulesListAction = async (options) => {
|
|
|
20984
21034
|
});
|
|
20985
21035
|
const catalog = buildRuleCatalog();
|
|
20986
21036
|
const config = validateConfigTypes((await resolveRuleConfigTarget(resolveProjectRoot(options))).config);
|
|
20987
|
-
const categoryFilter = options.category
|
|
21037
|
+
const categoryFilter = typeof options.category === "string" ? options.category.toLowerCase() : void 0;
|
|
20988
21038
|
const frameworkFilter = options.framework?.toLowerCase();
|
|
20989
21039
|
const rows = catalog.filter((entry) => {
|
|
20990
21040
|
if (categoryFilter && entry.category.toLowerCase() !== categoryFilter) return false;
|
|
@@ -21347,6 +21397,7 @@ const ROOT_FLAG_SPEC = {
|
|
|
21347
21397
|
"--yes"
|
|
21348
21398
|
]),
|
|
21349
21399
|
longOptionsWithRequiredValues: new Set([
|
|
21400
|
+
"--category",
|
|
21350
21401
|
"--changed-files-from",
|
|
21351
21402
|
"--blocking",
|
|
21352
21403
|
"--fail-on",
|
|
@@ -21503,6 +21554,7 @@ ${formatExampleLines([
|
|
|
21503
21554
|
["react-doctor ./apps/web", "scan a specific directory"],
|
|
21504
21555
|
["react-doctor --diff main", "scan only files changed vs. main"],
|
|
21505
21556
|
["react-doctor --staged", "scan staged files (pre-commit hook)"],
|
|
21557
|
+
["react-doctor --category Security", "show only one diagnostic category"],
|
|
21506
21558
|
["react-doctor --blocking warning", "fail CI on warnings too (default: error)"],
|
|
21507
21559
|
["react-doctor --json > report.json", "write a machine-readable report"],
|
|
21508
21560
|
["react-doctor why src/App.tsx:42", "explain why a rule fired there"],
|
|
@@ -21531,7 +21583,8 @@ ${formatExampleLines([
|
|
|
21531
21583
|
${highlighter.dim("Learn more:")}
|
|
21532
21584
|
${highlighter.info(CANONICAL_GITHUB_URL)}
|
|
21533
21585
|
`;
|
|
21534
|
-
const
|
|
21586
|
+
const collectCategoryOption = (value, previousValues) => [...previousValues ?? [], value];
|
|
21587
|
+
const program = new Command().name("react-doctor").description("Diagnose React codebase health").version(VERSION, "-v, --version", "display the version number").argument("[directory]", "project directory to scan", ".").option("--lint", "enable linting").option("--no-lint", "skip linting").option("--dead-code", "enable dead-code analysis (default)").option("--no-dead-code", "skip dead-code analysis (unused files / exports / dependencies, circular imports)").option("--verbose", "show every rule and per-file details (default shows top 3 rules)").option("--score", "output only the score").option("--json", "output a single structured JSON report (suppresses other output)").option("--json-compact", "with --json, emit compact JSON (no indentation)").option("-y, --yes", "skip prompts, scan all workspace projects").option("--no-parallel", "lint serially with one worker (default: parallel across CPU cores; set the worker count with REACT_DOCTOR_PARALLEL)").option("--project <name>", "select workspace project (comma-separated for multiple)").option("--diff [base]", "scan only files changed vs base branch (pass `false` to force a full scan, overriding config)").addOption(new Option$1("--changed-files-from <file>", "scan source files listed in a newline-delimited changed-files file").hideHelp()).option("--no-score", "skip the score API, the share URL, and crash reporting").addOption(new Option$1("--category <category>", "only show diagnostics in a category (repeatable; e.g. Security)").argParser(collectCategoryOption)).option("--no-telemetry", "alias for --no-score (skip the score API, share URL, and crash reporting)").option("--staged", "scan only staged (git index) files for pre-commit hooks").option("--blocking <level>", "severity that fails CI: error (default), warning, or none (advisory)").addOption(new Option$1("--fail-on <level>", "[deprecated] alias for --blocking <level>").hideHelp()).option("--no-respect-inline-disables", "audit mode: neutralize inline lint suppressions before scanning").option("--warnings", "show warning-severity diagnostics (default)").option("--no-warnings", "hide warning-severity diagnostics (errors only)").option("--color", "force colored output").option("--no-color", "disable colored output (also honors NO_COLOR)").addHelpText("after", renderRootHelpEpilog);
|
|
21535
21588
|
program.action(inspectAction);
|
|
21536
21589
|
program.command("why <location>").description("Explain why a rule fired (or why a suppression didn't apply) at a file:line").option("--project <name>", "select workspace project (comma-separated for multiple)").option("-c, --cwd <cwd>", "working directory", process.cwd()).option("--color", "force colored output").option("--no-color", "disable colored output (also honors NO_COLOR)").action((location, options) => whyAction(location, options));
|
|
21537
21590
|
program.command("install").alias("setup").description("Install the react-doctor skill into your coding agents and optional git hook").option("-y, --yes", "skip prompts, install for all detected agents").option("--dry-run", "show what would be installed without writing files").option("--agent-hooks", "install native non-blocking agent hooks for Claude Code and Cursor").option("-c, --cwd <cwd>", "working directory", process.cwd()).option("--color", "force colored output").option("--no-color", "disable colored output (also honors NO_COLOR)").addHelpText("after", renderInstallHelpEpilog).action(installAction);
|
|
@@ -21574,4 +21627,4 @@ Promise.resolve().then(() => assertNoRemovedFlags(process.argv)).then(() => prog
|
|
|
21574
21627
|
export {};
|
|
21575
21628
|
|
|
21576
21629
|
//# sourceMappingURL=cli.js.map
|
|
21577
|
-
//# debugId=
|
|
21630
|
+
//# debugId=e5cd8a39-286b-53d3-8951-268670de9a6a
|
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]="3464aaf0-7929-5863-b44e-a34e909e3e87")}catch(e){}}();
|
|
3
3
|
import { createRequire } from "node:module";
|
|
4
4
|
import * as Schema from "effect/Schema";
|
|
5
5
|
import * as fs$1 from "node:fs";
|
|
@@ -2125,8 +2125,8 @@ const isFile = (filePath) => {
|
|
|
2125
2125
|
return false;
|
|
2126
2126
|
}
|
|
2127
2127
|
};
|
|
2128
|
-
const SOURCE_FILE_PATTERN = /\.(tsx?|jsx
|
|
2129
|
-
const GENERATED_BUNDLE_FILE_PATTERN = /\.(iife|umd|global|min)\.js$/i;
|
|
2128
|
+
const SOURCE_FILE_PATTERN = /\.(tsx?|jsx?|mts|mjs)$/;
|
|
2129
|
+
const GENERATED_BUNDLE_FILE_PATTERN = /\.(iife|umd|global|min)\.m?js$/i;
|
|
2130
2130
|
const MINIFIED_SNIFF_BYTES = 65536;
|
|
2131
2131
|
const GIT_LS_FILES_MAX_BUFFER_BYTES = 50 * 1024 * 1024;
|
|
2132
2132
|
const IGNORED_DIRECTORIES = new Set([
|
|
@@ -5482,7 +5482,9 @@ const highlighter = {
|
|
|
5482
5482
|
gray: import_picocolors.default.gray,
|
|
5483
5483
|
bold: import_picocolors.default.bold
|
|
5484
5484
|
};
|
|
5485
|
-
const
|
|
5485
|
+
const NEXT_ENTRY_FILE_PATTERN = /^(?:\.\/)?(?:src\/)?(?:middleware|proxy)\.(?:tsx?|jsx?|mts|mjs)$/;
|
|
5486
|
+
const shouldIncludeExplicitLintPath = (filePath, project) => JSX_FILE_PATTERN.test(filePath) || project?.framework === "nextjs" && NEXT_ENTRY_FILE_PATTERN.test(filePath);
|
|
5487
|
+
const computeExplicitLintIncludePaths = (includePaths, project) => includePaths.length > 0 ? includePaths.filter((filePath) => shouldIncludeExplicitLintPath(filePath, project)) : void 0;
|
|
5486
5488
|
const LINGUIST_ATTRIBUTE_PATTERN = /^linguist-(?:vendored|generated)(?:=([a-zA-Z0-9]+))?$/i;
|
|
5487
5489
|
const FALSY_VALUES = new Set([
|
|
5488
5490
|
"false",
|
|
@@ -6035,11 +6037,11 @@ const listSourceFilesViaFilesystem = (rootDirectory) => {
|
|
|
6035
6037
|
return filePaths;
|
|
6036
6038
|
};
|
|
6037
6039
|
const listSourceFiles = (rootDirectory) => excludeMinifiedFiles(rootDirectory, listSourceFilesViaGit(rootDirectory) ?? listSourceFilesViaFilesystem(rootDirectory));
|
|
6038
|
-
const resolveLintIncludePaths = (rootDirectory, userConfig) => {
|
|
6040
|
+
const resolveLintIncludePaths = (rootDirectory, userConfig, project) => {
|
|
6039
6041
|
if (!Array.isArray(userConfig?.ignore?.files) || userConfig.ignore.files.length === 0) return;
|
|
6040
6042
|
const ignoredPatterns = compileIgnoredFilePatterns(userConfig);
|
|
6041
6043
|
return listSourceFiles(rootDirectory).filter((filePath) => {
|
|
6042
|
-
if (!
|
|
6044
|
+
if (!shouldIncludeExplicitLintPath(filePath, project)) return false;
|
|
6043
6045
|
return !isFileIgnoredByPatterns(filePath, rootDirectory, ignoredPatterns);
|
|
6044
6046
|
});
|
|
6045
6047
|
};
|
|
@@ -8391,7 +8393,7 @@ const runInspect = (input, hooks = {}) => Effect.gen(function* () {
|
|
|
8391
8393
|
directory: scanDirectory,
|
|
8392
8394
|
repo
|
|
8393
8395
|
}).pipe(Effect.orElseSucceed(() => null)) : Effect.succeed(null));
|
|
8394
|
-
const lintIncludePaths = (input.skipJsxIncludeFilter ? input.includePaths.length > 0 ? [...input.includePaths] : void 0 :
|
|
8396
|
+
const lintIncludePaths = (input.skipJsxIncludeFilter ? input.includePaths.length > 0 ? [...input.includePaths] : void 0 : computeExplicitLintIncludePaths([...input.includePaths], project)) ?? resolveLintIncludePaths(scanDirectory, resolvedConfig.config, project);
|
|
8395
8397
|
const scannedFilePaths = input.suppressScanSummary ? (lintIncludePaths ?? (yield* filesService.listSourceFiles(scanDirectory))).map((relativePath) => path$1.resolve(scanDirectory, relativePath)) : [];
|
|
8396
8398
|
const beforeLint = hooks.beforeLint ?? NO_HOOKS.beforeLint;
|
|
8397
8399
|
const afterLint = hooks.afterLint ?? NO_HOOKS.afterLint;
|
|
@@ -8989,4 +8991,4 @@ const toJsonReport = (result, options) => buildJsonReport({
|
|
|
8989
8991
|
export { AmbiguousProjectError, NoReactDependencyError, NotADirectoryError, PackageJsonNotFoundError, ProjectNotFoundError, ReactDoctorError, buildJsonReport, buildJsonReportError, clearCaches, defineConfig, diagnose, filterSourceFiles, getDiffInfo, isProjectDiscoveryError, isReactDoctorError, summarizeDiagnostics, toJsonReport };
|
|
8990
8992
|
|
|
8991
8993
|
//# sourceMappingURL=index.js.map
|
|
8992
|
-
//# debugId=
|
|
8994
|
+
//# debugId=3464aaf0-7929-5863-b44e-a34e909e3e87
|
package/dist/lsp.js
CHANGED
|
@@ -2136,8 +2136,8 @@ const isFile = (filePath) => {
|
|
|
2136
2136
|
return false;
|
|
2137
2137
|
}
|
|
2138
2138
|
};
|
|
2139
|
-
const SOURCE_FILE_PATTERN = /\.(tsx?|jsx
|
|
2140
|
-
const GENERATED_BUNDLE_FILE_PATTERN = /\.(iife|umd|global|min)\.js$/i;
|
|
2139
|
+
const SOURCE_FILE_PATTERN = /\.(tsx?|jsx?|mts|mjs)$/;
|
|
2140
|
+
const GENERATED_BUNDLE_FILE_PATTERN = /\.(iife|umd|global|min)\.m?js$/i;
|
|
2141
2141
|
const MINIFIED_SNIFF_BYTES = 65536;
|
|
2142
2142
|
const GIT_LS_FILES_MAX_BUFFER_BYTES = 50 * 1024 * 1024;
|
|
2143
2143
|
const IGNORED_DIRECTORIES = new Set([
|
|
@@ -5419,7 +5419,9 @@ const highlighter = {
|
|
|
5419
5419
|
gray: import_picocolors.default.gray,
|
|
5420
5420
|
bold: import_picocolors.default.bold
|
|
5421
5421
|
};
|
|
5422
|
-
const
|
|
5422
|
+
const NEXT_ENTRY_FILE_PATTERN = /^(?:\.\/)?(?:src\/)?(?:middleware|proxy)\.(?:tsx?|jsx?|mts|mjs)$/;
|
|
5423
|
+
const shouldIncludeExplicitLintPath = (filePath, project) => JSX_FILE_PATTERN.test(filePath) || project?.framework === "nextjs" && NEXT_ENTRY_FILE_PATTERN.test(filePath);
|
|
5424
|
+
const computeExplicitLintIncludePaths = (includePaths, project) => includePaths.length > 0 ? includePaths.filter((filePath) => shouldIncludeExplicitLintPath(filePath, project)) : void 0;
|
|
5423
5425
|
const LINGUIST_ATTRIBUTE_PATTERN = /^linguist-(?:vendored|generated)(?:=([a-zA-Z0-9]+))?$/i;
|
|
5424
5426
|
const FALSY_VALUES = new Set([
|
|
5425
5427
|
"false",
|
|
@@ -5972,11 +5974,11 @@ const listSourceFilesViaFilesystem = (rootDirectory) => {
|
|
|
5972
5974
|
return filePaths;
|
|
5973
5975
|
};
|
|
5974
5976
|
const listSourceFiles = (rootDirectory) => excludeMinifiedFiles(rootDirectory, listSourceFilesViaGit(rootDirectory) ?? listSourceFilesViaFilesystem(rootDirectory));
|
|
5975
|
-
const resolveLintIncludePaths = (rootDirectory, userConfig) => {
|
|
5977
|
+
const resolveLintIncludePaths = (rootDirectory, userConfig, project) => {
|
|
5976
5978
|
if (!Array.isArray(userConfig?.ignore?.files) || userConfig.ignore.files.length === 0) return;
|
|
5977
5979
|
const ignoredPatterns = compileIgnoredFilePatterns(userConfig);
|
|
5978
5980
|
return listSourceFiles(rootDirectory).filter((filePath) => {
|
|
5979
|
-
if (!
|
|
5981
|
+
if (!shouldIncludeExplicitLintPath(filePath, project)) return false;
|
|
5980
5982
|
return !isFileIgnoredByPatterns(filePath, rootDirectory, ignoredPatterns);
|
|
5981
5983
|
});
|
|
5982
5984
|
};
|
|
@@ -8328,7 +8330,7 @@ const runInspect = (input, hooks = {}) => Effect.gen(function* () {
|
|
|
8328
8330
|
directory: scanDirectory,
|
|
8329
8331
|
repo
|
|
8330
8332
|
}).pipe(Effect.orElseSucceed(() => null)) : Effect.succeed(null));
|
|
8331
|
-
const lintIncludePaths = (input.skipJsxIncludeFilter ? input.includePaths.length > 0 ? [...input.includePaths] : void 0 :
|
|
8333
|
+
const lintIncludePaths = (input.skipJsxIncludeFilter ? input.includePaths.length > 0 ? [...input.includePaths] : void 0 : computeExplicitLintIncludePaths([...input.includePaths], project)) ?? resolveLintIncludePaths(scanDirectory, resolvedConfig.config, project);
|
|
8332
8334
|
const scannedFilePaths = input.suppressScanSummary ? (lintIncludePaths ?? (yield* filesService.listSourceFiles(scanDirectory))).map((relativePath) => path$1.resolve(scanDirectory, relativePath)) : [];
|
|
8333
8335
|
const beforeLint = hooks.beforeLint ?? NO_HOOKS.beforeLint;
|
|
8334
8336
|
const afterLint = hooks.afterLint ?? NO_HOOKS.afterLint;
|
|
@@ -8805,7 +8807,9 @@ const SCANNABLE_EXTENSIONS = [
|
|
|
8805
8807
|
".ts",
|
|
8806
8808
|
".tsx",
|
|
8807
8809
|
".js",
|
|
8808
|
-
".jsx"
|
|
8810
|
+
".jsx",
|
|
8811
|
+
".mts",
|
|
8812
|
+
".mjs"
|
|
8809
8813
|
];
|
|
8810
8814
|
/** Filenames whose change invalidates project/config caches. */
|
|
8811
8815
|
const CONFIG_WATCH_FILENAMES = [
|
|
@@ -10853,5 +10857,5 @@ const startLanguageServer = () => {
|
|
|
10853
10857
|
};
|
|
10854
10858
|
//#endregion
|
|
10855
10859
|
export { startLanguageServer };
|
|
10856
|
-
!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]="
|
|
10857
|
-
//# debugId=
|
|
10860
|
+
!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]="feb075a7-adf0-5222-af8d-6ea6a4523050")}catch(e){}}();
|
|
10861
|
+
//# debugId=feb075a7-adf0-5222-af8d-6ea6a4523050
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "react-doctor",
|
|
3
|
-
"version": "0.4.2-dev.
|
|
3
|
+
"version": "0.4.2-dev.a59499b",
|
|
4
4
|
"description": "Your agent writes bad React. This catches it",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"accessibility",
|
|
@@ -66,7 +66,7 @@
|
|
|
66
66
|
"vscode-languageserver": "^9.0.1",
|
|
67
67
|
"vscode-languageserver-textdocument": "^1.0.12",
|
|
68
68
|
"vscode-uri": "^3.1.0",
|
|
69
|
-
"oxlint-plugin-react-doctor": "0.4.2-dev.
|
|
69
|
+
"oxlint-plugin-react-doctor": "0.4.2-dev.a59499b"
|
|
70
70
|
},
|
|
71
71
|
"devDependencies": {
|
|
72
72
|
"@types/babel__code-frame": "^7.27.0",
|