react-doctor 0.7.6-dev.0d11bd5 → 0.7.6-dev.17418
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 +61 -227
- package/dist/index.d.ts +4 -5
- package/dist/index.js +37 -87
- package/dist/lsp.js +61 -104
- package/package.json +2 -2
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
|