react-doctor 0.8.1-dev.fc1b3a3 → 0.8.1
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/README.md +4 -14
- package/dist/cli.js +209 -1129
- package/dist/index.d.ts +15 -38
- package/dist/index.js +99 -546
- package/dist/lsp.js +99 -546
- package/dist/skills/react-doctor/SKILL.md +0 -5
- 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]="3121a4e4-8a4a-55ea-ade8-47d0bf576a2f")}catch(e){}}();
|
|
3
3
|
import { r as __toESM$1, t as __commonJSMin$1 } from "./chunk-N93fKeF6.js";
|
|
4
4
|
import { createRequire } from "node:module";
|
|
5
5
|
import reactDoctorPlugin, { ALL_REACT_DOCTOR_RULE_KEYS, CROSS_FILE_DEPENDENCY_COLLECTORS, CROSS_FILE_RULE_IDS, FRAMEWORK_SPECIFIC_RULE_KEYS, FRAMEWORK_TOKENS, MOTION_LIBRARY_PACKAGES, REACT_COMPILER_RULES, REACT_DOCTOR_RULES, classifySecurityScanFile, collectCrossFileDependencyProbes, resetManifestCaches, shouldReadSecurityScanContent } from "oxlint-plugin-react-doctor";
|
|
@@ -32854,6 +32854,44 @@ var AmbiguousProjectError = class extends Error {
|
|
|
32854
32854
|
}
|
|
32855
32855
|
};
|
|
32856
32856
|
const isProjectDiscoveryError = (value) => value instanceof ProjectNotFoundError || value instanceof NoReactDependencyError || value instanceof PackageJsonNotFoundError || value instanceof NotADirectoryError || value instanceof AmbiguousProjectError;
|
|
32857
|
+
const isErrnoException = (error) => error instanceof Error && "code" in error;
|
|
32858
|
+
const IGNORABLE_READDIR_ERROR_CODES = new Set([
|
|
32859
|
+
"EACCES",
|
|
32860
|
+
"EPERM",
|
|
32861
|
+
"ENOENT",
|
|
32862
|
+
"ENOTDIR",
|
|
32863
|
+
"EINVAL",
|
|
32864
|
+
"ELOOP",
|
|
32865
|
+
"ENAMETOOLONG"
|
|
32866
|
+
]);
|
|
32867
|
+
const isIgnorableReaddirError = (error) => isErrnoException(error) && typeof error.code === "string" && IGNORABLE_READDIR_ERROR_CODES.has(error.code);
|
|
32868
|
+
const readDirectoryEntries = (directoryPath) => {
|
|
32869
|
+
try {
|
|
32870
|
+
return NFS.readdirSync(directoryPath, { withFileTypes: true });
|
|
32871
|
+
} catch (error) {
|
|
32872
|
+
if (isIgnorableReaddirError(error)) return [];
|
|
32873
|
+
throw error;
|
|
32874
|
+
}
|
|
32875
|
+
};
|
|
32876
|
+
const isFile = (filePath) => {
|
|
32877
|
+
try {
|
|
32878
|
+
return NFS.statSync(filePath).isFile();
|
|
32879
|
+
} catch {
|
|
32880
|
+
return false;
|
|
32881
|
+
}
|
|
32882
|
+
};
|
|
32883
|
+
const isDirectory = (directoryPath) => {
|
|
32884
|
+
try {
|
|
32885
|
+
return NFS.statSync(directoryPath).isDirectory();
|
|
32886
|
+
} catch {
|
|
32887
|
+
return false;
|
|
32888
|
+
}
|
|
32889
|
+
};
|
|
32890
|
+
const isPlainObject = (value) => {
|
|
32891
|
+
if (typeof value !== "object" || value === null || Array.isArray(value)) return false;
|
|
32892
|
+
const prototype = Object.getPrototypeOf(value);
|
|
32893
|
+
return prototype === null || prototype === Object.prototype;
|
|
32894
|
+
};
|
|
32857
32895
|
const SOURCE_FILE_PATTERN = /\.(tsx?|jsx?|mts|mjs)$/;
|
|
32858
32896
|
const GENERATED_BUNDLE_FILE_PATTERN = /\.(iife|umd|global|min)\.m?js$/i;
|
|
32859
32897
|
const GENERATED_SOURCE_DIRECTORY_PATTERN = /(?:^|\/)__generated__\//;
|
|
@@ -33012,44 +33050,6 @@ const SUPPLY_CHAIN_OVERLAP_TIMEOUT_MS = 9e4;
|
|
|
33012
33050
|
const SUPPLY_CHAIN_CACHE_TTL_MS = 864e5;
|
|
33013
33051
|
const SUPPLY_CHAIN_CACHE_SUBDIR = "supply-chain";
|
|
33014
33052
|
const SUPPLY_CHAIN_IGNORED_PACKAGES = new Set(["next"]);
|
|
33015
|
-
const isErrnoException = (error) => error instanceof Error && "code" in error;
|
|
33016
|
-
const IGNORABLE_READDIR_ERROR_CODES = new Set([
|
|
33017
|
-
"EACCES",
|
|
33018
|
-
"EPERM",
|
|
33019
|
-
"ENOENT",
|
|
33020
|
-
"ENOTDIR",
|
|
33021
|
-
"EINVAL",
|
|
33022
|
-
"ELOOP",
|
|
33023
|
-
"ENAMETOOLONG"
|
|
33024
|
-
]);
|
|
33025
|
-
const isIgnorableReaddirError = (error) => isErrnoException(error) && typeof error.code === "string" && IGNORABLE_READDIR_ERROR_CODES.has(error.code);
|
|
33026
|
-
const readDirectoryEntries = (directoryPath) => {
|
|
33027
|
-
try {
|
|
33028
|
-
return NFS.readdirSync(directoryPath, { withFileTypes: true });
|
|
33029
|
-
} catch (error) {
|
|
33030
|
-
if (isIgnorableReaddirError(error)) return [];
|
|
33031
|
-
throw error;
|
|
33032
|
-
}
|
|
33033
|
-
};
|
|
33034
|
-
const isFile = (filePath) => {
|
|
33035
|
-
try {
|
|
33036
|
-
return NFS.statSync(filePath).isFile();
|
|
33037
|
-
} catch {
|
|
33038
|
-
return false;
|
|
33039
|
-
}
|
|
33040
|
-
};
|
|
33041
|
-
const isDirectory = (directoryPath) => {
|
|
33042
|
-
try {
|
|
33043
|
-
return NFS.statSync(directoryPath).isDirectory();
|
|
33044
|
-
} catch {
|
|
33045
|
-
return false;
|
|
33046
|
-
}
|
|
33047
|
-
};
|
|
33048
|
-
const isPlainObject = (value) => {
|
|
33049
|
-
if (typeof value !== "object" || value === null || Array.isArray(value)) return false;
|
|
33050
|
-
const prototype = Object.getPrototypeOf(value);
|
|
33051
|
-
return prototype === null || prototype === Object.prototype;
|
|
33052
|
-
};
|
|
33053
33053
|
const lastSourceMappingUrl = (fileContent) => {
|
|
33054
33054
|
const lastReference = [...fileContent.matchAll(/\/\/# sourceMappingURL=(\S+)/g)].at(-1);
|
|
33055
33055
|
return lastReference ? lastReference[1] : null;
|
|
@@ -33375,10 +33375,10 @@ const FALLBACK_TSCONFIG_FILENAMES = ["tsconfig.app.json", "tsconfig.build.json"]
|
|
|
33375
33375
|
const FRAMEWORK_PACKAGES = {
|
|
33376
33376
|
next: "nextjs",
|
|
33377
33377
|
"@tanstack/react-start": "tanstack-start",
|
|
33378
|
-
"@remix-run/react": "remix",
|
|
33379
|
-
gatsby: "gatsby",
|
|
33380
33378
|
vite: "vite",
|
|
33381
33379
|
"react-scripts": "cra",
|
|
33380
|
+
"@remix-run/react": "remix",
|
|
33381
|
+
gatsby: "gatsby",
|
|
33382
33382
|
expo: "expo",
|
|
33383
33383
|
"react-native": "react-native"
|
|
33384
33384
|
};
|
|
@@ -33402,17 +33402,11 @@ const NEXT_CONFIG_FILENAMES = [
|
|
|
33402
33402
|
];
|
|
33403
33403
|
const BABEL_CONFIG_FILENAMES = [
|
|
33404
33404
|
".babelrc",
|
|
33405
|
-
".babelrc.js",
|
|
33406
33405
|
".babelrc.json",
|
|
33407
|
-
".babelrc.cjs",
|
|
33408
|
-
".babelrc.mjs",
|
|
33409
|
-
".babelrc.cts",
|
|
33410
33406
|
"babel.config.js",
|
|
33411
33407
|
"babel.config.json",
|
|
33412
33408
|
"babel.config.cjs",
|
|
33413
|
-
"babel.config.mjs"
|
|
33414
|
-
"babel.config.ts",
|
|
33415
|
-
"babel.config.cts"
|
|
33409
|
+
"babel.config.mjs"
|
|
33416
33410
|
];
|
|
33417
33411
|
const VITE_CONFIG_FILENAMES = [
|
|
33418
33412
|
"vite.config.js",
|
|
@@ -33424,28 +33418,12 @@ const VITE_CONFIG_FILENAMES = [
|
|
|
33424
33418
|
"vitest.config.ts",
|
|
33425
33419
|
"vitest.config.js"
|
|
33426
33420
|
];
|
|
33427
|
-
const RSBUILD_CONFIG_FILENAMES = [
|
|
33428
|
-
"rsbuild.config.ts",
|
|
33429
|
-
"rsbuild.config.js",
|
|
33430
|
-
"rsbuild.config.mts",
|
|
33431
|
-
"rsbuild.config.mjs",
|
|
33432
|
-
"rsbuild.config.cts",
|
|
33433
|
-
"rsbuild.config.cjs"
|
|
33434
|
-
];
|
|
33435
|
-
const RSPACK_CONFIG_FILENAMES = [
|
|
33436
|
-
"rspack.config.ts",
|
|
33437
|
-
"rspack.config.js",
|
|
33438
|
-
"rspack.config.mts",
|
|
33439
|
-
"rspack.config.mjs",
|
|
33440
|
-
"rspack.config.cts",
|
|
33441
|
-
"rspack.config.cjs"
|
|
33442
|
-
];
|
|
33443
33421
|
const EXPO_APP_CONFIG_FILENAMES = [
|
|
33444
33422
|
"app.json",
|
|
33445
33423
|
"app.config.js",
|
|
33446
33424
|
"app.config.ts"
|
|
33447
33425
|
];
|
|
33448
|
-
const REACT_COMPILER_PACKAGE_REFERENCE_PATTERN = /babel-plugin-react-compiler|react-compiler-runtime|
|
|
33426
|
+
const REACT_COMPILER_PACKAGE_REFERENCE_PATTERN = /babel-plugin-react-compiler|react-compiler-runtime|["']react-compiler["']/;
|
|
33449
33427
|
const REACT_COMPILER_ENABLED_FLAG_PATTERN = /["']?reactCompiler["']?\s*:\s*(?:true\b|\{)/;
|
|
33450
33428
|
const STATIC_EXPORT_OUTPUT_PATTERN = /(?:^|[^.\w])["']?output["']?\s*:\s*["']export["']/m;
|
|
33451
33429
|
const hasCompilerPackage = (packageJson, compilerPackages) => {
|
|
@@ -33480,8 +33458,6 @@ const detectReactCompiler = (directory, packageJson) => {
|
|
|
33480
33458
|
if (hasCompilerInConfigFiles(directory, NEXT_CONFIG_FILENAMES)) return true;
|
|
33481
33459
|
if (hasCompilerInConfigFiles(directory, BABEL_CONFIG_FILENAMES)) return true;
|
|
33482
33460
|
if (hasCompilerInConfigFiles(directory, VITE_CONFIG_FILENAMES)) return true;
|
|
33483
|
-
if (hasCompilerInConfigFiles(directory, RSBUILD_CONFIG_FILENAMES)) return true;
|
|
33484
|
-
if (hasCompilerInConfigFiles(directory, RSPACK_CONFIG_FILENAMES)) return true;
|
|
33485
33461
|
if (hasCompilerInConfigFiles(directory, EXPO_APP_CONFIG_FILENAMES)) return true;
|
|
33486
33462
|
return hasCompilerPackageInAncestors(directory, REACT_COMPILER_TRANSFORM_PACKAGES);
|
|
33487
33463
|
};
|
|
@@ -33623,16 +33599,6 @@ const getLowestDependencyMajor = (version) => {
|
|
|
33623
33599
|
}
|
|
33624
33600
|
return lowestMajor;
|
|
33625
33601
|
};
|
|
33626
|
-
const getDependencyMajorWithinSupportedRange = (version, latestSupportedMajor) => {
|
|
33627
|
-
const normalizedVersion = normalizeDependencyVersion(version);
|
|
33628
|
-
if (normalizedVersion === null) return null;
|
|
33629
|
-
const validRange = import_semver.validRange(normalizedVersion);
|
|
33630
|
-
if (validRange === null) return null;
|
|
33631
|
-
const minimumVersion = import_semver.minVersion(validRange);
|
|
33632
|
-
if (minimumVersion === null || minimumVersion.major > latestSupportedMajor) return null;
|
|
33633
|
-
if (import_semver.intersects(validRange, `>=${latestSupportedMajor + 1}.0.0`)) return null;
|
|
33634
|
-
return minimumVersion.major;
|
|
33635
|
-
};
|
|
33636
33602
|
const isConcreteDependencyVersion = (version) => {
|
|
33637
33603
|
const normalizedVersion = normalizeDependencyVersion(version);
|
|
33638
33604
|
return normalizedVersion !== null && /\d/.test(normalizedVersion);
|
|
@@ -33676,9 +33642,9 @@ const parseReactMajorMinor = (reactVersion) => {
|
|
|
33676
33642
|
};
|
|
33677
33643
|
};
|
|
33678
33644
|
const parseLowerBoundVersion = (versionSpec) => import_semver.validRange(versionSpec) !== null ? import_semver.minVersion(versionSpec) : import_semver.coerce(versionSpec);
|
|
33679
|
-
const
|
|
33680
|
-
if (typeof
|
|
33681
|
-
const trimmed =
|
|
33645
|
+
const parseTailwindMajorMinor = (tailwindVersion) => {
|
|
33646
|
+
if (typeof tailwindVersion !== "string") return null;
|
|
33647
|
+
const trimmed = tailwindVersion.trim();
|
|
33682
33648
|
if (trimmed.length === 0) return null;
|
|
33683
33649
|
const lowerBound = parseLowerBoundVersion(trimmed);
|
|
33684
33650
|
if (lowerBound === null || lowerBound.major <= 0) return null;
|
|
@@ -33687,7 +33653,6 @@ const parseDependencyMajorMinor = (dependencyVersion) => {
|
|
|
33687
33653
|
minor: lowerBound.minor
|
|
33688
33654
|
};
|
|
33689
33655
|
};
|
|
33690
|
-
const parseTailwindMajorMinor = (tailwindVersion) => parseDependencyMajorMinor(tailwindVersion);
|
|
33691
33656
|
const hasUpperBoundOnlyPeerRange = (range) => {
|
|
33692
33657
|
if (typeof range !== "string") return false;
|
|
33693
33658
|
const normalizedRange = normalizeDependencyVersion(range);
|
|
@@ -33940,6 +33905,19 @@ const getPreactVersion = (packageJson) => {
|
|
|
33940
33905
|
...packageJson.devDependencies
|
|
33941
33906
|
}.preact ?? null;
|
|
33942
33907
|
};
|
|
33908
|
+
const TANSTACK_QUERY_PACKAGES = new Set([
|
|
33909
|
+
"@tanstack/react-query",
|
|
33910
|
+
"@tanstack/query-core",
|
|
33911
|
+
"react-query"
|
|
33912
|
+
]);
|
|
33913
|
+
const hasTanStackQuery = (packageJson) => {
|
|
33914
|
+
const allDependencies = {
|
|
33915
|
+
...packageJson.peerDependencies,
|
|
33916
|
+
...packageJson.dependencies,
|
|
33917
|
+
...packageJson.devDependencies
|
|
33918
|
+
};
|
|
33919
|
+
return Object.keys(allDependencies).some((packageName) => TANSTACK_QUERY_PACKAGES.has(packageName));
|
|
33920
|
+
};
|
|
33943
33921
|
const resolveCatalogBackedDependencyVersion = ({ rootDirectory, rootPackageJson, packageName, version }) => {
|
|
33944
33922
|
if (version === null || !isCatalogReference(version)) return version;
|
|
33945
33923
|
const catalogName = extractCatalogName(version);
|
|
@@ -34142,60 +34120,7 @@ const listWorkspacePackages = (rootDirectory) => {
|
|
|
34142
34120
|
}
|
|
34143
34121
|
return packages;
|
|
34144
34122
|
};
|
|
34145
|
-
const getPreferredDependencyVersion = ({ packageJson, packageNames }) => {
|
|
34146
|
-
const allDependencies = {
|
|
34147
|
-
...packageJson.devDependencies,
|
|
34148
|
-
...packageJson.peerDependencies,
|
|
34149
|
-
...packageJson.dependencies
|
|
34150
|
-
};
|
|
34151
|
-
for (const packageName of packageNames) {
|
|
34152
|
-
const version = allDependencies[packageName];
|
|
34153
|
-
if (version !== void 0) return version;
|
|
34154
|
-
}
|
|
34155
|
-
return null;
|
|
34156
|
-
};
|
|
34157
|
-
const TANSTACK_REACT_QUERY_PACKAGES = ["@tanstack/react-query", "react-query"];
|
|
34158
|
-
const getTanStackQueryVersion = (packageJson) => {
|
|
34159
|
-
return getPreferredDependencyVersion({
|
|
34160
|
-
packageJson,
|
|
34161
|
-
packageNames: TANSTACK_REACT_QUERY_PACKAGES
|
|
34162
|
-
});
|
|
34163
|
-
};
|
|
34164
|
-
const STYLED_COMPONENTS_PACKAGES = ["styled-components"];
|
|
34165
|
-
const getStyledComponentsVersion = (packageJson) => {
|
|
34166
|
-
return getPreferredDependencyVersion({
|
|
34167
|
-
packageJson,
|
|
34168
|
-
packageNames: STYLED_COMPONENTS_PACKAGES
|
|
34169
|
-
});
|
|
34170
|
-
};
|
|
34171
|
-
const I18N_PACKAGES = [
|
|
34172
|
-
"i18next",
|
|
34173
|
-
"react-i18next",
|
|
34174
|
-
"next-i18next",
|
|
34175
|
-
"react-intl",
|
|
34176
|
-
"next-intl",
|
|
34177
|
-
"use-intl",
|
|
34178
|
-
"@formatjs/intl",
|
|
34179
|
-
"@lingui/core",
|
|
34180
|
-
"@lingui/react",
|
|
34181
|
-
"typesafe-i18n",
|
|
34182
|
-
"@tolgee/react",
|
|
34183
|
-
"react-intl-universal"
|
|
34184
|
-
];
|
|
34185
|
-
const hasI18nDependency = (packageJson) => {
|
|
34186
|
-
const allDependencies = {
|
|
34187
|
-
...packageJson.peerDependencies,
|
|
34188
|
-
...packageJson.dependencies,
|
|
34189
|
-
...packageJson.devDependencies,
|
|
34190
|
-
...packageJson.optionalDependencies
|
|
34191
|
-
};
|
|
34192
|
-
return I18N_PACKAGES.some((packageName) => allDependencies[packageName] !== void 0);
|
|
34193
|
-
};
|
|
34194
34123
|
const REANIMATED_DEPENDENCY_NAME = "react-native-reanimated";
|
|
34195
|
-
const MOBX_REACT_PACKAGE_NAME = "mobx-react";
|
|
34196
|
-
const MOBX_REACT_LITE_PACKAGE_NAME = "mobx-react-lite";
|
|
34197
|
-
const MOBX_STATE_TREE_PACKAGE_NAME = "mobx-state-tree";
|
|
34198
|
-
const MOBX_REACT_OBSERVER_PACKAGE_NAME = "mobx-react-observer";
|
|
34199
34124
|
const SHOPIFY_FLASH_LIST_PACKAGE_NAME = "@shopify/flash-list";
|
|
34200
34125
|
const resolveWorkspaceDependencyVersion = ({ concreteVersion, packageName, rootDirectory, rootPackageJson, sections, workspaceDirectory, workspacePackageJson }) => {
|
|
34201
34126
|
const dependencyDeclaration = getDependencyDeclaration({
|
|
@@ -34214,62 +34139,7 @@ const shouldReplaceReactVersion = (currentVersion, nextVersion) => {
|
|
|
34214
34139
|
if (nextMajor === null) return false;
|
|
34215
34140
|
return nextMajor < currentMajor;
|
|
34216
34141
|
};
|
|
34217
|
-
const
|
|
34218
|
-
if (currentFact.version === null) return true;
|
|
34219
|
-
if (nextFact.version === null) return false;
|
|
34220
|
-
const currentMajor = getLowestDependencyMajor(currentFact.version);
|
|
34221
|
-
const nextMajor = getLowestDependencyMajor(nextFact.version);
|
|
34222
|
-
if (currentMajor === null) return false;
|
|
34223
|
-
if (nextMajor === null) return true;
|
|
34224
|
-
if (currentMajor > latestSupportedMajor) return false;
|
|
34225
|
-
if (nextMajor > latestSupportedMajor) return true;
|
|
34226
|
-
return nextMajor < currentMajor;
|
|
34227
|
-
};
|
|
34228
|
-
const shouldReplaceStyledComponentsVersion = (currentVersion, nextVersion) => {
|
|
34229
|
-
if (!currentVersion) return true;
|
|
34230
|
-
const currentMajor = getLowestDependencyMajor(currentVersion);
|
|
34231
|
-
const nextMajor = getLowestDependencyMajor(nextVersion);
|
|
34232
|
-
if (currentMajor === null) return nextMajor !== null && nextMajor < 6;
|
|
34233
|
-
if (nextMajor === null) return currentMajor >= 6;
|
|
34234
|
-
return nextMajor < currentMajor;
|
|
34235
|
-
};
|
|
34236
|
-
const selectOldestDependencyVersion = (currentVersion, nextVersion) => {
|
|
34237
|
-
if (currentVersion === null || nextVersion === null) return null;
|
|
34238
|
-
const current = parseDependencyMajorMinor(currentVersion);
|
|
34239
|
-
const next = parseDependencyMajorMinor(nextVersion);
|
|
34240
|
-
if (current === null) return currentVersion;
|
|
34241
|
-
if (next === null) return nextVersion;
|
|
34242
|
-
if (next.major !== current.major) return next.major < current.major ? nextVersion : currentVersion;
|
|
34243
|
-
return next.minor < current.minor ? nextVersion : currentVersion;
|
|
34244
|
-
};
|
|
34245
|
-
const shouldReplaceMobxFact = (currentFact, nextFact) => {
|
|
34246
|
-
if (currentFact.sourceDirectory === null) return true;
|
|
34247
|
-
if (currentFact.version === null) return false;
|
|
34248
|
-
if (nextFact.version === null) return true;
|
|
34249
|
-
const currentMajor = getDependencyMajorWithinSupportedRange(currentFact.version, 6);
|
|
34250
|
-
const nextMajor = getDependencyMajorWithinSupportedRange(nextFact.version, 6);
|
|
34251
|
-
if (currentMajor === null) return false;
|
|
34252
|
-
if (nextMajor === null) return true;
|
|
34253
|
-
return selectOldestDependencyVersion(currentFact.version, nextFact.version) === nextFact.version;
|
|
34254
|
-
};
|
|
34255
|
-
const collectBindingVersion = (facts, packageJson, directory, packageName) => {
|
|
34256
|
-
const version = getDependencySpec(packageJson, packageName);
|
|
34257
|
-
if (version === null) return;
|
|
34258
|
-
const resolvedVersion = resolveCatalogBackedDependencyVersion({
|
|
34259
|
-
rootDirectory: directory,
|
|
34260
|
-
rootPackageJson: packageJson,
|
|
34261
|
-
packageName,
|
|
34262
|
-
version
|
|
34263
|
-
});
|
|
34264
|
-
if (packageName === MOBX_REACT_PACKAGE_NAME) {
|
|
34265
|
-
facts.mobxReactVersion = facts.hasMobxReact ? selectOldestDependencyVersion(facts.mobxReactVersion, resolvedVersion) : resolvedVersion;
|
|
34266
|
-
facts.hasMobxReact = true;
|
|
34267
|
-
return;
|
|
34268
|
-
}
|
|
34269
|
-
facts.mobxReactLiteVersion = facts.hasMobxReactLite ? selectOldestDependencyVersion(facts.mobxReactLiteVersion, resolvedVersion) : resolvedVersion;
|
|
34270
|
-
facts.hasMobxReactLite = true;
|
|
34271
|
-
};
|
|
34272
|
-
const evaluateManifestFacts = (facts, packageJson, directory, rootDirectory, rootPackageJson) => {
|
|
34142
|
+
const evaluateManifestFacts = (facts, packageJson, directory) => {
|
|
34273
34143
|
if (facts.expo.version === null) {
|
|
34274
34144
|
const spec = getDependencySpec(packageJson, "expo");
|
|
34275
34145
|
if (spec !== null) facts.expo = {
|
|
@@ -34291,74 +34161,13 @@ const evaluateManifestFacts = (facts, packageJson, directory, rootDirectory, roo
|
|
|
34291
34161
|
sourceDirectory: directory
|
|
34292
34162
|
};
|
|
34293
34163
|
}
|
|
34294
|
-
const mobxSpec = getDependencySpec(packageJson, "mobx");
|
|
34295
|
-
if (mobxSpec !== null) {
|
|
34296
|
-
const nextMobxFact = {
|
|
34297
|
-
version: resolveCatalogBackedDependencyVersion({
|
|
34298
|
-
rootDirectory: directory,
|
|
34299
|
-
rootPackageJson: packageJson,
|
|
34300
|
-
packageName: "mobx",
|
|
34301
|
-
version: mobxSpec
|
|
34302
|
-
}),
|
|
34303
|
-
sourceDirectory: directory
|
|
34304
|
-
};
|
|
34305
|
-
if (shouldReplaceMobxFact(facts.mobx, nextMobxFact)) facts.mobx = nextMobxFact;
|
|
34306
|
-
}
|
|
34307
|
-
collectBindingVersion(facts, packageJson, directory, MOBX_REACT_PACKAGE_NAME);
|
|
34308
|
-
collectBindingVersion(facts, packageJson, directory, MOBX_REACT_LITE_PACKAGE_NAME);
|
|
34309
|
-
facts.hasMobxStateTree = facts.hasMobxStateTree || getDependencySpec(packageJson, MOBX_STATE_TREE_PACKAGE_NAME) !== null;
|
|
34310
|
-
facts.hasMobxReactObserver = facts.hasMobxReactObserver || getDependencySpec(packageJson, MOBX_REACT_OBSERVER_PACKAGE_NAME) !== null;
|
|
34311
|
-
const zustandSpec = getDependencySpec(packageJson, "zustand");
|
|
34312
|
-
if (zustandSpec !== null) {
|
|
34313
|
-
const nextZustandFact = {
|
|
34314
|
-
version: resolveCatalogBackedDependencyVersion({
|
|
34315
|
-
rootDirectory: directory,
|
|
34316
|
-
rootPackageJson: packageJson,
|
|
34317
|
-
packageName: "zustand",
|
|
34318
|
-
version: zustandSpec
|
|
34319
|
-
}),
|
|
34320
|
-
sourceDirectory: directory
|
|
34321
|
-
};
|
|
34322
|
-
if (shouldReplaceSupportedDependencyFact(facts.zustand, nextZustandFact, 5)) facts.zustand = nextZustandFact;
|
|
34323
|
-
}
|
|
34324
34164
|
if (facts.reanimatedVersion === null) {
|
|
34325
34165
|
const spec = getDependencySpec(packageJson, REANIMATED_DEPENDENCY_NAME);
|
|
34326
34166
|
if (spec !== null) facts.reanimatedVersion = spec;
|
|
34327
34167
|
}
|
|
34328
|
-
if (facts.valtioVersion === null) {
|
|
34329
|
-
const spec = getDependencySpec(packageJson, "valtio");
|
|
34330
|
-
if (spec !== null) facts.valtioVersion = spec;
|
|
34331
|
-
}
|
|
34332
|
-
facts.tanstackQueryVersion ??= getTanStackQueryVersion(packageJson);
|
|
34333
|
-
const styledComponentsVersion = resolveCatalogBackedDependencyVersion({
|
|
34334
|
-
rootDirectory: directory,
|
|
34335
|
-
rootPackageJson: packageJson,
|
|
34336
|
-
packageName: "styled-components",
|
|
34337
|
-
version: getStyledComponentsVersion(packageJson)
|
|
34338
|
-
});
|
|
34339
|
-
if (styledComponentsVersion && shouldReplaceStyledComponentsVersion(facts.styledComponentsVersion, styledComponentsVersion)) facts.styledComponentsVersion = styledComponentsVersion;
|
|
34340
|
-
facts.hasI18nLibrary = facts.hasI18nLibrary || hasI18nDependency(packageJson);
|
|
34341
34168
|
facts.hasReactNativeAwarePackage = facts.hasReactNativeAwarePackage || isPackageJsonReactNativeAware(packageJson);
|
|
34342
34169
|
facts.hasReanimatedAwarePackage = facts.hasReanimatedAwarePackage || isPackageJsonReanimatedAware(packageJson);
|
|
34343
34170
|
facts.hasSsrDependency = facts.hasSsrDependency || isPackageJsonSsrAware(packageJson);
|
|
34344
|
-
const remotionSpec = getDependencySpec(packageJson, "remotion");
|
|
34345
|
-
if (remotionSpec !== null) {
|
|
34346
|
-
facts.hasRemotionDependency = true;
|
|
34347
|
-
const resolvedRemotionVersion = resolveCatalogBackedDependencyVersion({
|
|
34348
|
-
rootDirectory,
|
|
34349
|
-
rootPackageJson,
|
|
34350
|
-
packageName: "remotion",
|
|
34351
|
-
version: remotionSpec
|
|
34352
|
-
});
|
|
34353
|
-
const remotionMajorVersion = resolvedRemotionVersion === null ? null : getLowestDependencyMajor(resolvedRemotionVersion);
|
|
34354
|
-
if (remotionMajorVersion === null) {
|
|
34355
|
-
facts.hasUnknownRemotionVersion = true;
|
|
34356
|
-
facts.remotionVersion = null;
|
|
34357
|
-
} else if (!facts.hasUnknownRemotionVersion) {
|
|
34358
|
-
const currentRemotionMajorVersion = facts.remotionVersion === null ? null : getLowestDependencyMajor(facts.remotionVersion);
|
|
34359
|
-
if (currentRemotionMajorVersion === null || remotionMajorVersion < currentRemotionMajorVersion) facts.remotionVersion = resolvedRemotionVersion;
|
|
34360
|
-
}
|
|
34361
|
-
}
|
|
34362
34171
|
};
|
|
34363
34172
|
const collectWorkspaceFacts = (rootDirectory, rootPackageJson, { collectReactGroup }) => {
|
|
34364
34173
|
const facts = {
|
|
@@ -34378,33 +34187,12 @@ const collectWorkspaceFacts = (rootDirectory, rootPackageJson, { collectReactGro
|
|
|
34378
34187
|
version: null,
|
|
34379
34188
|
sourceDirectory: null
|
|
34380
34189
|
},
|
|
34381
|
-
valtioVersion: null,
|
|
34382
|
-
mobx: {
|
|
34383
|
-
version: null,
|
|
34384
|
-
sourceDirectory: null
|
|
34385
|
-
},
|
|
34386
|
-
hasMobxReact: false,
|
|
34387
|
-
mobxReactVersion: null,
|
|
34388
|
-
hasMobxReactLite: false,
|
|
34389
|
-
mobxReactLiteVersion: null,
|
|
34390
|
-
hasMobxStateTree: false,
|
|
34391
|
-
hasMobxReactObserver: false,
|
|
34392
|
-
zustand: {
|
|
34393
|
-
version: null,
|
|
34394
|
-
sourceDirectory: null
|
|
34395
|
-
},
|
|
34396
|
-
tanstackQueryVersion: null,
|
|
34397
|
-
styledComponentsVersion: null,
|
|
34398
|
-
hasI18nLibrary: false,
|
|
34399
34190
|
hasReactNativeAwarePackage: false,
|
|
34400
34191
|
hasReanimatedAwarePackage: false,
|
|
34401
34192
|
hasSsrDependency: false,
|
|
34402
|
-
hasRemotionDependency: false,
|
|
34403
|
-
hasUnknownRemotionVersion: false,
|
|
34404
|
-
remotionVersion: null,
|
|
34405
34193
|
reanimatedVersion: null
|
|
34406
34194
|
};
|
|
34407
|
-
evaluateManifestFacts(facts, rootPackageJson, rootDirectory
|
|
34195
|
+
evaluateManifestFacts(facts, rootPackageJson, rootDirectory);
|
|
34408
34196
|
let isReactGroupSettled = !collectReactGroup;
|
|
34409
34197
|
const visitedDirectories = /* @__PURE__ */ new Set();
|
|
34410
34198
|
for (const pattern of getWorkspacePatterns(rootDirectory, rootPackageJson)) {
|
|
@@ -34413,7 +34201,7 @@ const collectWorkspaceFacts = (rootDirectory, rootPackageJson, { collectReactGro
|
|
|
34413
34201
|
if (visitedDirectories.has(workspaceDirectory)) continue;
|
|
34414
34202
|
visitedDirectories.add(workspaceDirectory);
|
|
34415
34203
|
const workspacePackageJson = readPackageJson(Path.join(workspaceDirectory, "package.json"));
|
|
34416
|
-
evaluateManifestFacts(facts, workspacePackageJson, workspaceDirectory
|
|
34204
|
+
evaluateManifestFacts(facts, workspacePackageJson, workspaceDirectory);
|
|
34417
34205
|
const info = extractDependencyInfo(workspacePackageJson);
|
|
34418
34206
|
if (info.framework !== "unknown" && frameworkMergeRank(info.framework) < frameworkMergeRank(facts.framework)) facts.framework = info.framework;
|
|
34419
34207
|
if (isReactGroupSettled) continue;
|
|
@@ -34637,29 +34425,11 @@ const discoverProjectWithoutPackageJson = (directory) => {
|
|
|
34637
34425
|
tailwindVersion: null,
|
|
34638
34426
|
zodVersion: null,
|
|
34639
34427
|
zodMajorVersion: null,
|
|
34640
|
-
mobxVersion: null,
|
|
34641
|
-
mobxMajorVersion: null,
|
|
34642
|
-
hasMobxReact: false,
|
|
34643
|
-
mobxReactVersion: null,
|
|
34644
|
-
hasMobxReactLite: false,
|
|
34645
|
-
mobxReactLiteVersion: null,
|
|
34646
|
-
hasMobxStateTree: false,
|
|
34647
|
-
hasMobxReactObserver: false,
|
|
34648
|
-
zustandVersion: null,
|
|
34649
|
-
zustandMajorVersion: null,
|
|
34650
34428
|
framework: "unknown",
|
|
34651
34429
|
hasTypeScript: hasOwnTsConfig,
|
|
34652
34430
|
hasReactCompiler: false,
|
|
34653
34431
|
hasReactCompilerLintPlugin: false,
|
|
34654
34432
|
hasTanStackQuery: false,
|
|
34655
|
-
valtioVersion: null,
|
|
34656
|
-
valtioMajorVersion: null,
|
|
34657
|
-
hasRemotion: false,
|
|
34658
|
-
remotionVersion: null,
|
|
34659
|
-
remotionMajorVersion: null,
|
|
34660
|
-
hasI18nLibrary: false,
|
|
34661
|
-
tanstackQueryVersion: null,
|
|
34662
|
-
styledComponentsVersion: null,
|
|
34663
34433
|
hasSsrDependency: false,
|
|
34664
34434
|
preactVersion: null,
|
|
34665
34435
|
preactMajorVersion: null,
|
|
@@ -34758,12 +34528,6 @@ const discoverProject = (directory) => {
|
|
|
34758
34528
|
packageName: SHOPIFY_FLASH_LIST_PACKAGE_NAME,
|
|
34759
34529
|
version: workspaceFacts.shopifyFlashList.version
|
|
34760
34530
|
}) : null;
|
|
34761
|
-
const zustandVersion = resolveCatalogBackedDependencyVersion({
|
|
34762
|
-
rootDirectory: directory,
|
|
34763
|
-
rootPackageJson: packageJson,
|
|
34764
|
-
packageName: "zustand",
|
|
34765
|
-
version: workspaceFacts.zustand.version
|
|
34766
|
-
});
|
|
34767
34531
|
const hasReanimated = hasReactNativeWorkspace && workspaceFacts.hasReanimatedAwarePackage;
|
|
34768
34532
|
const reanimatedVersion = hasReanimated ? workspaceFacts.reanimatedVersion : null;
|
|
34769
34533
|
const nextjsVersion = framework === "nextjs" ? resolveCatalogBackedDependencyVersion({
|
|
@@ -34772,21 +34536,7 @@ const discoverProject = (directory) => {
|
|
|
34772
34536
|
packageName: "next",
|
|
34773
34537
|
version: workspaceFacts.next.version
|
|
34774
34538
|
}) : null;
|
|
34775
|
-
const valtioVersion = resolveCatalogBackedDependencyVersion({
|
|
34776
|
-
rootDirectory: directory,
|
|
34777
|
-
rootPackageJson: packageJson,
|
|
34778
|
-
packageName: "valtio",
|
|
34779
|
-
version: workspaceFacts.valtioVersion
|
|
34780
|
-
});
|
|
34781
|
-
const mobxVersion = resolveCatalogBackedDependencyVersion({
|
|
34782
|
-
rootDirectory: directory,
|
|
34783
|
-
rootPackageJson: packageJson,
|
|
34784
|
-
packageName: "mobx",
|
|
34785
|
-
version: workspaceFacts.mobx.version
|
|
34786
|
-
});
|
|
34787
34539
|
const preactVersion = getPreactVersion(packageJson);
|
|
34788
|
-
const remotionVersion = workspaceFacts.remotionVersion;
|
|
34789
|
-
const tanstackQueryVersion = getTanStackQueryVersion(packageJson) ?? workspaceFacts.tanstackQueryVersion;
|
|
34790
34540
|
const isPreES2023Target = hasTypeScript && detectPreES2023Target(directory);
|
|
34791
34541
|
const projectInfo = {
|
|
34792
34542
|
rootDirectory: directory,
|
|
@@ -34796,29 +34546,11 @@ const discoverProject = (directory) => {
|
|
|
34796
34546
|
tailwindVersion,
|
|
34797
34547
|
zodVersion,
|
|
34798
34548
|
zodMajorVersion: zodVersion === null ? null : getLowestDependencyMajor(zodVersion),
|
|
34799
|
-
mobxVersion,
|
|
34800
|
-
mobxMajorVersion: mobxVersion === null ? null : getDependencyMajorWithinSupportedRange(mobxVersion, 6),
|
|
34801
|
-
hasMobxReact: workspaceFacts.hasMobxReact,
|
|
34802
|
-
mobxReactVersion: workspaceFacts.mobxReactVersion,
|
|
34803
|
-
hasMobxReactLite: workspaceFacts.hasMobxReactLite,
|
|
34804
|
-
mobxReactLiteVersion: workspaceFacts.mobxReactLiteVersion,
|
|
34805
|
-
hasMobxStateTree: workspaceFacts.hasMobxStateTree,
|
|
34806
|
-
hasMobxReactObserver: workspaceFacts.hasMobxReactObserver,
|
|
34807
|
-
zustandVersion,
|
|
34808
|
-
zustandMajorVersion: zustandVersion === null ? null : getLowestDependencyMajor(zustandVersion),
|
|
34809
34549
|
framework,
|
|
34810
34550
|
hasTypeScript,
|
|
34811
34551
|
hasReactCompiler: detectReactCompiler(directory, packageJson),
|
|
34812
34552
|
hasReactCompilerLintPlugin: detectReactCompilerLintPlugin(directory, packageJson),
|
|
34813
|
-
hasTanStackQuery:
|
|
34814
|
-
hasI18nLibrary: workspaceFacts.hasI18nLibrary,
|
|
34815
|
-
tanstackQueryVersion,
|
|
34816
|
-
styledComponentsVersion: workspaceFacts.styledComponentsVersion,
|
|
34817
|
-
valtioVersion,
|
|
34818
|
-
valtioMajorVersion: valtioVersion === null ? null : getLowestDependencyMajor(valtioVersion),
|
|
34819
|
-
hasRemotion: workspaceFacts.hasRemotionDependency,
|
|
34820
|
-
remotionVersion,
|
|
34821
|
-
remotionMajorVersion: remotionVersion === null ? null : getLowestDependencyMajor(remotionVersion),
|
|
34553
|
+
hasTanStackQuery: hasTanStackQuery(packageJson),
|
|
34822
34554
|
hasSsrDependency: workspaceFacts.hasSsrDependency,
|
|
34823
34555
|
preactVersion,
|
|
34824
34556
|
preactMajorVersion: parseReactMajor(preactVersion),
|
|
@@ -35052,6 +34784,7 @@ const LEGACY_RULE_KEY_TO_NATIVE_RULE_KEY = {
|
|
|
35052
34784
|
"react/jsx-no-new-function-as-prop": "react-doctor/jsx-no-new-function-as-prop",
|
|
35053
34785
|
"react/jsx-no-new-object-as-prop": "react-doctor/jsx-no-new-object-as-prop",
|
|
35054
34786
|
"react/jsx-no-script-url": "react-doctor/jsx-no-script-url",
|
|
34787
|
+
"react/jsx-no-target-blank": "react-doctor/jsx-no-target-blank",
|
|
35055
34788
|
"react/jsx-no-undef": "react-doctor/jsx-no-undef",
|
|
35056
34789
|
"react/jsx-no-useless-fragment": "react-doctor/jsx-no-useless-fragment",
|
|
35057
34790
|
"react/jsx-pascal-case": "react-doctor/jsx-pascal-case",
|
|
@@ -37338,25 +37071,9 @@ const BABEL_CONFIG_FILE_NAMES = [
|
|
|
37338
37071
|
".babelrc.json"
|
|
37339
37072
|
];
|
|
37340
37073
|
const LEGACY_PRESET_SPEC = "module:metro-react-native-babel-preset";
|
|
37341
|
-
const LEGACY_PRESET_PACKAGE = "metro-react-native-babel-preset";
|
|
37342
|
-
const REACT_NATIVE_PACKAGE = "react-native";
|
|
37343
|
-
const PRESET_RENAME_MINIMUM_REACT_NATIVE_VERSION = "0.73.0";
|
|
37344
|
-
const LEGACY_PRESET_REFERENCE = new RegExp(`['"]${LEGACY_PRESET_SPEC}['"]`);
|
|
37345
37074
|
const MODERN_PRESET_REFERENCE = new RegExp(`['"]module:@react-native/babel-preset['"]`);
|
|
37346
37075
|
const ENABLE_BABEL_RUNTIME_VERSION = /enableBabelRuntime["']?\s*:\s*['"]/;
|
|
37347
|
-
const isReactNativeVersionAtLeastPresetRename = (rootDirectory, packageJson) => {
|
|
37348
|
-
const installedReactNativeManifestPath = Path.join(rootDirectory, "node_modules", REACT_NATIVE_PACKAGE, "package.json");
|
|
37349
|
-
const reactNativeVersionSpec = (isFile(installedReactNativeManifestPath) ? readPackageJson(installedReactNativeManifestPath).version : void 0) ?? getDependencySpec(packageJson, REACT_NATIVE_PACKAGE);
|
|
37350
|
-
if (reactNativeVersionSpec === null || reactNativeVersionSpec === void 0) return false;
|
|
37351
|
-
const normalizedVersionRange = import_semver.validRange(reactNativeVersionSpec);
|
|
37352
|
-
if (normalizedVersionRange === null) return false;
|
|
37353
|
-
const minimumVersion = import_semver.minVersion(normalizedVersionRange);
|
|
37354
|
-
return minimumVersion !== null && import_semver.gte(minimumVersion, PRESET_RENAME_MINIMUM_REACT_NATIVE_VERSION);
|
|
37355
|
-
};
|
|
37356
|
-
const canResolveLegacyPreset = (rootDirectory, packageJson) => getDependencySpec(packageJson, LEGACY_PRESET_PACKAGE) !== null || isFile(Path.join(rootDirectory, "node_modules", LEGACY_PRESET_PACKAGE, "package.json"));
|
|
37357
37076
|
const checkReactNativeMetroBabelPreset = (rootDirectory) => {
|
|
37358
|
-
const packageJson = readPackageJson(Path.join(rootDirectory, "package.json"));
|
|
37359
|
-
const shouldReportLegacyPreset = isReactNativeVersionAtLeastPresetRename(rootDirectory, packageJson) && !canResolveLegacyPreset(rootDirectory, packageJson);
|
|
37360
37077
|
for (const fileName of BABEL_CONFIG_FILE_NAMES) {
|
|
37361
37078
|
const filePath = Path.join(rootDirectory, fileName);
|
|
37362
37079
|
if (!isFile(filePath)) continue;
|
|
@@ -37366,7 +37083,7 @@ const checkReactNativeMetroBabelPreset = (rootDirectory) => {
|
|
|
37366
37083
|
} catch {
|
|
37367
37084
|
continue;
|
|
37368
37085
|
}
|
|
37369
|
-
if (
|
|
37086
|
+
if (contents.includes(LEGACY_PRESET_SPEC)) return [buildReactNativeDiagnostic({
|
|
37370
37087
|
filePath: fileName,
|
|
37371
37088
|
rule: "rn-no-metro-babel-preset",
|
|
37372
37089
|
severity: "error",
|
|
@@ -37389,6 +37106,12 @@ const checkReactNativeProject = (rootDirectory, project) => {
|
|
|
37389
37106
|
return [...checkReactNativeMetroBabelPreset(rootDirectory), ...checkReactNativeLibraryDependencies(rootDirectory)];
|
|
37390
37107
|
};
|
|
37391
37108
|
const RULE_KEY = "no-vulnerable-react-server-components";
|
|
37109
|
+
const DEPENDENCY_SECTIONS = [
|
|
37110
|
+
"dependencies",
|
|
37111
|
+
"devDependencies",
|
|
37112
|
+
"peerDependencies",
|
|
37113
|
+
"optionalDependencies"
|
|
37114
|
+
];
|
|
37392
37115
|
const REACT_RSC_ADVISORIES_BY_MINOR = {
|
|
37393
37116
|
"19.0": {
|
|
37394
37117
|
rceFixedVersion: "19.0.1",
|
|
@@ -37435,13 +37158,20 @@ const enumerateWorkspaceDirectories = (workspaceRoot) => {
|
|
|
37435
37158
|
for (const pattern of patterns) for (const directory of resolveWorkspaceDirectories(workspaceRoot, pattern)) directories.add(directory);
|
|
37436
37159
|
return [...directories];
|
|
37437
37160
|
};
|
|
37161
|
+
const readDeclaredSpec = (packageJson, packageName) => {
|
|
37162
|
+
for (const section of DEPENDENCY_SECTIONS) {
|
|
37163
|
+
const spec = packageJson[section]?.[packageName];
|
|
37164
|
+
if (typeof spec === "string") return spec;
|
|
37165
|
+
}
|
|
37166
|
+
return null;
|
|
37167
|
+
};
|
|
37438
37168
|
const resolveVersionInDirectory = (directory, packageName, declaredSpecOverride) => {
|
|
37439
37169
|
const manifestPath = Path.join(directory, "node_modules", packageName, "package.json");
|
|
37440
37170
|
if (isFile(manifestPath)) {
|
|
37441
37171
|
const installedVersion = import_semver.valid(readPackageJson(manifestPath).version ?? null);
|
|
37442
37172
|
if (installedVersion !== null) return installedVersion;
|
|
37443
37173
|
}
|
|
37444
|
-
const candidateSpecs = [
|
|
37174
|
+
const candidateSpecs = [readDeclaredSpec(readPackageJson(Path.join(directory, "package.json")), packageName), declaredSpecOverride];
|
|
37445
37175
|
for (const spec of candidateSpecs) {
|
|
37446
37176
|
const pinnedVersion = spec === null ? null : import_semver.valid(spec);
|
|
37447
37177
|
if (pinnedVersion !== null) return pinnedVersion;
|
|
@@ -38109,68 +37839,21 @@ const buildCapabilities = (project) => {
|
|
|
38109
37839
|
if (CLIENT_ONLY_FRAMEWORKS.has(project.framework)) capabilities.add("client-only");
|
|
38110
37840
|
if (project.isStaticExport) capabilities.add("nextjs:static-export");
|
|
38111
37841
|
if (project.nextjsMajorVersion !== null && project.nextjsMajorVersion >= 15) capabilities.add("nextjs:15");
|
|
38112
|
-
if (project.nextjsMajorVersion !== null && project.nextjsMajorVersion >= 16) capabilities.add("nextjs:16");
|
|
38113
37842
|
addMajorLadder(capabilities, "react", project.reactMajorVersion, 17, 30);
|
|
38114
37843
|
if (project.reactMajorVersion !== null && project.reactMajorVersion >= 19 && isMajorMinorAtLeast(parseReactMajorMinor(project.reactVersion), {
|
|
38115
37844
|
major: 19,
|
|
38116
37845
|
minor: 2
|
|
38117
37846
|
})) capabilities.add("react:19.2");
|
|
38118
|
-
if (project.tailwindVersion !== null)
|
|
38119
|
-
|
|
38120
|
-
|
|
38121
|
-
|
|
38122
|
-
|
|
38123
|
-
minor: 4
|
|
38124
|
-
})) capabilities.add("tailwind:3.4");
|
|
38125
|
-
if (tailwindVersion !== null && isMajorMinorAtLeast(tailwindVersion, {
|
|
38126
|
-
major: 4,
|
|
38127
|
-
minor: 0
|
|
38128
|
-
})) capabilities.add("tailwind:4");
|
|
38129
|
-
}
|
|
37847
|
+
if (project.tailwindVersion !== null) capabilities.add("tailwind");
|
|
37848
|
+
if (project.tailwindVersion !== null && isMajorMinorAtLeast(parseTailwindMajorMinor(project.tailwindVersion), {
|
|
37849
|
+
major: 3,
|
|
37850
|
+
minor: 4
|
|
37851
|
+
})) capabilities.add("tailwind:3.4");
|
|
38130
37852
|
if (project.zodVersion !== null) capabilities.add("zod");
|
|
38131
37853
|
if (project.zodMajorVersion !== null && project.zodMajorVersion >= 4) capabilities.add("zod:4");
|
|
38132
|
-
if (project.mobxVersion !== void 0 && project.mobxVersion !== null || project.hasMobxReact === true || project.hasMobxReactLite === true || project.hasMobxStateTree === true || project.hasMobxReactObserver === true) capabilities.add("mobx");
|
|
38133
|
-
if (project.hasMobxReact === true) capabilities.add("mobx-react");
|
|
38134
|
-
if (project.hasMobxReactLite === true) capabilities.add("mobx-react-lite");
|
|
38135
|
-
if (project.hasMobxReact === true || project.hasMobxReactLite === true) capabilities.add("mobx-react-binding");
|
|
38136
|
-
const mobxReactVersion = parseDependencyMajorMinor(project.mobxReactVersion);
|
|
38137
|
-
const mobxReactLiteVersion = parseDependencyMajorMinor(project.mobxReactLiteVersion);
|
|
38138
|
-
const hasMobxReactObserverMemoGuard = mobxReactVersion !== null && isMajorMinorAtLeast(mobxReactVersion, {
|
|
38139
|
-
major: 7,
|
|
38140
|
-
minor: 3
|
|
38141
|
-
});
|
|
38142
|
-
const hasMobxReactLiteObserverMemoGuard = mobxReactLiteVersion !== null && isMajorMinorAtLeast(mobxReactLiteVersion, {
|
|
38143
|
-
major: 3,
|
|
38144
|
-
minor: 3
|
|
38145
|
-
});
|
|
38146
|
-
if (hasMobxReactObserverMemoGuard) capabilities.add("mobx-react-observer-memo-guard");
|
|
38147
|
-
if (hasMobxReactLiteObserverMemoGuard) capabilities.add("mobx-react-lite-observer-memo-guard");
|
|
38148
|
-
if (hasMobxReactObserverMemoGuard || hasMobxReactLiteObserverMemoGuard) capabilities.add("mobx-react-binding-observer-memo-guard");
|
|
38149
|
-
if (project.hasMobxStateTree === true) capabilities.add("mobx-state-tree");
|
|
38150
|
-
if (project.hasMobxReactObserver === true) capabilities.add("mobx-react-observer");
|
|
38151
|
-
if (project.mobxMajorVersion !== void 0 && project.mobxMajorVersion !== null && project.mobxMajorVersion >= 4 && project.mobxMajorVersion <= 6) addMajorLadder(capabilities, "mobx", project.mobxMajorVersion, 4, 6);
|
|
38152
|
-
const mobxVersion = parseDependencyMajorMinor(project.mobxVersion);
|
|
38153
|
-
if (project.mobxMajorVersion === 6 && mobxVersion !== null && isMajorMinorAtLeast(mobxVersion, {
|
|
38154
|
-
major: 6,
|
|
38155
|
-
minor: 10
|
|
38156
|
-
})) capabilities.add("mobx:6.10");
|
|
38157
|
-
if (project.zustandVersion !== void 0 && project.zustandVersion !== null) capabilities.add("zustand");
|
|
38158
|
-
if (project.zustandMajorVersion !== void 0 && project.zustandMajorVersion !== null && project.zustandMajorVersion >= 1 && project.zustandMajorVersion <= 5) addMajorLadder(capabilities, "zustand", project.zustandMajorVersion, 1, 5);
|
|
38159
37854
|
if (project.isPreES2023Target) capabilities.add("pre-es2023");
|
|
38160
37855
|
if (project.hasReactCompiler) capabilities.add("react-compiler");
|
|
38161
|
-
if (
|
|
38162
|
-
if (project.styledComponentsVersion) {
|
|
38163
|
-
capabilities.add("styled-components");
|
|
38164
|
-
const styledComponentsMajor = getLowestDependencyMajor(project.styledComponentsVersion);
|
|
38165
|
-
if (styledComponentsMajor !== null && styledComponentsMajor >= 6) capabilities.add("styled-components:6");
|
|
38166
|
-
}
|
|
38167
|
-
if (project.hasI18nLibrary) capabilities.add("i18n");
|
|
38168
|
-
if (project.valtioVersion !== null) capabilities.add("valtio");
|
|
38169
|
-
addMajorLadder(capabilities, "valtio", project.valtioMajorVersion, 1, 10);
|
|
38170
|
-
if (project.hasRemotion) {
|
|
38171
|
-
capabilities.add("remotion");
|
|
38172
|
-
addMajorLadder(capabilities, "remotion", project.remotionMajorVersion ?? null, 4, 30);
|
|
38173
|
-
}
|
|
37856
|
+
if (project.hasTanStackQuery) capabilities.add("tanstack-query");
|
|
38174
37857
|
if (project.hasTypeScript) capabilities.add("typescript");
|
|
38175
37858
|
if (project.preactVersion !== null) capabilities.add("preact");
|
|
38176
37859
|
addMajorLadder(capabilities, "preact", project.preactMajorVersion, 10, 20);
|
|
@@ -38185,7 +37868,7 @@ const getCapabilities = (project) => {
|
|
|
38185
37868
|
capabilitiesByProject.set(project, capabilities);
|
|
38186
37869
|
return capabilities;
|
|
38187
37870
|
};
|
|
38188
|
-
const shouldEnableRule = (requires, tags, capabilities, ignoredTags, disabledWhen
|
|
37871
|
+
const shouldEnableRule = (requires, tags, capabilities, ignoredTags, disabledWhen) => {
|
|
38189
37872
|
if (requires) {
|
|
38190
37873
|
for (const capability of requires) if (!capabilities.has(capability)) return false;
|
|
38191
37874
|
}
|
|
@@ -38196,29 +37879,20 @@ const shouldEnableRule = (requires, tags, capabilities, ignoredTags, disabledWhe
|
|
|
38196
37879
|
if (tags) {
|
|
38197
37880
|
for (const tag of tags) if (ignoredTags.has(tag)) return false;
|
|
38198
37881
|
}
|
|
38199
|
-
if (includedTags && includedTags.size > 0) {
|
|
38200
|
-
if (!tags?.some((tag) => includedTags.has(tag))) return false;
|
|
38201
|
-
}
|
|
38202
37882
|
return true;
|
|
38203
37883
|
};
|
|
38204
|
-
const shouldEnableRuleByDefaultStatus = (options) => options.defaultEnabled !== false || options.hasExplicitOverride === true || options.includeTagDefaults && options.hasIncludedTags;
|
|
38205
37884
|
const yieldToEventLoop = () => new Promise((resolve) => {
|
|
38206
37885
|
setImmediate(resolve);
|
|
38207
37886
|
});
|
|
38208
37887
|
const createSecurityScanSession = (rootDirectory, options) => {
|
|
38209
37888
|
const capabilities = options.project ? getCapabilities(options.project) : /* @__PURE__ */ new Set();
|
|
38210
37889
|
const ignoredTags = options.ignoredTags ?? /* @__PURE__ */ new Set();
|
|
38211
|
-
const includedTags = options.includedTags ?? /* @__PURE__ */ new Set();
|
|
38212
37890
|
const enabledScanRules = REACT_DOCTOR_RULES.flatMap((entry) => {
|
|
38213
37891
|
const rule = entry.rule;
|
|
38214
37892
|
const scan = rule.scan;
|
|
38215
37893
|
if (typeof scan !== "function") return [];
|
|
38216
|
-
if (
|
|
38217
|
-
|
|
38218
|
-
includeTagDefaults: options.includeTagDefaults === true,
|
|
38219
|
-
hasIncludedTags: includedTags.size > 0
|
|
38220
|
-
})) return [];
|
|
38221
|
-
if (!shouldEnableRule(rule.requires, rule.tags, capabilities, ignoredTags, rule.disabledWhen, includedTags)) return [];
|
|
37894
|
+
if (rule.defaultEnabled === false) return [];
|
|
37895
|
+
if (!shouldEnableRule(rule.requires, rule.tags, capabilities, ignoredTags, rule.disabledWhen)) return [];
|
|
38222
37896
|
return [{
|
|
38223
37897
|
entry,
|
|
38224
37898
|
scan,
|
|
@@ -39416,35 +39090,6 @@ const parseGithubViewerPermission = (stdout) => {
|
|
|
39416
39090
|
return /^[A-Z_]+$/.test(value) ? value.toLowerCase() : null;
|
|
39417
39091
|
};
|
|
39418
39092
|
const splitNullSeparated = (value) => value.split("\0").filter((entry) => entry.length > 0);
|
|
39419
|
-
const parseBaselineDiffPlan = (value) => {
|
|
39420
|
-
const entries = splitNullSeparated(value);
|
|
39421
|
-
const baseFiles = /* @__PURE__ */ new Set();
|
|
39422
|
-
const headFiles = /* @__PURE__ */ new Set();
|
|
39423
|
-
for (let entryIndex = 0; entryIndex < entries.length; entryIndex += 2) {
|
|
39424
|
-
const status = entries[entryIndex];
|
|
39425
|
-
const filePath = entries[entryIndex + 1];
|
|
39426
|
-
if (status === void 0 || filePath === void 0 || status.length !== 1) return null;
|
|
39427
|
-
if (status === "A") {
|
|
39428
|
-
headFiles.add(filePath);
|
|
39429
|
-
continue;
|
|
39430
|
-
}
|
|
39431
|
-
if (status === "D") {
|
|
39432
|
-
baseFiles.add(filePath);
|
|
39433
|
-
continue;
|
|
39434
|
-
}
|
|
39435
|
-
if (status === "M" || status === "T") {
|
|
39436
|
-
baseFiles.add(filePath);
|
|
39437
|
-
headFiles.add(filePath);
|
|
39438
|
-
continue;
|
|
39439
|
-
}
|
|
39440
|
-
return null;
|
|
39441
|
-
}
|
|
39442
|
-
return {
|
|
39443
|
-
baseFiles: [...baseFiles],
|
|
39444
|
-
headFiles: [...headFiles],
|
|
39445
|
-
untrackedFiles: []
|
|
39446
|
-
};
|
|
39447
|
-
};
|
|
39448
39093
|
const UNTRACKED_FILE_LAST_LINE = Number.MAX_SAFE_INTEGER;
|
|
39449
39094
|
/**
|
|
39450
39095
|
* `Git` wraps every `git`-via-subprocess call react-doctor makes
|
|
@@ -39647,45 +39292,6 @@ var Git = class Git extends Service()("react-doctor/Git") {
|
|
|
39647
39292
|
githubViewerPermission,
|
|
39648
39293
|
branchExists,
|
|
39649
39294
|
mergeBase,
|
|
39650
|
-
baselineDiffPlan: (input) => {
|
|
39651
|
-
if (!isSafeGitRevision(input.ref)) return succeed$2(null);
|
|
39652
|
-
return gen(function* () {
|
|
39653
|
-
const unmerged = yield* runGit(input.directory, [
|
|
39654
|
-
"diff",
|
|
39655
|
-
"--no-ext-diff",
|
|
39656
|
-
"-z",
|
|
39657
|
-
"--name-only",
|
|
39658
|
-
"--diff-filter=U",
|
|
39659
|
-
"--relative"
|
|
39660
|
-
]);
|
|
39661
|
-
if (unmerged.status !== 0 || unmerged.stdout.length > 0) return null;
|
|
39662
|
-
const result = yield* runGit(input.directory, [
|
|
39663
|
-
"diff",
|
|
39664
|
-
"--no-ext-diff",
|
|
39665
|
-
"--no-textconv",
|
|
39666
|
-
"--no-renames",
|
|
39667
|
-
"-z",
|
|
39668
|
-
"--name-status",
|
|
39669
|
-
"--relative",
|
|
39670
|
-
input.ref
|
|
39671
|
-
]);
|
|
39672
|
-
if (result.status !== 0) return null;
|
|
39673
|
-
const plan = parseBaselineDiffPlan(result.stdout);
|
|
39674
|
-
if (plan === null) return null;
|
|
39675
|
-
const untracked = yield* runGit(input.directory, [
|
|
39676
|
-
"ls-files",
|
|
39677
|
-
"--others",
|
|
39678
|
-
"--exclude-standard",
|
|
39679
|
-
"-z"
|
|
39680
|
-
]);
|
|
39681
|
-
if (untracked.status !== 0) return null;
|
|
39682
|
-
return {
|
|
39683
|
-
baseFiles: plan.baseFiles,
|
|
39684
|
-
headFiles: plan.headFiles,
|
|
39685
|
-
untrackedFiles: splitNullSeparated(untracked.stdout)
|
|
39686
|
-
};
|
|
39687
|
-
}).pipe(catch_$1(() => succeed$2(null)), withSpan("Git.baselineDiffPlan"));
|
|
39688
|
-
},
|
|
39689
39295
|
diffSelection: ({ directory, explicitBaseBranch, includeUntracked = false }) => gen(function* () {
|
|
39690
39296
|
if (explicitBaseBranch !== void 0 && explicitBaseBranch.trim().length === 0) return yield* fail$4(new ReactDoctorError({ reason: new GitBaseBranchInvalid({ detail: "Diff base branch cannot be empty." }) }));
|
|
39691
39297
|
if (explicitBaseBranch !== void 0) {
|
|
@@ -39835,7 +39441,6 @@ var Git = class Git extends Service()("react-doctor/Git") {
|
|
|
39835
39441
|
githubViewerPermission: () => succeed$2(snapshot.githubViewerPermission ?? null),
|
|
39836
39442
|
branchExists: (_directory, branch) => succeed$2(snapshot.branchExists?.get(branch) ?? false),
|
|
39837
39443
|
mergeBase: ({ ref }) => succeed$2(snapshot.mergeBase?.get(ref) ?? null),
|
|
39838
|
-
baselineDiffPlan: () => succeed$2(snapshot.baselineDiffPlan ?? null),
|
|
39839
39444
|
diffSelection: () => succeed$2(snapshot.diffSelection ?? null),
|
|
39840
39445
|
stagedFilePaths: () => succeed$2(snapshot.stagedFiles ?? []),
|
|
39841
39446
|
showStagedContent: (_directory, relativePath) => succeed$2(snapshot.stagedContent?.get(relativePath) ?? null),
|
|
@@ -40204,9 +39809,8 @@ const buildUserPluginRules = (userPlugin, severityControls) => {
|
|
|
40204
39809
|
}
|
|
40205
39810
|
return enabled;
|
|
40206
39811
|
};
|
|
40207
|
-
const createOxlintConfig = ({ pluginPath, project, customRulesOnly = false, extendsPaths = [], ignoredTags = /* @__PURE__ */ new Set(),
|
|
40208
|
-
const
|
|
40209
|
-
const reactHooksJsPlugin = disableReactHooksJsPlugin || ruleSelection === "sidecar" || hasIncludedTags ? null : resolveReactHooksJsPlugin(project.hasReactCompiler || project.hasReactCompilerLintPlugin === true, customRulesOnly);
|
|
39812
|
+
const createOxlintConfig = ({ pluginPath, project, customRulesOnly = false, extendsPaths = [], ignoredTags = /* @__PURE__ */ new Set(), serverAuthFunctionNames, severityControls, userPlugins = [], disableReactHooksJsPlugin = false, ruleSelection, sidecarRuleIdFilter }) => {
|
|
39813
|
+
const reactHooksJsPlugin = disableReactHooksJsPlugin || ruleSelection === "sidecar" ? null : resolveReactHooksJsPlugin(project.hasReactCompiler || project.hasReactCompilerLintPlugin === true, customRulesOnly);
|
|
40210
39814
|
const reactCompilerRules = reactHooksJsPlugin ? applyRuleSeverityControls(filterRulesToAvailable(REACT_COMPILER_RULES, "react-hooks-js", reactHooksJsPlugin.availableRuleNames), severityControls) : {};
|
|
40211
39815
|
const jsPlugins = [];
|
|
40212
39816
|
if (reactHooksJsPlugin) jsPlugins.push(reactHooksJsPlugin.entry);
|
|
@@ -40221,14 +39825,9 @@ const createOxlintConfig = ({ pluginPath, project, customRulesOnly = false, exte
|
|
|
40221
39825
|
if (rule.scan !== void 0) continue;
|
|
40222
39826
|
if (customRulesOnly && registryEntry.originallyExternal) continue;
|
|
40223
39827
|
if (rule.framework !== "global" && !rule.requires) continue;
|
|
40224
|
-
if (!shouldEnableRule(rule.requires, rule.tags, capabilities, ignoredTags, rule.disabledWhen
|
|
39828
|
+
if (!shouldEnableRule(rule.requires, rule.tags, capabilities, ignoredTags, rule.disabledWhen)) continue;
|
|
40225
39829
|
const explicitRuleOverride = resolveRuleSeverityOverride({ ruleKey: registryEntry.key }, severityControls);
|
|
40226
|
-
if (
|
|
40227
|
-
defaultEnabled: rule.defaultEnabled,
|
|
40228
|
-
includeTagDefaults,
|
|
40229
|
-
hasIncludedTags,
|
|
40230
|
-
hasExplicitOverride: explicitRuleOverride !== void 0
|
|
40231
|
-
})) continue;
|
|
39830
|
+
if (rule.defaultEnabled === false && explicitRuleOverride === void 0) continue;
|
|
40232
39831
|
const severity = resolveRuleSeverityOverride({
|
|
40233
39832
|
ruleKey: registryEntry.key,
|
|
40234
39833
|
category: rule.category
|
|
@@ -40237,7 +39836,7 @@ const createOxlintConfig = ({ pluginPath, project, customRulesOnly = false, exte
|
|
|
40237
39836
|
enabledReactDoctorRules[registryEntry.key] = severity;
|
|
40238
39837
|
}
|
|
40239
39838
|
const userPluginRules = {};
|
|
40240
|
-
if (ruleSelection !== "sidecar"
|
|
39839
|
+
if (ruleSelection !== "sidecar") for (const userPlugin of userPlugins) {
|
|
40241
39840
|
Object.assign(userPluginRules, buildUserPluginRules(userPlugin, severityControls));
|
|
40242
39841
|
jsPlugins.push(userPlugin.entry);
|
|
40243
39842
|
}
|
|
@@ -40454,19 +40053,6 @@ const createSidecarLintCache = (cacheDirectory, rulesetHash) => {
|
|
|
40454
40053
|
}
|
|
40455
40054
|
};
|
|
40456
40055
|
};
|
|
40457
|
-
const fingerprintCacheByFilePath = /* @__PURE__ */ new Map();
|
|
40458
|
-
const fingerprintFileContents = (filePath, fingerprintLength) => {
|
|
40459
|
-
const fileStats = NFS.statSync(filePath, { bigint: true });
|
|
40460
|
-
const cachedFingerprint = fingerprintCacheByFilePath.get(filePath);
|
|
40461
|
-
if (cachedFingerprint?.modifiedTimeNanoseconds === fileStats.mtimeNs && cachedFingerprint.sizeBytes === fileStats.size) return cachedFingerprint.fingerprint;
|
|
40462
|
-
const fingerprint = crypto.createHash("sha256").update(NFS.readFileSync(filePath)).digest("hex").slice(0, fingerprintLength);
|
|
40463
|
-
fingerprintCacheByFilePath.set(filePath, {
|
|
40464
|
-
fingerprint,
|
|
40465
|
-
modifiedTimeNanoseconds: fileStats.mtimeNs,
|
|
40466
|
-
sizeBytes: fileStats.size
|
|
40467
|
-
});
|
|
40468
|
-
return fingerprint;
|
|
40469
|
-
};
|
|
40470
40056
|
const bundledRequire = createRequire(import.meta.url);
|
|
40471
40057
|
const childNodeVersionByBinaryPath = /* @__PURE__ */ new Map();
|
|
40472
40058
|
const resolveChildNodeVersion = (nodeBinaryPath) => {
|
|
@@ -40490,13 +40076,6 @@ const TOOLCHAIN_PACKAGE_SPECIFIERS = [
|
|
|
40490
40076
|
"oxlint-plugin-react-doctor/package.json",
|
|
40491
40077
|
"eslint-plugin-react-hooks/package.json"
|
|
40492
40078
|
];
|
|
40493
|
-
const resolvePluginFingerprint = () => {
|
|
40494
|
-
try {
|
|
40495
|
-
return fingerprintFileContents(bundledRequire.resolve("oxlint-plugin-react-doctor"), 16);
|
|
40496
|
-
} catch {
|
|
40497
|
-
return "unresolved";
|
|
40498
|
-
}
|
|
40499
|
-
};
|
|
40500
40079
|
const resolveOxlintToolchainVersions = (nodeBinaryPath = process.execPath) => {
|
|
40501
40080
|
const versions = [`node=${resolveChildNodeVersion(nodeBinaryPath)}`];
|
|
40502
40081
|
for (const specifier of TOOLCHAIN_PACKAGE_SPECIFIERS) try {
|
|
@@ -40506,7 +40085,6 @@ const resolveOxlintToolchainVersions = (nodeBinaryPath = process.execPath) => {
|
|
|
40506
40085
|
} catch {
|
|
40507
40086
|
versions.push(`${specifier}=missing`);
|
|
40508
40087
|
}
|
|
40509
|
-
versions.push(`oxlint-plugin-react-doctor#fingerprint=${resolvePluginFingerprint()}`);
|
|
40510
40088
|
return versions;
|
|
40511
40089
|
};
|
|
40512
40090
|
const esmRequire = createRequire(import.meta.url);
|
|
@@ -41200,17 +40778,12 @@ const REACT_ERROR_BOUNDARY_MESSAGE = "This try/catch cannot catch errors thrown
|
|
|
41200
40778
|
const REACT_COMPILER_IMPACT = "This component misses React Compiler's automatic memoization & re-renders more than it should";
|
|
41201
40779
|
const REACT_COMPILER_ACTION = "Rewrite the flagged code so the compiler can optimize it.";
|
|
41202
40780
|
const REACT_COMPILER_INCOMPATIBLE_LIBRARY_ACTION = "It's how the library works, not a bug in your code. Memoize values you pass from it into other memoized components, or suppress it with `// react-doctor-disable-next-line react-hooks-js/incompatible-library`.";
|
|
41203
|
-
const SET_STATE_IN_EFFECT_ACTION = "Prefer deriving or initializing the value before render. If the effect must read a browser API after mount, treat this as advisory or suppress it with `// react-doctor-disable-next-line react-hooks-js/set-state-in-effect`.";
|
|
41204
40781
|
const REACT_COMPILER_GENERIC_MESSAGE = `${REACT_COMPILER_IMPACT}. ${REACT_COMPILER_ACTION}`;
|
|
41205
40782
|
const buildReactCompilerMessage = (reasonSummary, action = REACT_COMPILER_ACTION) => {
|
|
41206
40783
|
const normalizedSummary = reasonSummary.replace(TRAILING_PERIOD_PATTERN, "");
|
|
41207
40784
|
if (!normalizedSummary) return `${REACT_COMPILER_IMPACT}. ${action}`;
|
|
41208
40785
|
return `${REACT_COMPILER_IMPACT}: ${normalizedSummary}. ${action}`;
|
|
41209
40786
|
};
|
|
41210
|
-
const buildSetStateInEffectMessage = (reasonSummary) => {
|
|
41211
|
-
const normalizedSummary = reasonSummary.replace(TRAILING_PERIOD_PATTERN, "");
|
|
41212
|
-
return `This synchronous effect update causes an extra render${normalizedSummary ? `: ${normalizedSummary}` : ""}. ${SET_STATE_IN_EFFECT_ACTION}`;
|
|
41213
|
-
};
|
|
41214
40787
|
const PLUGIN_CATEGORY_MAP = {
|
|
41215
40788
|
react: "Bugs",
|
|
41216
40789
|
"react-hooks": "Bugs",
|
|
@@ -41268,10 +40841,6 @@ const resolveCleanedDiagnostic = (message, help, plugin, rule, project) => {
|
|
|
41268
40841
|
message: REACT_ERROR_BOUNDARY_MESSAGE,
|
|
41269
40842
|
help: reasonDetail || help
|
|
41270
40843
|
};
|
|
41271
|
-
if (rule === "set-state-in-effect") return {
|
|
41272
|
-
message: buildSetStateInEffectMessage(reasonSummary.trim()),
|
|
41273
|
-
help: reasonDetail || help
|
|
41274
|
-
};
|
|
41275
40844
|
return {
|
|
41276
40845
|
message: buildReactCompilerMessage(reasonSummary.trim(), rule === "incompatible-library" ? REACT_COMPILER_INCOMPATIBLE_LIBRARY_ACTION : REACT_COMPILER_ACTION),
|
|
41277
40846
|
help: appendReanimatedSharedValueHint(reasonDetail || help, rule, project)
|
|
@@ -41982,7 +41551,7 @@ const reactHooksJsPluginDropNote = (error) => {
|
|
|
41982
41551
|
* 6. always restore disable directives + clean up the temp dir
|
|
41983
41552
|
*/
|
|
41984
41553
|
const runOxlint = async (options) => {
|
|
41985
|
-
const { rootDirectory, project, includePaths, nodeBinaryPath = process.execPath, customRulesOnly = false, respectInlineDisables = true, adoptExistingLintConfig = true, ignoredTags = /* @__PURE__ */ new Set(),
|
|
41554
|
+
const { rootDirectory, project, includePaths, nodeBinaryPath = process.execPath, customRulesOnly = false, respectInlineDisables = true, adoptExistingLintConfig = true, ignoredTags = /* @__PURE__ */ new Set(), userConfig, configSourceDirectory = rootDirectory, onPartialFailure, onFileCoverage, perFileLintCacheEnabled = false, sidecarLintCacheEnabled = false, onCacheStats, onSidecarStats, spawnTimeoutMs, outputMaxBytes, lintBatchOrdering = "cost" } = options;
|
|
41986
41555
|
const serverAuthFunctionNames = Array.isArray(userConfig?.serverAuthFunctionNames) ? userConfig.serverAuthFunctionNames.filter((entry) => typeof entry === "string" && entry.length > 0) : void 0;
|
|
41987
41556
|
const severityControls = buildRuleSeverityControls(userConfig);
|
|
41988
41557
|
validateRuleRegistration();
|
|
@@ -41996,15 +41565,13 @@ const runOxlint = async (options) => {
|
|
|
41996
41565
|
}
|
|
41997
41566
|
const pluginPath = resolvePluginPath();
|
|
41998
41567
|
const extendsPaths = (adoptExistingLintConfig && !customRulesOnly ? detectUserLintConfigPaths(rootDirectory) : []).filter(canOxlintExtendConfig);
|
|
41999
|
-
const userPlugins =
|
|
41568
|
+
const userPlugins = resolveUserPlugins(userConfig?.plugins, configSourceDirectory);
|
|
42000
41569
|
const buildConfig = (overrides) => createOxlintConfig({
|
|
42001
41570
|
pluginPath,
|
|
42002
41571
|
project,
|
|
42003
41572
|
customRulesOnly,
|
|
42004
41573
|
extendsPaths: overrides.extendsPaths,
|
|
42005
41574
|
ignoredTags,
|
|
42006
|
-
includedTags,
|
|
42007
|
-
includeTagDefaults,
|
|
42008
41575
|
serverAuthFunctionNames,
|
|
42009
41576
|
severityControls,
|
|
42010
41577
|
userPlugins,
|
|
@@ -42393,8 +41960,6 @@ var Linter = class Linter extends Service()("react-doctor/Linter") {
|
|
|
42393
41960
|
respectInlineDisables: input.respectInlineDisables,
|
|
42394
41961
|
adoptExistingLintConfig: input.adoptExistingLintConfig,
|
|
42395
41962
|
ignoredTags: input.ignoredTags,
|
|
42396
|
-
includedTags: input.includedTags,
|
|
42397
|
-
includeTagDefaults: input.includeTagDefaults,
|
|
42398
41963
|
userConfig: input.userConfig ?? null,
|
|
42399
41964
|
configSourceDirectory: input.configSourceDirectory,
|
|
42400
41965
|
onPartialFailure: (reason) => {
|
|
@@ -43243,9 +42808,7 @@ const runInspect = (input, hooks = {}) => gen(function* () {
|
|
|
43243
42808
|
const securityScanFailedRef = yield* make$13(false);
|
|
43244
42809
|
const securityScanFiber = yield* forkChild(runCollect(applyPerElementPipeline(isDiffMode ? empty$4 : unwrap(tryPromise(() => checkSecurityScanCooperative(scanDirectory, {
|
|
43245
42810
|
project,
|
|
43246
|
-
ignoredTags: input.ignoredTags
|
|
43247
|
-
includedTags: input.includedTags,
|
|
43248
|
-
includeTagDefaults: input.includeTagDefaults
|
|
42811
|
+
ignoredTags: input.ignoredTags
|
|
43249
42812
|
})).pipe(map$3((diagnostics) => fromIterable$1(diagnostics)), catch_$1(() => set(securityScanFailedRef, true).pipe(as(empty$4))))))).pipe(withSpan("SecurityScan.run")));
|
|
43250
42813
|
const shouldRunSupplyChain = !isDiffMode || (input.supplyChainManifestChanged ?? false);
|
|
43251
42814
|
const supplyChainOverlapTimeout = yield* SupplyChainOverlapTimeoutMs;
|
|
@@ -43336,8 +42899,6 @@ const runInspect = (input, hooks = {}) => gen(function* () {
|
|
|
43336
42899
|
respectInlineDisables: input.respectInlineDisables,
|
|
43337
42900
|
adoptExistingLintConfig: input.adoptExistingLintConfig,
|
|
43338
42901
|
ignoredTags: input.ignoredTags,
|
|
43339
|
-
includedTags: input.includedTags,
|
|
43340
|
-
includeTagDefaults: input.includeTagDefaults,
|
|
43341
42902
|
userConfig: resolvedConfig.config ?? void 0,
|
|
43342
42903
|
configSourceDirectory: resolvedConfig.configSourceDirectory ?? void 0,
|
|
43343
42904
|
onFileProgress: (scannedFileCount, totalFileCount) => {
|
|
@@ -43605,19 +43166,12 @@ const isPathInsideDirectory = (childAbsolutePath, parentAbsolutePath) => {
|
|
|
43605
43166
|
*/
|
|
43606
43167
|
const materializeSourceTree = (input) => gen(function* () {
|
|
43607
43168
|
const materializedFiles = [];
|
|
43608
|
-
const unmaterializedFiles = [];
|
|
43609
43169
|
const resolvedTempDirectory = path.resolve(input.tempDirectory);
|
|
43610
43170
|
for (const relativePath of input.files) {
|
|
43611
43171
|
const content = yield* input.readContent(relativePath).pipe(orElseSucceed(() => null));
|
|
43612
|
-
if (content === null)
|
|
43613
|
-
unmaterializedFiles.push(relativePath);
|
|
43614
|
-
continue;
|
|
43615
|
-
}
|
|
43172
|
+
if (content === null) continue;
|
|
43616
43173
|
const candidateTargetPath = path.resolve(resolvedTempDirectory, relativePath);
|
|
43617
|
-
if (!isPathInsideDirectory(candidateTargetPath, resolvedTempDirectory))
|
|
43618
|
-
unmaterializedFiles.push(relativePath);
|
|
43619
|
-
continue;
|
|
43620
|
-
}
|
|
43174
|
+
if (!isPathInsideDirectory(candidateTargetPath, resolvedTempDirectory)) continue;
|
|
43621
43175
|
yield* sync(() => {
|
|
43622
43176
|
fs.mkdirSync(path.dirname(candidateTargetPath), { recursive: true });
|
|
43623
43177
|
fs.writeFileSync(candidateTargetPath, content);
|
|
@@ -43634,7 +43188,6 @@ const materializeSourceTree = (input) => gen(function* () {
|
|
|
43634
43188
|
return {
|
|
43635
43189
|
tempDirectory: input.tempDirectory,
|
|
43636
43190
|
materializedFiles,
|
|
43637
|
-
unmaterializedFiles,
|
|
43638
43191
|
cleanup: () => {
|
|
43639
43192
|
try {
|
|
43640
43193
|
fs.rmSync(input.tempDirectory, {
|
|
@@ -44198,4 +43751,4 @@ const toJsonReport = (result, options) => buildJsonReport({
|
|
|
44198
43751
|
export { AmbiguousProjectError, NoReactDependencyError, NotADirectoryError, PackageJsonNotFoundError, ProjectNotFoundError, ReactDoctorError, buildJsonReport, buildJsonReportError, clearCaches, defineConfig, diagnose, filterSourceFiles, getDiffInfo, hasReactRuntime, isProjectDiscoveryError, isReactDoctorError, summarizeDiagnostics, toJsonReport };
|
|
44199
43752
|
|
|
44200
43753
|
//# sourceMappingURL=index.js.map
|
|
44201
|
-
//# debugId=
|
|
43754
|
+
//# debugId=3121a4e4-8a4a-55ea-ade8-47d0bf576a2f
|