react-doctor 0.7.4-dev.d4f2209 → 0.7.4
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/README.md +0 -8
- package/dist/cli.js +81 -290
- package/dist/index.d.ts +6 -55
- package/dist/index.js +66 -265
- package/dist/lsp.js +35 -188
- package/package.json +4 -4
package/dist/lsp.js
CHANGED
|
@@ -5,10 +5,10 @@ import * as OS from "node:os";
|
|
|
5
5
|
import os from "node:os";
|
|
6
6
|
import * as Path from "node:path";
|
|
7
7
|
import path from "node:path";
|
|
8
|
-
import reactDoctorPlugin, { ALL_REACT_DOCTOR_RULE_KEYS, CROSS_FILE_DEPENDENCY_COLLECTORS, CROSS_FILE_RULE_IDS, FRAMEWORK_SPECIFIC_RULE_KEYS, FRAMEWORK_TOKENS, MOTION_LIBRARY_PACKAGES, REACT_COMPILER_RULES, REACT_DOCTOR_RULES, classifySecurityScanFile, collectCrossFileDependencyProbes, resetManifestCaches, shouldReadSecurityScanContent } from "oxlint-plugin-react-doctor";
|
|
9
8
|
import * as NodeChildProcess from "node:child_process";
|
|
10
9
|
import { execFileSync, spawn, spawnSync } from "node:child_process";
|
|
11
|
-
import ts from "typescript";
|
|
10
|
+
import * as ts from "typescript";
|
|
11
|
+
import reactDoctorPlugin, { ALL_REACT_DOCTOR_RULE_KEYS, CROSS_FILE_DEPENDENCY_COLLECTORS, CROSS_FILE_RULE_IDS, FRAMEWORK_SPECIFIC_RULE_KEYS, MOTION_LIBRARY_PACKAGES, REACT_COMPILER_RULES, REACT_DOCTOR_RULES, classifySecurityScanFile, collectCrossFileDependencyProbes, resetManifestCaches, shouldReadSecurityScanContent } from "oxlint-plugin-react-doctor";
|
|
12
12
|
import { parseJSON5 } from "confbox";
|
|
13
13
|
import * as NodeUrl from "node:url";
|
|
14
14
|
import { fileURLToPath } from "node:url";
|
|
@@ -19339,31 +19339,6 @@ var Diagnostic = class extends Class("Diagnostic")({
|
|
|
19339
19339
|
relatedLocations: optional(ArraySchema(DiagnosticRelatedLocation)),
|
|
19340
19340
|
fixGroupId: optional(String$1)
|
|
19341
19341
|
}) {};
|
|
19342
|
-
var JsonReportDiagnosticV3 = class extends Class("JsonReportDiagnosticV3")({
|
|
19343
|
-
id: String$1,
|
|
19344
|
-
normalizedFilePath: String$1,
|
|
19345
|
-
filePath: String$1,
|
|
19346
|
-
plugin: String$1,
|
|
19347
|
-
rule: String$1,
|
|
19348
|
-
severity: Severity,
|
|
19349
|
-
tags: ArraySchema(String$1),
|
|
19350
|
-
title: optional(String$1),
|
|
19351
|
-
message: String$1,
|
|
19352
|
-
help: String$1,
|
|
19353
|
-
url: optional(String$1),
|
|
19354
|
-
line: Number$1,
|
|
19355
|
-
column: Number$1,
|
|
19356
|
-
offset: optional(Number$1),
|
|
19357
|
-
length: optional(Number$1),
|
|
19358
|
-
endLine: optional(Number$1),
|
|
19359
|
-
endColumn: optional(Number$1),
|
|
19360
|
-
category: String$1,
|
|
19361
|
-
matchByOccurrence: optional(Boolean$1),
|
|
19362
|
-
fileContext: optional(Literals(["test", "story"])),
|
|
19363
|
-
suppressionHint: optional(String$1),
|
|
19364
|
-
relatedLocations: optional(ArraySchema(DiagnosticRelatedLocation)),
|
|
19365
|
-
fixGroupId: optional(String$1)
|
|
19366
|
-
}) {};
|
|
19367
19342
|
/**
|
|
19368
19343
|
* Deterministic identity string for a diagnostic. Same diagnostic
|
|
19369
19344
|
* across two scans yields the same identity; lets baselines,
|
|
@@ -19377,7 +19352,6 @@ const JsonReportMode = Literals([
|
|
|
19377
19352
|
"staged",
|
|
19378
19353
|
"baseline"
|
|
19379
19354
|
]);
|
|
19380
|
-
const Framework = Literals(FRAMEWORK_TOKENS);
|
|
19381
19355
|
var JsonReportSummary = class extends Class("JsonReportSummary")({
|
|
19382
19356
|
errorCount: Number$1,
|
|
19383
19357
|
warningCount: Number$1,
|
|
@@ -19415,22 +19389,13 @@ var JsonReportProjectEntry = class extends Class("JsonReportProjectEntry")({
|
|
|
19415
19389
|
scannedFileCount: optional(Number$1),
|
|
19416
19390
|
elapsedMilliseconds: Number$1
|
|
19417
19391
|
}) {};
|
|
19418
|
-
|
|
19419
|
-
|
|
19420
|
-
|
|
19421
|
-
|
|
19422
|
-
|
|
19423
|
-
|
|
19424
|
-
|
|
19425
|
-
skippedChecks: ArraySchema(String$1),
|
|
19426
|
-
skippedCheckReasons: optional(Record$1(String$1, String$1)),
|
|
19427
|
-
analyzedFiles: ArraySchema(String$1),
|
|
19428
|
-
analyzedFileCount: Number$1,
|
|
19429
|
-
complete: Boolean$1,
|
|
19430
|
-
scannedFileCount: optional(Number$1),
|
|
19431
|
-
elapsedMilliseconds: Number$1
|
|
19432
|
-
}) {};
|
|
19433
|
-
/** Original full, diff, and staged report contract. */
|
|
19392
|
+
/**
|
|
19393
|
+
* Versioned JsonReport schema. `JsonReport` is a `Schema.Union` so we
|
|
19394
|
+
* can add `schemaVersion: 2` later as one new union member without
|
|
19395
|
+
* breaking existing v1 consumers (the GitHub Action keys off the
|
|
19396
|
+
* version literal). Today's union is single-arm; the shape is
|
|
19397
|
+
* intentional.
|
|
19398
|
+
*/
|
|
19434
19399
|
var JsonReportV1 = class extends Class("JsonReportV1")({
|
|
19435
19400
|
schemaVersion: Literal(1),
|
|
19436
19401
|
version: String$1,
|
|
@@ -19491,27 +19456,7 @@ var JsonReportV2 = class extends Class("JsonReportV2")({
|
|
|
19491
19456
|
elapsedMilliseconds: Number$1,
|
|
19492
19457
|
error: NullOr(JsonReportError)
|
|
19493
19458
|
}) {};
|
|
19494
|
-
|
|
19495
|
-
schemaVersion: Literal(3),
|
|
19496
|
-
version: String$1,
|
|
19497
|
-
ok: Boolean$1,
|
|
19498
|
-
directory: String$1,
|
|
19499
|
-
mode: JsonReportMode,
|
|
19500
|
-
baselineDegraded: optional(Boolean$1),
|
|
19501
|
-
reactDetected: optional(Boolean$1),
|
|
19502
|
-
diff: NullOr(JsonReportDiffInfo),
|
|
19503
|
-
baseline: optional(JsonReportBaseline),
|
|
19504
|
-
projects: ArraySchema(JsonReportProjectEntryV3),
|
|
19505
|
-
diagnostics: ArraySchema(JsonReportDiagnosticV3),
|
|
19506
|
-
summary: JsonReportSummary,
|
|
19507
|
-
elapsedMilliseconds: Number$1,
|
|
19508
|
-
error: NullOr(JsonReportError)
|
|
19509
|
-
}) {};
|
|
19510
|
-
Union([
|
|
19511
|
-
JsonReportV1,
|
|
19512
|
-
JsonReportV2,
|
|
19513
|
-
JsonReportV3
|
|
19514
|
-
]);
|
|
19459
|
+
Union([JsonReportV1, JsonReportV2]);
|
|
19515
19460
|
//#endregion
|
|
19516
19461
|
//#region ../../node_modules/.pnpm/semver@7.7.4/node_modules/semver/internal/constants.js
|
|
19517
19462
|
var require_constants$1 = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
|
|
@@ -34004,22 +33949,6 @@ const isPackageJsonReanimatedAware = (packageJson) => {
|
|
|
34004
33949
|
};
|
|
34005
33950
|
return Object.hasOwn(allDependencies, REANIMATED_DEPENDENCY_NAME$1);
|
|
34006
33951
|
};
|
|
34007
|
-
const SSR_DEPENDENCY_NAMES = new Set([
|
|
34008
|
-
"@react-router/cloudflare",
|
|
34009
|
-
"@react-router/node",
|
|
34010
|
-
"@react-router/serve",
|
|
34011
|
-
"vike",
|
|
34012
|
-
"vite-plugin-ssr"
|
|
34013
|
-
]);
|
|
34014
|
-
const isPackageJsonSsrAware = (packageJson) => {
|
|
34015
|
-
const allDependencies = {
|
|
34016
|
-
...packageJson.peerDependencies,
|
|
34017
|
-
...packageJson.dependencies,
|
|
34018
|
-
...packageJson.devDependencies,
|
|
34019
|
-
...packageJson.optionalDependencies
|
|
34020
|
-
};
|
|
34021
|
-
return Object.keys(allDependencies).some((packageName) => SSR_DEPENDENCY_NAMES.has(packageName));
|
|
34022
|
-
};
|
|
34023
33952
|
const getWorkspacePatterns = (rootDirectory, packageJson) => {
|
|
34024
33953
|
const pnpmPatterns = parsePnpmWorkspacePatterns(rootDirectory);
|
|
34025
33954
|
if (pnpmPatterns.length > 0) return pnpmPatterns;
|
|
@@ -34160,7 +34089,6 @@ const evaluateManifestFacts = (facts, packageJson, directory) => {
|
|
|
34160
34089
|
}
|
|
34161
34090
|
facts.hasReactNativeAwarePackage = facts.hasReactNativeAwarePackage || isPackageJsonReactNativeAware(packageJson);
|
|
34162
34091
|
facts.hasReanimatedAwarePackage = facts.hasReanimatedAwarePackage || isPackageJsonReanimatedAware(packageJson);
|
|
34163
|
-
facts.hasSsrDependency = facts.hasSsrDependency || isPackageJsonSsrAware(packageJson);
|
|
34164
34092
|
};
|
|
34165
34093
|
const collectWorkspaceFacts = (rootDirectory, rootPackageJson, { collectReactGroup }) => {
|
|
34166
34094
|
const facts = {
|
|
@@ -34182,7 +34110,6 @@ const collectWorkspaceFacts = (rootDirectory, rootPackageJson, { collectReactGro
|
|
|
34182
34110
|
},
|
|
34183
34111
|
hasReactNativeAwarePackage: false,
|
|
34184
34112
|
hasReanimatedAwarePackage: false,
|
|
34185
|
-
hasSsrDependency: false,
|
|
34186
34113
|
reanimatedVersion: null
|
|
34187
34114
|
};
|
|
34188
34115
|
evaluateManifestFacts(facts, rootPackageJson, rootDirectory);
|
|
@@ -34422,7 +34349,6 @@ const discoverProjectWithoutPackageJson = (directory) => {
|
|
|
34422
34349
|
hasTypeScript: hasOwnTsConfig,
|
|
34423
34350
|
hasReactCompiler: false,
|
|
34424
34351
|
hasTanStackQuery: false,
|
|
34425
|
-
hasSsrDependency: false,
|
|
34426
34352
|
preactVersion: null,
|
|
34427
34353
|
preactMajorVersion: null,
|
|
34428
34354
|
hasReactNativeWorkspace: false,
|
|
@@ -34542,7 +34468,6 @@ const discoverProject = (directory) => {
|
|
|
34542
34468
|
hasTypeScript,
|
|
34543
34469
|
hasReactCompiler: detectReactCompiler(directory, packageJson),
|
|
34544
34470
|
hasTanStackQuery: hasTanStackQuery(packageJson),
|
|
34545
|
-
hasSsrDependency: workspaceFacts.hasSsrDependency,
|
|
34546
34471
|
preactVersion,
|
|
34547
34472
|
preactMajorVersion: parseReactMajor(preactVersion),
|
|
34548
34473
|
hasReactNativeWorkspace,
|
|
@@ -35618,14 +35543,6 @@ var AmbiguousProject = class extends TaggedErrorClass()("AmbiguousProject", {
|
|
|
35618
35543
|
return `Ambiguous project at ${this.directory}: found ${this.candidates.length} candidates (${this.candidates.join(", ")})`;
|
|
35619
35544
|
}
|
|
35620
35545
|
};
|
|
35621
|
-
var ProjectDiscoveryFailed = class extends TaggedErrorClass()("ProjectDiscoveryFailed", {
|
|
35622
|
-
directory: String$1,
|
|
35623
|
-
cause: Unknown
|
|
35624
|
-
}) {
|
|
35625
|
-
get message() {
|
|
35626
|
-
return `Project discovery failed for ${this.directory}: ${pretty(fail$6(this.cause))}`;
|
|
35627
|
-
}
|
|
35628
|
-
};
|
|
35629
35546
|
var DeadCodeAnalysisFailed = class extends TaggedErrorClass()("DeadCodeAnalysisFailed", { cause: Unknown }) {
|
|
35630
35547
|
get message() {
|
|
35631
35548
|
return `Dead-code analysis failed: ${pretty(fail$6(this.cause))}`;
|
|
@@ -35660,7 +35577,6 @@ const ReactDoctorErrorReason = Union([
|
|
|
35660
35577
|
ProjectNotFound,
|
|
35661
35578
|
NoReactDependency,
|
|
35662
35579
|
AmbiguousProject,
|
|
35663
|
-
ProjectDiscoveryFailed,
|
|
35664
35580
|
DeadCodeAnalysisFailed,
|
|
35665
35581
|
GitInvocationFailed,
|
|
35666
35582
|
GitBaseBranchMissing,
|
|
@@ -37287,12 +37203,6 @@ const CLIENT_ONLY_FRAMEWORKS = new Set([
|
|
|
37287
37203
|
"react-native",
|
|
37288
37204
|
"expo"
|
|
37289
37205
|
]);
|
|
37290
|
-
const SSR_FRAMEWORKS = new Set([
|
|
37291
|
-
"nextjs",
|
|
37292
|
-
"remix",
|
|
37293
|
-
"gatsby",
|
|
37294
|
-
"tanstack-start"
|
|
37295
|
-
]);
|
|
37296
37206
|
const addMajorLadder = (capabilities, name, major, earliest, latest) => {
|
|
37297
37207
|
if (major === null) return;
|
|
37298
37208
|
const cappedMajor = Math.min(major, latest);
|
|
@@ -37305,7 +37215,6 @@ const buildCapabilities = (project) => {
|
|
|
37305
37215
|
if (project.framework === "expo" || project.framework === "react-native" || project.hasReactNativeWorkspace) capabilities.add("react-native");
|
|
37306
37216
|
if (project.expoVersion !== null) capabilities.add("expo");
|
|
37307
37217
|
if ((project.framework === "nextjs" || project.framework === "tanstack-start" || project.framework === "remix") && !project.isStaticExport) capabilities.add("server-actions");
|
|
37308
|
-
if (SSR_FRAMEWORKS.has(project.framework) || project.hasSsrDependency) capabilities.add("ssr");
|
|
37309
37218
|
if (CLIENT_ONLY_FRAMEWORKS.has(project.framework)) capabilities.add("client-only");
|
|
37310
37219
|
if (project.isStaticExport) capabilities.add("nextjs:static-export");
|
|
37311
37220
|
if (project.nextjsMajorVersion !== null && project.nextjsMajorVersion >= 15) capabilities.add("nextjs:15");
|
|
@@ -40710,8 +40619,6 @@ const spawnLintBatches = async (input) => {
|
|
|
40710
40619
|
const reasonHint = firstDropReason ? ` — first failure: ${firstDropReason}` : "";
|
|
40711
40620
|
reportSkippedFiles(droppedFiles, (fileListPreview) => `${droppedFiles.length} file(s) failed to lint and were skipped (${fileListPreview})${reasonHint}`);
|
|
40712
40621
|
reportSkippedFiles(outcome.deadlineSkippedFiles, (fileListPreview) => `${outcome.deadlineSkippedFiles.length} file(s) skipped — max scan duration reached before they were linted (${fileListPreview})`);
|
|
40713
|
-
const unavailableFiles = new Set([...droppedFiles, ...outcome.deadlineSkippedFiles]);
|
|
40714
|
-
input.onAnalyzedFiles?.([...new Set(fileBatches.flat().filter((filePath) => !unavailableFiles.has(filePath)))].sort());
|
|
40715
40622
|
return dedupeDiagnostics(diagnostics);
|
|
40716
40623
|
};
|
|
40717
40624
|
let didValidate = false;
|
|
@@ -40968,18 +40875,12 @@ const reactHooksJsPluginDropNote = (error) => {
|
|
|
40968
40875
|
* 6. always restore disable directives + clean up the temp dir
|
|
40969
40876
|
*/
|
|
40970
40877
|
const runOxlint = async (options) => {
|
|
40971
|
-
const { rootDirectory, project, includePaths, nodeBinaryPath = process.execPath, customRulesOnly = false, respectInlineDisables = true, adoptExistingLintConfig = true, ignoredTags = /* @__PURE__ */ new Set(), userConfig, configSourceDirectory = rootDirectory, onPartialFailure,
|
|
40878
|
+
const { rootDirectory, project, includePaths, nodeBinaryPath = process.execPath, customRulesOnly = false, respectInlineDisables = true, adoptExistingLintConfig = true, ignoredTags = /* @__PURE__ */ new Set(), userConfig, configSourceDirectory = rootDirectory, onPartialFailure, perFileLintCacheEnabled = false, sidecarLintCacheEnabled = false, onCacheStats, onSidecarStats, spawnTimeoutMs, outputMaxBytes, lintBatchOrdering = "cost" } = options;
|
|
40972
40879
|
const serverAuthFunctionNames = Array.isArray(userConfig?.serverAuthFunctionNames) ? userConfig.serverAuthFunctionNames.filter((entry) => typeof entry === "string" && entry.length > 0) : void 0;
|
|
40973
40880
|
const severityControls = buildRuleSeverityControls(userConfig);
|
|
40974
40881
|
validateRuleRegistration();
|
|
40975
40882
|
resetManifestCaches();
|
|
40976
|
-
if (includePaths !== void 0 && includePaths.length === 0)
|
|
40977
|
-
onFileCoverage?.({
|
|
40978
|
-
candidateFiles: [],
|
|
40979
|
-
analyzedFiles: []
|
|
40980
|
-
});
|
|
40981
|
-
return [];
|
|
40982
|
-
}
|
|
40883
|
+
if (includePaths !== void 0 && includePaths.length === 0) return [];
|
|
40983
40884
|
const pluginPath = resolvePluginPath();
|
|
40984
40885
|
const extendsPaths = (adoptExistingLintConfig && !customRulesOnly ? detectUserLintConfigPaths(rootDirectory) : []).filter(canOxlintExtendConfig);
|
|
40985
40886
|
const userPlugins = resolveUserPlugins(userConfig?.plugins, configSourceDirectory);
|
|
@@ -41040,7 +40941,6 @@ const runOxlint = async (options) => {
|
|
|
41040
40941
|
const runConfigOverFiles = async (buildConfigForPass, configFileName, files, fileProgress) => {
|
|
41041
40942
|
if (files.length === 0) return {
|
|
41042
40943
|
diagnostics: [],
|
|
41043
|
-
analyzedFiles: [],
|
|
41044
40944
|
didDropReactHooksJsPlugin: false,
|
|
41045
40945
|
hadPartialFailure: false
|
|
41046
40946
|
};
|
|
@@ -41052,32 +40952,24 @@ const runOxlint = async (options) => {
|
|
|
41052
40952
|
const passConfigPath = Path.join(configDirectory, configFileName);
|
|
41053
40953
|
const passBaseArgs = makeBaseArgs(passConfigPath);
|
|
41054
40954
|
const passFileBatches = buildFileBatches(passBaseArgs, files);
|
|
41055
|
-
|
|
41056
|
-
|
|
41057
|
-
|
|
41058
|
-
|
|
41059
|
-
|
|
41060
|
-
|
|
41061
|
-
|
|
41062
|
-
|
|
41063
|
-
|
|
41064
|
-
|
|
41065
|
-
|
|
41066
|
-
|
|
41067
|
-
|
|
41068
|
-
|
|
41069
|
-
spawnTimeoutMs,
|
|
41070
|
-
outputMaxBytes,
|
|
41071
|
-
concurrency: options.concurrency,
|
|
41072
|
-
signal: options.signal,
|
|
41073
|
-
deadlineEpochMs: options.deadlineEpochMs
|
|
41074
|
-
});
|
|
41075
|
-
};
|
|
40955
|
+
const spawnPass = () => spawnLintBatches({
|
|
40956
|
+
baseArgs: passBaseArgs,
|
|
40957
|
+
fileBatches: passFileBatches,
|
|
40958
|
+
rootDirectory,
|
|
40959
|
+
nodeBinaryPath,
|
|
40960
|
+
project,
|
|
40961
|
+
onPartialFailure: reportPartialFailure,
|
|
40962
|
+
onFileProgress: fileProgress,
|
|
40963
|
+
spawnTimeoutMs,
|
|
40964
|
+
outputMaxBytes,
|
|
40965
|
+
concurrency: options.concurrency,
|
|
40966
|
+
signal: options.signal,
|
|
40967
|
+
deadlineEpochMs: options.deadlineEpochMs
|
|
40968
|
+
});
|
|
41076
40969
|
writeOxlintConfig(passConfigPath, buildConfigForPass({}));
|
|
41077
40970
|
try {
|
|
41078
40971
|
return {
|
|
41079
40972
|
diagnostics: await spawnPass(),
|
|
41080
|
-
analyzedFiles,
|
|
41081
40973
|
didDropReactHooksJsPlugin: false,
|
|
41082
40974
|
hadPartialFailure
|
|
41083
40975
|
};
|
|
@@ -41089,7 +40981,6 @@ const runOxlint = async (options) => {
|
|
|
41089
40981
|
reportPartialFailure(reactHooksJsDropNote);
|
|
41090
40982
|
return {
|
|
41091
40983
|
diagnostics,
|
|
41092
|
-
analyzedFiles,
|
|
41093
40984
|
didDropReactHooksJsPlugin: true,
|
|
41094
40985
|
hadPartialFailure
|
|
41095
40986
|
};
|
|
@@ -41165,7 +41056,6 @@ const runOxlint = async (options) => {
|
|
|
41165
41056
|
const missFileSet = new Set(missFiles);
|
|
41166
41057
|
const hitFiles = candidateFiles.filter((candidateFile) => !missFileSet.has(candidateFile));
|
|
41167
41058
|
const sidecarReplayedDiagnostics = [];
|
|
41168
|
-
const sidecarReplayedFiles = [];
|
|
41169
41059
|
const sidecarLintFiles = [];
|
|
41170
41060
|
if (sidecarCache === null) sidecarLintFiles.push(...hitFiles);
|
|
41171
41061
|
else {
|
|
@@ -41173,10 +41063,8 @@ const runOxlint = async (options) => {
|
|
|
41173
41063
|
for (const hitFile of hitFiles) {
|
|
41174
41064
|
const cacheKey = cacheKeyByFile.get(hitFile);
|
|
41175
41065
|
const entry = cacheKey === void 0 ? null : sidecarCache.lookup(cacheKey);
|
|
41176
|
-
if (entry !== null && entry.probes.every((probe) => probeAnswers.answerFor(probe.kind, probe.path) === probe.answer))
|
|
41177
|
-
|
|
41178
|
-
sidecarReplayedDiagnostics.push(...entry.diagnostics);
|
|
41179
|
-
} else sidecarLintFiles.push(hitFile);
|
|
41066
|
+
if (entry !== null && entry.probes.every((probe) => probeAnswers.answerFor(probe.kind, probe.path) === probe.answer)) sidecarReplayedDiagnostics.push(...entry.diagnostics);
|
|
41067
|
+
else sidecarLintFiles.push(hitFile);
|
|
41180
41068
|
if (performance.now() - verifySliceStartedAt >= 12) {
|
|
41181
41069
|
await yieldToEventLoop();
|
|
41182
41070
|
verifySliceStartedAt = performance.now();
|
|
@@ -41202,7 +41090,6 @@ const runOxlint = async (options) => {
|
|
|
41202
41090
|
sidecarRuleIdFilter: new Set(unboundedSidecarRuleIds)
|
|
41203
41091
|
}), "oxlintrc.sidecar-unbounded.json", hitFiles, void 0) : {
|
|
41204
41092
|
diagnostics: [],
|
|
41205
|
-
analyzedFiles: [],
|
|
41206
41093
|
didDropReactHooksJsPlugin: false,
|
|
41207
41094
|
hadPartialFailure: false
|
|
41208
41095
|
};
|
|
@@ -41233,15 +41120,6 @@ const runOxlint = async (options) => {
|
|
|
41233
41120
|
probesByFile: await missProbesTask
|
|
41234
41121
|
}]
|
|
41235
41122
|
});
|
|
41236
|
-
const analyzedFileSet = new Set(fullResult.analyzedFiles);
|
|
41237
|
-
const boundedSidecarAnalyzedFileSet = new Set(boundedSidecarResult.analyzedFiles);
|
|
41238
|
-
const unboundedSidecarAnalyzedFileSet = new Set(unboundedSidecarResult.analyzedFiles);
|
|
41239
|
-
const sidecarReplayedFileSet = new Set(sidecarReplayedFiles);
|
|
41240
|
-
for (const hitFile of hitFiles) if (useSidecarCache ? (sidecarReplayedFileSet.has(hitFile) || boundedSidecarAnalyzedFileSet.has(hitFile)) && (unboundedSidecarRuleIds.length === 0 || unboundedSidecarAnalyzedFileSet.has(hitFile)) : boundedSidecarAnalyzedFileSet.has(hitFile)) analyzedFileSet.add(hitFile);
|
|
41241
|
-
onFileCoverage?.({
|
|
41242
|
-
candidateFiles,
|
|
41243
|
-
analyzedFiles: candidateFiles.filter((candidateFile) => analyzedFileSet.has(candidateFile))
|
|
41244
|
-
});
|
|
41245
41123
|
return dedupeDiagnostics([
|
|
41246
41124
|
...replayedDiagnostics,
|
|
41247
41125
|
...fullResult.diagnostics,
|
|
@@ -41252,7 +41130,6 @@ const runOxlint = async (options) => {
|
|
|
41252
41130
|
}
|
|
41253
41131
|
const baseArgs = makeBaseArgs(configPath);
|
|
41254
41132
|
const fileBatches = buildFileBatches(baseArgs, candidateFiles);
|
|
41255
|
-
let analyzedFiles = [];
|
|
41256
41133
|
const runBatches = () => spawnLintBatches({
|
|
41257
41134
|
baseArgs,
|
|
41258
41135
|
fileBatches,
|
|
@@ -41260,9 +41137,6 @@ const runOxlint = async (options) => {
|
|
|
41260
41137
|
nodeBinaryPath,
|
|
41261
41138
|
project,
|
|
41262
41139
|
onPartialFailure,
|
|
41263
|
-
onAnalyzedFiles: (filePaths) => {
|
|
41264
|
-
analyzedFiles = filePaths;
|
|
41265
|
-
},
|
|
41266
41140
|
onFileProgress: options.onFileProgress,
|
|
41267
41141
|
spawnTimeoutMs,
|
|
41268
41142
|
outputMaxBytes,
|
|
@@ -41272,12 +41146,7 @@ const runOxlint = async (options) => {
|
|
|
41272
41146
|
});
|
|
41273
41147
|
writeOxlintConfig(configPath, buildConfig({ extendsPaths }));
|
|
41274
41148
|
try {
|
|
41275
|
-
|
|
41276
|
-
onFileCoverage?.({
|
|
41277
|
-
candidateFiles,
|
|
41278
|
-
analyzedFiles
|
|
41279
|
-
});
|
|
41280
|
-
return diagnostics;
|
|
41149
|
+
return await runBatches();
|
|
41281
41150
|
} catch (error) {
|
|
41282
41151
|
const reactHooksJsDropNote = reactHooksJsPluginDropNote(error);
|
|
41283
41152
|
if (reactHooksJsDropNote !== null) {
|
|
@@ -41287,20 +41156,11 @@ const runOxlint = async (options) => {
|
|
|
41287
41156
|
}));
|
|
41288
41157
|
const diagnostics = await runBatches();
|
|
41289
41158
|
onPartialFailure?.(reactHooksJsDropNote);
|
|
41290
|
-
onFileCoverage?.({
|
|
41291
|
-
candidateFiles,
|
|
41292
|
-
analyzedFiles
|
|
41293
|
-
});
|
|
41294
41159
|
return diagnostics;
|
|
41295
41160
|
}
|
|
41296
41161
|
if (extendsPaths.length === 0) throw error;
|
|
41297
41162
|
writeOxlintConfig(configPath, buildConfig({ extendsPaths: [] }));
|
|
41298
|
-
|
|
41299
|
-
onFileCoverage?.({
|
|
41300
|
-
candidateFiles,
|
|
41301
|
-
analyzedFiles
|
|
41302
|
-
});
|
|
41303
|
-
return diagnostics;
|
|
41163
|
+
return await runBatches();
|
|
41304
41164
|
}
|
|
41305
41165
|
} finally {
|
|
41306
41166
|
restoreDisableDirectives();
|
|
@@ -41380,7 +41240,6 @@ var Linter = class Linter extends Service()("react-doctor/Linter") {
|
|
|
41380
41240
|
onPartialFailure: (reason) => {
|
|
41381
41241
|
collectedFailures.push(reason);
|
|
41382
41242
|
},
|
|
41383
|
-
onFileCoverage: input.onFileCoverage,
|
|
41384
41243
|
onFileProgress: input.onFileProgress,
|
|
41385
41244
|
perFileLintCacheEnabled,
|
|
41386
41245
|
sidecarLintCacheEnabled,
|
|
@@ -41473,10 +41332,7 @@ const translateProjectInfoError = (cause, directory) => {
|
|
|
41473
41332
|
directory: cause.directory,
|
|
41474
41333
|
candidates: cause.candidates
|
|
41475
41334
|
}) });
|
|
41476
|
-
return new ReactDoctorError({ reason: new
|
|
41477
|
-
directory,
|
|
41478
|
-
cause
|
|
41479
|
-
}) });
|
|
41335
|
+
return new ReactDoctorError({ reason: new ProjectNotFound({ directory }) });
|
|
41480
41336
|
};
|
|
41481
41337
|
var Project = class Project extends Service()("react-doctor/Project") {
|
|
41482
41338
|
static layerNode = succeed$3(Project, Project.of({ discover: fn("Project.discover")(function* (directory) {
|
|
@@ -42088,7 +41944,6 @@ const resolveGithubActionsScoreMetadata = (environment = process.env) => {
|
|
|
42088
41944
|
...actorAssociation !== void 0 ? { githubActorAssociation: actorAssociation } : {}
|
|
42089
41945
|
};
|
|
42090
41946
|
};
|
|
42091
|
-
const toNormalizedRelativePath = (filePath, rootDirectory) => Path.relative(Path.resolve(rootDirectory), Path.resolve(rootDirectory, filePath)).replaceAll("\\", "/") || ".";
|
|
42092
41947
|
const NO_HOOKS = {
|
|
42093
41948
|
beforeLint: () => void_,
|
|
42094
41949
|
afterLint: () => void_
|
|
@@ -42187,7 +42042,7 @@ const runInspect = (input, hooks = {}) => gen(function* () {
|
|
|
42187
42042
|
repo
|
|
42188
42043
|
}).pipe(orElseSucceed(() => null)) : succeed$2(null));
|
|
42189
42044
|
const lintIncludePaths = (input.skipJsxIncludeFilter ? input.includePaths.length > 0 ? [...input.includePaths] : void 0 : computeExplicitLintIncludePaths([...input.includePaths], project)) ?? resolveLintIncludePaths(scanDirectory, resolvedConfig.config, project);
|
|
42190
|
-
const
|
|
42045
|
+
const scannedFilePaths = input.suppressScanSummary ? (lintIncludePaths ?? (yield* filesService.listSourceFiles(scanDirectory))).map((relativePath) => Path.resolve(scanDirectory, relativePath)) : [];
|
|
42191
42046
|
const beforeLint = hooks.beforeLint ?? NO_HOOKS.beforeLint;
|
|
42192
42047
|
const afterLint = hooks.afterLint ?? NO_HOOKS.afterLint;
|
|
42193
42048
|
yield* beforeLint(project, lintIncludePaths ?? void 0);
|
|
@@ -42292,7 +42147,6 @@ const runInspect = (input, hooks = {}) => gen(function* () {
|
|
|
42292
42147
|
let deadCodeCacheHit = null;
|
|
42293
42148
|
let deadCodeSummaryCacheHits = null;
|
|
42294
42149
|
let deadCodeSummaryCacheMisses = null;
|
|
42295
|
-
const lintFileCoverageState = { value: null };
|
|
42296
42150
|
const baseLintStream = linterService.run({
|
|
42297
42151
|
rootDirectory: scanDirectory,
|
|
42298
42152
|
project,
|
|
@@ -42308,9 +42162,6 @@ const runInspect = (input, hooks = {}) => gen(function* () {
|
|
|
42308
42162
|
lastReportedTotalFileCount = totalFileCount;
|
|
42309
42163
|
runSync(scanProgress.update(`Scanning files (${scannedFileCount}/${totalFileCount})${workerCountSuffix}...`));
|
|
42310
42164
|
},
|
|
42311
|
-
onFileCoverage: (coverage) => {
|
|
42312
|
-
lintFileCoverageState.value = coverage;
|
|
42313
|
-
},
|
|
42314
42165
|
onCacheStats: (cacheHitFileCount, totalConsideredFileCount) => {
|
|
42315
42166
|
lintCacheHitFileCount = cacheHitFileCount;
|
|
42316
42167
|
lintCacheTotalFileCount = totalConsideredFileCount;
|
|
@@ -42341,10 +42192,7 @@ const runInspect = (input, hooks = {}) => gen(function* () {
|
|
|
42341
42192
|
const lintFailureState = yield* get$2(lintFailure);
|
|
42342
42193
|
yield* afterLint(lintFailureState.didFail);
|
|
42343
42194
|
if (lintFailureState.didFail) yield* scanProgress.fail(formatLintFailText(lintFailureState.reasonTag, process.version));
|
|
42344
|
-
const
|
|
42345
|
-
const analyzedFiles = lintFileCoverageState.value === null ? [] : [...new Set(lintFileCoverageState.value.analyzedFiles.map((filePath) => toNormalizedRelativePath(filePath, scanDirectory)))].sort();
|
|
42346
|
-
const totalFileCount = candidateFiles.length || lastReportedTotalFileCount || (lintIncludePaths?.length ?? project.sourceFileCount);
|
|
42347
|
-
const scannedFilePaths = input.suppressScanSummary ? candidateFiles.length > 0 ? candidateFiles.map((filePath) => Path.resolve(scanDirectory, filePath)) : fallbackScannedFilePaths : [];
|
|
42195
|
+
const totalFileCount = lastReportedTotalFileCount || (lintIncludePaths?.length ?? project.sourceFileCount);
|
|
42348
42196
|
const scannedFilesLabel = `${totalFileCount} ${totalFileCount === 1 ? "file" : "files"}`;
|
|
42349
42197
|
let deadCodeCollected = [];
|
|
42350
42198
|
if (lintFailureState.didFail) {
|
|
@@ -42426,7 +42274,6 @@ const runInspect = (input, hooks = {}) => gen(function* () {
|
|
|
42426
42274
|
deadCodeOverlapped: shouldOverlapDeadCode,
|
|
42427
42275
|
scannedFileCount: totalFileCount,
|
|
42428
42276
|
scannedFilePaths,
|
|
42429
|
-
analyzedFiles,
|
|
42430
42277
|
scanElapsedMilliseconds,
|
|
42431
42278
|
scanConcurrency,
|
|
42432
42279
|
supplyChainOverlapTimedOut: supplyChainResult.timedOut,
|
|
@@ -44816,5 +44663,5 @@ const startLanguageServer = () => {
|
|
|
44816
44663
|
};
|
|
44817
44664
|
//#endregion
|
|
44818
44665
|
export { startLanguageServer };
|
|
44819
|
-
!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]="
|
|
44820
|
-
//# debugId=
|
|
44666
|
+
!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]="bc30542b-b95d-5630-bd67-52e3d1367e54")}catch(e){}}();
|
|
44667
|
+
//# debugId=bc30542b-b95d-5630-bd67-52e3d1367e54
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "react-doctor",
|
|
3
|
-
"version": "0.7.4
|
|
3
|
+
"version": "0.7.4",
|
|
4
4
|
"description": "Your agent writes bad React. This catches it",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"accessibility",
|
|
@@ -65,8 +65,8 @@
|
|
|
65
65
|
"vscode-languageserver-textdocument": "^1.0.12",
|
|
66
66
|
"vscode-uri": "^3.1.0",
|
|
67
67
|
"yaml": "^2.9.0",
|
|
68
|
-
"
|
|
69
|
-
"
|
|
68
|
+
"oxlint-plugin-react-doctor": "0.7.4",
|
|
69
|
+
"deslop-js": "0.7.4"
|
|
70
70
|
},
|
|
71
71
|
"devDependencies": {
|
|
72
72
|
"@types/babel__code-frame": "^7.27.0",
|
|
@@ -74,8 +74,8 @@
|
|
|
74
74
|
"@xterm/headless": "^6.0.0",
|
|
75
75
|
"commander": "^14.0.3",
|
|
76
76
|
"ora": "^9.4.0",
|
|
77
|
-
"@react-doctor/api": "0.7.4",
|
|
78
77
|
"@react-doctor/core": "0.7.4",
|
|
78
|
+
"@react-doctor/api": "0.7.4",
|
|
79
79
|
"@react-doctor/language-server": "0.7.4"
|
|
80
80
|
},
|
|
81
81
|
"engines": {
|