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
|
@@ -1,7 +1,7 @@
|
|
|
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]="ef9cab92-43ea-5ce7-b57b-f8aa7d573729")}catch(e){}}();
|
|
3
3
|
import { i as __toESM, r as __require, t as __commonJSMin } from "./chunk-ChKA3wi6.js";
|
|
4
|
-
import { $ as warmReactCompilerDetection, $t as
|
|
4
|
+
import { $ as warmReactCompilerDetection, $t as OXLINT_SPLIT_TOTAL_BUDGET_MS, A as buildGitSourceListingRequest, An as TAILWIND_POSTCSS7_COMPAT_ALIAS, B as resolveGitCommand, Bt as MAINTAINABILITY_CATEGORY, Cn as SUPPLY_CHAIN_CACHE_SUBDIR, Dn as SUPPLY_CHAIN_OVERLAP_TIMEOUT_MS, Dt as FILE_LINT_CACHE_MAX_FILE_COUNT, En as SUPPLY_CHAIN_IGNORED_PACKAGES, Et as FILE_LINT_CACHE_FILENAME, F as lowerChildProcessPriority, Fn as TYPESCRIPT_DECLARATION_FILE_PATTERN, Ft as GIT_SOURCE_LISTING_ARGUMENTS, G as resolvePluginPath, Gt as MILLISECONDS_PER_SECOND, H as resolveOxlintThreadCount, Ht as MAINTAINABILITY_PLUGIN, In as VERCEL_NEXTJS_SECURITY_RELEASE_URL, It as HTML_FILE_PATTERN, J as resolveTsConfigRelativePath, Jt as OXLINT_IGNORED_DECLARATION_DIAGNOSTIC_CODES, K as resolveReactDoctorCacheDir, Kt as MINIFIED_SNIFF_BYTES, Lt as IGNORED_DIRECTORIES, M as buildOxlintWorkerSpawnSpec, Mn as TELEMETRY_EXPORT_INTERVAL_MS, Mt as GIT_CHECK_ATTR_MAX_BUFFER_BYTES, Nn as TELEMETRY_SHUTDOWN_TIMEOUT_MS, Nt as GIT_LS_FILES_MAX_BUFFER_BYTES, On as SUPPLY_CHAIN_PLUGIN, Ot as GENERATED_BUNDLE_FILE_PATTERN, P as killUnadoptedOxlintWorkers, Pn as TSCONFIG_FILENAMES, Pt as GIT_SHOW_MAX_BUFFER_BYTES, Q as takeReactCompilerDetection, Qt as OXLINT_SPAWN_TIMEOUT_MS, R as readSystemConcurrencyFacts, Rt as JSX_DUPLICATION_SOURCE_FILE_PATTERN, Sn as STAGED_FILES_PROJECT_CONFIG_FILENAMES, St as DUPLICATE_JSX_WORKER_IDLE_TIMEOUT_MS, Tn as SUPPLY_CHAIN_CATEGORY, Tt as FETCH_TIMEOUT_MS, U as resolveOxlintToolchainVersions, V as resolveOxlintBinary, Vt as MAINTAINABILITY_DUPLICATE_JSX_RULE, W as resolveOxlintWorkerRuntime, Wt as MAX_GLOB_PATTERN_LENGTH_CHARS, X as spawnOxlintWorkerProcess, Xt as OXLINT_OOM_RESCUE_BUDGET_MS, Y as setChildProcessRef, Z as takePrespawnedOxlintWorker, Zt as OXLINT_OUTPUT_MAX_BYTES, _n as SOCKET_PACKAGE_PAGE_BASE, _t as DEFAULT_BRANCH_CANDIDATES, an as REACT_BLOG_RSC_ADVISORY_URL, bn as SPAWN_ARGS_MAX_LENGTH_CHARS_DARWIN, bt as DOCS_RULES_BASE_URL, cn as RECOMMENDED_PNPM_MINIMUM_RELEASE_AGE_MINUTES, ct as AXIOM_TRACES_PATH, d as METRIC_DISTRIBUTION_BOUNDARIES, dn as SCORE_API_URL, en as OXLINT_WORKER_JOB_END_MARKER, et as ABORT_EXIT_CODES, ft as COMPILER_CLEANUP_BUCKET, gn as SOCKET_FREE_USER_AGENT, hn as SOCKET_FREE_PURL_API_BASE, ht as CONFIG_FINGERPRINT_FILENAMES, in as PROJECT_ANALYSIS_WORKER_TIMEOUT_MS, it as AXIOM_DATASET_HEADER, j as buildOxlintChildEnv, jn as TARGET_BLANK_BROWSER_SUPPORT, jt as GITHUB_VIEWER_PERMISSION_TIMEOUT_MS, kn as SUPPLY_CHAIN_RULE, kt as GENERATED_SOURCE_DIRECTORY_PATTERN, l as INTERNAL_ERROR_JSON_FALLBACK, ln as ROOT_CAUSE_GROUPABLE_RULE_KEYS, mt as CONFIG_CACHE_TTL_MS, nn as PROJECT_ANALYSIS_WORKER_MEMORY_BUDGET_BYTES, nt as ADOPTED_LINT_CONFIG_MAX_BYTES, on as REACT_ROUTER_CAPABILITY_THRESHOLDS, ot as AXIOM_METRICS_DATASET_HEADER, pn as SIDECAR_LINT_CACHE_FILENAME, pt as COMPILER_CLEANUP_RULE_KEYS, q as resolveScanConcurrency, qt as OCCURRENCE_MATCHED_CATEGORIES, rn as PROJECT_ANALYSIS_WORKER_TIMEOUT_CEILING_MS, rt as APP_ONLY_RULE_KEYS, sn as REACT_SERVER_DOM_PACKAGES, st as AXIOM_METRICS_PATH, tn as PROJECT_ANALYSIS_WORKER_MAX_OLD_SPACE_MB, tt as ADOPTABLE_LINT_CONFIG_FILENAMES, un as SCANNED_DOT_DIRECTORIES, vn as SOURCE_FILE_PATTERN, vt as DIAGNOSTIC_CATEGORY_BUCKETS, wn as SUPPLY_CHAIN_CACHE_TTL_MS, wt as ES_TARGET_YEAR_BY_NAME, xn as SPAWN_ARGS_MAX_LENGTH_CHARS_POSIX, yn as SPAWN_ARGS_MAX_LENGTH_CHARS, yt as DISABLE_DIRECTIVE_BACKUP_DIRECTORY_SEGMENTS, z as resolveConfiguredScanConcurrency } from "./constants-BmD_c3Yq.js";
|
|
5
5
|
import { n as require_picomatch, t as require_semver } from "./semver-BZIuy1gP.js";
|
|
6
6
|
import { createRequire } from "node:module";
|
|
7
7
|
import * as fs$1$2 from "node:fs";
|
|
@@ -20,7 +20,7 @@ import { Worker } from "node:worker_threads";
|
|
|
20
20
|
import { parseSync } from "oxc-parser";
|
|
21
21
|
import * as fs$1$1 from "node:fs/promises";
|
|
22
22
|
import { ResolverFactory } from "oxc-resolver";
|
|
23
|
-
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";
|
|
23
|
+
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";
|
|
24
24
|
import { parseJSON5, parseJSONC } from "confbox";
|
|
25
25
|
import { createJiti } from "jiti";
|
|
26
26
|
import { PassThrough } from "node:stream";
|
|
@@ -88,7 +88,7 @@ const unwrapTypescriptExpression = (expression) => {
|
|
|
88
88
|
return currentExpression;
|
|
89
89
|
};
|
|
90
90
|
//#endregion
|
|
91
|
-
//#region ../core/dist/collect-unplugin-auto-import-global-scopes-
|
|
91
|
+
//#region ../core/dist/collect-unplugin-auto-import-global-scopes-Z9dhela6.js
|
|
92
92
|
var import_picomatch = /* @__PURE__ */ __toESM(require_picomatch(), 1);
|
|
93
93
|
const LINGUIST_ATTRIBUTES = ["linguist-generated", "linguist-vendored"];
|
|
94
94
|
const DISABLED_ATTRIBUTE_VALUES = new Set([
|
|
@@ -526,7 +526,7 @@ const collectUnpluginAutoImportGlobalScopes = ({ rootDirectory, candidateFiles }
|
|
|
526
526
|
return scopes.some((scope) => scope.names.length > 0) ? scopes : [];
|
|
527
527
|
};
|
|
528
528
|
//#endregion
|
|
529
|
-
//#region ../core/dist/detect-duplicate-jsx-subtrees-
|
|
529
|
+
//#region ../core/dist/detect-duplicate-jsx-subtrees-B5UWtUyz.js
|
|
530
530
|
const yieldToEventLoop = () => new Promise((resolve) => {
|
|
531
531
|
setImmediate(resolve);
|
|
532
532
|
});
|
|
@@ -651,7 +651,7 @@ const resolveOptions$1 = (options) => ({
|
|
|
651
651
|
minimumDistinctFiles: options.minimumDistinctFiles ?? 1,
|
|
652
652
|
maxSourceFiles: options.budget?.maxSourceFiles ?? 5e3,
|
|
653
653
|
maxSourceLengthChars: options.budget?.maxSourceLengthChars ?? 1e6,
|
|
654
|
-
maxJsxNodes: options.budget?.maxJsxNodes ??
|
|
654
|
+
maxJsxNodes: options.budget?.maxJsxNodes ?? 5e5,
|
|
655
655
|
maxFamilies: options.budget?.maxFamilies ?? 20
|
|
656
656
|
});
|
|
657
657
|
const hashParts = (parts) => {
|
|
@@ -865,10 +865,12 @@ const collectCandidates = (source, sourceFile, signal, maximumCandidateCount) =>
|
|
|
865
865
|
const jsxNodes = [];
|
|
866
866
|
const pendingNodes = [sourceFile];
|
|
867
867
|
let limitExceeded = false;
|
|
868
|
+
let observedJsxNodeCount = 0;
|
|
868
869
|
while (pendingNodes.length > 0 && !limitExceeded && !signal?.aborted) {
|
|
869
870
|
const currentNode = pendingNodes.pop();
|
|
870
871
|
if (currentNode === void 0) continue;
|
|
871
872
|
if (isJsxSubtreeNode(currentNode)) {
|
|
873
|
+
observedJsxNodeCount += 1;
|
|
872
874
|
if (jsxNodes.length >= maximumCandidateCount) {
|
|
873
875
|
limitExceeded = true;
|
|
874
876
|
continue;
|
|
@@ -884,7 +886,8 @@ const collectCandidates = (source, sourceFile, signal, maximumCandidateCount) =>
|
|
|
884
886
|
if (limitExceeded || signal?.aborted) return {
|
|
885
887
|
candidates: [],
|
|
886
888
|
aborted: signal?.aborted ?? false,
|
|
887
|
-
limitExceeded
|
|
889
|
+
limitExceeded,
|
|
890
|
+
observedJsxNodeCount
|
|
888
891
|
};
|
|
889
892
|
const metadataByNode = /* @__PURE__ */ new Map();
|
|
890
893
|
const functionIdentityByNode = /* @__PURE__ */ new Map();
|
|
@@ -892,7 +895,8 @@ const collectCandidates = (source, sourceFile, signal, maximumCandidateCount) =>
|
|
|
892
895
|
if (signal?.aborted) return {
|
|
893
896
|
candidates: [],
|
|
894
897
|
aborted: true,
|
|
895
|
-
limitExceeded: false
|
|
898
|
+
limitExceeded: false,
|
|
899
|
+
observedJsxNodeCount
|
|
896
900
|
};
|
|
897
901
|
buildJsxSubtreeMetadata(jsxNodes[nodeIndex], metadataByNode);
|
|
898
902
|
}
|
|
@@ -910,7 +914,8 @@ const collectCandidates = (source, sourceFile, signal, maximumCandidateCount) =>
|
|
|
910
914
|
};
|
|
911
915
|
}),
|
|
912
916
|
aborted: false,
|
|
913
|
-
limitExceeded: false
|
|
917
|
+
limitExceeded: false,
|
|
918
|
+
observedJsxNodeCount
|
|
914
919
|
};
|
|
915
920
|
};
|
|
916
921
|
const scanSource = (input) => {
|
|
@@ -947,8 +952,7 @@ const scanSource = (input) => {
|
|
|
947
952
|
incompleteReason: {
|
|
948
953
|
kind: "jsx-node-limit",
|
|
949
954
|
limit: input.options.maxJsxNodes,
|
|
950
|
-
observed: input.
|
|
951
|
-
path: input.source.path
|
|
955
|
+
observed: input.scannedJsxNodeCount + collectedCandidates.observedJsxNodeCount
|
|
952
956
|
},
|
|
953
957
|
didAbort: false,
|
|
954
958
|
didScan: false
|
|
@@ -1065,7 +1069,10 @@ const detectDuplicateJsxSubtreesCooperative = async (sourceReader, options = {})
|
|
|
1065
1069
|
scannedSourceFileCount,
|
|
1066
1070
|
scannedJsxNodeCount
|
|
1067
1071
|
});
|
|
1068
|
-
if (scannedSource.incompleteReason !== null)
|
|
1072
|
+
if (scannedSource.incompleteReason !== null) {
|
|
1073
|
+
incompleteReasons.push(scannedSource.incompleteReason);
|
|
1074
|
+
if (scannedSource.incompleteReason.kind === "jsx-node-limit") break;
|
|
1075
|
+
}
|
|
1069
1076
|
if (scannedSource.didScan) {
|
|
1070
1077
|
candidates.push(...scannedSource.candidates);
|
|
1071
1078
|
scannedJsxNodeCount += scannedSource.candidates.length;
|
|
@@ -1083,7 +1090,7 @@ const detectDuplicateJsxSubtreesCooperative = async (sourceReader, options = {})
|
|
|
1083
1090
|
});
|
|
1084
1091
|
};
|
|
1085
1092
|
//#endregion
|
|
1086
|
-
//#region ../core/dist/detect-react-compiler-
|
|
1093
|
+
//#region ../core/dist/detect-react-compiler-DLpaU8gr.js
|
|
1087
1094
|
const NEXT_CONFIG_FILENAMES = [
|
|
1088
1095
|
"next.config.js",
|
|
1089
1096
|
"next.config.mjs",
|
|
@@ -65690,13 +65697,17 @@ const getBrowserslistProtectionRequirement = (directory) => {
|
|
|
65690
65697
|
env: "production"
|
|
65691
65698
|
});
|
|
65692
65699
|
if (!queries) return void 0;
|
|
65700
|
+
if ((typeof queries === "string" ? [queries] : queries).some((query) => /\b(?:extends|stats)\b|\bbrowserslist\s+config\b/i.test(query))) return;
|
|
65693
65701
|
let requirement;
|
|
65694
65702
|
let hasUnsupportedTarget = false;
|
|
65695
65703
|
const previousIgnoreOldData = process.env.BROWSERSLIST_IGNORE_OLD_DATA;
|
|
65696
65704
|
let browserTargets = [];
|
|
65697
65705
|
try {
|
|
65698
65706
|
process.env.BROWSERSLIST_IGNORE_OLD_DATA = "true";
|
|
65699
|
-
browserTargets = (0, import_browserslist.default)(queries
|
|
65707
|
+
browserTargets = (0, import_browserslist.default)(queries, {
|
|
65708
|
+
path: false,
|
|
65709
|
+
stats: {}
|
|
65710
|
+
});
|
|
65700
65711
|
} finally {
|
|
65701
65712
|
if (previousIgnoreOldData === void 0) delete process.env.BROWSERSLIST_IGNORE_OLD_DATA;
|
|
65702
65713
|
else process.env.BROWSERSLIST_IGNORE_OLD_DATA = previousIgnoreOldData;
|
|
@@ -67797,6 +67808,13 @@ const DEFAULT_SURFACE_EXCLUDED_TAGS = {
|
|
|
67797
67808
|
ciFailure: ["design"]
|
|
67798
67809
|
};
|
|
67799
67810
|
const isRecord = (value) => typeof value === "object" && value !== null && !Array.isArray(value);
|
|
67811
|
+
const KNOWN_RULE_KEYS = new Set([...ALL_REACT_DOCTOR_RULE_KEYS, ...EXTERNAL_RULES.map((rule) => rule.key)]);
|
|
67812
|
+
const BUNDLED_RULE_NAMESPACES = new Set([...KNOWN_RULE_KEYS].flatMap(getEquivalentRuleKeys).map((key) => key.slice(0, key.lastIndexOf("/"))));
|
|
67813
|
+
const getUnknownBundledRuleKeys = (rules) => Object.keys(rules ?? {}).filter((key) => {
|
|
67814
|
+
const canonicalKey = canonicalizeUserRuleKey(key);
|
|
67815
|
+
const namespace = canonicalKey.slice(0, canonicalKey.lastIndexOf("/"));
|
|
67816
|
+
return BUNDLED_RULE_NAMESPACES.has(namespace) && !KNOWN_RULE_KEYS.has(canonicalKey);
|
|
67817
|
+
});
|
|
67800
67818
|
const VALID_RULE_SEVERITIES = [
|
|
67801
67819
|
"error",
|
|
67802
67820
|
"warn",
|
|
@@ -67965,6 +67983,32 @@ const validateSeverityMap = (fieldName, rawMap, keysAreCategories = false) => {
|
|
|
67965
67983
|
}
|
|
67966
67984
|
return validated;
|
|
67967
67985
|
};
|
|
67986
|
+
const ONLY_EXPORT_COMPONENTS_STRING_ARRAY_KEYS = ["allowExportNames", "customHOCs"];
|
|
67987
|
+
const ONLY_EXPORT_COMPONENTS_BOOLEAN_KEYS = ["allowConstantExport", "checkJS"];
|
|
67988
|
+
const validateOnlyExportComponentsField = (rawOptions) => {
|
|
67989
|
+
if (!isRecord(rawOptions)) {
|
|
67990
|
+
warnConfigIssue(`config field "onlyExportComponents" must be an object (got ${typeof rawOptions}); ignoring this field.`);
|
|
67991
|
+
return;
|
|
67992
|
+
}
|
|
67993
|
+
const validated = {};
|
|
67994
|
+
for (const [key, value] of Object.entries(rawOptions)) {
|
|
67995
|
+
const fieldName = `onlyExportComponents.${key}`;
|
|
67996
|
+
const stringArrayKey = ONLY_EXPORT_COMPONENTS_STRING_ARRAY_KEYS.find((candidateKey) => candidateKey === key);
|
|
67997
|
+
if (stringArrayKey !== void 0) {
|
|
67998
|
+
const entries = validateStringArrayField(fieldName, value);
|
|
67999
|
+
if (entries !== void 0) validated[stringArrayKey] = entries;
|
|
68000
|
+
continue;
|
|
68001
|
+
}
|
|
68002
|
+
const booleanKey = ONLY_EXPORT_COMPONENTS_BOOLEAN_KEYS.find((candidateKey) => candidateKey === key);
|
|
68003
|
+
if (booleanKey !== void 0) {
|
|
68004
|
+
const flag = coerceMaybeBooleanString(fieldName, value);
|
|
68005
|
+
if (flag !== void 0) validated[booleanKey] = flag;
|
|
68006
|
+
continue;
|
|
68007
|
+
}
|
|
68008
|
+
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.`);
|
|
68009
|
+
}
|
|
68010
|
+
return validated;
|
|
68011
|
+
};
|
|
67968
68012
|
const applyFieldValidator = (config, validated, fieldName, validator) => {
|
|
67969
68013
|
const raw = config[fieldName];
|
|
67970
68014
|
if (raw === void 0) return;
|
|
@@ -67979,8 +68023,10 @@ const validateConfigTypes = (config) => {
|
|
|
67979
68023
|
for (const fieldName of STRING_ARRAY_FIELD_NAMES) applyFieldValidator(config, validated, fieldName, (value) => validateStringArrayField(fieldName, value));
|
|
67980
68024
|
applyFieldValidator(config, validated, "ignore", validateIgnoreField);
|
|
67981
68025
|
applyFieldValidator(config, validated, "surfaces", validateSurfacesField);
|
|
68026
|
+
applyFieldValidator(config, validated, "onlyExportComponents", validateOnlyExportComponentsField);
|
|
67982
68027
|
for (const fieldName of SEVERITY_FIELD_NAMES) applyFieldValidator(config, validated, fieldName, (value) => validateSeverityMap(fieldName, value, fieldName === "categories"));
|
|
67983
68028
|
applyFieldValidator(config, validated, "plugins", (value) => validateStringArrayField("plugins", value));
|
|
68029
|
+
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.`);
|
|
67984
68030
|
return validated;
|
|
67985
68031
|
};
|
|
67986
68032
|
const warn = (message) => {
|
|
@@ -68302,7 +68348,7 @@ const dedupeRelatedDiagnostics = (diagnostics) => {
|
|
|
68302
68348
|
};
|
|
68303
68349
|
const isPathInsideDirectory = (childAbsolutePath, parentAbsolutePath) => {
|
|
68304
68350
|
const relativePath = path$1$1.relative(parentAbsolutePath, childAbsolutePath);
|
|
68305
|
-
return Boolean(relativePath) && !relativePath.startsWith(
|
|
68351
|
+
return Boolean(relativePath) && relativePath !== ".." && !relativePath.startsWith(`..${path$1$1.sep}`) && !path$1$1.isAbsolute(relativePath);
|
|
68306
68352
|
};
|
|
68307
68353
|
const compareStrings = (left, right) => left < right ? -1 : left > right ? 1 : 0;
|
|
68308
68354
|
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));
|
|
@@ -70161,16 +70207,24 @@ const createSecurityScanSession = (rootDirectory, options) => {
|
|
|
70161
70207
|
const rule = entry.rule;
|
|
70162
70208
|
const scan = rule.scan;
|
|
70163
70209
|
if (typeof scan !== "function") return [];
|
|
70210
|
+
const explicitRuleOverride = resolveRuleSeverityOverride({ ruleKey: entry.key }, options.severityControls);
|
|
70211
|
+
const severityOverride = explicitRuleOverride ?? resolveRuleSeverityOverride({
|
|
70212
|
+
ruleKey: entry.key,
|
|
70213
|
+
category: "Security"
|
|
70214
|
+
}, options.severityControls);
|
|
70215
|
+
if (severityOverride === "off") return [];
|
|
70164
70216
|
if (!shouldEnableRuleByDefaultStatus({
|
|
70165
70217
|
defaultEnabled: rule.defaultEnabled,
|
|
70166
70218
|
includeTagDefaults: options.includeTagDefaults === true,
|
|
70167
|
-
hasIncludedTags: includedTags.size > 0
|
|
70219
|
+
hasIncludedTags: includedTags.size > 0,
|
|
70220
|
+
hasExplicitOverride: explicitRuleOverride !== void 0
|
|
70168
70221
|
})) return [];
|
|
70169
70222
|
if (!shouldEnableRule(rule.requires, rule.tags, capabilities, ignoredTags, rule.disabledWhen, includedTags)) return [];
|
|
70170
70223
|
return [{
|
|
70171
70224
|
entry,
|
|
70172
70225
|
scan,
|
|
70173
|
-
|
|
70226
|
+
severityOverride,
|
|
70227
|
+
committedFilesOnly: rule.committedFilesOnly !== false
|
|
70174
70228
|
}];
|
|
70175
70229
|
});
|
|
70176
70230
|
if (enabledScanRules.length === 0) return null;
|
|
@@ -70187,10 +70241,13 @@ const createSecurityScanSession = (rootDirectory, options) => {
|
|
|
70187
70241
|
};
|
|
70188
70242
|
const scanFileByRule = function* (file) {
|
|
70189
70243
|
if (file === null) return;
|
|
70190
|
-
for (const { entry, scan, committedFilesOnly } of enabledScanRules) {
|
|
70244
|
+
for (const { entry, scan, severityOverride, committedFilesOnly } of enabledScanRules) {
|
|
70191
70245
|
for (const finding of scan(file)) {
|
|
70192
|
-
if (committedFilesOnly && isFileGitIgnored(file)) continue;
|
|
70193
|
-
const diagnostic = buildSecurityScanDiagnostic(finding
|
|
70246
|
+
if ((finding.committedFilesOnly ?? committedFilesOnly) && isFileGitIgnored(file)) continue;
|
|
70247
|
+
const diagnostic = buildSecurityScanDiagnostic(severityOverride === void 0 ? finding : {
|
|
70248
|
+
...finding,
|
|
70249
|
+
severity: severityOverride
|
|
70250
|
+
}, entry, file.relativePath);
|
|
70194
70251
|
const key = `${diagnostic.rule}:${diagnostic.filePath}:${diagnostic.line}:${diagnostic.column}:${diagnostic.message}`;
|
|
70195
70252
|
if (seen.has(key)) continue;
|
|
70196
70253
|
seen.add(key);
|
|
@@ -71840,6 +71897,82 @@ const detectUserLintConfigPaths = (rootDirectory) => {
|
|
|
71840
71897
|
}
|
|
71841
71898
|
return [];
|
|
71842
71899
|
};
|
|
71900
|
+
const isSymlinkFreePath = (filePath, rootDirectory) => {
|
|
71901
|
+
if (!isPathInsideDirectory(filePath, rootDirectory)) return false;
|
|
71902
|
+
let currentPath = rootDirectory;
|
|
71903
|
+
for (const segment of path$1$1.relative(rootDirectory, filePath).split(path$1$1.sep)) {
|
|
71904
|
+
currentPath = path$1$1.join(currentPath, segment);
|
|
71905
|
+
try {
|
|
71906
|
+
if (fs$1$2.lstatSync(currentPath).isSymbolicLink()) return false;
|
|
71907
|
+
} catch (error) {
|
|
71908
|
+
return isErrnoException(error) && error.code === "ENOENT";
|
|
71909
|
+
}
|
|
71910
|
+
}
|
|
71911
|
+
return true;
|
|
71912
|
+
};
|
|
71913
|
+
const snapshotAdoptedLintConfigs = (input) => {
|
|
71914
|
+
const sourceBoundaryDirectory = path$1$1.resolve(findGitRepositoryRoot(input.rootDirectory) ?? input.rootDirectory);
|
|
71915
|
+
const boundaryDirectory = fs$1$2.realpathSync(sourceBoundaryDirectory);
|
|
71916
|
+
const snapshots = /* @__PURE__ */ new Map();
|
|
71917
|
+
const expandedFileCounts = /* @__PURE__ */ new Map();
|
|
71918
|
+
const activePaths = /* @__PURE__ */ new Set();
|
|
71919
|
+
let expandedFileCount = 0;
|
|
71920
|
+
const snapshotConfig = (configPath, depth) => {
|
|
71921
|
+
const resolvedPath = path$1$1.resolve(configPath);
|
|
71922
|
+
const existingSnapshot = snapshots.get(resolvedPath);
|
|
71923
|
+
if (existingSnapshot) {
|
|
71924
|
+
expandedFileCount += expandedFileCounts.get(resolvedPath) ?? 1;
|
|
71925
|
+
if (expandedFileCount > 64) throw new Error("Adopted lint config expands too many files");
|
|
71926
|
+
return existingSnapshot;
|
|
71927
|
+
}
|
|
71928
|
+
if (depth > 32 || expandedFileCount >= 64 || activePaths.has(resolvedPath) || !isSymlinkFreePath(resolvedPath, boundaryDirectory)) throw new Error("Unsafe adopted lint config chain");
|
|
71929
|
+
const configStats = fs$1$2.lstatSync(resolvedPath);
|
|
71930
|
+
if (!configStats.isFile() || configStats.size > 1048576) throw new Error("Unsupported adopted lint config file");
|
|
71931
|
+
const previousFileCount = expandedFileCount;
|
|
71932
|
+
expandedFileCount += 1;
|
|
71933
|
+
activePaths.add(resolvedPath);
|
|
71934
|
+
try {
|
|
71935
|
+
const parsed = parseJSONC(readTextFileUpToCharacterLimitSync({
|
|
71936
|
+
filePath: resolvedPath,
|
|
71937
|
+
maximumLengthChars: ADOPTED_LINT_CONFIG_MAX_BYTES,
|
|
71938
|
+
sizeBytes: configStats.size
|
|
71939
|
+
}), { allowTrailingComma: true });
|
|
71940
|
+
if (!isPlainObject(parsed)) throw new Error("Invalid adopted lint config");
|
|
71941
|
+
const sanitized = snapshotValue(parsed, resolvedPath, depth);
|
|
71942
|
+
const snapshotPath = path$1$1.join(input.snapshotDirectory, `adopted-${snapshots.size}.json`);
|
|
71943
|
+
fs$1$2.writeFileSync(snapshotPath, JSON.stringify(sanitized), {
|
|
71944
|
+
flag: "wx",
|
|
71945
|
+
mode: 384
|
|
71946
|
+
});
|
|
71947
|
+
snapshots.set(resolvedPath, snapshotPath);
|
|
71948
|
+
expandedFileCounts.set(resolvedPath, expandedFileCount - previousFileCount);
|
|
71949
|
+
return snapshotPath;
|
|
71950
|
+
} finally {
|
|
71951
|
+
activePaths.delete(resolvedPath);
|
|
71952
|
+
}
|
|
71953
|
+
};
|
|
71954
|
+
const snapshotValue = (value, configPath, depth) => {
|
|
71955
|
+
if (depth > 32) throw new Error("Adopted lint config too deep");
|
|
71956
|
+
if (Array.isArray(value)) return value.map((entry) => snapshotValue(entry, configPath, depth + 1));
|
|
71957
|
+
if (!isPlainObject(value)) return value;
|
|
71958
|
+
if (Object.hasOwn(value, "jsPlugins")) throw new Error("Executable adopted lint config");
|
|
71959
|
+
return Object.fromEntries(Object.entries(value).map(([key, entry]) => {
|
|
71960
|
+
if (key !== "extends") return [key, snapshotValue(entry, configPath, depth + 1)];
|
|
71961
|
+
return [key, (Array.isArray(entry) ? entry : [entry]).map((extendedPath) => {
|
|
71962
|
+
if (typeof extendedPath !== "string") throw new Error("Invalid lint config extends");
|
|
71963
|
+
return snapshotConfig(path$1$1.resolve(path$1$1.dirname(configPath), extendedPath), depth + 1);
|
|
71964
|
+
})];
|
|
71965
|
+
}));
|
|
71966
|
+
};
|
|
71967
|
+
return input.configPaths.flatMap((configPath) => {
|
|
71968
|
+
try {
|
|
71969
|
+
if (!isPathInsideDirectory(configPath, sourceBoundaryDirectory)) return [];
|
|
71970
|
+
return [snapshotConfig(path$1$1.join(boundaryDirectory, path$1$1.relative(sourceBoundaryDirectory, configPath)), 0)];
|
|
71971
|
+
} catch {
|
|
71972
|
+
return [];
|
|
71973
|
+
}
|
|
71974
|
+
});
|
|
71975
|
+
};
|
|
71843
71976
|
const readAdoptedLintConfigSettings = (configPaths) => {
|
|
71844
71977
|
const mergedSettings = /* @__PURE__ */ new Map();
|
|
71845
71978
|
for (const configPath of configPaths) {
|
|
@@ -71867,6 +72000,7 @@ const getBackupPath = (rootDirectory, absolutePath) => {
|
|
|
71867
72000
|
};
|
|
71868
72001
|
const removeBackupRootIfEmpty = (rootDirectory) => {
|
|
71869
72002
|
const backupRootDirectory = getBackupRootDirectory(rootDirectory);
|
|
72003
|
+
if (!isSymlinkFreePath(backupRootDirectory, rootDirectory)) return;
|
|
71870
72004
|
if (!walkSourceTreeFiles(backupRootDirectory).next().done) return;
|
|
71871
72005
|
fs$1$2.rmSync(backupRootDirectory, {
|
|
71872
72006
|
recursive: true,
|
|
@@ -71967,8 +72101,13 @@ const collectNeutralizationCandidatePaths = (rootDirectory, discoveredRelativePa
|
|
|
71967
72101
|
const recoverOrphanedBackups = (rootDirectory) => {
|
|
71968
72102
|
const blockedPaths = /* @__PURE__ */ new Set();
|
|
71969
72103
|
const backupRootDirectory = getBackupRootDirectory(rootDirectory);
|
|
72104
|
+
if (!isSymlinkFreePath(backupRootDirectory, rootDirectory)) return blockedPaths;
|
|
71970
72105
|
for (const { absolutePath: backupPath } of walkSourceTreeFiles(backupRootDirectory)) {
|
|
71971
72106
|
const originalPath = path$1$1.join(rootDirectory, path$1$1.relative(backupRootDirectory, backupPath));
|
|
72107
|
+
if (!isSymlinkFreePath(backupPath, rootDirectory) || !isSymlinkFreePath(originalPath, rootDirectory)) {
|
|
72108
|
+
blockedPaths.add(originalPath);
|
|
72109
|
+
continue;
|
|
72110
|
+
}
|
|
71972
72111
|
if (neutralizedFileLeases.has(originalPath)) continue;
|
|
71973
72112
|
let backupContent;
|
|
71974
72113
|
let currentContent;
|
|
@@ -72019,6 +72158,7 @@ const neutralizeDisableDirectives = async (rootDirectory, includePaths, options
|
|
|
72019
72158
|
lease.referenceCount -= 1;
|
|
72020
72159
|
if (lease.referenceCount > 0) continue;
|
|
72021
72160
|
neutralizedFileLeases.delete(absolutePath);
|
|
72161
|
+
if (!isSymlinkFreePath(absolutePath, lease.rootDirectory) || !isSymlinkFreePath(lease.backupPath, lease.rootDirectory)) continue;
|
|
72022
72162
|
try {
|
|
72023
72163
|
const currentContent = fs$1$2.readFileSync(absolutePath, "utf-8");
|
|
72024
72164
|
if (currentContent !== lease.neutralizedContent && currentContent !== lease.originalContent) {
|
|
@@ -72036,6 +72176,7 @@ const neutralizeDisableDirectives = async (rootDirectory, includePaths, options
|
|
|
72036
72176
|
const onExit = () => restore();
|
|
72037
72177
|
process.once("exit", onExit);
|
|
72038
72178
|
const leaseCandidatePath = (absolutePath) => {
|
|
72179
|
+
if (!isSymlinkFreePath(absolutePath, resolvedRootDirectory)) return;
|
|
72039
72180
|
if (leasedPaths.has(absolutePath)) return;
|
|
72040
72181
|
if (blockedPaths.has(absolutePath)) return;
|
|
72041
72182
|
const existingLease = neutralizedFileLeases.get(absolutePath);
|
|
@@ -72053,7 +72194,7 @@ const neutralizeDisableDirectives = async (rootDirectory, includePaths, options
|
|
|
72053
72194
|
const neutralizedContent = neutralizeContent(originalContent);
|
|
72054
72195
|
if (neutralizedContent !== originalContent) {
|
|
72055
72196
|
const backupPath = getBackupPath(resolvedRootDirectory, absolutePath);
|
|
72056
|
-
if (backupPath === null) return;
|
|
72197
|
+
if (backupPath === null || !isSymlinkFreePath(backupPath, resolvedRootDirectory)) return;
|
|
72057
72198
|
try {
|
|
72058
72199
|
fs$1$2.mkdirSync(path$1$1.dirname(backupPath), { recursive: true });
|
|
72059
72200
|
fs$1$2.writeFileSync(backupPath, originalContent, { flag: "wx" });
|
|
@@ -72063,6 +72204,7 @@ const neutralizeDisableDirectives = async (rootDirectory, includePaths, options
|
|
|
72063
72204
|
}
|
|
72064
72205
|
fs$1$2.writeFileSync(absolutePath, neutralizedContent);
|
|
72065
72206
|
neutralizedFileLeases.set(absolutePath, {
|
|
72207
|
+
rootDirectory: resolvedRootDirectory,
|
|
72066
72208
|
backupPath,
|
|
72067
72209
|
originalContent,
|
|
72068
72210
|
neutralizedContent,
|
|
@@ -72101,7 +72243,13 @@ const normalizeConfigForHash = (config) => {
|
|
|
72101
72243
|
if (Array.isArray(clone?.jsPlugins)) clone.jsPlugins = clone.jsPlugins.map((_, index) => `<plugin:${index}>`);
|
|
72102
72244
|
return clone;
|
|
72103
72245
|
};
|
|
72104
|
-
const computeRulesetHash = (input) => crypto.createHash("sha1").update(
|
|
72246
|
+
const computeRulesetHash = (input) => crypto.createHash("sha1").update("project-bulk-suppressions-isolated\0").update(JSON.stringify([
|
|
72247
|
+
normalizeConfigForHash(input.config),
|
|
72248
|
+
input.toolchainVersions,
|
|
72249
|
+
input.ignorePatterns,
|
|
72250
|
+
input.tsconfigContent,
|
|
72251
|
+
input.respectInlineDisables
|
|
72252
|
+
])).digest("hex");
|
|
72105
72253
|
/**
|
|
72106
72254
|
* Loads a plugin module via the local require resolver and extracts
|
|
72107
72255
|
* `(name, ruleNames)` from either `module.exports.meta + rules` or
|
|
@@ -72257,7 +72405,7 @@ const buildUserPluginRules = (userPlugin, severityControls) => {
|
|
|
72257
72405
|
}
|
|
72258
72406
|
return enabled;
|
|
72259
72407
|
};
|
|
72260
|
-
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 }) => {
|
|
72408
|
+
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 }) => {
|
|
72261
72409
|
const hasIncludedTags = includedTags.size > 0;
|
|
72262
72410
|
const resolvedReactHooksJsPlugin = disableReactHooksJsPlugin || hasIncludedTags ? null : resolveReactHooksJsPlugin(project.hasReactCompiler || project.hasReactCompilerLintPlugin === true, customRulesOnly);
|
|
72263
72411
|
const reactHooksJsPlugin = ruleSelection === "sidecar" ? null : resolvedReactHooksJsPlugin;
|
|
@@ -72340,6 +72488,7 @@ const createOxlintConfig = ({ pluginPath, diagnosticContextDirectory, project, c
|
|
|
72340
72488
|
} : {},
|
|
72341
72489
|
...project.shopifyFlashListMajorVersion !== null ? { shopifyFlashListMajorVersion: project.shopifyFlashListMajorVersion } : {},
|
|
72342
72490
|
...serverAuthFunctionNames && serverAuthFunctionNames.length > 0 ? { serverAuthFunctionNames: [...serverAuthFunctionNames] } : {},
|
|
72491
|
+
...onlyExportComponents !== void 0 ? { onlyExportComponents } : {},
|
|
72343
72492
|
...projectIndexModuleSources !== void 0 ? { projectIndexModuleSources: [...projectIndexModuleSources] } : {}
|
|
72344
72493
|
}
|
|
72345
72494
|
},
|
|
@@ -74254,35 +74403,64 @@ const spawnLintBatches = async (input) => {
|
|
|
74254
74403
|
batchState.deadlineSkippedFileCount += batch.length;
|
|
74255
74404
|
return [];
|
|
74256
74405
|
}
|
|
74257
|
-
const batchArgs = [
|
|
74406
|
+
const batchArgs = [
|
|
74407
|
+
...baseArgs,
|
|
74408
|
+
"--",
|
|
74409
|
+
...batch
|
|
74410
|
+
];
|
|
74258
74411
|
try {
|
|
74259
|
-
const spawnBatch = () => {
|
|
74412
|
+
const spawnBatch = async () => {
|
|
74260
74413
|
const effectiveSpawnTimeoutMs = resolveSpawnTimeoutMs();
|
|
74261
74414
|
if (effectiveSpawnTimeoutMs === 0) {
|
|
74262
74415
|
deadlineSkippedFiles.push(...batch);
|
|
74263
74416
|
batchState.deadlineSkippedFileCount += batch.length;
|
|
74264
|
-
return
|
|
74417
|
+
return null;
|
|
74418
|
+
}
|
|
74419
|
+
const onStart = () => {
|
|
74420
|
+
if (batchState.didStart) return;
|
|
74421
|
+
batchState.didStart = true;
|
|
74422
|
+
startedFileCount += batchState.initialFileCount;
|
|
74423
|
+
reportBatchStarted(passBatches.length);
|
|
74424
|
+
};
|
|
74425
|
+
let argumentsList = batchArgs;
|
|
74426
|
+
if (input.workingDirectory !== void 0) {
|
|
74427
|
+
const selectedFiles = (await spawnOxlint([
|
|
74428
|
+
...baseArgs,
|
|
74429
|
+
"--debug",
|
|
74430
|
+
"files",
|
|
74431
|
+
...batch
|
|
74432
|
+
], rootDirectory, nodeBinaryPath, effectiveSpawnTimeoutMs, outputMaxBytes, signal, onStart)).split(/\r?\n/).filter(Boolean).map((filePath) => path$1$1.resolve(rootDirectory, filePath));
|
|
74433
|
+
if (selectedFiles.length === 0) return JSON.stringify({ diagnostics: [] });
|
|
74434
|
+
argumentsList = [
|
|
74435
|
+
...baseArgs,
|
|
74436
|
+
"--no-ignore",
|
|
74437
|
+
...selectedFiles
|
|
74438
|
+
];
|
|
74265
74439
|
}
|
|
74266
74440
|
return runOxlintJob({
|
|
74267
|
-
argumentsList
|
|
74268
|
-
rootDirectory,
|
|
74441
|
+
argumentsList,
|
|
74442
|
+
rootDirectory: input.workingDirectory ?? rootDirectory,
|
|
74269
74443
|
nodeBinaryPath,
|
|
74270
74444
|
spawnTimeoutMs: effectiveSpawnTimeoutMs ?? 6e4,
|
|
74271
74445
|
outputMaxBytes: outputMaxBytes ?? 52428800,
|
|
74272
74446
|
maxWorkers: requestedConcurrency,
|
|
74273
74447
|
filesystemCacheEpoch: input.spawnSlots?.filesystemCacheEpoch ?? null,
|
|
74274
74448
|
abortSignal: signal,
|
|
74275
|
-
onStart
|
|
74276
|
-
if (batchState.didStart) return;
|
|
74277
|
-
batchState.didStart = true;
|
|
74278
|
-
startedFileCount += batchState.initialFileCount;
|
|
74279
|
-
reportBatchStarted(passBatches.length);
|
|
74280
|
-
}
|
|
74449
|
+
onStart
|
|
74281
74450
|
});
|
|
74282
74451
|
};
|
|
74283
74452
|
const stdout = input.spawnSlots === void 0 ? await spawnBatch() : await input.spawnSlots.run(spawnBatch, signal);
|
|
74284
74453
|
if (stdout === null) return [];
|
|
74285
|
-
|
|
74454
|
+
const diagnostics = parseOxlintOutput(stdout, project, rootDirectory, sourcePathByLintPath, sourceMapByLintPath, input.diagnosticContextDirectory);
|
|
74455
|
+
if (input.workingDirectory === void 0) return diagnostics;
|
|
74456
|
+
return diagnostics.map((diagnostic) => ({
|
|
74457
|
+
...diagnostic,
|
|
74458
|
+
filePath: toNormalizedRelativePath(diagnostic.filePath, rootDirectory),
|
|
74459
|
+
...diagnostic.relatedLocations ? { relatedLocations: diagnostic.relatedLocations.map((location) => ({
|
|
74460
|
+
...location,
|
|
74461
|
+
filePath: toNormalizedRelativePath(location.filePath, rootDirectory)
|
|
74462
|
+
})) } : {}
|
|
74463
|
+
}));
|
|
74286
74464
|
} catch (error) {
|
|
74287
74465
|
if (!isSplittableReactDoctorError(error)) throw error;
|
|
74288
74466
|
if (isPastDeadline()) {
|
|
@@ -75004,13 +75182,19 @@ const runOxlint = async (options) => {
|
|
|
75004
75182
|
}
|
|
75005
75183
|
const pluginPath = resolvePluginPath();
|
|
75006
75184
|
const detectedConfigPaths = adoptExistingLintConfig && !customRulesOnly ? detectUserLintConfigPaths(rootDirectory) : [];
|
|
75007
|
-
const
|
|
75185
|
+
const adoptableConfigPaths = detectedConfigPaths.filter(canOxlintExtendConfig);
|
|
75008
75186
|
const adoptedSettings = detectedConfigPaths.length > 0 ? readAdoptedLintConfigSettings(detectedConfigPaths) : {};
|
|
75009
75187
|
const userPlugins = includedTags.size > 0 ? [] : resolveUserPlugins(userConfig?.plugins, configSourceDirectory);
|
|
75010
75188
|
const restoreDisableDirectives = await neutralizeDisableDirectives(rootDirectory, includePaths ?? options.precomputedSourceFiles?.map((sourceFile) => sourceFile.path), { recoverOnly: respectInlineDisables });
|
|
75011
75189
|
const configDirectory = fs$1$2.mkdtempSync(path$1$1.join(os.tmpdir(), "react-doctor-oxlintrc-"));
|
|
75012
75190
|
const configPath = path$1$1.join(configDirectory, "oxlintrc.json");
|
|
75191
|
+
const workingDirectory = fs$1$2.existsSync(path$1$1.join(rootDirectory, "oxlint-suppressions.json")) ? configDirectory : void 0;
|
|
75013
75192
|
try {
|
|
75193
|
+
const extendsPaths = snapshotAdoptedLintConfigs({
|
|
75194
|
+
configPaths: adoptableConfigPaths,
|
|
75195
|
+
rootDirectory,
|
|
75196
|
+
snapshotDirectory: configDirectory
|
|
75197
|
+
});
|
|
75014
75198
|
const diagnosticContextDirectory = path$1$1.join(configDirectory, "contexts");
|
|
75015
75199
|
fs$1$2.mkdirSync(diagnosticContextDirectory);
|
|
75016
75200
|
const oxlintBinary = resolveOxlintBinary();
|
|
@@ -75019,7 +75203,7 @@ const runOxlint = async (options) => {
|
|
|
75019
75203
|
if (project.hasTypeScript) {
|
|
75020
75204
|
const tsconfigRelativePath = resolveTsConfigRelativePath(rootDirectory);
|
|
75021
75205
|
if (tsconfigRelativePath) {
|
|
75022
|
-
sharedArgs.push("--tsconfig", tsconfigRelativePath);
|
|
75206
|
+
sharedArgs.push("--tsconfig", path$1$1.resolve(rootDirectory, tsconfigRelativePath));
|
|
75023
75207
|
try {
|
|
75024
75208
|
tsconfigContent = fs$1$2.readFileSync(path$1$1.resolve(rootDirectory, tsconfigRelativePath), "utf8");
|
|
75025
75209
|
} catch {
|
|
@@ -75071,6 +75255,7 @@ const runOxlint = async (options) => {
|
|
|
75071
75255
|
runtimeGlobals,
|
|
75072
75256
|
unpluginAutoImportGlobalScopes,
|
|
75073
75257
|
serverAuthFunctionNames,
|
|
75258
|
+
onlyExportComponents: userConfig?.onlyExportComponents,
|
|
75074
75259
|
projectIndexModuleSources,
|
|
75075
75260
|
severityControls,
|
|
75076
75261
|
adoptedSettings,
|
|
@@ -75108,6 +75293,7 @@ const runOxlint = async (options) => {
|
|
|
75108
75293
|
return spawnLintBatches({
|
|
75109
75294
|
baseArgs: passBaseArgs,
|
|
75110
75295
|
fileBatches: passFileBatches,
|
|
75296
|
+
workingDirectory,
|
|
75111
75297
|
rootDirectory,
|
|
75112
75298
|
nodeBinaryPath,
|
|
75113
75299
|
project: lintProject,
|
|
@@ -75336,6 +75522,7 @@ const runOxlint = async (options) => {
|
|
|
75336
75522
|
const runBatches = () => spawnLintBatches({
|
|
75337
75523
|
baseArgs,
|
|
75338
75524
|
fileBatches,
|
|
75525
|
+
workingDirectory,
|
|
75339
75526
|
rootDirectory,
|
|
75340
75527
|
nodeBinaryPath,
|
|
75341
75528
|
project: lintProject,
|
|
@@ -76327,7 +76514,8 @@ const runInspect = (input, hooks = {}) => gen(function* () {
|
|
|
76327
76514
|
return filteredDiagnostic === null ? none() : some(filteredDiagnostic);
|
|
76328
76515
|
})));
|
|
76329
76516
|
const applyPerElementPipeline = (rawStream) => filterPerElementPipeline(rawStream).pipe(tap((diagnostic) => reporterService.emit(diagnostic)));
|
|
76330
|
-
const
|
|
76517
|
+
const severityControls = buildRuleSeverityControls(resolvedConfig.config);
|
|
76518
|
+
const pnpmHardeningSeverity = resolveRuleSeverityOverride({ ruleKey: "react-doctor/require-pnpm-hardening" }, severityControls);
|
|
76331
76519
|
const envCollected = yield* runCollect(applyPerElementPipeline(fromIterable$1(isDiffMode ? [] : [
|
|
76332
76520
|
...checkReducedMotion(scanDirectory),
|
|
76333
76521
|
...pnpmHardeningSeverity === "warn" || pnpmHardeningSeverity === "error" ? checkPnpmHardening(scanDirectory) : [],
|
|
@@ -76339,6 +76527,7 @@ const runInspect = (input, hooks = {}) => gen(function* () {
|
|
|
76339
76527
|
let didSecurityScanReachDeadline = false;
|
|
76340
76528
|
const securityScanFiber = yield* forkChild(runCollect(applyPerElementPipeline(isDiffMode ? empty$4 : unwrap(tryPromise((signal) => checkSecurityScanCooperative(scanDirectory, {
|
|
76341
76529
|
project,
|
|
76530
|
+
severityControls,
|
|
76342
76531
|
ignoredTags: input.ignoredTags,
|
|
76343
76532
|
includedTags: input.includedTags,
|
|
76344
76533
|
includeTagDefaults: input.includeTagDefaults,
|
|
@@ -76386,7 +76575,7 @@ const runInspect = (input, hooks = {}) => gen(function* () {
|
|
|
76386
76575
|
const maintainabilityPhaseTimeoutMs = yield* DeadCodePhaseTimeoutMs;
|
|
76387
76576
|
const workerCountSuffix = scanConcurrency > 1 ? ` ${highlighter.dim(`[~${scanConcurrency} workers]`)}` : "";
|
|
76388
76577
|
const projectCapabilities = getCapabilities(project);
|
|
76389
|
-
const projectRuleSelections = resolveProjectRuleSelections(
|
|
76578
|
+
const projectRuleSelections = resolveProjectRuleSelections(severityControls).filter((selection) => {
|
|
76390
76579
|
const rule = REACT_DOCTOR_RULE_REGISTRY[selection.ruleId];
|
|
76391
76580
|
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]));
|
|
76392
76581
|
});
|
|
@@ -77611,7 +77800,7 @@ const makeNoopConsole = () => ({
|
|
|
77611
77800
|
});
|
|
77612
77801
|
//#endregion
|
|
77613
77802
|
//#region src/cli/utils/version.ts
|
|
77614
|
-
const VERSION = "0.9.
|
|
77803
|
+
const VERSION = "0.9.23-dev.05dfafe";
|
|
77615
77804
|
//#endregion
|
|
77616
77805
|
//#region src/cli/utils/json-mode.ts
|
|
77617
77806
|
let context = null;
|
|
@@ -77953,7 +78142,7 @@ const recordDistribution = (name, value, options = {}) => {
|
|
|
77953
78142
|
} catch {}
|
|
77954
78143
|
};
|
|
77955
78144
|
//#endregion
|
|
77956
|
-
export { buildRuleSeverityControls as $,
|
|
78145
|
+
export { buildRuleSeverityControls as $, runInspect as $t, Files as A, buildWithScope as An, hasPublishedFixRecipe as At, PerFileLintCacheEnabled as B, yieldToEventLoop as Bn, listSourceFiles as Bt, ACTION_INPUT_ENVIRONMENT_VARIABLES as C, provideContext as Cn, getChangedLineRanges as Ct, isCodingAgentEnvironment as D, sync as Dn, getRuleMetadata as Dt, isCiOrCodingAgentEnvironment as E, runSync as En, getEquivalentRuleKeys as Et, Linter as F, makeUnsafe$5 as Fn, isProjectDiscoveryError as Ft, SidecarLintCacheEnabled as G, isFile as Gn, materializeSourceTree as Gt, Project as H, toCanonicalPath as Hn, listWorkspacePackages as Ht, Maintainability as I, fail$5 as In, isReactDoctorError as It, anonymizeInPlace as J, remainingDeadlineBudgetMs as Jt, StagedFiles as K, isPlainObject as Kn, mergeAndFilterDiagnostics as Kt, NodeResolver as L, void_$1 as Ln, isSameRuleKey as Lt, InvocationCaches as M, provide$2 as Mn, hashFileContents as Mt, LEGACY_CONFIG_FILENAME as N, succeed$3 as Nn, highlighter as Nt, Config as O, try_ as On, getUnknownBundledRuleKeys as Ot, LintPartialFailures as P, close as Pn, isPathInsideDirectory as Pt, buildRuleDocsUrl as Q, restoreLegacyThrow as Qt, OxlintConcurrency as R, ParentSpan as Rn, isScanComplete as Rt, isDebugFlagEnabled as S, provide as Sn, getBaselineDiffPlan as St, isCiEnvironment as T, runPromise as Tn, getDiffInfo as Tt, Reporter as U, isDirectory as Un, loadConfigWithSource as Ut, Progress as V, messageFromUnknown as Vn, listSourceFilesCooperative as Vt, Score as W, isErrnoException as Wn, mapWithConcurrency as Wt, atomicWriteJson as X, resolveLintBatchOrdering as Xt, anonymizeText as Y, resolveGithubActionsScoreMetadata as Yt, buildJsonReport as Z, resolveScanTarget as Zt, VERSION as _, gen as _n, findGitRepositoryRoot as _t, isEnvFlagEnabled as a, validateConfigTypes as an, collectSourceFilesByDirectory as at, isNonInteractiveEnvironment as b, orElseSucceed as bn, formatErrorChain as bt, setSentryProjectInfo as c, Console as cn, countOptInProjectRuleSelections as ct, isJsonModeActive as d, log as dn, createOxlintSpawnSlots as dt, scrubSensitivePaths as en, buildSkippedChecks as et, setJsonReportDirectory as f, warn$1 as fn, detectAiTrainingEnvironment as ft, writeJsonReport as g, make$30 as gn, filterSourceFiles as gt, writeJsonErrorReport as h, decodeUnknownSync as hn, filterPathsOutsideDirectories as ht, isTelemetryEnabled as i, toRelativePath as in, clearConfigCache as it, Git as j, mergeAll$1 as jn, hasSupportedFrameworkOrLibrary as jt, DIAGNOSTIC_DELTA_IDENTITY as k, void_ as kn, groupBy as kt, getRunId as l, error as ln, createChangedLineMatcher as lt, writeJsonCancellationReport as m, JsonReport as mn, filterDiagnosticsForSurface as mt, recordDistribution as n, shouldUseMaintainabilityLayer as nn, canonicalizeUserRuleKey as nt, buildSentryScope as o, warmDuplicateJsxWorker as on, computeConfigFingerprint as ot, setJsonReportMode as p, Diagnostic as pn, discoverSupportedSubprojects as pt, SupplyChain as q, mergeReactDoctorConfigs as qt, toSpanAttributes as r, summarizeDiagnostics as rn, classifyFileContext as rt, buildSentryProjectContext as s, warmOxlintWorkerPool as sn, computeDiagnosticDelta as st, recordCount as t, setColorEnabled as tn, calculateScore as tt, enableJsonMode as u, info as un, createInvocationCaches as ut, makeNoopConsole as v, makeSpan$1 as vn, findLegacyConfig as vt, detectRunnerOs as w, provideService as wn, getDiagnosticRuleIdentity as wt, isGitHookEnvironment as x, promise as xn, formatReactDoctorError as xt, CliInputError as y, map$3 as yn, fingerprintDiagnosticEvidence as yt, OxlintSpawnSlots as z, isMonorepoRoot as zn, layerObservability as zt };
|
|
77957
78146
|
|
|
77958
|
-
//# sourceMappingURL=record-metric-
|
|
77959
|
-
//# debugId=
|
|
78147
|
+
//# sourceMappingURL=record-metric-9Q_AofQZ.js.map
|
|
78148
|
+
//# debugId=ef9cab92-43ea-5ce7-b57b-f8aa7d573729
|
|
@@ -1,8 +1,8 @@
|
|
|
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]="
|
|
3
|
-
import { S as SENTRY_FLUSH_TIMEOUT_MS, u as METRIC } from "./constants-
|
|
4
|
-
import {
|
|
5
|
-
import { i as getSentry, n as shutdownTelemetry, o as isExpectedUserError } from "./telemetry-runtime-
|
|
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]="89e6f5ee-def1-5266-aafb-f526ceef387a")}catch(e){}}();
|
|
3
|
+
import { S as SENTRY_FLUSH_TIMEOUT_MS, u as METRIC } from "./constants-BmD_c3Yq.js";
|
|
4
|
+
import { It as isReactDoctorError, l as getRunId, o as buildSentryScope, t as recordCount } from "./record-metric-9Q_AofQZ.js";
|
|
5
|
+
import { i as getSentry, n as shutdownTelemetry, o as isExpectedUserError } from "./telemetry-runtime-CdsvqQbi.js";
|
|
6
6
|
import { r as recordRunTraceId, t as getActiveRunTrace } from "./active-run-trace-Dewycxda.js";
|
|
7
7
|
//#region src/cli/utils/report-error.ts
|
|
8
8
|
/**
|
|
@@ -61,5 +61,5 @@ const reportErrorToSentry = async (error) => {
|
|
|
61
61
|
//#endregion
|
|
62
62
|
export { reportErrorToSentry as t };
|
|
63
63
|
|
|
64
|
-
//# sourceMappingURL=report-error-
|
|
65
|
-
//# debugId=
|
|
64
|
+
//# sourceMappingURL=report-error-D8MXuEuX.js.map
|
|
65
|
+
//# debugId=89e6f5ee-def1-5266-aafb-f526ceef387a
|