react-doctor 0.9.22 → 0.9.23-dev.05dfafe
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/{build-section-divider-JXerAqjw.js → build-section-divider-B3l6DXTH.js} +5 -5
- package/dist/{ci-BWu53Ijl.js → ci-DUDuv_KL.js} +13 -13
- package/dist/cli.js +25 -25
- package/dist/{constants-lt2tTZjE.js → constants-BmD_c3Yq.js} +12 -6
- package/dist/{constants-DNh19qg9.js → constants-T2clfs7L.js} +4 -4
- package/dist/{design-CN12FgvK.js → design-Bj9aMiuv.js} +4 -4
- package/dist/duplicate-jsx-worker.js +17 -10
- package/dist/{exit-gracefully-BMgB2pVu.js → exit-gracefully-cCXyQl3i.js} +6 -6
- package/dist/{handle-error-CoIUQwLf.js → handle-error-lgLxrA8y.js} +6 -6
- package/dist/index.d.ts +20 -2
- package/dist/index.js +247 -41
- package/dist/{inspect-D4QLdCtm.js → inspect-Bb1HyA7w.js} +16 -16
- package/dist/{install-R6-fv9t4.js → install-Ctq7ew69.js} +10 -10
- package/dist/{install-doctor-script-D9-Bdbx6.js → install-doctor-script-C8URs5z8.js} +5 -5
- package/dist/{install-github-workflow-B01vSPPa.js → install-github-workflow-4uZez_Ux.js} +6 -6
- package/dist/{install-react-doctor-DZnPIaiY.js → install-react-doctor-z8YCZ_ln.js} +9 -9
- package/dist/{is-cache-globally-disabled-af0VF8nQ.js → is-cache-globally-disabled-CveNGcRi.js} +4 -4
- package/dist/{jsx-runtime-D_p1BwrV.js → jsx-runtime-DGgjHKxp.js} +6 -6
- package/dist/oxlint-worker.js +1 -1
- package/dist/{print-branded-header-BegpykMJ.js → print-branded-header-DMHPLUaY.js} +4 -4
- package/dist/project-analysis-worker.js +1 -1
- package/dist/{prompt-runtime-scan-url-OIHMChS6.js → prompt-runtime-scan-url-Bjf8oUgu.js} +5 -5
- package/dist/{read-object-file-Bd06Y-EV.js → read-object-file-1GYa4MDG.js} +4 -4
- package/dist/{record-metric-5SPbuLyj.js → record-metric-9Q_AofQZ.js} +232 -43
- package/dist/{report-error-DayUUIc-.js → report-error-D8MXuEuX.js} +6 -6
- package/dist/{report-workflow-result-tdrT9lW-.js → report-workflow-result-CoKQrvw3.js} +6 -6
- package/dist/{resolve-scan-exit-code-DWrr-Xuv.js → resolve-scan-exit-code-B8M3Cm1y.js} +42 -30
- package/dist/{resolve-scope-OdFJKZGv.js → resolve-scope-mO5jhToI.js} +6 -6
- package/dist/{rules-DNgtXPXx.js → rules-DfsolVSa.js} +7 -7
- package/dist/{run-scan-app-COJWBnqC.js → run-scan-app-C_1vEytD.js} +45 -16
- package/dist/{runtime-scan-CkpS56h8.js → runtime-scan-DO6eZB9B.js} +10 -10
- package/dist/{sanitize-runtime-url-fwyTS789.js → sanitize-runtime-url-B_DTc6vp.js} +4 -4
- package/dist/{scan-iZF-ydER.js → scan-zowhHQj5.js} +10 -10
- package/dist/{should-skip-prompts-BvvlROWq.js → should-skip-prompts-DWFgbnKE.js} +4 -4
- package/dist/{should-use-tui-BjzxYIbC.js → should-use-tui-CTkAbfEk.js} +4 -4
- package/dist/skills/react-doctor/references/explain.md +26 -0
- package/dist/{start-scan-preamble-CQy0CKXS.js → start-scan-preamble-DDAT_0oB.js} +5 -5
- package/dist/start-scan-preamble.js +3 -3
- package/dist/{telemetry-runtime-DQLNzRNG.js → telemetry-runtime-CdsvqQbi.js} +13 -7
- package/dist/{version-BasyRE1W.js → version-5cBv0dgb.js} +5 -5
- package/dist/{why-ni8gAKZe.js → why-BD6q7PxE.js} +4 -4
- package/dist/{with-run-span-eDYTicUo.js → with-run-span-qr6tFfqD.js} +6 -6
- package/package.json +4 -4
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]="03c9fd81-e844-5b50-b2ac-f3212ea46bf8")}catch(e){}}();
|
|
3
3
|
import { i as __toESM, r as __require, t as __commonJSMin } from "./chunk-ChKA3wi6.js";
|
|
4
4
|
import { createRequire } from "node:module";
|
|
5
5
|
import * as fs$1$2 from "node:fs";
|
|
@@ -19,14 +19,14 @@ import * as net from "node:net";
|
|
|
19
19
|
import { parseSync } from "oxc-parser";
|
|
20
20
|
import * as fs$1$1 from "node:fs/promises";
|
|
21
21
|
import { ResolverFactory } from "oxc-resolver";
|
|
22
|
-
import { ALL_REACT_DOCTOR_RULE_KEYS, CROSS_FILE_DEPENDENCY_COLLECTORS, CROSS_FILE_RULE_IDS, FRAMEWORK_SPECIFIC_RULE_KEYS, FRAMEWORK_TOKENS, MOTION_LIBRARY_PACKAGES, REACT_COMPILER_BRIDGE_RULES, REACT_COMPILER_RULES, REACT_DOCTOR_OPT_IN_PROJECT_RULE_IDS, REACT_DOCTOR_PROJECT_RULES, REACT_DOCTOR_RULES, REACT_DOCTOR_RULE_REGISTRY, REACT_DOCTOR_SCAN_RULES, atomicWriteFile, classifySecurityScanFile, collectCrossFileDependencyProbes, getDiagnosticContextPath, resetManifestCaches, shouldReadSecurityScanContent } from "oxlint-plugin-react-doctor/core";
|
|
22
|
+
import { ALL_REACT_DOCTOR_RULE_KEYS, CROSS_FILE_DEPENDENCY_COLLECTORS, CROSS_FILE_RULE_IDS, EXTERNAL_RULES, FRAMEWORK_SPECIFIC_RULE_KEYS, FRAMEWORK_TOKENS, MOTION_LIBRARY_PACKAGES, REACT_COMPILER_BRIDGE_RULES, REACT_COMPILER_RULES, REACT_DOCTOR_OPT_IN_PROJECT_RULE_IDS, REACT_DOCTOR_PROJECT_RULES, REACT_DOCTOR_RULES, REACT_DOCTOR_RULE_REGISTRY, REACT_DOCTOR_SCAN_RULES, atomicWriteFile, classifySecurityScanFile, collectCrossFileDependencyProbes, getDiagnosticContextPath, resetManifestCaches, shouldReadSecurityScanContent } from "oxlint-plugin-react-doctor/core";
|
|
23
23
|
import { parseJSON5, parseJSONC } from "confbox";
|
|
24
24
|
import { createJiti } from "jiti";
|
|
25
25
|
import { PassThrough } from "node:stream";
|
|
26
26
|
import { convertToTSX } from "@astrojs/compiler/sync";
|
|
27
27
|
import { STATUS_CODES } from "node:http";
|
|
28
28
|
import { gzipSync } from "node:zlib";
|
|
29
|
-
//#region ../core/dist/constants-
|
|
29
|
+
//#region ../core/dist/constants-BSeQaOcv.js
|
|
30
30
|
const HTML_FILE_PATTERN = /\.html$/i;
|
|
31
31
|
const SOURCE_FILE_PATTERN = /\.(?:astro|tsx?|jsx?|mts|mjs|[hH][tT][mM][lL])$/;
|
|
32
32
|
const GENERATED_BUNDLE_FILE_PATTERN = /\.(iife|umd|global|min)\.m?js$/i;
|
|
@@ -393,6 +393,7 @@ const JSX_DUPLICATION_SOURCE_FILE_PATTERN = /\.[cm]?(?:jsx?|tsx)$/;
|
|
|
393
393
|
const MAINTAINABILITY_PLUGIN = "react-doctor";
|
|
394
394
|
const MAINTAINABILITY_DUPLICATE_JSX_RULE = "duplicate-jsx-subtree";
|
|
395
395
|
const MAINTAINABILITY_CATEGORY = "Maintainability";
|
|
396
|
+
const ADOPTED_LINT_CONFIG_MAX_BYTES = 1024 * 1024;
|
|
396
397
|
//#endregion
|
|
397
398
|
//#region ../core/dist/fs-utils-3PlHYkCD.js
|
|
398
399
|
const isErrnoException = (error) => error instanceof Error && "code" in error;
|
|
@@ -440,7 +441,7 @@ const isPlainObject = (value) => {
|
|
|
440
441
|
//#region ../core/dist/react-compiler-detection-worker-protocol-Dp5LlrE8.js
|
|
441
442
|
const isReactCompilerDetectionReply = (value) => typeof value === "object" && value !== null && "id" in value && typeof value.id === "number" && "hasReactCompiler" in value && (typeof value.hasReactCompiler === "boolean" || value.hasReactCompiler === null);
|
|
442
443
|
//#endregion
|
|
443
|
-
//#region ../core/dist/react-compiler-detection-client-
|
|
444
|
+
//#region ../core/dist/react-compiler-detection-client-oiOwecj7.js
|
|
444
445
|
const pendingOutputsByRequestKey = /* @__PURE__ */ new Map();
|
|
445
446
|
const toRequestKey = (request) => [
|
|
446
447
|
request.directory,
|
|
@@ -573,6 +574,11 @@ const buildOxlintChildEnv = (sourceEnv) => {
|
|
|
573
574
|
if (name.startsWith("npm_config_")) continue;
|
|
574
575
|
childEnv[name] = value;
|
|
575
576
|
}
|
|
577
|
+
childEnv.BROWSERSLIST = "defaults";
|
|
578
|
+
childEnv.BROWSERSLIST_IGNORE_OLD_DATA = "true";
|
|
579
|
+
delete childEnv.BROWSERSLIST_CONFIG;
|
|
580
|
+
delete childEnv.BROWSERSLIST_STATS;
|
|
581
|
+
delete childEnv.BROWSERSLIST_DANGEROUS_EXTEND;
|
|
576
582
|
const isCompileCacheDisabled = Boolean(sourceEnv.NODE_DISABLE_COMPILE_CACHE);
|
|
577
583
|
const isCompileCacheAlreadySet = childEnv.NODE_COMPILE_CACHE !== void 0;
|
|
578
584
|
if (!isCompileCacheDisabled && !isCompileCacheAlreadySet) childEnv.NODE_COMPILE_CACHE = path$1$1.join(os.tmpdir(), NODE_COMPILE_CACHE_DIR_NAME);
|
|
@@ -2710,7 +2716,7 @@ var require_picomatch$1 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
2710
2716
|
module.exports = picomatch;
|
|
2711
2717
|
}));
|
|
2712
2718
|
//#endregion
|
|
2713
|
-
//#region ../core/dist/collect-unplugin-auto-import-global-scopes-
|
|
2719
|
+
//#region ../core/dist/collect-unplugin-auto-import-global-scopes-Z9dhela6.js
|
|
2714
2720
|
var import_picomatch = /* @__PURE__ */ __toESM((/* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
2715
2721
|
const pico = require_picomatch$1();
|
|
2716
2722
|
const utils = require_utils();
|
|
@@ -3160,7 +3166,7 @@ const collectUnpluginAutoImportGlobalScopes = ({ rootDirectory, candidateFiles }
|
|
|
3160
3166
|
return scopes.some((scope) => scope.names.length > 0) ? scopes : [];
|
|
3161
3167
|
};
|
|
3162
3168
|
//#endregion
|
|
3163
|
-
//#region ../core/dist/detect-duplicate-jsx-subtrees-
|
|
3169
|
+
//#region ../core/dist/detect-duplicate-jsx-subtrees-B5UWtUyz.js
|
|
3164
3170
|
const yieldToEventLoop = () => new Promise((resolve) => {
|
|
3165
3171
|
setImmediate(resolve);
|
|
3166
3172
|
});
|
|
@@ -3285,7 +3291,7 @@ const resolveOptions$1 = (options) => ({
|
|
|
3285
3291
|
minimumDistinctFiles: options.minimumDistinctFiles ?? 1,
|
|
3286
3292
|
maxSourceFiles: options.budget?.maxSourceFiles ?? 5e3,
|
|
3287
3293
|
maxSourceLengthChars: options.budget?.maxSourceLengthChars ?? 1e6,
|
|
3288
|
-
maxJsxNodes: options.budget?.maxJsxNodes ??
|
|
3294
|
+
maxJsxNodes: options.budget?.maxJsxNodes ?? 5e5,
|
|
3289
3295
|
maxFamilies: options.budget?.maxFamilies ?? 20
|
|
3290
3296
|
});
|
|
3291
3297
|
const hashParts = (parts) => {
|
|
@@ -3499,10 +3505,12 @@ const collectCandidates = (source, sourceFile, signal, maximumCandidateCount) =>
|
|
|
3499
3505
|
const jsxNodes = [];
|
|
3500
3506
|
const pendingNodes = [sourceFile];
|
|
3501
3507
|
let limitExceeded = false;
|
|
3508
|
+
let observedJsxNodeCount = 0;
|
|
3502
3509
|
while (pendingNodes.length > 0 && !limitExceeded && !signal?.aborted) {
|
|
3503
3510
|
const currentNode = pendingNodes.pop();
|
|
3504
3511
|
if (currentNode === void 0) continue;
|
|
3505
3512
|
if (isJsxSubtreeNode(currentNode)) {
|
|
3513
|
+
observedJsxNodeCount += 1;
|
|
3506
3514
|
if (jsxNodes.length >= maximumCandidateCount) {
|
|
3507
3515
|
limitExceeded = true;
|
|
3508
3516
|
continue;
|
|
@@ -3518,7 +3526,8 @@ const collectCandidates = (source, sourceFile, signal, maximumCandidateCount) =>
|
|
|
3518
3526
|
if (limitExceeded || signal?.aborted) return {
|
|
3519
3527
|
candidates: [],
|
|
3520
3528
|
aborted: signal?.aborted ?? false,
|
|
3521
|
-
limitExceeded
|
|
3529
|
+
limitExceeded,
|
|
3530
|
+
observedJsxNodeCount
|
|
3522
3531
|
};
|
|
3523
3532
|
const metadataByNode = /* @__PURE__ */ new Map();
|
|
3524
3533
|
const functionIdentityByNode = /* @__PURE__ */ new Map();
|
|
@@ -3526,7 +3535,8 @@ const collectCandidates = (source, sourceFile, signal, maximumCandidateCount) =>
|
|
|
3526
3535
|
if (signal?.aborted) return {
|
|
3527
3536
|
candidates: [],
|
|
3528
3537
|
aborted: true,
|
|
3529
|
-
limitExceeded: false
|
|
3538
|
+
limitExceeded: false,
|
|
3539
|
+
observedJsxNodeCount
|
|
3530
3540
|
};
|
|
3531
3541
|
buildJsxSubtreeMetadata(jsxNodes[nodeIndex], metadataByNode);
|
|
3532
3542
|
}
|
|
@@ -3544,7 +3554,8 @@ const collectCandidates = (source, sourceFile, signal, maximumCandidateCount) =>
|
|
|
3544
3554
|
};
|
|
3545
3555
|
}),
|
|
3546
3556
|
aborted: false,
|
|
3547
|
-
limitExceeded: false
|
|
3557
|
+
limitExceeded: false,
|
|
3558
|
+
observedJsxNodeCount
|
|
3548
3559
|
};
|
|
3549
3560
|
};
|
|
3550
3561
|
const scanSource = (input) => {
|
|
@@ -3581,8 +3592,7 @@ const scanSource = (input) => {
|
|
|
3581
3592
|
incompleteReason: {
|
|
3582
3593
|
kind: "jsx-node-limit",
|
|
3583
3594
|
limit: input.options.maxJsxNodes,
|
|
3584
|
-
observed: input.
|
|
3585
|
-
path: input.source.path
|
|
3595
|
+
observed: input.scannedJsxNodeCount + collectedCandidates.observedJsxNodeCount
|
|
3586
3596
|
},
|
|
3587
3597
|
didAbort: false,
|
|
3588
3598
|
didScan: false
|
|
@@ -3699,7 +3709,10 @@ const detectDuplicateJsxSubtreesCooperative = async (sourceReader, options = {})
|
|
|
3699
3709
|
scannedSourceFileCount,
|
|
3700
3710
|
scannedJsxNodeCount
|
|
3701
3711
|
});
|
|
3702
|
-
if (scannedSource.incompleteReason !== null)
|
|
3712
|
+
if (scannedSource.incompleteReason !== null) {
|
|
3713
|
+
incompleteReasons.push(scannedSource.incompleteReason);
|
|
3714
|
+
if (scannedSource.incompleteReason.kind === "jsx-node-limit") break;
|
|
3715
|
+
}
|
|
3703
3716
|
if (scannedSource.didScan) {
|
|
3704
3717
|
candidates.push(...scannedSource.candidates);
|
|
3705
3718
|
scannedJsxNodeCount += scannedSource.candidates.length;
|
|
@@ -3717,7 +3730,7 @@ const detectDuplicateJsxSubtreesCooperative = async (sourceReader, options = {})
|
|
|
3717
3730
|
});
|
|
3718
3731
|
};
|
|
3719
3732
|
//#endregion
|
|
3720
|
-
//#region ../core/dist/detect-react-compiler-
|
|
3733
|
+
//#region ../core/dist/detect-react-compiler-DLpaU8gr.js
|
|
3721
3734
|
const NEXT_CONFIG_FILENAMES = [
|
|
3722
3735
|
"next.config.js",
|
|
3723
3736
|
"next.config.mjs",
|
|
@@ -68438,13 +68451,17 @@ const getBrowserslistProtectionRequirement = (directory) => {
|
|
|
68438
68451
|
env: "production"
|
|
68439
68452
|
});
|
|
68440
68453
|
if (!queries) return void 0;
|
|
68454
|
+
if ((typeof queries === "string" ? [queries] : queries).some((query) => /\b(?:extends|stats)\b|\bbrowserslist\s+config\b/i.test(query))) return;
|
|
68441
68455
|
let requirement;
|
|
68442
68456
|
let hasUnsupportedTarget = false;
|
|
68443
68457
|
const previousIgnoreOldData = process.env.BROWSERSLIST_IGNORE_OLD_DATA;
|
|
68444
68458
|
let browserTargets = [];
|
|
68445
68459
|
try {
|
|
68446
68460
|
process.env.BROWSERSLIST_IGNORE_OLD_DATA = "true";
|
|
68447
|
-
browserTargets = (0, import_browserslist.default)(queries
|
|
68461
|
+
browserTargets = (0, import_browserslist.default)(queries, {
|
|
68462
|
+
path: false,
|
|
68463
|
+
stats: {}
|
|
68464
|
+
});
|
|
68448
68465
|
} finally {
|
|
68449
68466
|
if (previousIgnoreOldData === void 0) delete process.env.BROWSERSLIST_IGNORE_OLD_DATA;
|
|
68450
68467
|
else process.env.BROWSERSLIST_IGNORE_OLD_DATA = previousIgnoreOldData;
|
|
@@ -68986,11 +69003,22 @@ for (const [legacyRuleKey, nativeRuleKey] of Object.entries(LEGACY_RULE_KEY_TO_N
|
|
|
68986
69003
|
NATIVE_RULE_KEY_TO_LEGACY_RULE_KEYS.set(nativeRuleKey, aliases);
|
|
68987
69004
|
}
|
|
68988
69005
|
const getLegacyRuleKeysForNative = (ruleKey) => NATIVE_RULE_KEY_TO_LEGACY_RULE_KEYS.get(ruleKey) ?? [];
|
|
69006
|
+
const REACT_DOCTOR_RULE_KEY_PREFIX = "react-doctor/";
|
|
68989
69007
|
const canonicalizeRuleKey = (ruleKey) => {
|
|
68990
69008
|
const nativeRuleKey = LEGACY_RULE_KEY_TO_NATIVE_RULE_KEY[ruleKey];
|
|
68991
69009
|
return typeof nativeRuleKey === "string" ? nativeRuleKey : ruleKey;
|
|
68992
69010
|
};
|
|
68993
69011
|
const isReactDoctorShortIdOf = (bareRuleKey, qualifiedRuleKey) => !bareRuleKey.includes("/") && qualifiedRuleKey === `react-doctor/${bareRuleKey}`;
|
|
69012
|
+
/**
|
|
69013
|
+
* Canonicalizes a rule key as users write it in config: a legacy alias
|
|
69014
|
+
* (`react/jsx-key`) maps to its native key, and a bare short id (`no-eval`)
|
|
69015
|
+
* qualifies as `react-doctor/<id>` — mirroring `isSameRuleKey`'s matching —
|
|
69016
|
+
* so telemetry groups every spelling of one rule under one key.
|
|
69017
|
+
*/
|
|
69018
|
+
const canonicalizeUserRuleKey = (ruleKey) => {
|
|
69019
|
+
const nativeRuleKey = canonicalizeRuleKey(ruleKey);
|
|
69020
|
+
return nativeRuleKey.includes("/") ? nativeRuleKey : `${REACT_DOCTOR_RULE_KEY_PREFIX}${nativeRuleKey}`;
|
|
69021
|
+
};
|
|
68994
69022
|
const isSameRuleKey = (candidateRuleKey, targetRuleKey) => {
|
|
68995
69023
|
const canonicalCandidate = canonicalizeRuleKey(candidateRuleKey);
|
|
68996
69024
|
const canonicalTarget = canonicalizeRuleKey(targetRuleKey);
|
|
@@ -70321,6 +70349,13 @@ const DEFAULT_SURFACE_EXCLUDED_TAGS = {
|
|
|
70321
70349
|
ciFailure: ["design"]
|
|
70322
70350
|
};
|
|
70323
70351
|
const isRecord = (value) => typeof value === "object" && value !== null && !Array.isArray(value);
|
|
70352
|
+
const KNOWN_RULE_KEYS = new Set([...ALL_REACT_DOCTOR_RULE_KEYS, ...EXTERNAL_RULES.map((rule) => rule.key)]);
|
|
70353
|
+
const BUNDLED_RULE_NAMESPACES = new Set([...KNOWN_RULE_KEYS].flatMap(getEquivalentRuleKeys).map((key) => key.slice(0, key.lastIndexOf("/"))));
|
|
70354
|
+
const getUnknownBundledRuleKeys = (rules) => Object.keys(rules ?? {}).filter((key) => {
|
|
70355
|
+
const canonicalKey = canonicalizeUserRuleKey(key);
|
|
70356
|
+
const namespace = canonicalKey.slice(0, canonicalKey.lastIndexOf("/"));
|
|
70357
|
+
return BUNDLED_RULE_NAMESPACES.has(namespace) && !KNOWN_RULE_KEYS.has(canonicalKey);
|
|
70358
|
+
});
|
|
70324
70359
|
const VALID_RULE_SEVERITIES = [
|
|
70325
70360
|
"error",
|
|
70326
70361
|
"warn",
|
|
@@ -70489,6 +70524,32 @@ const validateSeverityMap = (fieldName, rawMap, keysAreCategories = false) => {
|
|
|
70489
70524
|
}
|
|
70490
70525
|
return validated;
|
|
70491
70526
|
};
|
|
70527
|
+
const ONLY_EXPORT_COMPONENTS_STRING_ARRAY_KEYS = ["allowExportNames", "customHOCs"];
|
|
70528
|
+
const ONLY_EXPORT_COMPONENTS_BOOLEAN_KEYS = ["allowConstantExport", "checkJS"];
|
|
70529
|
+
const validateOnlyExportComponentsField = (rawOptions) => {
|
|
70530
|
+
if (!isRecord(rawOptions)) {
|
|
70531
|
+
warnConfigIssue(`config field "onlyExportComponents" must be an object (got ${typeof rawOptions}); ignoring this field.`);
|
|
70532
|
+
return;
|
|
70533
|
+
}
|
|
70534
|
+
const validated = {};
|
|
70535
|
+
for (const [key, value] of Object.entries(rawOptions)) {
|
|
70536
|
+
const fieldName = `onlyExportComponents.${key}`;
|
|
70537
|
+
const stringArrayKey = ONLY_EXPORT_COMPONENTS_STRING_ARRAY_KEYS.find((candidateKey) => candidateKey === key);
|
|
70538
|
+
if (stringArrayKey !== void 0) {
|
|
70539
|
+
const entries = validateStringArrayField(fieldName, value);
|
|
70540
|
+
if (entries !== void 0) validated[stringArrayKey] = entries;
|
|
70541
|
+
continue;
|
|
70542
|
+
}
|
|
70543
|
+
const booleanKey = ONLY_EXPORT_COMPONENTS_BOOLEAN_KEYS.find((candidateKey) => candidateKey === key);
|
|
70544
|
+
if (booleanKey !== void 0) {
|
|
70545
|
+
const flag = coerceMaybeBooleanString(fieldName, value);
|
|
70546
|
+
if (flag !== void 0) validated[booleanKey] = flag;
|
|
70547
|
+
continue;
|
|
70548
|
+
}
|
|
70549
|
+
warnConfigIssue(`config field "${fieldName}" is not a known option (expected one of: ${[...ONLY_EXPORT_COMPONENTS_STRING_ARRAY_KEYS, ...ONLY_EXPORT_COMPONENTS_BOOLEAN_KEYS].join(", ")}); ignoring.`);
|
|
70550
|
+
}
|
|
70551
|
+
return validated;
|
|
70552
|
+
};
|
|
70492
70553
|
const applyFieldValidator = (config, validated, fieldName, validator) => {
|
|
70493
70554
|
const raw = config[fieldName];
|
|
70494
70555
|
if (raw === void 0) return;
|
|
@@ -70503,8 +70564,10 @@ const validateConfigTypes = (config) => {
|
|
|
70503
70564
|
for (const fieldName of STRING_ARRAY_FIELD_NAMES) applyFieldValidator(config, validated, fieldName, (value) => validateStringArrayField(fieldName, value));
|
|
70504
70565
|
applyFieldValidator(config, validated, "ignore", validateIgnoreField);
|
|
70505
70566
|
applyFieldValidator(config, validated, "surfaces", validateSurfacesField);
|
|
70567
|
+
applyFieldValidator(config, validated, "onlyExportComponents", validateOnlyExportComponentsField);
|
|
70506
70568
|
for (const fieldName of SEVERITY_FIELD_NAMES) applyFieldValidator(config, validated, fieldName, (value) => validateSeverityMap(fieldName, value, fieldName === "categories"));
|
|
70507
70569
|
applyFieldValidator(config, validated, "plugins", (value) => validateStringArrayField("plugins", value));
|
|
70570
|
+
for (const ruleKey of getUnknownBundledRuleKeys(validated.rules)) warnConfigIssue(`config field "rules.${ruleKey}" is not a known bundled rule; this override has no effect. Run "react-doctor rules list" to find its rule ID.`);
|
|
70508
70571
|
return validated;
|
|
70509
70572
|
};
|
|
70510
70573
|
const warn = (message) => {
|
|
@@ -70798,7 +70861,7 @@ const dedupeRelatedDiagnostics = (diagnostics) => {
|
|
|
70798
70861
|
};
|
|
70799
70862
|
const isPathInsideDirectory = (childAbsolutePath, parentAbsolutePath) => {
|
|
70800
70863
|
const relativePath = path$1$1.relative(parentAbsolutePath, childAbsolutePath);
|
|
70801
|
-
return Boolean(relativePath) && !relativePath.startsWith(
|
|
70864
|
+
return Boolean(relativePath) && relativePath !== ".." && !relativePath.startsWith(`..${path$1$1.sep}`) && !path$1$1.isAbsolute(relativePath);
|
|
70802
70865
|
};
|
|
70803
70866
|
const compareStrings = (left, right) => left < right ? -1 : left > right ? 1 : 0;
|
|
70804
70867
|
const sortDiagnosticsStable = (diagnostics) => [...diagnostics].sort((left, right) => compareStrings(left.filePath, right.filePath) || left.line - right.line || left.column - right.column || compareStrings(left.plugin, right.plugin) || compareStrings(left.rule, right.rule) || compareStrings(left.severity, right.severity) || compareStrings(left.message, right.message));
|
|
@@ -72657,16 +72720,24 @@ const createSecurityScanSession = (rootDirectory, options) => {
|
|
|
72657
72720
|
const rule = entry.rule;
|
|
72658
72721
|
const scan = rule.scan;
|
|
72659
72722
|
if (typeof scan !== "function") return [];
|
|
72723
|
+
const explicitRuleOverride = resolveRuleSeverityOverride({ ruleKey: entry.key }, options.severityControls);
|
|
72724
|
+
const severityOverride = explicitRuleOverride ?? resolveRuleSeverityOverride({
|
|
72725
|
+
ruleKey: entry.key,
|
|
72726
|
+
category: "Security"
|
|
72727
|
+
}, options.severityControls);
|
|
72728
|
+
if (severityOverride === "off") return [];
|
|
72660
72729
|
if (!shouldEnableRuleByDefaultStatus({
|
|
72661
72730
|
defaultEnabled: rule.defaultEnabled,
|
|
72662
72731
|
includeTagDefaults: options.includeTagDefaults === true,
|
|
72663
|
-
hasIncludedTags: includedTags.size > 0
|
|
72732
|
+
hasIncludedTags: includedTags.size > 0,
|
|
72733
|
+
hasExplicitOverride: explicitRuleOverride !== void 0
|
|
72664
72734
|
})) return [];
|
|
72665
72735
|
if (!shouldEnableRule(rule.requires, rule.tags, capabilities, ignoredTags, rule.disabledWhen, includedTags)) return [];
|
|
72666
72736
|
return [{
|
|
72667
72737
|
entry,
|
|
72668
72738
|
scan,
|
|
72669
|
-
|
|
72739
|
+
severityOverride,
|
|
72740
|
+
committedFilesOnly: rule.committedFilesOnly !== false
|
|
72670
72741
|
}];
|
|
72671
72742
|
});
|
|
72672
72743
|
if (enabledScanRules.length === 0) return null;
|
|
@@ -72683,10 +72754,13 @@ const createSecurityScanSession = (rootDirectory, options) => {
|
|
|
72683
72754
|
};
|
|
72684
72755
|
const scanFileByRule = function* (file) {
|
|
72685
72756
|
if (file === null) return;
|
|
72686
|
-
for (const { entry, scan, committedFilesOnly } of enabledScanRules) {
|
|
72757
|
+
for (const { entry, scan, severityOverride, committedFilesOnly } of enabledScanRules) {
|
|
72687
72758
|
for (const finding of scan(file)) {
|
|
72688
|
-
if (committedFilesOnly && isFileGitIgnored(file)) continue;
|
|
72689
|
-
const diagnostic = buildSecurityScanDiagnostic(finding
|
|
72759
|
+
if ((finding.committedFilesOnly ?? committedFilesOnly) && isFileGitIgnored(file)) continue;
|
|
72760
|
+
const diagnostic = buildSecurityScanDiagnostic(severityOverride === void 0 ? finding : {
|
|
72761
|
+
...finding,
|
|
72762
|
+
severity: severityOverride
|
|
72763
|
+
}, entry, file.relativePath);
|
|
72690
72764
|
const key = `${diagnostic.rule}:${diagnostic.filePath}:${diagnostic.line}:${diagnostic.column}:${diagnostic.message}`;
|
|
72691
72765
|
if (seen.has(key)) continue;
|
|
72692
72766
|
seen.add(key);
|
|
@@ -74201,6 +74275,82 @@ const detectUserLintConfigPaths = (rootDirectory) => {
|
|
|
74201
74275
|
}
|
|
74202
74276
|
return [];
|
|
74203
74277
|
};
|
|
74278
|
+
const isSymlinkFreePath = (filePath, rootDirectory) => {
|
|
74279
|
+
if (!isPathInsideDirectory(filePath, rootDirectory)) return false;
|
|
74280
|
+
let currentPath = rootDirectory;
|
|
74281
|
+
for (const segment of path$1$1.relative(rootDirectory, filePath).split(path$1$1.sep)) {
|
|
74282
|
+
currentPath = path$1$1.join(currentPath, segment);
|
|
74283
|
+
try {
|
|
74284
|
+
if (fs$1$2.lstatSync(currentPath).isSymbolicLink()) return false;
|
|
74285
|
+
} catch (error) {
|
|
74286
|
+
return isErrnoException(error) && error.code === "ENOENT";
|
|
74287
|
+
}
|
|
74288
|
+
}
|
|
74289
|
+
return true;
|
|
74290
|
+
};
|
|
74291
|
+
const snapshotAdoptedLintConfigs = (input) => {
|
|
74292
|
+
const sourceBoundaryDirectory = path$1$1.resolve(findGitRepositoryRoot(input.rootDirectory) ?? input.rootDirectory);
|
|
74293
|
+
const boundaryDirectory = fs$1$2.realpathSync(sourceBoundaryDirectory);
|
|
74294
|
+
const snapshots = /* @__PURE__ */ new Map();
|
|
74295
|
+
const expandedFileCounts = /* @__PURE__ */ new Map();
|
|
74296
|
+
const activePaths = /* @__PURE__ */ new Set();
|
|
74297
|
+
let expandedFileCount = 0;
|
|
74298
|
+
const snapshotConfig = (configPath, depth) => {
|
|
74299
|
+
const resolvedPath = path$1$1.resolve(configPath);
|
|
74300
|
+
const existingSnapshot = snapshots.get(resolvedPath);
|
|
74301
|
+
if (existingSnapshot) {
|
|
74302
|
+
expandedFileCount += expandedFileCounts.get(resolvedPath) ?? 1;
|
|
74303
|
+
if (expandedFileCount > 64) throw new Error("Adopted lint config expands too many files");
|
|
74304
|
+
return existingSnapshot;
|
|
74305
|
+
}
|
|
74306
|
+
if (depth > 32 || expandedFileCount >= 64 || activePaths.has(resolvedPath) || !isSymlinkFreePath(resolvedPath, boundaryDirectory)) throw new Error("Unsafe adopted lint config chain");
|
|
74307
|
+
const configStats = fs$1$2.lstatSync(resolvedPath);
|
|
74308
|
+
if (!configStats.isFile() || configStats.size > 1048576) throw new Error("Unsupported adopted lint config file");
|
|
74309
|
+
const previousFileCount = expandedFileCount;
|
|
74310
|
+
expandedFileCount += 1;
|
|
74311
|
+
activePaths.add(resolvedPath);
|
|
74312
|
+
try {
|
|
74313
|
+
const parsed = parseJSONC(readTextFileUpToCharacterLimitSync({
|
|
74314
|
+
filePath: resolvedPath,
|
|
74315
|
+
maximumLengthChars: ADOPTED_LINT_CONFIG_MAX_BYTES,
|
|
74316
|
+
sizeBytes: configStats.size
|
|
74317
|
+
}), { allowTrailingComma: true });
|
|
74318
|
+
if (!isPlainObject(parsed)) throw new Error("Invalid adopted lint config");
|
|
74319
|
+
const sanitized = snapshotValue(parsed, resolvedPath, depth);
|
|
74320
|
+
const snapshotPath = path$1$1.join(input.snapshotDirectory, `adopted-${snapshots.size}.json`);
|
|
74321
|
+
fs$1$2.writeFileSync(snapshotPath, JSON.stringify(sanitized), {
|
|
74322
|
+
flag: "wx",
|
|
74323
|
+
mode: 384
|
|
74324
|
+
});
|
|
74325
|
+
snapshots.set(resolvedPath, snapshotPath);
|
|
74326
|
+
expandedFileCounts.set(resolvedPath, expandedFileCount - previousFileCount);
|
|
74327
|
+
return snapshotPath;
|
|
74328
|
+
} finally {
|
|
74329
|
+
activePaths.delete(resolvedPath);
|
|
74330
|
+
}
|
|
74331
|
+
};
|
|
74332
|
+
const snapshotValue = (value, configPath, depth) => {
|
|
74333
|
+
if (depth > 32) throw new Error("Adopted lint config too deep");
|
|
74334
|
+
if (Array.isArray(value)) return value.map((entry) => snapshotValue(entry, configPath, depth + 1));
|
|
74335
|
+
if (!isPlainObject(value)) return value;
|
|
74336
|
+
if (Object.hasOwn(value, "jsPlugins")) throw new Error("Executable adopted lint config");
|
|
74337
|
+
return Object.fromEntries(Object.entries(value).map(([key, entry]) => {
|
|
74338
|
+
if (key !== "extends") return [key, snapshotValue(entry, configPath, depth + 1)];
|
|
74339
|
+
return [key, (Array.isArray(entry) ? entry : [entry]).map((extendedPath) => {
|
|
74340
|
+
if (typeof extendedPath !== "string") throw new Error("Invalid lint config extends");
|
|
74341
|
+
return snapshotConfig(path$1$1.resolve(path$1$1.dirname(configPath), extendedPath), depth + 1);
|
|
74342
|
+
})];
|
|
74343
|
+
}));
|
|
74344
|
+
};
|
|
74345
|
+
return input.configPaths.flatMap((configPath) => {
|
|
74346
|
+
try {
|
|
74347
|
+
if (!isPathInsideDirectory(configPath, sourceBoundaryDirectory)) return [];
|
|
74348
|
+
return [snapshotConfig(path$1$1.join(boundaryDirectory, path$1$1.relative(sourceBoundaryDirectory, configPath)), 0)];
|
|
74349
|
+
} catch {
|
|
74350
|
+
return [];
|
|
74351
|
+
}
|
|
74352
|
+
});
|
|
74353
|
+
};
|
|
74204
74354
|
const readAdoptedLintConfigSettings = (configPaths) => {
|
|
74205
74355
|
const mergedSettings = /* @__PURE__ */ new Map();
|
|
74206
74356
|
for (const configPath of configPaths) {
|
|
@@ -74228,6 +74378,7 @@ const getBackupPath = (rootDirectory, absolutePath) => {
|
|
|
74228
74378
|
};
|
|
74229
74379
|
const removeBackupRootIfEmpty = (rootDirectory) => {
|
|
74230
74380
|
const backupRootDirectory = getBackupRootDirectory(rootDirectory);
|
|
74381
|
+
if (!isSymlinkFreePath(backupRootDirectory, rootDirectory)) return;
|
|
74231
74382
|
if (!walkSourceTreeFiles(backupRootDirectory).next().done) return;
|
|
74232
74383
|
fs$1$2.rmSync(backupRootDirectory, {
|
|
74233
74384
|
recursive: true,
|
|
@@ -74328,8 +74479,13 @@ const collectNeutralizationCandidatePaths = (rootDirectory, discoveredRelativePa
|
|
|
74328
74479
|
const recoverOrphanedBackups = (rootDirectory) => {
|
|
74329
74480
|
const blockedPaths = /* @__PURE__ */ new Set();
|
|
74330
74481
|
const backupRootDirectory = getBackupRootDirectory(rootDirectory);
|
|
74482
|
+
if (!isSymlinkFreePath(backupRootDirectory, rootDirectory)) return blockedPaths;
|
|
74331
74483
|
for (const { absolutePath: backupPath } of walkSourceTreeFiles(backupRootDirectory)) {
|
|
74332
74484
|
const originalPath = path$1$1.join(rootDirectory, path$1$1.relative(backupRootDirectory, backupPath));
|
|
74485
|
+
if (!isSymlinkFreePath(backupPath, rootDirectory) || !isSymlinkFreePath(originalPath, rootDirectory)) {
|
|
74486
|
+
blockedPaths.add(originalPath);
|
|
74487
|
+
continue;
|
|
74488
|
+
}
|
|
74333
74489
|
if (neutralizedFileLeases.has(originalPath)) continue;
|
|
74334
74490
|
let backupContent;
|
|
74335
74491
|
let currentContent;
|
|
@@ -74380,6 +74536,7 @@ const neutralizeDisableDirectives = async (rootDirectory, includePaths, options
|
|
|
74380
74536
|
lease.referenceCount -= 1;
|
|
74381
74537
|
if (lease.referenceCount > 0) continue;
|
|
74382
74538
|
neutralizedFileLeases.delete(absolutePath);
|
|
74539
|
+
if (!isSymlinkFreePath(absolutePath, lease.rootDirectory) || !isSymlinkFreePath(lease.backupPath, lease.rootDirectory)) continue;
|
|
74383
74540
|
try {
|
|
74384
74541
|
const currentContent = fs$1$2.readFileSync(absolutePath, "utf-8");
|
|
74385
74542
|
if (currentContent !== lease.neutralizedContent && currentContent !== lease.originalContent) {
|
|
@@ -74397,6 +74554,7 @@ const neutralizeDisableDirectives = async (rootDirectory, includePaths, options
|
|
|
74397
74554
|
const onExit = () => restore();
|
|
74398
74555
|
process.once("exit", onExit);
|
|
74399
74556
|
const leaseCandidatePath = (absolutePath) => {
|
|
74557
|
+
if (!isSymlinkFreePath(absolutePath, resolvedRootDirectory)) return;
|
|
74400
74558
|
if (leasedPaths.has(absolutePath)) return;
|
|
74401
74559
|
if (blockedPaths.has(absolutePath)) return;
|
|
74402
74560
|
const existingLease = neutralizedFileLeases.get(absolutePath);
|
|
@@ -74414,7 +74572,7 @@ const neutralizeDisableDirectives = async (rootDirectory, includePaths, options
|
|
|
74414
74572
|
const neutralizedContent = neutralizeContent(originalContent);
|
|
74415
74573
|
if (neutralizedContent !== originalContent) {
|
|
74416
74574
|
const backupPath = getBackupPath(resolvedRootDirectory, absolutePath);
|
|
74417
|
-
if (backupPath === null) return;
|
|
74575
|
+
if (backupPath === null || !isSymlinkFreePath(backupPath, resolvedRootDirectory)) return;
|
|
74418
74576
|
try {
|
|
74419
74577
|
fs$1$2.mkdirSync(path$1$1.dirname(backupPath), { recursive: true });
|
|
74420
74578
|
fs$1$2.writeFileSync(backupPath, originalContent, { flag: "wx" });
|
|
@@ -74424,6 +74582,7 @@ const neutralizeDisableDirectives = async (rootDirectory, includePaths, options
|
|
|
74424
74582
|
}
|
|
74425
74583
|
fs$1$2.writeFileSync(absolutePath, neutralizedContent);
|
|
74426
74584
|
neutralizedFileLeases.set(absolutePath, {
|
|
74585
|
+
rootDirectory: resolvedRootDirectory,
|
|
74427
74586
|
backupPath,
|
|
74428
74587
|
originalContent,
|
|
74429
74588
|
neutralizedContent,
|
|
@@ -74462,7 +74621,13 @@ const normalizeConfigForHash = (config) => {
|
|
|
74462
74621
|
if (Array.isArray(clone?.jsPlugins)) clone.jsPlugins = clone.jsPlugins.map((_, index) => `<plugin:${index}>`);
|
|
74463
74622
|
return clone;
|
|
74464
74623
|
};
|
|
74465
|
-
const computeRulesetHash = (input) => crypto.createHash("sha1").update(
|
|
74624
|
+
const computeRulesetHash = (input) => crypto.createHash("sha1").update("project-bulk-suppressions-isolated\0").update(JSON.stringify([
|
|
74625
|
+
normalizeConfigForHash(input.config),
|
|
74626
|
+
input.toolchainVersions,
|
|
74627
|
+
input.ignorePatterns,
|
|
74628
|
+
input.tsconfigContent,
|
|
74629
|
+
input.respectInlineDisables
|
|
74630
|
+
])).digest("hex");
|
|
74466
74631
|
/**
|
|
74467
74632
|
* Loads a plugin module via the local require resolver and extracts
|
|
74468
74633
|
* `(name, ruleNames)` from either `module.exports.meta + rules` or
|
|
@@ -74618,7 +74783,7 @@ const buildUserPluginRules = (userPlugin, severityControls) => {
|
|
|
74618
74783
|
}
|
|
74619
74784
|
return enabled;
|
|
74620
74785
|
};
|
|
74621
|
-
const createOxlintConfig = ({ pluginPath, diagnosticContextDirectory, project, customRulesOnly = false, extendsPaths = [], ignoredTags = /* @__PURE__ */ new Set(), includedTags = /* @__PURE__ */ new Set(), includeTagDefaults = false, runtimeGlobals, unpluginAutoImportGlobalScopes, serverAuthFunctionNames, projectIndexModuleSources, severityControls, adoptedSettings = {}, userPlugins = [], disableReactHooksJsPlugin = false, ruleSelection, sidecarRuleIdFilter }) => {
|
|
74786
|
+
const createOxlintConfig = ({ pluginPath, diagnosticContextDirectory, project, customRulesOnly = false, extendsPaths = [], ignoredTags = /* @__PURE__ */ new Set(), includedTags = /* @__PURE__ */ new Set(), includeTagDefaults = false, runtimeGlobals, unpluginAutoImportGlobalScopes, serverAuthFunctionNames, onlyExportComponents, projectIndexModuleSources, severityControls, adoptedSettings = {}, userPlugins = [], disableReactHooksJsPlugin = false, ruleSelection, sidecarRuleIdFilter }) => {
|
|
74622
74787
|
const hasIncludedTags = includedTags.size > 0;
|
|
74623
74788
|
const resolvedReactHooksJsPlugin = disableReactHooksJsPlugin || hasIncludedTags ? null : resolveReactHooksJsPlugin(project.hasReactCompiler || project.hasReactCompilerLintPlugin === true, customRulesOnly);
|
|
74624
74789
|
const reactHooksJsPlugin = ruleSelection === "sidecar" ? null : resolvedReactHooksJsPlugin;
|
|
@@ -74701,6 +74866,7 @@ const createOxlintConfig = ({ pluginPath, diagnosticContextDirectory, project, c
|
|
|
74701
74866
|
} : {},
|
|
74702
74867
|
...project.shopifyFlashListMajorVersion !== null ? { shopifyFlashListMajorVersion: project.shopifyFlashListMajorVersion } : {},
|
|
74703
74868
|
...serverAuthFunctionNames && serverAuthFunctionNames.length > 0 ? { serverAuthFunctionNames: [...serverAuthFunctionNames] } : {},
|
|
74869
|
+
...onlyExportComponents !== void 0 ? { onlyExportComponents } : {},
|
|
74704
74870
|
...projectIndexModuleSources !== void 0 ? { projectIndexModuleSources: [...projectIndexModuleSources] } : {}
|
|
74705
74871
|
}
|
|
74706
74872
|
},
|
|
@@ -76611,35 +76777,64 @@ const spawnLintBatches = async (input) => {
|
|
|
76611
76777
|
batchState.deadlineSkippedFileCount += batch.length;
|
|
76612
76778
|
return [];
|
|
76613
76779
|
}
|
|
76614
|
-
const batchArgs = [
|
|
76780
|
+
const batchArgs = [
|
|
76781
|
+
...baseArgs,
|
|
76782
|
+
"--",
|
|
76783
|
+
...batch
|
|
76784
|
+
];
|
|
76615
76785
|
try {
|
|
76616
|
-
const spawnBatch = () => {
|
|
76786
|
+
const spawnBatch = async () => {
|
|
76617
76787
|
const effectiveSpawnTimeoutMs = resolveSpawnTimeoutMs();
|
|
76618
76788
|
if (effectiveSpawnTimeoutMs === 0) {
|
|
76619
76789
|
deadlineSkippedFiles.push(...batch);
|
|
76620
76790
|
batchState.deadlineSkippedFileCount += batch.length;
|
|
76621
|
-
return
|
|
76791
|
+
return null;
|
|
76792
|
+
}
|
|
76793
|
+
const onStart = () => {
|
|
76794
|
+
if (batchState.didStart) return;
|
|
76795
|
+
batchState.didStart = true;
|
|
76796
|
+
startedFileCount += batchState.initialFileCount;
|
|
76797
|
+
reportBatchStarted(passBatches.length);
|
|
76798
|
+
};
|
|
76799
|
+
let argumentsList = batchArgs;
|
|
76800
|
+
if (input.workingDirectory !== void 0) {
|
|
76801
|
+
const selectedFiles = (await spawnOxlint([
|
|
76802
|
+
...baseArgs,
|
|
76803
|
+
"--debug",
|
|
76804
|
+
"files",
|
|
76805
|
+
...batch
|
|
76806
|
+
], rootDirectory, nodeBinaryPath, effectiveSpawnTimeoutMs, outputMaxBytes, signal, onStart)).split(/\r?\n/).filter(Boolean).map((filePath) => path$1$1.resolve(rootDirectory, filePath));
|
|
76807
|
+
if (selectedFiles.length === 0) return JSON.stringify({ diagnostics: [] });
|
|
76808
|
+
argumentsList = [
|
|
76809
|
+
...baseArgs,
|
|
76810
|
+
"--no-ignore",
|
|
76811
|
+
...selectedFiles
|
|
76812
|
+
];
|
|
76622
76813
|
}
|
|
76623
76814
|
return runOxlintJob({
|
|
76624
|
-
argumentsList
|
|
76625
|
-
rootDirectory,
|
|
76815
|
+
argumentsList,
|
|
76816
|
+
rootDirectory: input.workingDirectory ?? rootDirectory,
|
|
76626
76817
|
nodeBinaryPath,
|
|
76627
76818
|
spawnTimeoutMs: effectiveSpawnTimeoutMs ?? 6e4,
|
|
76628
76819
|
outputMaxBytes: outputMaxBytes ?? 52428800,
|
|
76629
76820
|
maxWorkers: requestedConcurrency,
|
|
76630
76821
|
filesystemCacheEpoch: input.spawnSlots?.filesystemCacheEpoch ?? null,
|
|
76631
76822
|
abortSignal: signal,
|
|
76632
|
-
onStart
|
|
76633
|
-
if (batchState.didStart) return;
|
|
76634
|
-
batchState.didStart = true;
|
|
76635
|
-
startedFileCount += batchState.initialFileCount;
|
|
76636
|
-
reportBatchStarted(passBatches.length);
|
|
76637
|
-
}
|
|
76823
|
+
onStart
|
|
76638
76824
|
});
|
|
76639
76825
|
};
|
|
76640
76826
|
const stdout = input.spawnSlots === void 0 ? await spawnBatch() : await input.spawnSlots.run(spawnBatch, signal);
|
|
76641
76827
|
if (stdout === null) return [];
|
|
76642
|
-
|
|
76828
|
+
const diagnostics = parseOxlintOutput(stdout, project, rootDirectory, sourcePathByLintPath, sourceMapByLintPath, input.diagnosticContextDirectory);
|
|
76829
|
+
if (input.workingDirectory === void 0) return diagnostics;
|
|
76830
|
+
return diagnostics.map((diagnostic) => ({
|
|
76831
|
+
...diagnostic,
|
|
76832
|
+
filePath: toNormalizedRelativePath(diagnostic.filePath, rootDirectory),
|
|
76833
|
+
...diagnostic.relatedLocations ? { relatedLocations: diagnostic.relatedLocations.map((location) => ({
|
|
76834
|
+
...location,
|
|
76835
|
+
filePath: toNormalizedRelativePath(location.filePath, rootDirectory)
|
|
76836
|
+
})) } : {}
|
|
76837
|
+
}));
|
|
76643
76838
|
} catch (error) {
|
|
76644
76839
|
if (!isSplittableReactDoctorError(error)) throw error;
|
|
76645
76840
|
if (isPastDeadline()) {
|
|
@@ -77361,13 +77556,19 @@ const runOxlint = async (options) => {
|
|
|
77361
77556
|
}
|
|
77362
77557
|
const pluginPath = resolvePluginPath();
|
|
77363
77558
|
const detectedConfigPaths = adoptExistingLintConfig && !customRulesOnly ? detectUserLintConfigPaths(rootDirectory) : [];
|
|
77364
|
-
const
|
|
77559
|
+
const adoptableConfigPaths = detectedConfigPaths.filter(canOxlintExtendConfig);
|
|
77365
77560
|
const adoptedSettings = detectedConfigPaths.length > 0 ? readAdoptedLintConfigSettings(detectedConfigPaths) : {};
|
|
77366
77561
|
const userPlugins = includedTags.size > 0 ? [] : resolveUserPlugins(userConfig?.plugins, configSourceDirectory);
|
|
77367
77562
|
const restoreDisableDirectives = await neutralizeDisableDirectives(rootDirectory, includePaths ?? options.precomputedSourceFiles?.map((sourceFile) => sourceFile.path), { recoverOnly: respectInlineDisables });
|
|
77368
77563
|
const configDirectory = fs$1$2.mkdtempSync(path$1$1.join(os.tmpdir(), "react-doctor-oxlintrc-"));
|
|
77369
77564
|
const configPath = path$1$1.join(configDirectory, "oxlintrc.json");
|
|
77565
|
+
const workingDirectory = fs$1$2.existsSync(path$1$1.join(rootDirectory, "oxlint-suppressions.json")) ? configDirectory : void 0;
|
|
77370
77566
|
try {
|
|
77567
|
+
const extendsPaths = snapshotAdoptedLintConfigs({
|
|
77568
|
+
configPaths: adoptableConfigPaths,
|
|
77569
|
+
rootDirectory,
|
|
77570
|
+
snapshotDirectory: configDirectory
|
|
77571
|
+
});
|
|
77371
77572
|
const diagnosticContextDirectory = path$1$1.join(configDirectory, "contexts");
|
|
77372
77573
|
fs$1$2.mkdirSync(diagnosticContextDirectory);
|
|
77373
77574
|
const oxlintBinary = resolveOxlintBinary();
|
|
@@ -77376,7 +77577,7 @@ const runOxlint = async (options) => {
|
|
|
77376
77577
|
if (project.hasTypeScript) {
|
|
77377
77578
|
const tsconfigRelativePath = resolveTsConfigRelativePath(rootDirectory);
|
|
77378
77579
|
if (tsconfigRelativePath) {
|
|
77379
|
-
sharedArgs.push("--tsconfig", tsconfigRelativePath);
|
|
77580
|
+
sharedArgs.push("--tsconfig", path$1$1.resolve(rootDirectory, tsconfigRelativePath));
|
|
77380
77581
|
try {
|
|
77381
77582
|
tsconfigContent = fs$1$2.readFileSync(path$1$1.resolve(rootDirectory, tsconfigRelativePath), "utf8");
|
|
77382
77583
|
} catch {
|
|
@@ -77428,6 +77629,7 @@ const runOxlint = async (options) => {
|
|
|
77428
77629
|
runtimeGlobals,
|
|
77429
77630
|
unpluginAutoImportGlobalScopes,
|
|
77430
77631
|
serverAuthFunctionNames,
|
|
77632
|
+
onlyExportComponents: userConfig?.onlyExportComponents,
|
|
77431
77633
|
projectIndexModuleSources,
|
|
77432
77634
|
severityControls,
|
|
77433
77635
|
adoptedSettings,
|
|
@@ -77465,6 +77667,7 @@ const runOxlint = async (options) => {
|
|
|
77465
77667
|
return spawnLintBatches({
|
|
77466
77668
|
baseArgs: passBaseArgs,
|
|
77467
77669
|
fileBatches: passFileBatches,
|
|
77670
|
+
workingDirectory,
|
|
77468
77671
|
rootDirectory,
|
|
77469
77672
|
nodeBinaryPath,
|
|
77470
77673
|
project: lintProject,
|
|
@@ -77693,6 +77896,7 @@ const runOxlint = async (options) => {
|
|
|
77693
77896
|
const runBatches = () => spawnLintBatches({
|
|
77694
77897
|
baseArgs,
|
|
77695
77898
|
fileBatches,
|
|
77899
|
+
workingDirectory,
|
|
77696
77900
|
rootDirectory,
|
|
77697
77901
|
nodeBinaryPath,
|
|
77698
77902
|
project: lintProject,
|
|
@@ -78684,7 +78888,8 @@ const runInspect = (input, hooks = {}) => gen(function* () {
|
|
|
78684
78888
|
return filteredDiagnostic === null ? none() : some(filteredDiagnostic);
|
|
78685
78889
|
})));
|
|
78686
78890
|
const applyPerElementPipeline = (rawStream) => filterPerElementPipeline(rawStream).pipe(tap((diagnostic) => reporterService.emit(diagnostic)));
|
|
78687
|
-
const
|
|
78891
|
+
const severityControls = buildRuleSeverityControls(resolvedConfig.config);
|
|
78892
|
+
const pnpmHardeningSeverity = resolveRuleSeverityOverride({ ruleKey: "react-doctor/require-pnpm-hardening" }, severityControls);
|
|
78688
78893
|
const envCollected = yield* runCollect(applyPerElementPipeline(fromIterable$1(isDiffMode ? [] : [
|
|
78689
78894
|
...checkReducedMotion(scanDirectory),
|
|
78690
78895
|
...pnpmHardeningSeverity === "warn" || pnpmHardeningSeverity === "error" ? checkPnpmHardening(scanDirectory) : [],
|
|
@@ -78696,6 +78901,7 @@ const runInspect = (input, hooks = {}) => gen(function* () {
|
|
|
78696
78901
|
let didSecurityScanReachDeadline = false;
|
|
78697
78902
|
const securityScanFiber = yield* forkChild(runCollect(applyPerElementPipeline(isDiffMode ? empty$4 : unwrap(tryPromise((signal) => checkSecurityScanCooperative(scanDirectory, {
|
|
78698
78903
|
project,
|
|
78904
|
+
severityControls,
|
|
78699
78905
|
ignoredTags: input.ignoredTags,
|
|
78700
78906
|
includedTags: input.includedTags,
|
|
78701
78907
|
includeTagDefaults: input.includeTagDefaults,
|
|
@@ -78743,7 +78949,7 @@ const runInspect = (input, hooks = {}) => gen(function* () {
|
|
|
78743
78949
|
const maintainabilityPhaseTimeoutMs = yield* DeadCodePhaseTimeoutMs;
|
|
78744
78950
|
const workerCountSuffix = scanConcurrency > 1 ? ` ${highlighter.dim(`[~${scanConcurrency} workers]`)}` : "";
|
|
78745
78951
|
const projectCapabilities = getCapabilities(project);
|
|
78746
|
-
const projectRuleSelections = resolveProjectRuleSelections(
|
|
78952
|
+
const projectRuleSelections = resolveProjectRuleSelections(severityControls).filter((selection) => {
|
|
78747
78953
|
const rule = REACT_DOCTOR_RULE_REGISTRY[selection.ruleId];
|
|
78748
78954
|
return rule !== void 0 && shouldEnableRule(rule.requires, rule.tags, projectCapabilities, input.ignoredTags, rule.disabledWhen, input.includedTags) && (selection.ruleId === "duplicate-jsx-subtree" ? input.runDeadCode : !isDiffMode) && (showWarnings || projectRuleSelectionsMaySurfaceWhenWarningsAreHidden([selection]));
|
|
78749
78955
|
});
|
|
@@ -79750,4 +79956,4 @@ const toJsonReport = (result, options) => buildJsonReport({
|
|
|
79750
79956
|
export { AmbiguousProjectError, NoReactDependencyError, NotADirectoryError, PackageJsonNotFoundError, ProjectNotFoundError, ReactDoctorError, buildJsonReport, buildJsonReportError, clearCaches, defineConfig, diagnose, filterSourceFiles, getDiffInfo, hasReactRuntime, isProjectDiscoveryError, isReactDoctorError, summarizeDiagnostics, toJsonReport };
|
|
79751
79957
|
|
|
79752
79958
|
//# sourceMappingURL=index.js.map
|
|
79753
|
-
//# debugId=
|
|
79959
|
+
//# debugId=03c9fd81-e844-5b50-b2ac-f3212ea46bf8
|