react-doctor 0.7.6-dev.5699529 → 0.7.6-dev.64950ba
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 +60 -226
- package/dist/index.d.ts +4 -5
- package/dist/index.js +37 -87
- package/dist/lsp.js +36 -86
- package/package.json +3 -3
package/dist/index.d.ts
CHANGED
|
@@ -9654,7 +9654,6 @@ interface DiagnoseOptions {
|
|
|
9654
9654
|
/** See `ReactDoctorConfig.deadCode`. Ignored in diff mode. */
|
|
9655
9655
|
deadCode?: boolean;
|
|
9656
9656
|
verbose?: boolean;
|
|
9657
|
-
/** Restrict linting to these supported JS/TS source files. */
|
|
9658
9657
|
includePaths?: string[];
|
|
9659
9658
|
/**
|
|
9660
9659
|
* Per-call override for `ReactDoctorConfig.respectInlineDisables`.
|
|
@@ -9916,9 +9915,9 @@ interface JsonReportProjectEntry {
|
|
|
9916
9915
|
skippedCheckReasons?: Record<string, string>;
|
|
9917
9916
|
/**
|
|
9918
9917
|
* Number of source files this scan's linter examined. In diff / changed
|
|
9919
|
-
* mode it's the count of changed
|
|
9920
|
-
* scan it's the whole source tree. `0`
|
|
9921
|
-
* files held nothing React Doctor lints —
|
|
9918
|
+
* mode it's the count of changed React-eligible files (`.tsx`/`.jsx` plus
|
|
9919
|
+
* framework entry files); in a full scan it's the whole source tree. `0`
|
|
9920
|
+
* in a diff scan means the changed files held nothing React Doctor lints —
|
|
9922
9921
|
* the GitHub Action reads that as "nothing to report" (skips the PR comment;
|
|
9923
9922
|
* the commit status says "skipped"). Optional: absent on reports from
|
|
9924
9923
|
* constructors that don't track it (e.g. `toJsonReport`).
|
|
@@ -10256,7 +10255,7 @@ declare const buildJsonReport: (input: BuildJsonReportInput) => JsonReportV3$1;
|
|
|
10256
10255
|
* render diff-base mistakes (`GitBaseBranchInvalid` /
|
|
10257
10256
|
* `GitBaseBranchMissing`) as clean user errors instead of crashes.
|
|
10258
10257
|
*/
|
|
10259
|
-
declare const getDiffInfo: (directory: string, explicitBaseBranch?: string
|
|
10258
|
+
declare const getDiffInfo: (directory: string, explicitBaseBranch?: string) => Promise<DiffInfo | null>;
|
|
10260
10259
|
declare const filterSourceFiles: (filePaths: string[]) => string[];
|
|
10261
10260
|
/**
|
|
10262
10261
|
* Programmatic façade over `Git.changedLineRanges` (the `lines` scope). Diffs
|
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]="7a10d23c-04fd-53e1-a623-a3dc5d6d0830")}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 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";
|
|
@@ -32930,6 +32930,7 @@ const IGNORED_DIRECTORIES = new Set([
|
|
|
32930
32930
|
"out",
|
|
32931
32931
|
"storybook-static"
|
|
32932
32932
|
]);
|
|
32933
|
+
const JSX_FILE_PATTERN = /\.(tsx|jsx)$/;
|
|
32933
32934
|
const MILLISECONDS_PER_SECOND = 1e3;
|
|
32934
32935
|
const SCORE_API_URL = "https://www.react.doctor/api/score";
|
|
32935
32936
|
const FETCH_TIMEOUT_MS = 1e4;
|
|
@@ -33142,15 +33143,13 @@ const listSourceFilesViaFilesystem = (rootDirectory) => {
|
|
|
33142
33143
|
const listSourceFilesWithSize = (rootDirectory) => collectSizedSourceFiles(rootDirectory, (listSourceFilesViaGit(rootDirectory) ?? listSourceFilesViaFilesystem(rootDirectory)).sort());
|
|
33143
33144
|
const listSourceFiles = (rootDirectory) => listSourceFilesWithSize(rootDirectory).map((entry) => entry.path);
|
|
33144
33145
|
const countSourceFiles = (rootDirectory) => listSourceFilesWithSize(rootDirectory).length;
|
|
33145
|
-
const UTF8_BOM_CHARACTER = "";
|
|
33146
|
-
const stripUtf8Bom = (content) => content.startsWith(UTF8_BOM_CHARACTER) ? content.slice(1) : content;
|
|
33147
33146
|
const cachedPackageJsons = /* @__PURE__ */ new Map();
|
|
33148
33147
|
const clearPackageJsonCache = () => {
|
|
33149
33148
|
cachedPackageJsons.clear();
|
|
33150
33149
|
};
|
|
33151
33150
|
const readPackageJsonUncached = (packageJsonPath) => {
|
|
33152
33151
|
try {
|
|
33153
|
-
return JSON.parse(
|
|
33152
|
+
return JSON.parse(NFS.readFileSync(packageJsonPath, "utf-8"));
|
|
33154
33153
|
} catch (error) {
|
|
33155
33154
|
if (error instanceof SyntaxError) return {};
|
|
33156
33155
|
if (isErrnoException(error)) {
|
|
@@ -36791,6 +36790,7 @@ const PNPM_WORKSPACE_FILE = "pnpm-workspace.yaml";
|
|
|
36791
36790
|
const PNPM_LOCKFILE = "pnpm-lock.yaml";
|
|
36792
36791
|
const PACKAGE_JSON_FILE = "package.json";
|
|
36793
36792
|
const PNPM_HARDENING_RULE_KEY = "require-pnpm-hardening";
|
|
36793
|
+
const UTF8_BOM_CHAR = "";
|
|
36794
36794
|
const HARDENING_SETTING_KEYS = new Set([
|
|
36795
36795
|
"minimumReleaseAge",
|
|
36796
36796
|
"blockExoticSubdeps",
|
|
@@ -36815,11 +36815,12 @@ const stripInlineComment = (rawValue) => {
|
|
|
36815
36815
|
return rawValue;
|
|
36816
36816
|
};
|
|
36817
36817
|
const unquote = (rawValue) => rawValue.replace(/^["']|["']$/g, "");
|
|
36818
|
+
const stripBom = (rawContent) => rawContent.startsWith(UTF8_BOM_CHAR) ? rawContent.slice(1) : rawContent;
|
|
36818
36819
|
const parseHardeningSettings = (content) => {
|
|
36819
36820
|
let minimumReleaseAge = null;
|
|
36820
36821
|
let blockExoticSubdeps = null;
|
|
36821
36822
|
let trustPolicy = null;
|
|
36822
|
-
const lines =
|
|
36823
|
+
const lines = stripBom(content).split(/\r?\n/);
|
|
36823
36824
|
for (let lineIndex = 0; lineIndex < lines.length; lineIndex += 1) {
|
|
36824
36825
|
const lineText = lines[lineIndex];
|
|
36825
36826
|
if (lineText === void 0) continue;
|
|
@@ -36853,7 +36854,7 @@ const isPnpmManagedProject = (rootDirectory) => {
|
|
|
36853
36854
|
const packageJsonPath = Path.join(rootDirectory, PACKAGE_JSON_FILE);
|
|
36854
36855
|
if (!isFile(packageJsonPath)) return false;
|
|
36855
36856
|
try {
|
|
36856
|
-
const packageJsonRaw =
|
|
36857
|
+
const packageJsonRaw = NFS.readFileSync(packageJsonPath, "utf-8");
|
|
36857
36858
|
const packageJson = JSON.parse(packageJsonRaw);
|
|
36858
36859
|
if (packageJson !== null && typeof packageJson === "object" && "packageManager" in packageJson && typeof packageJson.packageManager === "string" && packageJson.packageManager.startsWith("pnpm@")) return true;
|
|
36859
36860
|
} catch {
|
|
@@ -37515,7 +37516,9 @@ const highlighter = {
|
|
|
37515
37516
|
gray: import_picocolors.default.gray,
|
|
37516
37517
|
bold: import_picocolors.default.bold
|
|
37517
37518
|
};
|
|
37518
|
-
const
|
|
37519
|
+
const NEXT_ENTRY_FILE_PATTERN = /^(?:\.\/)?(?:src\/)?(?:middleware|proxy)\.(?:tsx?|jsx?|mts|mjs)$/;
|
|
37520
|
+
const shouldIncludeExplicitLintPath = (filePath, project) => JSX_FILE_PATTERN.test(filePath) || project?.framework === "nextjs" && NEXT_ENTRY_FILE_PATTERN.test(filePath);
|
|
37521
|
+
const computeExplicitLintIncludePaths = (includePaths, project) => includePaths.length > 0 ? includePaths.filter((filePath) => shouldIncludeExplicitLintPath(filePath, project)) : void 0;
|
|
37519
37522
|
const LINGUIST_ATTRIBUTE_PATTERN = /^linguist-(?:vendored|generated)(?:=([a-zA-Z0-9]+))?$/i;
|
|
37520
37523
|
const FALSY_VALUES = new Set([
|
|
37521
37524
|
"false",
|
|
@@ -38357,11 +38360,11 @@ const resolveDeadCodeTimeout = (input) => {
|
|
|
38357
38360
|
phaseTimeoutMs: workerTimeoutMs + DEAD_CODE_PHASE_TIMEOUT_OVER_WORKER_MS
|
|
38358
38361
|
};
|
|
38359
38362
|
};
|
|
38360
|
-
const resolveLintIncludePaths = (rootDirectory, userConfig) => {
|
|
38363
|
+
const resolveLintIncludePaths = (rootDirectory, userConfig, project) => {
|
|
38361
38364
|
if (!Array.isArray(userConfig?.ignore?.files) || userConfig.ignore.files.length === 0) return;
|
|
38362
38365
|
const ignoredPatterns = compileIgnoredFilePatterns(userConfig);
|
|
38363
38366
|
return listSourceFiles(rootDirectory).filter((filePath) => {
|
|
38364
|
-
if (!
|
|
38367
|
+
if (!shouldIncludeExplicitLintPath(filePath, project)) return false;
|
|
38365
38368
|
return !isFileIgnoredByPatterns(filePath, rootDirectory, ignoredPatterns);
|
|
38366
38369
|
});
|
|
38367
38370
|
};
|
|
@@ -38579,7 +38582,6 @@ const parseGithubViewerPermission = (stdout) => {
|
|
|
38579
38582
|
return /^[A-Z_]+$/.test(value) ? value.toLowerCase() : null;
|
|
38580
38583
|
};
|
|
38581
38584
|
const splitNullSeparated = (value) => value.split("\0").filter((entry) => entry.length > 0);
|
|
38582
|
-
const UNTRACKED_FILE_LAST_LINE = Number.MAX_SAFE_INTEGER;
|
|
38583
38585
|
/**
|
|
38584
38586
|
* `Git` wraps every `git`-via-subprocess call react-doctor makes
|
|
38585
38587
|
* behind a `Context.Service`. The production layer (`layerNode`)
|
|
@@ -38650,14 +38652,6 @@ var Git = class Git extends Service()("react-doctor/Git") {
|
|
|
38650
38652
|
args,
|
|
38651
38653
|
directory
|
|
38652
38654
|
});
|
|
38653
|
-
const listUntrackedFilePaths = (directory, includePaths = []) => runGit(directory, [
|
|
38654
|
-
"ls-files",
|
|
38655
|
-
"-z",
|
|
38656
|
-
"--others",
|
|
38657
|
-
"--exclude-standard",
|
|
38658
|
-
...includePaths.length > 0 ? ["--", ...includePaths] : []
|
|
38659
|
-
]).pipe(map$3((result) => result.status === 0 ? splitNullSeparated(result.stdout) : null));
|
|
38660
|
-
const mergeUntracked = (directory, trackedFilePaths, includeUntracked) => includeUntracked ? listUntrackedFilePaths(directory).pipe(map$3((untracked) => untracked === null ? trackedFilePaths : [...new Set([...trackedFilePaths, ...untracked])])) : succeed$2(trackedFilePaths);
|
|
38661
38655
|
const currentBranch = (directory) => runGit(directory, [
|
|
38662
38656
|
"rev-parse",
|
|
38663
38657
|
"--abbrev-ref",
|
|
@@ -38780,7 +38774,7 @@ var Git = class Git extends Service()("react-doctor/Git") {
|
|
|
38780
38774
|
githubViewerPermission,
|
|
38781
38775
|
branchExists,
|
|
38782
38776
|
mergeBase,
|
|
38783
|
-
diffSelection: ({ directory, explicitBaseBranch
|
|
38777
|
+
diffSelection: ({ directory, explicitBaseBranch }) => gen(function* () {
|
|
38784
38778
|
if (explicitBaseBranch !== void 0 && explicitBaseBranch.trim().length === 0) return yield* fail$4(new ReactDoctorError({ reason: new GitBaseBranchInvalid({ detail: "Diff base branch cannot be empty." }) }));
|
|
38785
38779
|
if (explicitBaseBranch !== void 0) {
|
|
38786
38780
|
const range = parseGitDiffRange(explicitBaseBranch);
|
|
@@ -38809,7 +38803,7 @@ var Git = class Git extends Service()("react-doctor/Git") {
|
|
|
38809
38803
|
"HEAD"
|
|
38810
38804
|
]);
|
|
38811
38805
|
if (uncommitted.status !== 0) return null;
|
|
38812
|
-
const files =
|
|
38806
|
+
const files = splitNullSeparated(uncommitted.stdout);
|
|
38813
38807
|
if (files.length === 0) return null;
|
|
38814
38808
|
return {
|
|
38815
38809
|
currentBranch: resolvedCurrentBranch,
|
|
@@ -38839,7 +38833,7 @@ var Git = class Git extends Service()("react-doctor/Git") {
|
|
|
38839
38833
|
currentBranch: resolvedCurrentBranch,
|
|
38840
38834
|
baseBranch,
|
|
38841
38835
|
diffBaseRef: mergeBaseRef,
|
|
38842
|
-
changedFiles:
|
|
38836
|
+
changedFiles: splitNullSeparated(diff.stdout),
|
|
38843
38837
|
isCurrentChanges: false
|
|
38844
38838
|
};
|
|
38845
38839
|
}).pipe(withSpan("Git.diffSelection")),
|
|
@@ -38885,7 +38879,7 @@ var Git = class Git extends Service()("react-doctor/Git") {
|
|
|
38885
38879
|
stdout: result.stdout
|
|
38886
38880
|
};
|
|
38887
38881
|
}).pipe(withSpan("Git.grep")),
|
|
38888
|
-
changedLineRanges: ({ directory, baseRef, cached, files
|
|
38882
|
+
changedLineRanges: ({ directory, baseRef, cached, files }) => gen(function* () {
|
|
38889
38883
|
if (files.length === 0) return [];
|
|
38890
38884
|
if (baseRef !== void 0 && !isSafeGitRevision(baseRef)) return null;
|
|
38891
38885
|
const result = yield* runGit(directory, [
|
|
@@ -38899,14 +38893,7 @@ var Git = class Git extends Service()("react-doctor/Git") {
|
|
|
38899
38893
|
...files
|
|
38900
38894
|
]);
|
|
38901
38895
|
if (result.status !== 0) return null;
|
|
38902
|
-
|
|
38903
|
-
if (cached || !includeUntracked) return changedLineRanges;
|
|
38904
|
-
const untrackedFilePaths = yield* listUntrackedFilePaths(directory, files);
|
|
38905
|
-
if (untrackedFilePaths === null) return changedLineRanges;
|
|
38906
|
-
return [...changedLineRanges, ...untrackedFilePaths.map((file) => ({
|
|
38907
|
-
file,
|
|
38908
|
-
ranges: [[1, UNTRACKED_FILE_LAST_LINE]]
|
|
38909
|
-
}))];
|
|
38896
|
+
return parseChangedLineRanges(result.stdout);
|
|
38910
38897
|
}).pipe(catch_$1((error) => error.reason._tag === "GitInvocationFailed" ? succeed$2(null) : fail$4(error)), withSpan("Git.changedLineRanges"))
|
|
38911
38898
|
});
|
|
38912
38899
|
})).pipe(provide$2(layer$2.pipe(provide$2(mergeAll$1(layer$1, layer)))));
|
|
@@ -39658,12 +39645,6 @@ const mapWithConcurrency = async (items, concurrency, task) => {
|
|
|
39658
39645
|
if (errors.length > 0) throw errors[0];
|
|
39659
39646
|
return results;
|
|
39660
39647
|
};
|
|
39661
|
-
const lineOfUtf8Offset = (sourceBuffer, utf8Offset) => {
|
|
39662
|
-
let lineNumber = 1;
|
|
39663
|
-
const scanEnd = Math.min(utf8Offset, sourceBuffer.length);
|
|
39664
|
-
for (let byteIndex = 0; byteIndex < scanEnd; byteIndex++) if (sourceBuffer[byteIndex] === 10) lineNumber++;
|
|
39665
|
-
return lineNumber;
|
|
39666
|
-
};
|
|
39667
39648
|
const REANIMATED_SHARED_VALUE_HINT = "If this is a Reanimated shared value, prefer its React Compiler-compatible `.get()` / `.set()` accessors over `.value` — https://docs.swmansion.com/react-native-reanimated/docs/core/useSharedValue/#react-compiler-support";
|
|
39668
39649
|
const ACCESSORS_MIN_VERSION = "3.15.0";
|
|
39669
39650
|
const supportsAccessors = (reanimatedVersion) => {
|
|
@@ -40235,6 +40216,13 @@ const findOutermostEnclosingFunctionRange = (sourceFile, targetLine) => {
|
|
|
40235
40216
|
visit(sourceFile);
|
|
40236
40217
|
return foundRange;
|
|
40237
40218
|
};
|
|
40219
|
+
const NEWLINE_BYTE = 10;
|
|
40220
|
+
const lineOfUtf8Offset = (sourceBuffer, utf8Offset) => {
|
|
40221
|
+
let lineNumber = 1;
|
|
40222
|
+
const scanEnd = Math.min(utf8Offset, sourceBuffer.length);
|
|
40223
|
+
for (let byteIndex = 0; byteIndex < scanEnd; byteIndex++) if (sourceBuffer[byteIndex] === NEWLINE_BYTE) lineNumber++;
|
|
40224
|
+
return lineNumber;
|
|
40225
|
+
};
|
|
40238
40226
|
/**
|
|
40239
40227
|
* Drops `react-doctor/react-compiler-no-manual-memoization` diagnostics
|
|
40240
40228
|
* whose enclosing function also carries a `react-hooks-js` (React
|
|
@@ -40415,11 +40403,11 @@ const buildRelatedLocations = (labels, filePath) => {
|
|
|
40415
40403
|
}
|
|
40416
40404
|
return related;
|
|
40417
40405
|
};
|
|
40418
|
-
const
|
|
40419
|
-
|
|
40420
|
-
const
|
|
40421
|
-
|
|
40422
|
-
|
|
40406
|
+
const isOxlintOutput = (value) => {
|
|
40407
|
+
if (typeof value !== "object" || value === null) return false;
|
|
40408
|
+
const candidate = value;
|
|
40409
|
+
return Array.isArray(candidate.diagnostics);
|
|
40410
|
+
};
|
|
40423
40411
|
/**
|
|
40424
40412
|
* Parses one oxlint subprocess's stdout into a flat `Diagnostic[]`.
|
|
40425
40413
|
* Tolerates the leading-notice-line shape oxlint sometimes prints
|
|
@@ -40438,59 +40426,23 @@ const parseOxlintOutput = (stdout, project, rootDirectory) => {
|
|
|
40438
40426
|
throw new ReactDoctorError({ reason: new OxlintOutputUnparseable({ preview: stdout.slice(0, 600) }) });
|
|
40439
40427
|
}
|
|
40440
40428
|
if (!isOxlintOutput(parsed)) throw new ReactDoctorError({ reason: new OxlintOutputUnparseable({ preview: stdout.slice(0, 600) }) });
|
|
40441
|
-
const engineFailureDiagnostic = parsed.diagnostics.find(isEngineFailureDiagnostic);
|
|
40442
|
-
if (engineFailureDiagnostic !== void 0) throw new ReactDoctorError({ reason: new OxlintOutputUnparseable({ preview: JSON.stringify(engineFailureDiagnostic).slice(0, 600) }) });
|
|
40443
40429
|
const minifiedFileCache = /* @__PURE__ */ new Map();
|
|
40444
|
-
const sourceBufferCache = /* @__PURE__ */ new Map();
|
|
40445
|
-
const sourceLinesCache = /* @__PURE__ */ new Map();
|
|
40446
|
-
const resolveAbsolutePath = (filename) => Path.isAbsolute(filename) ? filename : Path.resolve(rootDirectory || ".", filename);
|
|
40447
|
-
const readSourceBuffer = (filename) => {
|
|
40448
|
-
const absolutePath = resolveAbsolutePath(filename);
|
|
40449
|
-
const cached = sourceBufferCache.get(absolutePath);
|
|
40450
|
-
if (cached !== void 0) return cached;
|
|
40451
|
-
let sourceBuffer;
|
|
40452
|
-
try {
|
|
40453
|
-
sourceBuffer = NFS.readFileSync(absolutePath);
|
|
40454
|
-
} catch {
|
|
40455
|
-
sourceBuffer = null;
|
|
40456
|
-
}
|
|
40457
|
-
sourceBufferCache.set(absolutePath, sourceBuffer);
|
|
40458
|
-
return sourceBuffer;
|
|
40459
|
-
};
|
|
40460
|
-
const readSourceLines = (filename) => {
|
|
40461
|
-
const absolutePath = resolveAbsolutePath(filename);
|
|
40462
|
-
const cached = sourceLinesCache.get(absolutePath);
|
|
40463
|
-
if (cached !== void 0) return cached;
|
|
40464
|
-
const sourceBuffer = readSourceBuffer(filename);
|
|
40465
|
-
const sourceLines = sourceBuffer ? sourceBuffer.toString("utf8").split("\n") : null;
|
|
40466
|
-
sourceLinesCache.set(absolutePath, sourceLines);
|
|
40467
|
-
return sourceLines;
|
|
40468
|
-
};
|
|
40469
40430
|
const isMinifiedDiagnosticFile = (filename) => {
|
|
40470
|
-
const absolutePath =
|
|
40431
|
+
const absolutePath = Path.isAbsolute(filename) ? filename : Path.resolve(rootDirectory || ".", filename);
|
|
40471
40432
|
const cached = minifiedFileCache.get(absolutePath);
|
|
40472
40433
|
if (cached !== void 0) return cached;
|
|
40473
40434
|
const minified = isMinifiedSource(absolutePath);
|
|
40474
40435
|
minifiedFileCache.set(absolutePath, minified);
|
|
40475
40436
|
return minified;
|
|
40476
40437
|
};
|
|
40477
|
-
return suppressMemoizationInBailedOutFunctions(parsed.diagnostics.filter((diagnostic) =>
|
|
40438
|
+
return suppressMemoizationInBailedOutFunctions(parsed.diagnostics.filter((diagnostic) => diagnostic.code && isLintableSourceFile(diagnostic.filename) && !isMinifiedDiagnosticFile(diagnostic.filename) && !shouldSuppressLocalUseHookDiagnostic(diagnostic, rootDirectory) && !shouldSuppressCompilerFindingInWorklet(diagnostic, project, rootDirectory)).map((diagnostic) => {
|
|
40478
40439
|
const { plugin, rule } = parseRuleCode(diagnostic.code);
|
|
40479
40440
|
const primaryLabel = diagnostic.labels[0];
|
|
40480
40441
|
const cleaned = cleanDiagnosticMessage(diagnostic.message, diagnostic.help, plugin, rule, project);
|
|
40481
40442
|
const normalizedFilePath = diagnostic.filename.replaceAll("\\", "/");
|
|
40482
40443
|
const primarySpan = primaryLabel?.span;
|
|
40483
|
-
const sourceBuffer = primarySpan ? readSourceBuffer(diagnostic.filename) : null;
|
|
40484
40444
|
const relatedLocations = buildRelatedLocations(diagnostic.labels, normalizedFilePath);
|
|
40485
40445
|
const category = resolveDiagnosticCategory(plugin, rule);
|
|
40486
|
-
const matchByOccurrence = resolveMatchByOccurrence(rule, category);
|
|
40487
|
-
const sourceLines = primarySpan ? readSourceLines(diagnostic.filename) : null;
|
|
40488
|
-
const primaryLineIndex = primarySpan ? primarySpan.line - 1 : -1;
|
|
40489
|
-
const primaryLine = sourceLines?.[primaryLineIndex];
|
|
40490
|
-
const primaryColumnIndex = primarySpan ? primarySpan.column - 1 : -1;
|
|
40491
|
-
const isJsxTagLabel = primaryLine !== void 0 && primaryColumnIndex >= 0 && (primaryLine[primaryColumnIndex] === "<" || primaryLine[primaryColumnIndex - 1] === "<");
|
|
40492
|
-
const jsxOpenerEndLineIndex = sourceLines && isJsxTagLabel ? findJsxOpenerSpan(sourceLines, primaryLineIndex) : null;
|
|
40493
|
-
const primarySpanEndLine = jsxOpenerEndLineIndex !== null ? jsxOpenerEndLineIndex + 1 : primarySpan && sourceBuffer ? lineOfUtf8Offset(sourceBuffer, primarySpan.offset + Math.max(primarySpan.length - 1, 0)) : void 0;
|
|
40494
40446
|
return {
|
|
40495
40447
|
filePath: normalizedFilePath,
|
|
40496
40448
|
plugin,
|
|
@@ -40504,11 +40456,10 @@ const parseOxlintOutput = (stdout, project, rootDirectory) => {
|
|
|
40504
40456
|
column: primarySpan?.column ?? 0,
|
|
40505
40457
|
...primarySpan ? {
|
|
40506
40458
|
offset: primarySpan.offset,
|
|
40507
|
-
length: primarySpan.length
|
|
40508
|
-
...primarySpanEndLine !== void 0 ? { endLine: primarySpanEndLine } : {}
|
|
40459
|
+
length: primarySpan.length
|
|
40509
40460
|
} : {},
|
|
40510
40461
|
category,
|
|
40511
|
-
...
|
|
40462
|
+
...resolveMatchByOccurrence(rule, category) ? { matchByOccurrence: true } : {},
|
|
40512
40463
|
...relatedLocations.length > 0 ? { relatedLocations } : {}
|
|
40513
40464
|
};
|
|
40514
40465
|
}), rootDirectory);
|
|
@@ -42295,7 +42246,7 @@ const runInspect = (input, hooks = {}) => gen(function* () {
|
|
|
42295
42246
|
directory: scanDirectory,
|
|
42296
42247
|
repo
|
|
42297
42248
|
}).pipe(orElseSucceed(() => null)) : succeed$2(null));
|
|
42298
|
-
const lintIncludePaths = (input.
|
|
42249
|
+
const lintIncludePaths = (input.skipJsxIncludeFilter ? input.includePaths.length > 0 ? [...input.includePaths] : void 0 : computeExplicitLintIncludePaths([...input.includePaths], project)) ?? resolveLintIncludePaths(scanDirectory, resolvedConfig.config, project);
|
|
42299
42250
|
const fallbackScannedFilePaths = input.suppressScanSummary ? (lintIncludePaths ?? (yield* filesService.listSourceFiles(scanDirectory))).map((relativePath) => Path.resolve(scanDirectory, relativePath)) : [];
|
|
42300
42251
|
const beforeLint = hooks.beforeLint ?? NO_HOOKS.beforeLint;
|
|
42301
42252
|
const afterLint = hooks.afterLint ?? NO_HOOKS.afterLint;
|
|
@@ -42966,11 +42917,10 @@ const buildSkippedChecks = (input) => {
|
|
|
42966
42917
|
* render diff-base mistakes (`GitBaseBranchInvalid` /
|
|
42967
42918
|
* `GitBaseBranchMissing`) as clean user errors instead of crashes.
|
|
42968
42919
|
*/
|
|
42969
|
-
const getDiffInfo = (directory, explicitBaseBranch
|
|
42920
|
+
const getDiffInfo = (directory, explicitBaseBranch) => runPromise(gen(function* () {
|
|
42970
42921
|
const selection = yield* (yield* Git).diffSelection({
|
|
42971
42922
|
directory,
|
|
42972
|
-
explicitBaseBranch
|
|
42973
|
-
includeUntracked
|
|
42923
|
+
explicitBaseBranch
|
|
42974
42924
|
});
|
|
42975
42925
|
if (selection === null) return null;
|
|
42976
42926
|
return {
|
|
@@ -43260,4 +43210,4 @@ const toJsonReport = (result, options) => buildJsonReport({
|
|
|
43260
43210
|
export { AmbiguousProjectError, NoReactDependencyError, NotADirectoryError, PackageJsonNotFoundError, ProjectNotFoundError, ReactDoctorError, buildJsonReport, buildJsonReportError, clearCaches, defineConfig, diagnose, filterSourceFiles, getDiffInfo, hasReactRuntime, isProjectDiscoveryError, isReactDoctorError, summarizeDiagnostics, toJsonReport };
|
|
43261
43211
|
|
|
43262
43212
|
//# sourceMappingURL=index.js.map
|
|
43263
|
-
//# debugId=
|
|
43213
|
+
//# debugId=7a10d23c-04fd-53e1-a623-a3dc5d6d0830
|
package/dist/lsp.js
CHANGED
|
@@ -32959,6 +32959,7 @@ const IGNORED_DIRECTORIES = new Set([
|
|
|
32959
32959
|
"out",
|
|
32960
32960
|
"storybook-static"
|
|
32961
32961
|
]);
|
|
32962
|
+
const JSX_FILE_PATTERN = /\.(tsx|jsx)$/;
|
|
32962
32963
|
const MILLISECONDS_PER_SECOND = 1e3;
|
|
32963
32964
|
const SCORE_API_URL = "https://www.react.doctor/api/score";
|
|
32964
32965
|
const FETCH_TIMEOUT_MS = 1e4;
|
|
@@ -33194,15 +33195,13 @@ const listSourceFilesViaFilesystem = (rootDirectory) => {
|
|
|
33194
33195
|
const listSourceFilesWithSize = (rootDirectory) => collectSizedSourceFiles(rootDirectory, (listSourceFilesViaGit(rootDirectory) ?? listSourceFilesViaFilesystem(rootDirectory)).sort());
|
|
33195
33196
|
const listSourceFiles = (rootDirectory) => listSourceFilesWithSize(rootDirectory).map((entry) => entry.path);
|
|
33196
33197
|
const countSourceFiles = (rootDirectory) => listSourceFilesWithSize(rootDirectory).length;
|
|
33197
|
-
const UTF8_BOM_CHARACTER = "";
|
|
33198
|
-
const stripUtf8Bom = (content) => content.startsWith(UTF8_BOM_CHARACTER) ? content.slice(1) : content;
|
|
33199
33198
|
const cachedPackageJsons = /* @__PURE__ */ new Map();
|
|
33200
33199
|
const clearPackageJsonCache = () => {
|
|
33201
33200
|
cachedPackageJsons.clear();
|
|
33202
33201
|
};
|
|
33203
33202
|
const readPackageJsonUncached = (packageJsonPath) => {
|
|
33204
33203
|
try {
|
|
33205
|
-
return JSON.parse(
|
|
33204
|
+
return JSON.parse(NFS.readFileSync(packageJsonPath, "utf-8"));
|
|
33206
33205
|
} catch (error) {
|
|
33207
33206
|
if (error instanceof SyntaxError) return {};
|
|
33208
33207
|
if (isErrnoException(error)) {
|
|
@@ -36769,6 +36768,7 @@ const PNPM_WORKSPACE_FILE = "pnpm-workspace.yaml";
|
|
|
36769
36768
|
const PNPM_LOCKFILE = "pnpm-lock.yaml";
|
|
36770
36769
|
const PACKAGE_JSON_FILE = "package.json";
|
|
36771
36770
|
const PNPM_HARDENING_RULE_KEY = "require-pnpm-hardening";
|
|
36771
|
+
const UTF8_BOM_CHAR = "";
|
|
36772
36772
|
const HARDENING_SETTING_KEYS = new Set([
|
|
36773
36773
|
"minimumReleaseAge",
|
|
36774
36774
|
"blockExoticSubdeps",
|
|
@@ -36793,11 +36793,12 @@ const stripInlineComment = (rawValue) => {
|
|
|
36793
36793
|
return rawValue;
|
|
36794
36794
|
};
|
|
36795
36795
|
const unquote = (rawValue) => rawValue.replace(/^["']|["']$/g, "");
|
|
36796
|
+
const stripBom = (rawContent) => rawContent.startsWith(UTF8_BOM_CHAR) ? rawContent.slice(1) : rawContent;
|
|
36796
36797
|
const parseHardeningSettings = (content) => {
|
|
36797
36798
|
let minimumReleaseAge = null;
|
|
36798
36799
|
let blockExoticSubdeps = null;
|
|
36799
36800
|
let trustPolicy = null;
|
|
36800
|
-
const lines =
|
|
36801
|
+
const lines = stripBom(content).split(/\r?\n/);
|
|
36801
36802
|
for (let lineIndex = 0; lineIndex < lines.length; lineIndex += 1) {
|
|
36802
36803
|
const lineText = lines[lineIndex];
|
|
36803
36804
|
if (lineText === void 0) continue;
|
|
@@ -36831,7 +36832,7 @@ const isPnpmManagedProject = (rootDirectory) => {
|
|
|
36831
36832
|
const packageJsonPath = Path.join(rootDirectory, PACKAGE_JSON_FILE);
|
|
36832
36833
|
if (!isFile(packageJsonPath)) return false;
|
|
36833
36834
|
try {
|
|
36834
|
-
const packageJsonRaw =
|
|
36835
|
+
const packageJsonRaw = NFS.readFileSync(packageJsonPath, "utf-8");
|
|
36835
36836
|
const packageJson = JSON.parse(packageJsonRaw);
|
|
36836
36837
|
if (packageJson !== null && typeof packageJson === "object" && "packageManager" in packageJson && typeof packageJson.packageManager === "string" && packageJson.packageManager.startsWith("pnpm@")) return true;
|
|
36837
36838
|
} catch {
|
|
@@ -37493,7 +37494,9 @@ const highlighter = {
|
|
|
37493
37494
|
gray: import_picocolors.default.gray,
|
|
37494
37495
|
bold: import_picocolors.default.bold
|
|
37495
37496
|
};
|
|
37496
|
-
const
|
|
37497
|
+
const NEXT_ENTRY_FILE_PATTERN = /^(?:\.\/)?(?:src\/)?(?:middleware|proxy)\.(?:tsx?|jsx?|mts|mjs)$/;
|
|
37498
|
+
const shouldIncludeExplicitLintPath = (filePath, project) => JSX_FILE_PATTERN.test(filePath) || project?.framework === "nextjs" && NEXT_ENTRY_FILE_PATTERN.test(filePath);
|
|
37499
|
+
const computeExplicitLintIncludePaths = (includePaths, project) => includePaths.length > 0 ? includePaths.filter((filePath) => shouldIncludeExplicitLintPath(filePath, project)) : void 0;
|
|
37497
37500
|
const LINGUIST_ATTRIBUTE_PATTERN = /^linguist-(?:vendored|generated)(?:=([a-zA-Z0-9]+))?$/i;
|
|
37498
37501
|
const FALSY_VALUES = new Set([
|
|
37499
37502
|
"false",
|
|
@@ -38335,11 +38338,11 @@ const resolveDeadCodeTimeout = (input) => {
|
|
|
38335
38338
|
phaseTimeoutMs: workerTimeoutMs + DEAD_CODE_PHASE_TIMEOUT_OVER_WORKER_MS
|
|
38336
38339
|
};
|
|
38337
38340
|
};
|
|
38338
|
-
const resolveLintIncludePaths = (rootDirectory, userConfig) => {
|
|
38341
|
+
const resolveLintIncludePaths = (rootDirectory, userConfig, project) => {
|
|
38339
38342
|
if (!Array.isArray(userConfig?.ignore?.files) || userConfig.ignore.files.length === 0) return;
|
|
38340
38343
|
const ignoredPatterns = compileIgnoredFilePatterns(userConfig);
|
|
38341
38344
|
return listSourceFiles(rootDirectory).filter((filePath) => {
|
|
38342
|
-
if (!
|
|
38345
|
+
if (!shouldIncludeExplicitLintPath(filePath, project)) return false;
|
|
38343
38346
|
return !isFileIgnoredByPatterns(filePath, rootDirectory, ignoredPatterns);
|
|
38344
38347
|
});
|
|
38345
38348
|
};
|
|
@@ -38557,7 +38560,6 @@ const parseGithubViewerPermission = (stdout) => {
|
|
|
38557
38560
|
return /^[A-Z_]+$/.test(value) ? value.toLowerCase() : null;
|
|
38558
38561
|
};
|
|
38559
38562
|
const splitNullSeparated = (value) => value.split("\0").filter((entry) => entry.length > 0);
|
|
38560
|
-
const UNTRACKED_FILE_LAST_LINE = Number.MAX_SAFE_INTEGER;
|
|
38561
38563
|
/**
|
|
38562
38564
|
* `Git` wraps every `git`-via-subprocess call react-doctor makes
|
|
38563
38565
|
* behind a `Context.Service`. The production layer (`layerNode`)
|
|
@@ -38628,14 +38630,6 @@ var Git = class Git extends Service()("react-doctor/Git") {
|
|
|
38628
38630
|
args,
|
|
38629
38631
|
directory
|
|
38630
38632
|
});
|
|
38631
|
-
const listUntrackedFilePaths = (directory, includePaths = []) => runGit(directory, [
|
|
38632
|
-
"ls-files",
|
|
38633
|
-
"-z",
|
|
38634
|
-
"--others",
|
|
38635
|
-
"--exclude-standard",
|
|
38636
|
-
...includePaths.length > 0 ? ["--", ...includePaths] : []
|
|
38637
|
-
]).pipe(map$3((result) => result.status === 0 ? splitNullSeparated(result.stdout) : null));
|
|
38638
|
-
const mergeUntracked = (directory, trackedFilePaths, includeUntracked) => includeUntracked ? listUntrackedFilePaths(directory).pipe(map$3((untracked) => untracked === null ? trackedFilePaths : [...new Set([...trackedFilePaths, ...untracked])])) : succeed$2(trackedFilePaths);
|
|
38639
38633
|
const currentBranch = (directory) => runGit(directory, [
|
|
38640
38634
|
"rev-parse",
|
|
38641
38635
|
"--abbrev-ref",
|
|
@@ -38758,7 +38752,7 @@ var Git = class Git extends Service()("react-doctor/Git") {
|
|
|
38758
38752
|
githubViewerPermission,
|
|
38759
38753
|
branchExists,
|
|
38760
38754
|
mergeBase,
|
|
38761
|
-
diffSelection: ({ directory, explicitBaseBranch
|
|
38755
|
+
diffSelection: ({ directory, explicitBaseBranch }) => gen(function* () {
|
|
38762
38756
|
if (explicitBaseBranch !== void 0 && explicitBaseBranch.trim().length === 0) return yield* fail$4(new ReactDoctorError({ reason: new GitBaseBranchInvalid({ detail: "Diff base branch cannot be empty." }) }));
|
|
38763
38757
|
if (explicitBaseBranch !== void 0) {
|
|
38764
38758
|
const range = parseGitDiffRange(explicitBaseBranch);
|
|
@@ -38787,7 +38781,7 @@ var Git = class Git extends Service()("react-doctor/Git") {
|
|
|
38787
38781
|
"HEAD"
|
|
38788
38782
|
]);
|
|
38789
38783
|
if (uncommitted.status !== 0) return null;
|
|
38790
|
-
const files =
|
|
38784
|
+
const files = splitNullSeparated(uncommitted.stdout);
|
|
38791
38785
|
if (files.length === 0) return null;
|
|
38792
38786
|
return {
|
|
38793
38787
|
currentBranch: resolvedCurrentBranch,
|
|
@@ -38817,7 +38811,7 @@ var Git = class Git extends Service()("react-doctor/Git") {
|
|
|
38817
38811
|
currentBranch: resolvedCurrentBranch,
|
|
38818
38812
|
baseBranch,
|
|
38819
38813
|
diffBaseRef: mergeBaseRef,
|
|
38820
|
-
changedFiles:
|
|
38814
|
+
changedFiles: splitNullSeparated(diff.stdout),
|
|
38821
38815
|
isCurrentChanges: false
|
|
38822
38816
|
};
|
|
38823
38817
|
}).pipe(withSpan("Git.diffSelection")),
|
|
@@ -38863,7 +38857,7 @@ var Git = class Git extends Service()("react-doctor/Git") {
|
|
|
38863
38857
|
stdout: result.stdout
|
|
38864
38858
|
};
|
|
38865
38859
|
}).pipe(withSpan("Git.grep")),
|
|
38866
|
-
changedLineRanges: ({ directory, baseRef, cached, files
|
|
38860
|
+
changedLineRanges: ({ directory, baseRef, cached, files }) => gen(function* () {
|
|
38867
38861
|
if (files.length === 0) return [];
|
|
38868
38862
|
if (baseRef !== void 0 && !isSafeGitRevision(baseRef)) return null;
|
|
38869
38863
|
const result = yield* runGit(directory, [
|
|
@@ -38877,14 +38871,7 @@ var Git = class Git extends Service()("react-doctor/Git") {
|
|
|
38877
38871
|
...files
|
|
38878
38872
|
]);
|
|
38879
38873
|
if (result.status !== 0) return null;
|
|
38880
|
-
|
|
38881
|
-
if (cached || !includeUntracked) return changedLineRanges;
|
|
38882
|
-
const untrackedFilePaths = yield* listUntrackedFilePaths(directory, files);
|
|
38883
|
-
if (untrackedFilePaths === null) return changedLineRanges;
|
|
38884
|
-
return [...changedLineRanges, ...untrackedFilePaths.map((file) => ({
|
|
38885
|
-
file,
|
|
38886
|
-
ranges: [[1, UNTRACKED_FILE_LAST_LINE]]
|
|
38887
|
-
}))];
|
|
38874
|
+
return parseChangedLineRanges(result.stdout);
|
|
38888
38875
|
}).pipe(catch_$1((error) => error.reason._tag === "GitInvocationFailed" ? succeed$2(null) : fail$4(error)), withSpan("Git.changedLineRanges"))
|
|
38889
38876
|
});
|
|
38890
38877
|
})).pipe(provide$2(layer$2.pipe(provide$2(mergeAll$1(layer$1, layer)))));
|
|
@@ -39636,12 +39623,6 @@ const mapWithConcurrency = async (items, concurrency, task) => {
|
|
|
39636
39623
|
if (errors.length > 0) throw errors[0];
|
|
39637
39624
|
return results;
|
|
39638
39625
|
};
|
|
39639
|
-
const lineOfUtf8Offset = (sourceBuffer, utf8Offset) => {
|
|
39640
|
-
let lineNumber = 1;
|
|
39641
|
-
const scanEnd = Math.min(utf8Offset, sourceBuffer.length);
|
|
39642
|
-
for (let byteIndex = 0; byteIndex < scanEnd; byteIndex++) if (sourceBuffer[byteIndex] === 10) lineNumber++;
|
|
39643
|
-
return lineNumber;
|
|
39644
|
-
};
|
|
39645
39626
|
const REANIMATED_SHARED_VALUE_HINT = "If this is a Reanimated shared value, prefer its React Compiler-compatible `.get()` / `.set()` accessors over `.value` — https://docs.swmansion.com/react-native-reanimated/docs/core/useSharedValue/#react-compiler-support";
|
|
39646
39627
|
const ACCESSORS_MIN_VERSION = "3.15.0";
|
|
39647
39628
|
const supportsAccessors = (reanimatedVersion) => {
|
|
@@ -40213,6 +40194,13 @@ const findOutermostEnclosingFunctionRange = (sourceFile, targetLine) => {
|
|
|
40213
40194
|
visit(sourceFile);
|
|
40214
40195
|
return foundRange;
|
|
40215
40196
|
};
|
|
40197
|
+
const NEWLINE_BYTE = 10;
|
|
40198
|
+
const lineOfUtf8Offset = (sourceBuffer, utf8Offset) => {
|
|
40199
|
+
let lineNumber = 1;
|
|
40200
|
+
const scanEnd = Math.min(utf8Offset, sourceBuffer.length);
|
|
40201
|
+
for (let byteIndex = 0; byteIndex < scanEnd; byteIndex++) if (sourceBuffer[byteIndex] === NEWLINE_BYTE) lineNumber++;
|
|
40202
|
+
return lineNumber;
|
|
40203
|
+
};
|
|
40216
40204
|
/**
|
|
40217
40205
|
* Drops `react-doctor/react-compiler-no-manual-memoization` diagnostics
|
|
40218
40206
|
* whose enclosing function also carries a `react-hooks-js` (React
|
|
@@ -40393,11 +40381,11 @@ const buildRelatedLocations = (labels, filePath) => {
|
|
|
40393
40381
|
}
|
|
40394
40382
|
return related;
|
|
40395
40383
|
};
|
|
40396
|
-
const
|
|
40397
|
-
|
|
40398
|
-
const
|
|
40399
|
-
|
|
40400
|
-
|
|
40384
|
+
const isOxlintOutput = (value) => {
|
|
40385
|
+
if (typeof value !== "object" || value === null) return false;
|
|
40386
|
+
const candidate = value;
|
|
40387
|
+
return Array.isArray(candidate.diagnostics);
|
|
40388
|
+
};
|
|
40401
40389
|
/**
|
|
40402
40390
|
* Parses one oxlint subprocess's stdout into a flat `Diagnostic[]`.
|
|
40403
40391
|
* Tolerates the leading-notice-line shape oxlint sometimes prints
|
|
@@ -40416,59 +40404,23 @@ const parseOxlintOutput = (stdout, project, rootDirectory) => {
|
|
|
40416
40404
|
throw new ReactDoctorError({ reason: new OxlintOutputUnparseable({ preview: stdout.slice(0, 600) }) });
|
|
40417
40405
|
}
|
|
40418
40406
|
if (!isOxlintOutput(parsed)) throw new ReactDoctorError({ reason: new OxlintOutputUnparseable({ preview: stdout.slice(0, 600) }) });
|
|
40419
|
-
const engineFailureDiagnostic = parsed.diagnostics.find(isEngineFailureDiagnostic);
|
|
40420
|
-
if (engineFailureDiagnostic !== void 0) throw new ReactDoctorError({ reason: new OxlintOutputUnparseable({ preview: JSON.stringify(engineFailureDiagnostic).slice(0, 600) }) });
|
|
40421
40407
|
const minifiedFileCache = /* @__PURE__ */ new Map();
|
|
40422
|
-
const sourceBufferCache = /* @__PURE__ */ new Map();
|
|
40423
|
-
const sourceLinesCache = /* @__PURE__ */ new Map();
|
|
40424
|
-
const resolveAbsolutePath = (filename) => Path.isAbsolute(filename) ? filename : Path.resolve(rootDirectory || ".", filename);
|
|
40425
|
-
const readSourceBuffer = (filename) => {
|
|
40426
|
-
const absolutePath = resolveAbsolutePath(filename);
|
|
40427
|
-
const cached = sourceBufferCache.get(absolutePath);
|
|
40428
|
-
if (cached !== void 0) return cached;
|
|
40429
|
-
let sourceBuffer;
|
|
40430
|
-
try {
|
|
40431
|
-
sourceBuffer = NFS.readFileSync(absolutePath);
|
|
40432
|
-
} catch {
|
|
40433
|
-
sourceBuffer = null;
|
|
40434
|
-
}
|
|
40435
|
-
sourceBufferCache.set(absolutePath, sourceBuffer);
|
|
40436
|
-
return sourceBuffer;
|
|
40437
|
-
};
|
|
40438
|
-
const readSourceLines = (filename) => {
|
|
40439
|
-
const absolutePath = resolveAbsolutePath(filename);
|
|
40440
|
-
const cached = sourceLinesCache.get(absolutePath);
|
|
40441
|
-
if (cached !== void 0) return cached;
|
|
40442
|
-
const sourceBuffer = readSourceBuffer(filename);
|
|
40443
|
-
const sourceLines = sourceBuffer ? sourceBuffer.toString("utf8").split("\n") : null;
|
|
40444
|
-
sourceLinesCache.set(absolutePath, sourceLines);
|
|
40445
|
-
return sourceLines;
|
|
40446
|
-
};
|
|
40447
40408
|
const isMinifiedDiagnosticFile = (filename) => {
|
|
40448
|
-
const absolutePath =
|
|
40409
|
+
const absolutePath = Path.isAbsolute(filename) ? filename : Path.resolve(rootDirectory || ".", filename);
|
|
40449
40410
|
const cached = minifiedFileCache.get(absolutePath);
|
|
40450
40411
|
if (cached !== void 0) return cached;
|
|
40451
40412
|
const minified = isMinifiedSource(absolutePath);
|
|
40452
40413
|
minifiedFileCache.set(absolutePath, minified);
|
|
40453
40414
|
return minified;
|
|
40454
40415
|
};
|
|
40455
|
-
return suppressMemoizationInBailedOutFunctions(parsed.diagnostics.filter((diagnostic) =>
|
|
40416
|
+
return suppressMemoizationInBailedOutFunctions(parsed.diagnostics.filter((diagnostic) => diagnostic.code && isLintableSourceFile(diagnostic.filename) && !isMinifiedDiagnosticFile(diagnostic.filename) && !shouldSuppressLocalUseHookDiagnostic(diagnostic, rootDirectory) && !shouldSuppressCompilerFindingInWorklet(diagnostic, project, rootDirectory)).map((diagnostic) => {
|
|
40456
40417
|
const { plugin, rule } = parseRuleCode(diagnostic.code);
|
|
40457
40418
|
const primaryLabel = diagnostic.labels[0];
|
|
40458
40419
|
const cleaned = cleanDiagnosticMessage(diagnostic.message, diagnostic.help, plugin, rule, project);
|
|
40459
40420
|
const normalizedFilePath = diagnostic.filename.replaceAll("\\", "/");
|
|
40460
40421
|
const primarySpan = primaryLabel?.span;
|
|
40461
|
-
const sourceBuffer = primarySpan ? readSourceBuffer(diagnostic.filename) : null;
|
|
40462
40422
|
const relatedLocations = buildRelatedLocations(diagnostic.labels, normalizedFilePath);
|
|
40463
40423
|
const category = resolveDiagnosticCategory(plugin, rule);
|
|
40464
|
-
const matchByOccurrence = resolveMatchByOccurrence(rule, category);
|
|
40465
|
-
const sourceLines = primarySpan ? readSourceLines(diagnostic.filename) : null;
|
|
40466
|
-
const primaryLineIndex = primarySpan ? primarySpan.line - 1 : -1;
|
|
40467
|
-
const primaryLine = sourceLines?.[primaryLineIndex];
|
|
40468
|
-
const primaryColumnIndex = primarySpan ? primarySpan.column - 1 : -1;
|
|
40469
|
-
const isJsxTagLabel = primaryLine !== void 0 && primaryColumnIndex >= 0 && (primaryLine[primaryColumnIndex] === "<" || primaryLine[primaryColumnIndex - 1] === "<");
|
|
40470
|
-
const jsxOpenerEndLineIndex = sourceLines && isJsxTagLabel ? findJsxOpenerSpan(sourceLines, primaryLineIndex) : null;
|
|
40471
|
-
const primarySpanEndLine = jsxOpenerEndLineIndex !== null ? jsxOpenerEndLineIndex + 1 : primarySpan && sourceBuffer ? lineOfUtf8Offset(sourceBuffer, primarySpan.offset + Math.max(primarySpan.length - 1, 0)) : void 0;
|
|
40472
40424
|
return {
|
|
40473
40425
|
filePath: normalizedFilePath,
|
|
40474
40426
|
plugin,
|
|
@@ -40482,11 +40434,10 @@ const parseOxlintOutput = (stdout, project, rootDirectory) => {
|
|
|
40482
40434
|
column: primarySpan?.column ?? 0,
|
|
40483
40435
|
...primarySpan ? {
|
|
40484
40436
|
offset: primarySpan.offset,
|
|
40485
|
-
length: primarySpan.length
|
|
40486
|
-
...primarySpanEndLine !== void 0 ? { endLine: primarySpanEndLine } : {}
|
|
40437
|
+
length: primarySpan.length
|
|
40487
40438
|
} : {},
|
|
40488
40439
|
category,
|
|
40489
|
-
...
|
|
40440
|
+
...resolveMatchByOccurrence(rule, category) ? { matchByOccurrence: true } : {},
|
|
40490
40441
|
...relatedLocations.length > 0 ? { relatedLocations } : {}
|
|
40491
40442
|
};
|
|
40492
40443
|
}), rootDirectory);
|
|
@@ -42273,7 +42224,7 @@ const runInspect = (input, hooks = {}) => gen(function* () {
|
|
|
42273
42224
|
directory: scanDirectory,
|
|
42274
42225
|
repo
|
|
42275
42226
|
}).pipe(orElseSucceed(() => null)) : succeed$2(null));
|
|
42276
|
-
const lintIncludePaths = (input.
|
|
42227
|
+
const lintIncludePaths = (input.skipJsxIncludeFilter ? input.includePaths.length > 0 ? [...input.includePaths] : void 0 : computeExplicitLintIncludePaths([...input.includePaths], project)) ?? resolveLintIncludePaths(scanDirectory, resolvedConfig.config, project);
|
|
42277
42228
|
const fallbackScannedFilePaths = input.suppressScanSummary ? (lintIncludePaths ?? (yield* filesService.listSourceFiles(scanDirectory))).map((relativePath) => Path.resolve(scanDirectory, relativePath)) : [];
|
|
42278
42229
|
const beforeLint = hooks.beforeLint ?? NO_HOOKS.beforeLint;
|
|
42279
42230
|
const afterLint = hooks.afterLint ?? NO_HOOKS.afterLint;
|
|
@@ -42768,7 +42719,7 @@ const runEditorScan = async (input) => {
|
|
|
42768
42719
|
warnings,
|
|
42769
42720
|
isCi: false,
|
|
42770
42721
|
resolveLocalGithubViewerPermission: false,
|
|
42771
|
-
|
|
42722
|
+
skipJsxIncludeFilter: true
|
|
42772
42723
|
}).pipe(withSpan("runEditorScan", { attributes: {
|
|
42773
42724
|
"editor.lint": lint,
|
|
42774
42725
|
"editor.runDeadCode": runDeadCode
|
|
@@ -44542,7 +44493,6 @@ const METRIC = {
|
|
|
44542
44493
|
cliInvoked: "cli.invoked",
|
|
44543
44494
|
cliError: "cli.error",
|
|
44544
44495
|
cliEnvironmentError: "cli.env_error",
|
|
44545
|
-
stagedSnapshotDivergence: "staged.snapshot_divergence",
|
|
44546
44496
|
projectDetected: "project.detected",
|
|
44547
44497
|
projectPathSelected: "project.path_selected",
|
|
44548
44498
|
projectConfigSelected: "project.config_selected",
|
|
@@ -44897,5 +44847,5 @@ const startLanguageServer = () => {
|
|
|
44897
44847
|
};
|
|
44898
44848
|
//#endregion
|
|
44899
44849
|
export { startLanguageServer };
|
|
44900
|
-
!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]="
|
|
44901
|
-
//# debugId=
|
|
44850
|
+
!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]="56ea0b36-0904-532b-96d1-b4d9c867fe13")}catch(e){}}();
|
|
44851
|
+
//# debugId=56ea0b36-0904-532b-96d1-b4d9c867fe13
|