react-doctor 0.8.1-dev.f4aa821 → 0.8.1-dev.fc1b3a3
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 +14 -4
- package/dist/cli.js +479 -122
- package/dist/index.d.ts +17 -0
- package/dist/index.js +388 -78
- package/dist/lsp.js +388 -78
- package/dist/skills/react-doctor/SKILL.md +5 -0
- package/package.json +3 -3
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]="d6c84ba6-2fee-56d3-ba17-e8408ecdedc5")}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,44 +32854,6 @@ 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
|
-
};
|
|
32895
32857
|
const SOURCE_FILE_PATTERN = /\.(tsx?|jsx?|mts|mjs)$/;
|
|
32896
32858
|
const GENERATED_BUNDLE_FILE_PATTERN = /\.(iife|umd|global|min)\.m?js$/i;
|
|
32897
32859
|
const GENERATED_SOURCE_DIRECTORY_PATTERN = /(?:^|\/)__generated__\//;
|
|
@@ -33050,6 +33012,44 @@ const SUPPLY_CHAIN_OVERLAP_TIMEOUT_MS = 9e4;
|
|
|
33050
33012
|
const SUPPLY_CHAIN_CACHE_TTL_MS = 864e5;
|
|
33051
33013
|
const SUPPLY_CHAIN_CACHE_SUBDIR = "supply-chain";
|
|
33052
33014
|
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
|
-
vite: "vite",
|
|
33379
|
-
"react-scripts": "cra",
|
|
33380
33378
|
"@remix-run/react": "remix",
|
|
33381
33379
|
gatsby: "gatsby",
|
|
33380
|
+
vite: "vite",
|
|
33381
|
+
"react-scripts": "cra",
|
|
33382
33382
|
expo: "expo",
|
|
33383
33383
|
"react-native": "react-native"
|
|
33384
33384
|
};
|
|
@@ -33402,11 +33402,17 @@ const NEXT_CONFIG_FILENAMES = [
|
|
|
33402
33402
|
];
|
|
33403
33403
|
const BABEL_CONFIG_FILENAMES = [
|
|
33404
33404
|
".babelrc",
|
|
33405
|
+
".babelrc.js",
|
|
33405
33406
|
".babelrc.json",
|
|
33407
|
+
".babelrc.cjs",
|
|
33408
|
+
".babelrc.mjs",
|
|
33409
|
+
".babelrc.cts",
|
|
33406
33410
|
"babel.config.js",
|
|
33407
33411
|
"babel.config.json",
|
|
33408
33412
|
"babel.config.cjs",
|
|
33409
|
-
"babel.config.mjs"
|
|
33413
|
+
"babel.config.mjs",
|
|
33414
|
+
"babel.config.ts",
|
|
33415
|
+
"babel.config.cts"
|
|
33410
33416
|
];
|
|
33411
33417
|
const VITE_CONFIG_FILENAMES = [
|
|
33412
33418
|
"vite.config.js",
|
|
@@ -33418,12 +33424,28 @@ const VITE_CONFIG_FILENAMES = [
|
|
|
33418
33424
|
"vitest.config.ts",
|
|
33419
33425
|
"vitest.config.js"
|
|
33420
33426
|
];
|
|
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
|
+
];
|
|
33421
33443
|
const EXPO_APP_CONFIG_FILENAMES = [
|
|
33422
33444
|
"app.json",
|
|
33423
33445
|
"app.config.js",
|
|
33424
33446
|
"app.config.ts"
|
|
33425
33447
|
];
|
|
33426
|
-
const REACT_COMPILER_PACKAGE_REFERENCE_PATTERN = /babel-plugin-react-compiler|react-compiler-runtime|["']react-compiler["']/;
|
|
33448
|
+
const REACT_COMPILER_PACKAGE_REFERENCE_PATTERN = /babel-plugin-react-compiler|react-compiler-runtime|reactCompilerPreset\s*\(|["']react-compiler["']/;
|
|
33427
33449
|
const REACT_COMPILER_ENABLED_FLAG_PATTERN = /["']?reactCompiler["']?\s*:\s*(?:true\b|\{)/;
|
|
33428
33450
|
const STATIC_EXPORT_OUTPUT_PATTERN = /(?:^|[^.\w])["']?output["']?\s*:\s*["']export["']/m;
|
|
33429
33451
|
const hasCompilerPackage = (packageJson, compilerPackages) => {
|
|
@@ -33458,6 +33480,8 @@ const detectReactCompiler = (directory, packageJson) => {
|
|
|
33458
33480
|
if (hasCompilerInConfigFiles(directory, NEXT_CONFIG_FILENAMES)) return true;
|
|
33459
33481
|
if (hasCompilerInConfigFiles(directory, BABEL_CONFIG_FILENAMES)) return true;
|
|
33460
33482
|
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;
|
|
33461
33485
|
if (hasCompilerInConfigFiles(directory, EXPO_APP_CONFIG_FILENAMES)) return true;
|
|
33462
33486
|
return hasCompilerPackageInAncestors(directory, REACT_COMPILER_TRANSFORM_PACKAGES);
|
|
33463
33487
|
};
|
|
@@ -33599,6 +33623,16 @@ const getLowestDependencyMajor = (version) => {
|
|
|
33599
33623
|
}
|
|
33600
33624
|
return lowestMajor;
|
|
33601
33625
|
};
|
|
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
|
+
};
|
|
33602
33636
|
const isConcreteDependencyVersion = (version) => {
|
|
33603
33637
|
const normalizedVersion = normalizeDependencyVersion(version);
|
|
33604
33638
|
return normalizedVersion !== null && /\d/.test(normalizedVersion);
|
|
@@ -33642,9 +33676,9 @@ const parseReactMajorMinor = (reactVersion) => {
|
|
|
33642
33676
|
};
|
|
33643
33677
|
};
|
|
33644
33678
|
const parseLowerBoundVersion = (versionSpec) => import_semver.validRange(versionSpec) !== null ? import_semver.minVersion(versionSpec) : import_semver.coerce(versionSpec);
|
|
33645
|
-
const
|
|
33646
|
-
if (typeof
|
|
33647
|
-
const trimmed =
|
|
33679
|
+
const parseDependencyMajorMinor = (dependencyVersion) => {
|
|
33680
|
+
if (typeof dependencyVersion !== "string") return null;
|
|
33681
|
+
const trimmed = dependencyVersion.trim();
|
|
33648
33682
|
if (trimmed.length === 0) return null;
|
|
33649
33683
|
const lowerBound = parseLowerBoundVersion(trimmed);
|
|
33650
33684
|
if (lowerBound === null || lowerBound.major <= 0) return null;
|
|
@@ -33653,6 +33687,7 @@ const parseTailwindMajorMinor = (tailwindVersion) => {
|
|
|
33653
33687
|
minor: lowerBound.minor
|
|
33654
33688
|
};
|
|
33655
33689
|
};
|
|
33690
|
+
const parseTailwindMajorMinor = (tailwindVersion) => parseDependencyMajorMinor(tailwindVersion);
|
|
33656
33691
|
const hasUpperBoundOnlyPeerRange = (range) => {
|
|
33657
33692
|
if (typeof range !== "string") return false;
|
|
33658
33693
|
const normalizedRange = normalizeDependencyVersion(range);
|
|
@@ -33905,19 +33940,6 @@ const getPreactVersion = (packageJson) => {
|
|
|
33905
33940
|
...packageJson.devDependencies
|
|
33906
33941
|
}.preact ?? null;
|
|
33907
33942
|
};
|
|
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
|
-
};
|
|
33921
33943
|
const resolveCatalogBackedDependencyVersion = ({ rootDirectory, rootPackageJson, packageName, version }) => {
|
|
33922
33944
|
if (version === null || !isCatalogReference(version)) return version;
|
|
33923
33945
|
const catalogName = extractCatalogName(version);
|
|
@@ -34120,7 +34142,60 @@ const listWorkspacePackages = (rootDirectory) => {
|
|
|
34120
34142
|
}
|
|
34121
34143
|
return packages;
|
|
34122
34144
|
};
|
|
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
|
+
};
|
|
34123
34194
|
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";
|
|
34124
34199
|
const SHOPIFY_FLASH_LIST_PACKAGE_NAME = "@shopify/flash-list";
|
|
34125
34200
|
const resolveWorkspaceDependencyVersion = ({ concreteVersion, packageName, rootDirectory, rootPackageJson, sections, workspaceDirectory, workspacePackageJson }) => {
|
|
34126
34201
|
const dependencyDeclaration = getDependencyDeclaration({
|
|
@@ -34139,6 +34214,61 @@ const shouldReplaceReactVersion = (currentVersion, nextVersion) => {
|
|
|
34139
34214
|
if (nextMajor === null) return false;
|
|
34140
34215
|
return nextMajor < currentMajor;
|
|
34141
34216
|
};
|
|
34217
|
+
const shouldReplaceSupportedDependencyFact = (currentFact, nextFact, latestSupportedMajor) => {
|
|
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
|
+
};
|
|
34142
34272
|
const evaluateManifestFacts = (facts, packageJson, directory, rootDirectory, rootPackageJson) => {
|
|
34143
34273
|
if (facts.expo.version === null) {
|
|
34144
34274
|
const spec = getDependencySpec(packageJson, "expo");
|
|
@@ -34161,6 +34291,36 @@ const evaluateManifestFacts = (facts, packageJson, directory, rootDirectory, roo
|
|
|
34161
34291
|
sourceDirectory: directory
|
|
34162
34292
|
};
|
|
34163
34293
|
}
|
|
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
|
+
}
|
|
34164
34324
|
if (facts.reanimatedVersion === null) {
|
|
34165
34325
|
const spec = getDependencySpec(packageJson, REANIMATED_DEPENDENCY_NAME);
|
|
34166
34326
|
if (spec !== null) facts.reanimatedVersion = spec;
|
|
@@ -34169,6 +34329,15 @@ const evaluateManifestFacts = (facts, packageJson, directory, rootDirectory, roo
|
|
|
34169
34329
|
const spec = getDependencySpec(packageJson, "valtio");
|
|
34170
34330
|
if (spec !== null) facts.valtioVersion = spec;
|
|
34171
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);
|
|
34172
34341
|
facts.hasReactNativeAwarePackage = facts.hasReactNativeAwarePackage || isPackageJsonReactNativeAware(packageJson);
|
|
34173
34342
|
facts.hasReanimatedAwarePackage = facts.hasReanimatedAwarePackage || isPackageJsonReanimatedAware(packageJson);
|
|
34174
34343
|
facts.hasSsrDependency = facts.hasSsrDependency || isPackageJsonSsrAware(packageJson);
|
|
@@ -34210,6 +34379,23 @@ const collectWorkspaceFacts = (rootDirectory, rootPackageJson, { collectReactGro
|
|
|
34210
34379
|
sourceDirectory: null
|
|
34211
34380
|
},
|
|
34212
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,
|
|
34213
34399
|
hasReactNativeAwarePackage: false,
|
|
34214
34400
|
hasReanimatedAwarePackage: false,
|
|
34215
34401
|
hasSsrDependency: false,
|
|
@@ -34451,6 +34637,16 @@ const discoverProjectWithoutPackageJson = (directory) => {
|
|
|
34451
34637
|
tailwindVersion: null,
|
|
34452
34638
|
zodVersion: null,
|
|
34453
34639
|
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,
|
|
34454
34650
|
framework: "unknown",
|
|
34455
34651
|
hasTypeScript: hasOwnTsConfig,
|
|
34456
34652
|
hasReactCompiler: false,
|
|
@@ -34461,6 +34657,9 @@ const discoverProjectWithoutPackageJson = (directory) => {
|
|
|
34461
34657
|
hasRemotion: false,
|
|
34462
34658
|
remotionVersion: null,
|
|
34463
34659
|
remotionMajorVersion: null,
|
|
34660
|
+
hasI18nLibrary: false,
|
|
34661
|
+
tanstackQueryVersion: null,
|
|
34662
|
+
styledComponentsVersion: null,
|
|
34464
34663
|
hasSsrDependency: false,
|
|
34465
34664
|
preactVersion: null,
|
|
34466
34665
|
preactMajorVersion: null,
|
|
@@ -34559,6 +34758,12 @@ const discoverProject = (directory) => {
|
|
|
34559
34758
|
packageName: SHOPIFY_FLASH_LIST_PACKAGE_NAME,
|
|
34560
34759
|
version: workspaceFacts.shopifyFlashList.version
|
|
34561
34760
|
}) : null;
|
|
34761
|
+
const zustandVersion = resolveCatalogBackedDependencyVersion({
|
|
34762
|
+
rootDirectory: directory,
|
|
34763
|
+
rootPackageJson: packageJson,
|
|
34764
|
+
packageName: "zustand",
|
|
34765
|
+
version: workspaceFacts.zustand.version
|
|
34766
|
+
});
|
|
34562
34767
|
const hasReanimated = hasReactNativeWorkspace && workspaceFacts.hasReanimatedAwarePackage;
|
|
34563
34768
|
const reanimatedVersion = hasReanimated ? workspaceFacts.reanimatedVersion : null;
|
|
34564
34769
|
const nextjsVersion = framework === "nextjs" ? resolveCatalogBackedDependencyVersion({
|
|
@@ -34573,8 +34778,15 @@ const discoverProject = (directory) => {
|
|
|
34573
34778
|
packageName: "valtio",
|
|
34574
34779
|
version: workspaceFacts.valtioVersion
|
|
34575
34780
|
});
|
|
34781
|
+
const mobxVersion = resolveCatalogBackedDependencyVersion({
|
|
34782
|
+
rootDirectory: directory,
|
|
34783
|
+
rootPackageJson: packageJson,
|
|
34784
|
+
packageName: "mobx",
|
|
34785
|
+
version: workspaceFacts.mobx.version
|
|
34786
|
+
});
|
|
34576
34787
|
const preactVersion = getPreactVersion(packageJson);
|
|
34577
34788
|
const remotionVersion = workspaceFacts.remotionVersion;
|
|
34789
|
+
const tanstackQueryVersion = getTanStackQueryVersion(packageJson) ?? workspaceFacts.tanstackQueryVersion;
|
|
34578
34790
|
const isPreES2023Target = hasTypeScript && detectPreES2023Target(directory);
|
|
34579
34791
|
const projectInfo = {
|
|
34580
34792
|
rootDirectory: directory,
|
|
@@ -34584,11 +34796,24 @@ const discoverProject = (directory) => {
|
|
|
34584
34796
|
tailwindVersion,
|
|
34585
34797
|
zodVersion,
|
|
34586
34798
|
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),
|
|
34587
34809
|
framework,
|
|
34588
34810
|
hasTypeScript,
|
|
34589
34811
|
hasReactCompiler: detectReactCompiler(directory, packageJson),
|
|
34590
34812
|
hasReactCompilerLintPlugin: detectReactCompilerLintPlugin(directory, packageJson),
|
|
34591
|
-
hasTanStackQuery:
|
|
34813
|
+
hasTanStackQuery: tanstackQueryVersion !== null,
|
|
34814
|
+
hasI18nLibrary: workspaceFacts.hasI18nLibrary,
|
|
34815
|
+
tanstackQueryVersion,
|
|
34816
|
+
styledComponentsVersion: workspaceFacts.styledComponentsVersion,
|
|
34592
34817
|
valtioVersion,
|
|
34593
34818
|
valtioMajorVersion: valtioVersion === null ? null : getLowestDependencyMajor(valtioVersion),
|
|
34594
34819
|
hasRemotion: workspaceFacts.hasRemotionDependency,
|
|
@@ -37884,21 +38109,62 @@ const buildCapabilities = (project) => {
|
|
|
37884
38109
|
if (CLIENT_ONLY_FRAMEWORKS.has(project.framework)) capabilities.add("client-only");
|
|
37885
38110
|
if (project.isStaticExport) capabilities.add("nextjs:static-export");
|
|
37886
38111
|
if (project.nextjsMajorVersion !== null && project.nextjsMajorVersion >= 15) capabilities.add("nextjs:15");
|
|
38112
|
+
if (project.nextjsMajorVersion !== null && project.nextjsMajorVersion >= 16) capabilities.add("nextjs:16");
|
|
37887
38113
|
addMajorLadder(capabilities, "react", project.reactMajorVersion, 17, 30);
|
|
37888
38114
|
if (project.reactMajorVersion !== null && project.reactMajorVersion >= 19 && isMajorMinorAtLeast(parseReactMajorMinor(project.reactVersion), {
|
|
37889
38115
|
major: 19,
|
|
37890
38116
|
minor: 2
|
|
37891
38117
|
})) capabilities.add("react:19.2");
|
|
37892
|
-
if (project.tailwindVersion !== null)
|
|
37893
|
-
|
|
37894
|
-
|
|
37895
|
-
|
|
37896
|
-
|
|
38118
|
+
if (project.tailwindVersion !== null) {
|
|
38119
|
+
capabilities.add("tailwind");
|
|
38120
|
+
const tailwindVersion = parseTailwindMajorMinor(project.tailwindVersion);
|
|
38121
|
+
if (isMajorMinorAtLeast(tailwindVersion, {
|
|
38122
|
+
major: 3,
|
|
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
|
+
}
|
|
37897
38130
|
if (project.zodVersion !== null) capabilities.add("zod");
|
|
37898
38131
|
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);
|
|
37899
38159
|
if (project.isPreES2023Target) capabilities.add("pre-es2023");
|
|
37900
38160
|
if (project.hasReactCompiler) capabilities.add("react-compiler");
|
|
37901
|
-
if (project.hasTanStackQuery) capabilities.add("tanstack-query");
|
|
38161
|
+
if (Boolean(project.hasTanStackQuery) || Boolean(project.tanstackQueryVersion)) capabilities.add("tanstack-query");
|
|
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");
|
|
37902
38168
|
if (project.valtioVersion !== null) capabilities.add("valtio");
|
|
37903
38169
|
addMajorLadder(capabilities, "valtio", project.valtioMajorVersion, 1, 10);
|
|
37904
38170
|
if (project.hasRemotion) {
|
|
@@ -37919,7 +38185,7 @@ const getCapabilities = (project) => {
|
|
|
37919
38185
|
capabilitiesByProject.set(project, capabilities);
|
|
37920
38186
|
return capabilities;
|
|
37921
38187
|
};
|
|
37922
|
-
const shouldEnableRule = (requires, tags, capabilities, ignoredTags, disabledWhen) => {
|
|
38188
|
+
const shouldEnableRule = (requires, tags, capabilities, ignoredTags, disabledWhen, includedTags) => {
|
|
37923
38189
|
if (requires) {
|
|
37924
38190
|
for (const capability of requires) if (!capabilities.has(capability)) return false;
|
|
37925
38191
|
}
|
|
@@ -37930,20 +38196,29 @@ const shouldEnableRule = (requires, tags, capabilities, ignoredTags, disabledWhe
|
|
|
37930
38196
|
if (tags) {
|
|
37931
38197
|
for (const tag of tags) if (ignoredTags.has(tag)) return false;
|
|
37932
38198
|
}
|
|
38199
|
+
if (includedTags && includedTags.size > 0) {
|
|
38200
|
+
if (!tags?.some((tag) => includedTags.has(tag))) return false;
|
|
38201
|
+
}
|
|
37933
38202
|
return true;
|
|
37934
38203
|
};
|
|
38204
|
+
const shouldEnableRuleByDefaultStatus = (options) => options.defaultEnabled !== false || options.hasExplicitOverride === true || options.includeTagDefaults && options.hasIncludedTags;
|
|
37935
38205
|
const yieldToEventLoop = () => new Promise((resolve) => {
|
|
37936
38206
|
setImmediate(resolve);
|
|
37937
38207
|
});
|
|
37938
38208
|
const createSecurityScanSession = (rootDirectory, options) => {
|
|
37939
38209
|
const capabilities = options.project ? getCapabilities(options.project) : /* @__PURE__ */ new Set();
|
|
37940
38210
|
const ignoredTags = options.ignoredTags ?? /* @__PURE__ */ new Set();
|
|
38211
|
+
const includedTags = options.includedTags ?? /* @__PURE__ */ new Set();
|
|
37941
38212
|
const enabledScanRules = REACT_DOCTOR_RULES.flatMap((entry) => {
|
|
37942
38213
|
const rule = entry.rule;
|
|
37943
38214
|
const scan = rule.scan;
|
|
37944
38215
|
if (typeof scan !== "function") return [];
|
|
37945
|
-
if (
|
|
37946
|
-
|
|
38216
|
+
if (!shouldEnableRuleByDefaultStatus({
|
|
38217
|
+
defaultEnabled: rule.defaultEnabled,
|
|
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 [];
|
|
37947
38222
|
return [{
|
|
37948
38223
|
entry,
|
|
37949
38224
|
scan,
|
|
@@ -39929,8 +40204,9 @@ const buildUserPluginRules = (userPlugin, severityControls) => {
|
|
|
39929
40204
|
}
|
|
39930
40205
|
return enabled;
|
|
39931
40206
|
};
|
|
39932
|
-
const createOxlintConfig = ({ pluginPath, project, customRulesOnly = false, extendsPaths = [], ignoredTags = /* @__PURE__ */ new Set(), serverAuthFunctionNames, severityControls, userPlugins = [], disableReactHooksJsPlugin = false, ruleSelection, sidecarRuleIdFilter }) => {
|
|
39933
|
-
const
|
|
40207
|
+
const createOxlintConfig = ({ pluginPath, project, customRulesOnly = false, extendsPaths = [], ignoredTags = /* @__PURE__ */ new Set(), includedTags = /* @__PURE__ */ new Set(), includeTagDefaults = false, serverAuthFunctionNames, severityControls, userPlugins = [], disableReactHooksJsPlugin = false, ruleSelection, sidecarRuleIdFilter }) => {
|
|
40208
|
+
const hasIncludedTags = includedTags.size > 0;
|
|
40209
|
+
const reactHooksJsPlugin = disableReactHooksJsPlugin || ruleSelection === "sidecar" || hasIncludedTags ? null : resolveReactHooksJsPlugin(project.hasReactCompiler || project.hasReactCompilerLintPlugin === true, customRulesOnly);
|
|
39934
40210
|
const reactCompilerRules = reactHooksJsPlugin ? applyRuleSeverityControls(filterRulesToAvailable(REACT_COMPILER_RULES, "react-hooks-js", reactHooksJsPlugin.availableRuleNames), severityControls) : {};
|
|
39935
40211
|
const jsPlugins = [];
|
|
39936
40212
|
if (reactHooksJsPlugin) jsPlugins.push(reactHooksJsPlugin.entry);
|
|
@@ -39945,9 +40221,14 @@ const createOxlintConfig = ({ pluginPath, project, customRulesOnly = false, exte
|
|
|
39945
40221
|
if (rule.scan !== void 0) continue;
|
|
39946
40222
|
if (customRulesOnly && registryEntry.originallyExternal) continue;
|
|
39947
40223
|
if (rule.framework !== "global" && !rule.requires) continue;
|
|
39948
|
-
if (!shouldEnableRule(rule.requires, rule.tags, capabilities, ignoredTags, rule.disabledWhen)) continue;
|
|
40224
|
+
if (!shouldEnableRule(rule.requires, rule.tags, capabilities, ignoredTags, rule.disabledWhen, includedTags)) continue;
|
|
39949
40225
|
const explicitRuleOverride = resolveRuleSeverityOverride({ ruleKey: registryEntry.key }, severityControls);
|
|
39950
|
-
if (
|
|
40226
|
+
if (!shouldEnableRuleByDefaultStatus({
|
|
40227
|
+
defaultEnabled: rule.defaultEnabled,
|
|
40228
|
+
includeTagDefaults,
|
|
40229
|
+
hasIncludedTags,
|
|
40230
|
+
hasExplicitOverride: explicitRuleOverride !== void 0
|
|
40231
|
+
})) continue;
|
|
39951
40232
|
const severity = resolveRuleSeverityOverride({
|
|
39952
40233
|
ruleKey: registryEntry.key,
|
|
39953
40234
|
category: rule.category
|
|
@@ -39956,7 +40237,7 @@ const createOxlintConfig = ({ pluginPath, project, customRulesOnly = false, exte
|
|
|
39956
40237
|
enabledReactDoctorRules[registryEntry.key] = severity;
|
|
39957
40238
|
}
|
|
39958
40239
|
const userPluginRules = {};
|
|
39959
|
-
if (ruleSelection !== "sidecar") for (const userPlugin of userPlugins) {
|
|
40240
|
+
if (ruleSelection !== "sidecar" && !hasIncludedTags) for (const userPlugin of userPlugins) {
|
|
39960
40241
|
Object.assign(userPluginRules, buildUserPluginRules(userPlugin, severityControls));
|
|
39961
40242
|
jsPlugins.push(userPlugin.entry);
|
|
39962
40243
|
}
|
|
@@ -40173,6 +40454,19 @@ const createSidecarLintCache = (cacheDirectory, rulesetHash) => {
|
|
|
40173
40454
|
}
|
|
40174
40455
|
};
|
|
40175
40456
|
};
|
|
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
|
+
};
|
|
40176
40470
|
const bundledRequire = createRequire(import.meta.url);
|
|
40177
40471
|
const childNodeVersionByBinaryPath = /* @__PURE__ */ new Map();
|
|
40178
40472
|
const resolveChildNodeVersion = (nodeBinaryPath) => {
|
|
@@ -40196,6 +40490,13 @@ const TOOLCHAIN_PACKAGE_SPECIFIERS = [
|
|
|
40196
40490
|
"oxlint-plugin-react-doctor/package.json",
|
|
40197
40491
|
"eslint-plugin-react-hooks/package.json"
|
|
40198
40492
|
];
|
|
40493
|
+
const resolvePluginFingerprint = () => {
|
|
40494
|
+
try {
|
|
40495
|
+
return fingerprintFileContents(bundledRequire.resolve("oxlint-plugin-react-doctor"), 16);
|
|
40496
|
+
} catch {
|
|
40497
|
+
return "unresolved";
|
|
40498
|
+
}
|
|
40499
|
+
};
|
|
40199
40500
|
const resolveOxlintToolchainVersions = (nodeBinaryPath = process.execPath) => {
|
|
40200
40501
|
const versions = [`node=${resolveChildNodeVersion(nodeBinaryPath)}`];
|
|
40201
40502
|
for (const specifier of TOOLCHAIN_PACKAGE_SPECIFIERS) try {
|
|
@@ -40205,6 +40506,7 @@ const resolveOxlintToolchainVersions = (nodeBinaryPath = process.execPath) => {
|
|
|
40205
40506
|
} catch {
|
|
40206
40507
|
versions.push(`${specifier}=missing`);
|
|
40207
40508
|
}
|
|
40509
|
+
versions.push(`oxlint-plugin-react-doctor#fingerprint=${resolvePluginFingerprint()}`);
|
|
40208
40510
|
return versions;
|
|
40209
40511
|
};
|
|
40210
40512
|
const esmRequire = createRequire(import.meta.url);
|
|
@@ -41680,7 +41982,7 @@ const reactHooksJsPluginDropNote = (error) => {
|
|
|
41680
41982
|
* 6. always restore disable directives + clean up the temp dir
|
|
41681
41983
|
*/
|
|
41682
41984
|
const runOxlint = async (options) => {
|
|
41683
|
-
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;
|
|
41985
|
+
const { rootDirectory, project, includePaths, nodeBinaryPath = process.execPath, customRulesOnly = false, respectInlineDisables = true, adoptExistingLintConfig = true, ignoredTags = /* @__PURE__ */ new Set(), includedTags = /* @__PURE__ */ new Set(), includeTagDefaults = false, userConfig, configSourceDirectory = rootDirectory, onPartialFailure, onFileCoverage, perFileLintCacheEnabled = false, sidecarLintCacheEnabled = false, onCacheStats, onSidecarStats, spawnTimeoutMs, outputMaxBytes, lintBatchOrdering = "cost" } = options;
|
|
41684
41986
|
const serverAuthFunctionNames = Array.isArray(userConfig?.serverAuthFunctionNames) ? userConfig.serverAuthFunctionNames.filter((entry) => typeof entry === "string" && entry.length > 0) : void 0;
|
|
41685
41987
|
const severityControls = buildRuleSeverityControls(userConfig);
|
|
41686
41988
|
validateRuleRegistration();
|
|
@@ -41694,13 +41996,15 @@ const runOxlint = async (options) => {
|
|
|
41694
41996
|
}
|
|
41695
41997
|
const pluginPath = resolvePluginPath();
|
|
41696
41998
|
const extendsPaths = (adoptExistingLintConfig && !customRulesOnly ? detectUserLintConfigPaths(rootDirectory) : []).filter(canOxlintExtendConfig);
|
|
41697
|
-
const userPlugins = resolveUserPlugins(userConfig?.plugins, configSourceDirectory);
|
|
41999
|
+
const userPlugins = includedTags.size > 0 ? [] : resolveUserPlugins(userConfig?.plugins, configSourceDirectory);
|
|
41698
42000
|
const buildConfig = (overrides) => createOxlintConfig({
|
|
41699
42001
|
pluginPath,
|
|
41700
42002
|
project,
|
|
41701
42003
|
customRulesOnly,
|
|
41702
42004
|
extendsPaths: overrides.extendsPaths,
|
|
41703
42005
|
ignoredTags,
|
|
42006
|
+
includedTags,
|
|
42007
|
+
includeTagDefaults,
|
|
41704
42008
|
serverAuthFunctionNames,
|
|
41705
42009
|
severityControls,
|
|
41706
42010
|
userPlugins,
|
|
@@ -42089,6 +42393,8 @@ var Linter = class Linter extends Service()("react-doctor/Linter") {
|
|
|
42089
42393
|
respectInlineDisables: input.respectInlineDisables,
|
|
42090
42394
|
adoptExistingLintConfig: input.adoptExistingLintConfig,
|
|
42091
42395
|
ignoredTags: input.ignoredTags,
|
|
42396
|
+
includedTags: input.includedTags,
|
|
42397
|
+
includeTagDefaults: input.includeTagDefaults,
|
|
42092
42398
|
userConfig: input.userConfig ?? null,
|
|
42093
42399
|
configSourceDirectory: input.configSourceDirectory,
|
|
42094
42400
|
onPartialFailure: (reason) => {
|
|
@@ -42937,7 +43243,9 @@ const runInspect = (input, hooks = {}) => gen(function* () {
|
|
|
42937
43243
|
const securityScanFailedRef = yield* make$13(false);
|
|
42938
43244
|
const securityScanFiber = yield* forkChild(runCollect(applyPerElementPipeline(isDiffMode ? empty$4 : unwrap(tryPromise(() => checkSecurityScanCooperative(scanDirectory, {
|
|
42939
43245
|
project,
|
|
42940
|
-
ignoredTags: input.ignoredTags
|
|
43246
|
+
ignoredTags: input.ignoredTags,
|
|
43247
|
+
includedTags: input.includedTags,
|
|
43248
|
+
includeTagDefaults: input.includeTagDefaults
|
|
42941
43249
|
})).pipe(map$3((diagnostics) => fromIterable$1(diagnostics)), catch_$1(() => set(securityScanFailedRef, true).pipe(as(empty$4))))))).pipe(withSpan("SecurityScan.run")));
|
|
42942
43250
|
const shouldRunSupplyChain = !isDiffMode || (input.supplyChainManifestChanged ?? false);
|
|
42943
43251
|
const supplyChainOverlapTimeout = yield* SupplyChainOverlapTimeoutMs;
|
|
@@ -43028,6 +43336,8 @@ const runInspect = (input, hooks = {}) => gen(function* () {
|
|
|
43028
43336
|
respectInlineDisables: input.respectInlineDisables,
|
|
43029
43337
|
adoptExistingLintConfig: input.adoptExistingLintConfig,
|
|
43030
43338
|
ignoredTags: input.ignoredTags,
|
|
43339
|
+
includedTags: input.includedTags,
|
|
43340
|
+
includeTagDefaults: input.includeTagDefaults,
|
|
43031
43341
|
userConfig: resolvedConfig.config ?? void 0,
|
|
43032
43342
|
configSourceDirectory: resolvedConfig.configSourceDirectory ?? void 0,
|
|
43033
43343
|
onFileProgress: (scannedFileCount, totalFileCount) => {
|
|
@@ -43888,4 +44198,4 @@ const toJsonReport = (result, options) => buildJsonReport({
|
|
|
43888
44198
|
export { AmbiguousProjectError, NoReactDependencyError, NotADirectoryError, PackageJsonNotFoundError, ProjectNotFoundError, ReactDoctorError, buildJsonReport, buildJsonReportError, clearCaches, defineConfig, diagnose, filterSourceFiles, getDiffInfo, hasReactRuntime, isProjectDiscoveryError, isReactDoctorError, summarizeDiagnostics, toJsonReport };
|
|
43889
44199
|
|
|
43890
44200
|
//# sourceMappingURL=index.js.map
|
|
43891
|
-
//# debugId=
|
|
44201
|
+
//# debugId=d6c84ba6-2fee-56d3-ba17-e8408ecdedc5
|