react-doctor 0.7.6-dev.17418 → 0.7.6-dev.1d7b6e2
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 +227 -61
- package/dist/index.d.ts +5 -4
- package/dist/index.js +87 -37
- package/dist/lsp.js +104 -61
- package/package.json +4 -4
package/dist/index.d.ts
CHANGED
|
@@ -9654,6 +9654,7 @@ 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. */
|
|
9657
9658
|
includePaths?: string[];
|
|
9658
9659
|
/**
|
|
9659
9660
|
* Per-call override for `ReactDoctorConfig.respectInlineDisables`.
|
|
@@ -9915,9 +9916,9 @@ interface JsonReportProjectEntry {
|
|
|
9915
9916
|
skippedCheckReasons?: Record<string, string>;
|
|
9916
9917
|
/**
|
|
9917
9918
|
* Number of source files this scan's linter examined. In diff / changed
|
|
9918
|
-
* mode it's the count of changed
|
|
9919
|
-
*
|
|
9920
|
-
*
|
|
9919
|
+
* mode it's the count of changed supported JS/TS source files; in a full
|
|
9920
|
+
* scan it's the whole source tree. `0` in a diff scan means the changed
|
|
9921
|
+
* files held nothing React Doctor lints —
|
|
9921
9922
|
* the GitHub Action reads that as "nothing to report" (skips the PR comment;
|
|
9922
9923
|
* the commit status says "skipped"). Optional: absent on reports from
|
|
9923
9924
|
* constructors that don't track it (e.g. `toJsonReport`).
|
|
@@ -10255,7 +10256,7 @@ declare const buildJsonReport: (input: BuildJsonReportInput) => JsonReportV3$1;
|
|
|
10255
10256
|
* render diff-base mistakes (`GitBaseBranchInvalid` /
|
|
10256
10257
|
* `GitBaseBranchMissing`) as clean user errors instead of crashes.
|
|
10257
10258
|
*/
|
|
10258
|
-
declare const getDiffInfo: (directory: string, explicitBaseBranch?: string) => Promise<DiffInfo | null>;
|
|
10259
|
+
declare const getDiffInfo: (directory: string, explicitBaseBranch?: string, includeUntracked?: boolean) => Promise<DiffInfo | null>;
|
|
10259
10260
|
declare const filterSourceFiles: (filePaths: string[]) => string[];
|
|
10260
10261
|
/**
|
|
10261
10262
|
* 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]="2aa6fc3c-96ab-5a4c-8a52-e74d27fb4b5a")}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,7 +32930,6 @@ const IGNORED_DIRECTORIES = new Set([
|
|
|
32930
32930
|
"out",
|
|
32931
32931
|
"storybook-static"
|
|
32932
32932
|
]);
|
|
32933
|
-
const JSX_FILE_PATTERN = /\.(tsx|jsx)$/;
|
|
32934
32933
|
const MILLISECONDS_PER_SECOND = 1e3;
|
|
32935
32934
|
const SCORE_API_URL = "https://www.react.doctor/api/score";
|
|
32936
32935
|
const FETCH_TIMEOUT_MS = 1e4;
|
|
@@ -33143,13 +33142,15 @@ const listSourceFilesViaFilesystem = (rootDirectory) => {
|
|
|
33143
33142
|
const listSourceFilesWithSize = (rootDirectory) => collectSizedSourceFiles(rootDirectory, (listSourceFilesViaGit(rootDirectory) ?? listSourceFilesViaFilesystem(rootDirectory)).sort());
|
|
33144
33143
|
const listSourceFiles = (rootDirectory) => listSourceFilesWithSize(rootDirectory).map((entry) => entry.path);
|
|
33145
33144
|
const countSourceFiles = (rootDirectory) => listSourceFilesWithSize(rootDirectory).length;
|
|
33145
|
+
const UTF8_BOM_CHARACTER = "";
|
|
33146
|
+
const stripUtf8Bom = (content) => content.startsWith(UTF8_BOM_CHARACTER) ? content.slice(1) : content;
|
|
33146
33147
|
const cachedPackageJsons = /* @__PURE__ */ new Map();
|
|
33147
33148
|
const clearPackageJsonCache = () => {
|
|
33148
33149
|
cachedPackageJsons.clear();
|
|
33149
33150
|
};
|
|
33150
33151
|
const readPackageJsonUncached = (packageJsonPath) => {
|
|
33151
33152
|
try {
|
|
33152
|
-
return JSON.parse(NFS.readFileSync(packageJsonPath, "utf-8"));
|
|
33153
|
+
return JSON.parse(stripUtf8Bom(NFS.readFileSync(packageJsonPath, "utf-8")));
|
|
33153
33154
|
} catch (error) {
|
|
33154
33155
|
if (error instanceof SyntaxError) return {};
|
|
33155
33156
|
if (isErrnoException(error)) {
|
|
@@ -36790,7 +36791,6 @@ const PNPM_WORKSPACE_FILE = "pnpm-workspace.yaml";
|
|
|
36790
36791
|
const PNPM_LOCKFILE = "pnpm-lock.yaml";
|
|
36791
36792
|
const PACKAGE_JSON_FILE = "package.json";
|
|
36792
36793
|
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,12 +36815,11 @@ 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;
|
|
36819
36818
|
const parseHardeningSettings = (content) => {
|
|
36820
36819
|
let minimumReleaseAge = null;
|
|
36821
36820
|
let blockExoticSubdeps = null;
|
|
36822
36821
|
let trustPolicy = null;
|
|
36823
|
-
const lines =
|
|
36822
|
+
const lines = stripUtf8Bom(content).split(/\r?\n/);
|
|
36824
36823
|
for (let lineIndex = 0; lineIndex < lines.length; lineIndex += 1) {
|
|
36825
36824
|
const lineText = lines[lineIndex];
|
|
36826
36825
|
if (lineText === void 0) continue;
|
|
@@ -36854,7 +36853,7 @@ const isPnpmManagedProject = (rootDirectory) => {
|
|
|
36854
36853
|
const packageJsonPath = Path.join(rootDirectory, PACKAGE_JSON_FILE);
|
|
36855
36854
|
if (!isFile(packageJsonPath)) return false;
|
|
36856
36855
|
try {
|
|
36857
|
-
const packageJsonRaw = NFS.readFileSync(packageJsonPath, "utf-8");
|
|
36856
|
+
const packageJsonRaw = stripUtf8Bom(NFS.readFileSync(packageJsonPath, "utf-8"));
|
|
36858
36857
|
const packageJson = JSON.parse(packageJsonRaw);
|
|
36859
36858
|
if (packageJson !== null && typeof packageJson === "object" && "packageManager" in packageJson && typeof packageJson.packageManager === "string" && packageJson.packageManager.startsWith("pnpm@")) return true;
|
|
36860
36859
|
} catch {
|
|
@@ -37516,9 +37515,7 @@ const highlighter = {
|
|
|
37516
37515
|
gray: import_picocolors.default.gray,
|
|
37517
37516
|
bold: import_picocolors.default.bold
|
|
37518
37517
|
};
|
|
37519
|
-
const
|
|
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;
|
|
37518
|
+
const computeExplicitLintIncludePaths = (includePaths) => includePaths.length > 0 ? includePaths.filter(isLintableSourceFile) : void 0;
|
|
37522
37519
|
const LINGUIST_ATTRIBUTE_PATTERN = /^linguist-(?:vendored|generated)(?:=([a-zA-Z0-9]+))?$/i;
|
|
37523
37520
|
const FALSY_VALUES = new Set([
|
|
37524
37521
|
"false",
|
|
@@ -38360,11 +38357,11 @@ const resolveDeadCodeTimeout = (input) => {
|
|
|
38360
38357
|
phaseTimeoutMs: workerTimeoutMs + DEAD_CODE_PHASE_TIMEOUT_OVER_WORKER_MS
|
|
38361
38358
|
};
|
|
38362
38359
|
};
|
|
38363
|
-
const resolveLintIncludePaths = (rootDirectory, userConfig
|
|
38360
|
+
const resolveLintIncludePaths = (rootDirectory, userConfig) => {
|
|
38364
38361
|
if (!Array.isArray(userConfig?.ignore?.files) || userConfig.ignore.files.length === 0) return;
|
|
38365
38362
|
const ignoredPatterns = compileIgnoredFilePatterns(userConfig);
|
|
38366
38363
|
return listSourceFiles(rootDirectory).filter((filePath) => {
|
|
38367
|
-
if (!
|
|
38364
|
+
if (!isLintableSourceFile(filePath)) return false;
|
|
38368
38365
|
return !isFileIgnoredByPatterns(filePath, rootDirectory, ignoredPatterns);
|
|
38369
38366
|
});
|
|
38370
38367
|
};
|
|
@@ -38582,6 +38579,7 @@ const parseGithubViewerPermission = (stdout) => {
|
|
|
38582
38579
|
return /^[A-Z_]+$/.test(value) ? value.toLowerCase() : null;
|
|
38583
38580
|
};
|
|
38584
38581
|
const splitNullSeparated = (value) => value.split("\0").filter((entry) => entry.length > 0);
|
|
38582
|
+
const UNTRACKED_FILE_LAST_LINE = Number.MAX_SAFE_INTEGER;
|
|
38585
38583
|
/**
|
|
38586
38584
|
* `Git` wraps every `git`-via-subprocess call react-doctor makes
|
|
38587
38585
|
* behind a `Context.Service`. The production layer (`layerNode`)
|
|
@@ -38652,6 +38650,14 @@ var Git = class Git extends Service()("react-doctor/Git") {
|
|
|
38652
38650
|
args,
|
|
38653
38651
|
directory
|
|
38654
38652
|
});
|
|
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);
|
|
38655
38661
|
const currentBranch = (directory) => runGit(directory, [
|
|
38656
38662
|
"rev-parse",
|
|
38657
38663
|
"--abbrev-ref",
|
|
@@ -38774,7 +38780,7 @@ var Git = class Git extends Service()("react-doctor/Git") {
|
|
|
38774
38780
|
githubViewerPermission,
|
|
38775
38781
|
branchExists,
|
|
38776
38782
|
mergeBase,
|
|
38777
|
-
diffSelection: ({ directory, explicitBaseBranch }) => gen(function* () {
|
|
38783
|
+
diffSelection: ({ directory, explicitBaseBranch, includeUntracked = false }) => gen(function* () {
|
|
38778
38784
|
if (explicitBaseBranch !== void 0 && explicitBaseBranch.trim().length === 0) return yield* fail$4(new ReactDoctorError({ reason: new GitBaseBranchInvalid({ detail: "Diff base branch cannot be empty." }) }));
|
|
38779
38785
|
if (explicitBaseBranch !== void 0) {
|
|
38780
38786
|
const range = parseGitDiffRange(explicitBaseBranch);
|
|
@@ -38803,7 +38809,7 @@ var Git = class Git extends Service()("react-doctor/Git") {
|
|
|
38803
38809
|
"HEAD"
|
|
38804
38810
|
]);
|
|
38805
38811
|
if (uncommitted.status !== 0) return null;
|
|
38806
|
-
const files = splitNullSeparated(uncommitted.stdout);
|
|
38812
|
+
const files = yield* mergeUntracked(directory, splitNullSeparated(uncommitted.stdout), includeUntracked);
|
|
38807
38813
|
if (files.length === 0) return null;
|
|
38808
38814
|
return {
|
|
38809
38815
|
currentBranch: resolvedCurrentBranch,
|
|
@@ -38833,7 +38839,7 @@ var Git = class Git extends Service()("react-doctor/Git") {
|
|
|
38833
38839
|
currentBranch: resolvedCurrentBranch,
|
|
38834
38840
|
baseBranch,
|
|
38835
38841
|
diffBaseRef: mergeBaseRef,
|
|
38836
|
-
changedFiles: splitNullSeparated(diff.stdout),
|
|
38842
|
+
changedFiles: yield* mergeUntracked(directory, splitNullSeparated(diff.stdout), includeUntracked),
|
|
38837
38843
|
isCurrentChanges: false
|
|
38838
38844
|
};
|
|
38839
38845
|
}).pipe(withSpan("Git.diffSelection")),
|
|
@@ -38879,7 +38885,7 @@ var Git = class Git extends Service()("react-doctor/Git") {
|
|
|
38879
38885
|
stdout: result.stdout
|
|
38880
38886
|
};
|
|
38881
38887
|
}).pipe(withSpan("Git.grep")),
|
|
38882
|
-
changedLineRanges: ({ directory, baseRef, cached, files }) => gen(function* () {
|
|
38888
|
+
changedLineRanges: ({ directory, baseRef, cached, files, includeUntracked = false }) => gen(function* () {
|
|
38883
38889
|
if (files.length === 0) return [];
|
|
38884
38890
|
if (baseRef !== void 0 && !isSafeGitRevision(baseRef)) return null;
|
|
38885
38891
|
const result = yield* runGit(directory, [
|
|
@@ -38893,7 +38899,14 @@ var Git = class Git extends Service()("react-doctor/Git") {
|
|
|
38893
38899
|
...files
|
|
38894
38900
|
]);
|
|
38895
38901
|
if (result.status !== 0) return null;
|
|
38896
|
-
|
|
38902
|
+
const changedLineRanges = parseChangedLineRanges(result.stdout);
|
|
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
|
+
}))];
|
|
38897
38910
|
}).pipe(catch_$1((error) => error.reason._tag === "GitInvocationFailed" ? succeed$2(null) : fail$4(error)), withSpan("Git.changedLineRanges"))
|
|
38898
38911
|
});
|
|
38899
38912
|
})).pipe(provide$2(layer$2.pipe(provide$2(mergeAll$1(layer$1, layer)))));
|
|
@@ -39645,6 +39658,12 @@ const mapWithConcurrency = async (items, concurrency, task) => {
|
|
|
39645
39658
|
if (errors.length > 0) throw errors[0];
|
|
39646
39659
|
return results;
|
|
39647
39660
|
};
|
|
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
|
+
};
|
|
39648
39667
|
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";
|
|
39649
39668
|
const ACCESSORS_MIN_VERSION = "3.15.0";
|
|
39650
39669
|
const supportsAccessors = (reanimatedVersion) => {
|
|
@@ -40216,13 +40235,6 @@ const findOutermostEnclosingFunctionRange = (sourceFile, targetLine) => {
|
|
|
40216
40235
|
visit(sourceFile);
|
|
40217
40236
|
return foundRange;
|
|
40218
40237
|
};
|
|
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
|
-
};
|
|
40226
40238
|
/**
|
|
40227
40239
|
* Drops `react-doctor/react-compiler-no-manual-memoization` diagnostics
|
|
40228
40240
|
* whose enclosing function also carries a `react-hooks-js` (React
|
|
@@ -40403,11 +40415,11 @@ const buildRelatedLocations = (labels, filePath) => {
|
|
|
40403
40415
|
}
|
|
40404
40416
|
return related;
|
|
40405
40417
|
};
|
|
40406
|
-
const
|
|
40407
|
-
|
|
40408
|
-
|
|
40409
|
-
|
|
40410
|
-
|
|
40418
|
+
const isOxlintSpan = (value) => isRecord(value) && typeof value.offset === "number" && typeof value.length === "number" && typeof value.line === "number" && typeof value.column === "number";
|
|
40419
|
+
const isOxlintLabel = (value) => isRecord(value) && isOxlintSpan(value.span);
|
|
40420
|
+
const isMappableOxlintDiagnostic = (value) => isRecord(value) && typeof value.code === "string" && value.code.length > 0 && typeof value.filename === "string" && value.filename.length > 0 && (value.severity === "warning" || value.severity === "error") && Array.isArray(value.labels) && value.labels.every(isOxlintLabel);
|
|
40421
|
+
const isEngineFailureDiagnostic = (value) => !isRecord(value) || typeof value.filename !== "string" || value.filename.length === 0;
|
|
40422
|
+
const isOxlintOutput = (value) => isRecord(value) && Array.isArray(value.diagnostics);
|
|
40411
40423
|
/**
|
|
40412
40424
|
* Parses one oxlint subprocess's stdout into a flat `Diagnostic[]`.
|
|
40413
40425
|
* Tolerates the leading-notice-line shape oxlint sometimes prints
|
|
@@ -40426,23 +40438,59 @@ const parseOxlintOutput = (stdout, project, rootDirectory) => {
|
|
|
40426
40438
|
throw new ReactDoctorError({ reason: new OxlintOutputUnparseable({ preview: stdout.slice(0, 600) }) });
|
|
40427
40439
|
}
|
|
40428
40440
|
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) }) });
|
|
40429
40443
|
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
|
+
};
|
|
40430
40469
|
const isMinifiedDiagnosticFile = (filename) => {
|
|
40431
|
-
const absolutePath =
|
|
40470
|
+
const absolutePath = resolveAbsolutePath(filename);
|
|
40432
40471
|
const cached = minifiedFileCache.get(absolutePath);
|
|
40433
40472
|
if (cached !== void 0) return cached;
|
|
40434
40473
|
const minified = isMinifiedSource(absolutePath);
|
|
40435
40474
|
minifiedFileCache.set(absolutePath, minified);
|
|
40436
40475
|
return minified;
|
|
40437
40476
|
};
|
|
40438
|
-
return suppressMemoizationInBailedOutFunctions(parsed.diagnostics.filter((diagnostic) => diagnostic
|
|
40477
|
+
return suppressMemoizationInBailedOutFunctions(parsed.diagnostics.filter((diagnostic) => isMappableOxlintDiagnostic(diagnostic) && isLintableSourceFile(diagnostic.filename) && !isMinifiedDiagnosticFile(diagnostic.filename) && !shouldSuppressLocalUseHookDiagnostic(diagnostic, rootDirectory) && !shouldSuppressCompilerFindingInWorklet(diagnostic, project, rootDirectory)).map((diagnostic) => {
|
|
40439
40478
|
const { plugin, rule } = parseRuleCode(diagnostic.code);
|
|
40440
40479
|
const primaryLabel = diagnostic.labels[0];
|
|
40441
40480
|
const cleaned = cleanDiagnosticMessage(diagnostic.message, diagnostic.help, plugin, rule, project);
|
|
40442
40481
|
const normalizedFilePath = diagnostic.filename.replaceAll("\\", "/");
|
|
40443
40482
|
const primarySpan = primaryLabel?.span;
|
|
40483
|
+
const sourceBuffer = primarySpan ? readSourceBuffer(diagnostic.filename) : null;
|
|
40444
40484
|
const relatedLocations = buildRelatedLocations(diagnostic.labels, normalizedFilePath);
|
|
40445
40485
|
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;
|
|
40446
40494
|
return {
|
|
40447
40495
|
filePath: normalizedFilePath,
|
|
40448
40496
|
plugin,
|
|
@@ -40456,10 +40504,11 @@ const parseOxlintOutput = (stdout, project, rootDirectory) => {
|
|
|
40456
40504
|
column: primarySpan?.column ?? 0,
|
|
40457
40505
|
...primarySpan ? {
|
|
40458
40506
|
offset: primarySpan.offset,
|
|
40459
|
-
length: primarySpan.length
|
|
40507
|
+
length: primarySpan.length,
|
|
40508
|
+
...primarySpanEndLine !== void 0 ? { endLine: primarySpanEndLine } : {}
|
|
40460
40509
|
} : {},
|
|
40461
40510
|
category,
|
|
40462
|
-
...
|
|
40511
|
+
...matchByOccurrence ? { matchByOccurrence: true } : {},
|
|
40463
40512
|
...relatedLocations.length > 0 ? { relatedLocations } : {}
|
|
40464
40513
|
};
|
|
40465
40514
|
}), rootDirectory);
|
|
@@ -42246,7 +42295,7 @@ const runInspect = (input, hooks = {}) => gen(function* () {
|
|
|
42246
42295
|
directory: scanDirectory,
|
|
42247
42296
|
repo
|
|
42248
42297
|
}).pipe(orElseSucceed(() => null)) : succeed$2(null));
|
|
42249
|
-
const lintIncludePaths = (input.
|
|
42298
|
+
const lintIncludePaths = (input.skipExplicitIncludePathFilter ? input.includePaths.length > 0 ? [...input.includePaths] : void 0 : computeExplicitLintIncludePaths([...input.includePaths])) ?? resolveLintIncludePaths(scanDirectory, resolvedConfig.config);
|
|
42250
42299
|
const fallbackScannedFilePaths = input.suppressScanSummary ? (lintIncludePaths ?? (yield* filesService.listSourceFiles(scanDirectory))).map((relativePath) => Path.resolve(scanDirectory, relativePath)) : [];
|
|
42251
42300
|
const beforeLint = hooks.beforeLint ?? NO_HOOKS.beforeLint;
|
|
42252
42301
|
const afterLint = hooks.afterLint ?? NO_HOOKS.afterLint;
|
|
@@ -42917,10 +42966,11 @@ const buildSkippedChecks = (input) => {
|
|
|
42917
42966
|
* render diff-base mistakes (`GitBaseBranchInvalid` /
|
|
42918
42967
|
* `GitBaseBranchMissing`) as clean user errors instead of crashes.
|
|
42919
42968
|
*/
|
|
42920
|
-
const getDiffInfo = (directory, explicitBaseBranch) => runPromise(gen(function* () {
|
|
42969
|
+
const getDiffInfo = (directory, explicitBaseBranch, includeUntracked) => runPromise(gen(function* () {
|
|
42921
42970
|
const selection = yield* (yield* Git).diffSelection({
|
|
42922
42971
|
directory,
|
|
42923
|
-
explicitBaseBranch
|
|
42972
|
+
explicitBaseBranch,
|
|
42973
|
+
includeUntracked
|
|
42924
42974
|
});
|
|
42925
42975
|
if (selection === null) return null;
|
|
42926
42976
|
return {
|
|
@@ -43210,4 +43260,4 @@ const toJsonReport = (result, options) => buildJsonReport({
|
|
|
43210
43260
|
export { AmbiguousProjectError, NoReactDependencyError, NotADirectoryError, PackageJsonNotFoundError, ProjectNotFoundError, ReactDoctorError, buildJsonReport, buildJsonReportError, clearCaches, defineConfig, diagnose, filterSourceFiles, getDiffInfo, hasReactRuntime, isProjectDiscoveryError, isReactDoctorError, summarizeDiagnostics, toJsonReport };
|
|
43211
43261
|
|
|
43212
43262
|
//# sourceMappingURL=index.js.map
|
|
43213
|
-
//# debugId=
|
|
43263
|
+
//# debugId=2aa6fc3c-96ab-5a4c-8a52-e74d27fb4b5a
|