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/lsp.js
CHANGED
|
@@ -32883,44 +32883,6 @@ var AmbiguousProjectError = class extends Error {
|
|
|
32883
32883
|
}
|
|
32884
32884
|
};
|
|
32885
32885
|
const isProjectDiscoveryError = (value) => value instanceof ProjectNotFoundError || value instanceof NoReactDependencyError || value instanceof PackageJsonNotFoundError || value instanceof NotADirectoryError || value instanceof AmbiguousProjectError;
|
|
32886
|
-
const isErrnoException = (error) => error instanceof Error && "code" in error;
|
|
32887
|
-
const IGNORABLE_READDIR_ERROR_CODES = new Set([
|
|
32888
|
-
"EACCES",
|
|
32889
|
-
"EPERM",
|
|
32890
|
-
"ENOENT",
|
|
32891
|
-
"ENOTDIR",
|
|
32892
|
-
"EINVAL",
|
|
32893
|
-
"ELOOP",
|
|
32894
|
-
"ENAMETOOLONG"
|
|
32895
|
-
]);
|
|
32896
|
-
const isIgnorableReaddirError = (error) => isErrnoException(error) && typeof error.code === "string" && IGNORABLE_READDIR_ERROR_CODES.has(error.code);
|
|
32897
|
-
const readDirectoryEntries = (directoryPath) => {
|
|
32898
|
-
try {
|
|
32899
|
-
return NFS.readdirSync(directoryPath, { withFileTypes: true });
|
|
32900
|
-
} catch (error) {
|
|
32901
|
-
if (isIgnorableReaddirError(error)) return [];
|
|
32902
|
-
throw error;
|
|
32903
|
-
}
|
|
32904
|
-
};
|
|
32905
|
-
const isFile = (filePath) => {
|
|
32906
|
-
try {
|
|
32907
|
-
return NFS.statSync(filePath).isFile();
|
|
32908
|
-
} catch {
|
|
32909
|
-
return false;
|
|
32910
|
-
}
|
|
32911
|
-
};
|
|
32912
|
-
const isDirectory = (directoryPath) => {
|
|
32913
|
-
try {
|
|
32914
|
-
return NFS.statSync(directoryPath).isDirectory();
|
|
32915
|
-
} catch {
|
|
32916
|
-
return false;
|
|
32917
|
-
}
|
|
32918
|
-
};
|
|
32919
|
-
const isPlainObject = (value) => {
|
|
32920
|
-
if (typeof value !== "object" || value === null || Array.isArray(value)) return false;
|
|
32921
|
-
const prototype = Object.getPrototypeOf(value);
|
|
32922
|
-
return prototype === null || prototype === Object.prototype;
|
|
32923
|
-
};
|
|
32924
32886
|
const SOURCE_FILE_PATTERN = /\.(tsx?|jsx?|mts|mjs)$/;
|
|
32925
32887
|
const GENERATED_BUNDLE_FILE_PATTERN = /\.(iife|umd|global|min)\.m?js$/i;
|
|
32926
32888
|
const GENERATED_SOURCE_DIRECTORY_PATTERN = /(?:^|\/)__generated__\//;
|
|
@@ -33102,6 +33064,44 @@ const SUPPLY_CHAIN_OVERLAP_TIMEOUT_MS = 9e4;
|
|
|
33102
33064
|
const SUPPLY_CHAIN_CACHE_TTL_MS = 864e5;
|
|
33103
33065
|
const SUPPLY_CHAIN_CACHE_SUBDIR = "supply-chain";
|
|
33104
33066
|
const SUPPLY_CHAIN_IGNORED_PACKAGES = new Set(["next"]);
|
|
33067
|
+
const isErrnoException = (error) => error instanceof Error && "code" in error;
|
|
33068
|
+
const IGNORABLE_READDIR_ERROR_CODES = new Set([
|
|
33069
|
+
"EACCES",
|
|
33070
|
+
"EPERM",
|
|
33071
|
+
"ENOENT",
|
|
33072
|
+
"ENOTDIR",
|
|
33073
|
+
"EINVAL",
|
|
33074
|
+
"ELOOP",
|
|
33075
|
+
"ENAMETOOLONG"
|
|
33076
|
+
]);
|
|
33077
|
+
const isIgnorableReaddirError = (error) => isErrnoException(error) && typeof error.code === "string" && IGNORABLE_READDIR_ERROR_CODES.has(error.code);
|
|
33078
|
+
const readDirectoryEntries = (directoryPath) => {
|
|
33079
|
+
try {
|
|
33080
|
+
return NFS.readdirSync(directoryPath, { withFileTypes: true });
|
|
33081
|
+
} catch (error) {
|
|
33082
|
+
if (isIgnorableReaddirError(error)) return [];
|
|
33083
|
+
throw error;
|
|
33084
|
+
}
|
|
33085
|
+
};
|
|
33086
|
+
const isFile = (filePath) => {
|
|
33087
|
+
try {
|
|
33088
|
+
return NFS.statSync(filePath).isFile();
|
|
33089
|
+
} catch {
|
|
33090
|
+
return false;
|
|
33091
|
+
}
|
|
33092
|
+
};
|
|
33093
|
+
const isDirectory = (directoryPath) => {
|
|
33094
|
+
try {
|
|
33095
|
+
return NFS.statSync(directoryPath).isDirectory();
|
|
33096
|
+
} catch {
|
|
33097
|
+
return false;
|
|
33098
|
+
}
|
|
33099
|
+
};
|
|
33100
|
+
const isPlainObject = (value) => {
|
|
33101
|
+
if (typeof value !== "object" || value === null || Array.isArray(value)) return false;
|
|
33102
|
+
const prototype = Object.getPrototypeOf(value);
|
|
33103
|
+
return prototype === null || prototype === Object.prototype;
|
|
33104
|
+
};
|
|
33105
33105
|
const lastSourceMappingUrl = (fileContent) => {
|
|
33106
33106
|
const lastReference = [...fileContent.matchAll(/\/\/# sourceMappingURL=(\S+)/g)].at(-1);
|
|
33107
33107
|
return lastReference ? lastReference[1] : null;
|
|
@@ -33427,10 +33427,10 @@ const FALLBACK_TSCONFIG_FILENAMES = ["tsconfig.app.json", "tsconfig.build.json"]
|
|
|
33427
33427
|
const FRAMEWORK_PACKAGES = {
|
|
33428
33428
|
next: "nextjs",
|
|
33429
33429
|
"@tanstack/react-start": "tanstack-start",
|
|
33430
|
-
vite: "vite",
|
|
33431
|
-
"react-scripts": "cra",
|
|
33432
33430
|
"@remix-run/react": "remix",
|
|
33433
33431
|
gatsby: "gatsby",
|
|
33432
|
+
vite: "vite",
|
|
33433
|
+
"react-scripts": "cra",
|
|
33434
33434
|
expo: "expo",
|
|
33435
33435
|
"react-native": "react-native"
|
|
33436
33436
|
};
|
|
@@ -33454,11 +33454,17 @@ const NEXT_CONFIG_FILENAMES = [
|
|
|
33454
33454
|
];
|
|
33455
33455
|
const BABEL_CONFIG_FILENAMES = [
|
|
33456
33456
|
".babelrc",
|
|
33457
|
+
".babelrc.js",
|
|
33457
33458
|
".babelrc.json",
|
|
33459
|
+
".babelrc.cjs",
|
|
33460
|
+
".babelrc.mjs",
|
|
33461
|
+
".babelrc.cts",
|
|
33458
33462
|
"babel.config.js",
|
|
33459
33463
|
"babel.config.json",
|
|
33460
33464
|
"babel.config.cjs",
|
|
33461
|
-
"babel.config.mjs"
|
|
33465
|
+
"babel.config.mjs",
|
|
33466
|
+
"babel.config.ts",
|
|
33467
|
+
"babel.config.cts"
|
|
33462
33468
|
];
|
|
33463
33469
|
const VITE_CONFIG_FILENAMES = [
|
|
33464
33470
|
"vite.config.js",
|
|
@@ -33470,12 +33476,28 @@ const VITE_CONFIG_FILENAMES = [
|
|
|
33470
33476
|
"vitest.config.ts",
|
|
33471
33477
|
"vitest.config.js"
|
|
33472
33478
|
];
|
|
33479
|
+
const RSBUILD_CONFIG_FILENAMES = [
|
|
33480
|
+
"rsbuild.config.ts",
|
|
33481
|
+
"rsbuild.config.js",
|
|
33482
|
+
"rsbuild.config.mts",
|
|
33483
|
+
"rsbuild.config.mjs",
|
|
33484
|
+
"rsbuild.config.cts",
|
|
33485
|
+
"rsbuild.config.cjs"
|
|
33486
|
+
];
|
|
33487
|
+
const RSPACK_CONFIG_FILENAMES = [
|
|
33488
|
+
"rspack.config.ts",
|
|
33489
|
+
"rspack.config.js",
|
|
33490
|
+
"rspack.config.mts",
|
|
33491
|
+
"rspack.config.mjs",
|
|
33492
|
+
"rspack.config.cts",
|
|
33493
|
+
"rspack.config.cjs"
|
|
33494
|
+
];
|
|
33473
33495
|
const EXPO_APP_CONFIG_FILENAMES = [
|
|
33474
33496
|
"app.json",
|
|
33475
33497
|
"app.config.js",
|
|
33476
33498
|
"app.config.ts"
|
|
33477
33499
|
];
|
|
33478
|
-
const REACT_COMPILER_PACKAGE_REFERENCE_PATTERN = /babel-plugin-react-compiler|react-compiler-runtime|["']react-compiler["']/;
|
|
33500
|
+
const REACT_COMPILER_PACKAGE_REFERENCE_PATTERN = /babel-plugin-react-compiler|react-compiler-runtime|reactCompilerPreset\s*\(|["']react-compiler["']/;
|
|
33479
33501
|
const REACT_COMPILER_ENABLED_FLAG_PATTERN = /["']?reactCompiler["']?\s*:\s*(?:true\b|\{)/;
|
|
33480
33502
|
const STATIC_EXPORT_OUTPUT_PATTERN = /(?:^|[^.\w])["']?output["']?\s*:\s*["']export["']/m;
|
|
33481
33503
|
const hasCompilerPackage = (packageJson, compilerPackages) => {
|
|
@@ -33510,6 +33532,8 @@ const detectReactCompiler = (directory, packageJson) => {
|
|
|
33510
33532
|
if (hasCompilerInConfigFiles(directory, NEXT_CONFIG_FILENAMES)) return true;
|
|
33511
33533
|
if (hasCompilerInConfigFiles(directory, BABEL_CONFIG_FILENAMES)) return true;
|
|
33512
33534
|
if (hasCompilerInConfigFiles(directory, VITE_CONFIG_FILENAMES)) return true;
|
|
33535
|
+
if (hasCompilerInConfigFiles(directory, RSBUILD_CONFIG_FILENAMES)) return true;
|
|
33536
|
+
if (hasCompilerInConfigFiles(directory, RSPACK_CONFIG_FILENAMES)) return true;
|
|
33513
33537
|
if (hasCompilerInConfigFiles(directory, EXPO_APP_CONFIG_FILENAMES)) return true;
|
|
33514
33538
|
return hasCompilerPackageInAncestors(directory, REACT_COMPILER_TRANSFORM_PACKAGES);
|
|
33515
33539
|
};
|
|
@@ -33651,6 +33675,16 @@ const getLowestDependencyMajor = (version) => {
|
|
|
33651
33675
|
}
|
|
33652
33676
|
return lowestMajor;
|
|
33653
33677
|
};
|
|
33678
|
+
const getDependencyMajorWithinSupportedRange = (version, latestSupportedMajor) => {
|
|
33679
|
+
const normalizedVersion = normalizeDependencyVersion(version);
|
|
33680
|
+
if (normalizedVersion === null) return null;
|
|
33681
|
+
const validRange = import_semver.validRange(normalizedVersion);
|
|
33682
|
+
if (validRange === null) return null;
|
|
33683
|
+
const minimumVersion = import_semver.minVersion(validRange);
|
|
33684
|
+
if (minimumVersion === null || minimumVersion.major > latestSupportedMajor) return null;
|
|
33685
|
+
if (import_semver.intersects(validRange, `>=${latestSupportedMajor + 1}.0.0`)) return null;
|
|
33686
|
+
return minimumVersion.major;
|
|
33687
|
+
};
|
|
33654
33688
|
const isConcreteDependencyVersion = (version) => {
|
|
33655
33689
|
const normalizedVersion = normalizeDependencyVersion(version);
|
|
33656
33690
|
return normalizedVersion !== null && /\d/.test(normalizedVersion);
|
|
@@ -33694,9 +33728,9 @@ const parseReactMajorMinor = (reactVersion) => {
|
|
|
33694
33728
|
};
|
|
33695
33729
|
};
|
|
33696
33730
|
const parseLowerBoundVersion = (versionSpec) => import_semver.validRange(versionSpec) !== null ? import_semver.minVersion(versionSpec) : import_semver.coerce(versionSpec);
|
|
33697
|
-
const
|
|
33698
|
-
if (typeof
|
|
33699
|
-
const trimmed =
|
|
33731
|
+
const parseDependencyMajorMinor = (dependencyVersion) => {
|
|
33732
|
+
if (typeof dependencyVersion !== "string") return null;
|
|
33733
|
+
const trimmed = dependencyVersion.trim();
|
|
33700
33734
|
if (trimmed.length === 0) return null;
|
|
33701
33735
|
const lowerBound = parseLowerBoundVersion(trimmed);
|
|
33702
33736
|
if (lowerBound === null || lowerBound.major <= 0) return null;
|
|
@@ -33705,6 +33739,7 @@ const parseTailwindMajorMinor = (tailwindVersion) => {
|
|
|
33705
33739
|
minor: lowerBound.minor
|
|
33706
33740
|
};
|
|
33707
33741
|
};
|
|
33742
|
+
const parseTailwindMajorMinor = (tailwindVersion) => parseDependencyMajorMinor(tailwindVersion);
|
|
33708
33743
|
const hasUpperBoundOnlyPeerRange = (range) => {
|
|
33709
33744
|
if (typeof range !== "string") return false;
|
|
33710
33745
|
const normalizedRange = normalizeDependencyVersion(range);
|
|
@@ -33957,19 +33992,6 @@ const getPreactVersion = (packageJson) => {
|
|
|
33957
33992
|
...packageJson.devDependencies
|
|
33958
33993
|
}.preact ?? null;
|
|
33959
33994
|
};
|
|
33960
|
-
const TANSTACK_QUERY_PACKAGES = new Set([
|
|
33961
|
-
"@tanstack/react-query",
|
|
33962
|
-
"@tanstack/query-core",
|
|
33963
|
-
"react-query"
|
|
33964
|
-
]);
|
|
33965
|
-
const hasTanStackQuery = (packageJson) => {
|
|
33966
|
-
const allDependencies = {
|
|
33967
|
-
...packageJson.peerDependencies,
|
|
33968
|
-
...packageJson.dependencies,
|
|
33969
|
-
...packageJson.devDependencies
|
|
33970
|
-
};
|
|
33971
|
-
return Object.keys(allDependencies).some((packageName) => TANSTACK_QUERY_PACKAGES.has(packageName));
|
|
33972
|
-
};
|
|
33973
33995
|
const resolveCatalogBackedDependencyVersion = ({ rootDirectory, rootPackageJson, packageName, version }) => {
|
|
33974
33996
|
if (version === null || !isCatalogReference(version)) return version;
|
|
33975
33997
|
const catalogName = extractCatalogName(version);
|
|
@@ -34172,7 +34194,60 @@ const listWorkspacePackages = (rootDirectory) => {
|
|
|
34172
34194
|
}
|
|
34173
34195
|
return packages;
|
|
34174
34196
|
};
|
|
34197
|
+
const getPreferredDependencyVersion = ({ packageJson, packageNames }) => {
|
|
34198
|
+
const allDependencies = {
|
|
34199
|
+
...packageJson.devDependencies,
|
|
34200
|
+
...packageJson.peerDependencies,
|
|
34201
|
+
...packageJson.dependencies
|
|
34202
|
+
};
|
|
34203
|
+
for (const packageName of packageNames) {
|
|
34204
|
+
const version = allDependencies[packageName];
|
|
34205
|
+
if (version !== void 0) return version;
|
|
34206
|
+
}
|
|
34207
|
+
return null;
|
|
34208
|
+
};
|
|
34209
|
+
const TANSTACK_REACT_QUERY_PACKAGES = ["@tanstack/react-query", "react-query"];
|
|
34210
|
+
const getTanStackQueryVersion = (packageJson) => {
|
|
34211
|
+
return getPreferredDependencyVersion({
|
|
34212
|
+
packageJson,
|
|
34213
|
+
packageNames: TANSTACK_REACT_QUERY_PACKAGES
|
|
34214
|
+
});
|
|
34215
|
+
};
|
|
34216
|
+
const STYLED_COMPONENTS_PACKAGES = ["styled-components"];
|
|
34217
|
+
const getStyledComponentsVersion = (packageJson) => {
|
|
34218
|
+
return getPreferredDependencyVersion({
|
|
34219
|
+
packageJson,
|
|
34220
|
+
packageNames: STYLED_COMPONENTS_PACKAGES
|
|
34221
|
+
});
|
|
34222
|
+
};
|
|
34223
|
+
const I18N_PACKAGES = [
|
|
34224
|
+
"i18next",
|
|
34225
|
+
"react-i18next",
|
|
34226
|
+
"next-i18next",
|
|
34227
|
+
"react-intl",
|
|
34228
|
+
"next-intl",
|
|
34229
|
+
"use-intl",
|
|
34230
|
+
"@formatjs/intl",
|
|
34231
|
+
"@lingui/core",
|
|
34232
|
+
"@lingui/react",
|
|
34233
|
+
"typesafe-i18n",
|
|
34234
|
+
"@tolgee/react",
|
|
34235
|
+
"react-intl-universal"
|
|
34236
|
+
];
|
|
34237
|
+
const hasI18nDependency = (packageJson) => {
|
|
34238
|
+
const allDependencies = {
|
|
34239
|
+
...packageJson.peerDependencies,
|
|
34240
|
+
...packageJson.dependencies,
|
|
34241
|
+
...packageJson.devDependencies,
|
|
34242
|
+
...packageJson.optionalDependencies
|
|
34243
|
+
};
|
|
34244
|
+
return I18N_PACKAGES.some((packageName) => allDependencies[packageName] !== void 0);
|
|
34245
|
+
};
|
|
34175
34246
|
const REANIMATED_DEPENDENCY_NAME = "react-native-reanimated";
|
|
34247
|
+
const MOBX_REACT_PACKAGE_NAME = "mobx-react";
|
|
34248
|
+
const MOBX_REACT_LITE_PACKAGE_NAME = "mobx-react-lite";
|
|
34249
|
+
const MOBX_STATE_TREE_PACKAGE_NAME = "mobx-state-tree";
|
|
34250
|
+
const MOBX_REACT_OBSERVER_PACKAGE_NAME = "mobx-react-observer";
|
|
34176
34251
|
const SHOPIFY_FLASH_LIST_PACKAGE_NAME = "@shopify/flash-list";
|
|
34177
34252
|
const resolveWorkspaceDependencyVersion = ({ concreteVersion, packageName, rootDirectory, rootPackageJson, sections, workspaceDirectory, workspacePackageJson }) => {
|
|
34178
34253
|
const dependencyDeclaration = getDependencyDeclaration({
|
|
@@ -34191,6 +34266,61 @@ const shouldReplaceReactVersion = (currentVersion, nextVersion) => {
|
|
|
34191
34266
|
if (nextMajor === null) return false;
|
|
34192
34267
|
return nextMajor < currentMajor;
|
|
34193
34268
|
};
|
|
34269
|
+
const shouldReplaceSupportedDependencyFact = (currentFact, nextFact, latestSupportedMajor) => {
|
|
34270
|
+
if (currentFact.version === null) return true;
|
|
34271
|
+
if (nextFact.version === null) return false;
|
|
34272
|
+
const currentMajor = getLowestDependencyMajor(currentFact.version);
|
|
34273
|
+
const nextMajor = getLowestDependencyMajor(nextFact.version);
|
|
34274
|
+
if (currentMajor === null) return false;
|
|
34275
|
+
if (nextMajor === null) return true;
|
|
34276
|
+
if (currentMajor > latestSupportedMajor) return false;
|
|
34277
|
+
if (nextMajor > latestSupportedMajor) return true;
|
|
34278
|
+
return nextMajor < currentMajor;
|
|
34279
|
+
};
|
|
34280
|
+
const shouldReplaceStyledComponentsVersion = (currentVersion, nextVersion) => {
|
|
34281
|
+
if (!currentVersion) return true;
|
|
34282
|
+
const currentMajor = getLowestDependencyMajor(currentVersion);
|
|
34283
|
+
const nextMajor = getLowestDependencyMajor(nextVersion);
|
|
34284
|
+
if (currentMajor === null) return nextMajor !== null && nextMajor < 6;
|
|
34285
|
+
if (nextMajor === null) return currentMajor >= 6;
|
|
34286
|
+
return nextMajor < currentMajor;
|
|
34287
|
+
};
|
|
34288
|
+
const selectOldestDependencyVersion = (currentVersion, nextVersion) => {
|
|
34289
|
+
if (currentVersion === null || nextVersion === null) return null;
|
|
34290
|
+
const current = parseDependencyMajorMinor(currentVersion);
|
|
34291
|
+
const next = parseDependencyMajorMinor(nextVersion);
|
|
34292
|
+
if (current === null) return currentVersion;
|
|
34293
|
+
if (next === null) return nextVersion;
|
|
34294
|
+
if (next.major !== current.major) return next.major < current.major ? nextVersion : currentVersion;
|
|
34295
|
+
return next.minor < current.minor ? nextVersion : currentVersion;
|
|
34296
|
+
};
|
|
34297
|
+
const shouldReplaceMobxFact = (currentFact, nextFact) => {
|
|
34298
|
+
if (currentFact.sourceDirectory === null) return true;
|
|
34299
|
+
if (currentFact.version === null) return false;
|
|
34300
|
+
if (nextFact.version === null) return true;
|
|
34301
|
+
const currentMajor = getDependencyMajorWithinSupportedRange(currentFact.version, 6);
|
|
34302
|
+
const nextMajor = getDependencyMajorWithinSupportedRange(nextFact.version, 6);
|
|
34303
|
+
if (currentMajor === null) return false;
|
|
34304
|
+
if (nextMajor === null) return true;
|
|
34305
|
+
return selectOldestDependencyVersion(currentFact.version, nextFact.version) === nextFact.version;
|
|
34306
|
+
};
|
|
34307
|
+
const collectBindingVersion = (facts, packageJson, directory, packageName) => {
|
|
34308
|
+
const version = getDependencySpec(packageJson, packageName);
|
|
34309
|
+
if (version === null) return;
|
|
34310
|
+
const resolvedVersion = resolveCatalogBackedDependencyVersion({
|
|
34311
|
+
rootDirectory: directory,
|
|
34312
|
+
rootPackageJson: packageJson,
|
|
34313
|
+
packageName,
|
|
34314
|
+
version
|
|
34315
|
+
});
|
|
34316
|
+
if (packageName === MOBX_REACT_PACKAGE_NAME) {
|
|
34317
|
+
facts.mobxReactVersion = facts.hasMobxReact ? selectOldestDependencyVersion(facts.mobxReactVersion, resolvedVersion) : resolvedVersion;
|
|
34318
|
+
facts.hasMobxReact = true;
|
|
34319
|
+
return;
|
|
34320
|
+
}
|
|
34321
|
+
facts.mobxReactLiteVersion = facts.hasMobxReactLite ? selectOldestDependencyVersion(facts.mobxReactLiteVersion, resolvedVersion) : resolvedVersion;
|
|
34322
|
+
facts.hasMobxReactLite = true;
|
|
34323
|
+
};
|
|
34194
34324
|
const evaluateManifestFacts = (facts, packageJson, directory, rootDirectory, rootPackageJson) => {
|
|
34195
34325
|
if (facts.expo.version === null) {
|
|
34196
34326
|
const spec = getDependencySpec(packageJson, "expo");
|
|
@@ -34213,6 +34343,36 @@ const evaluateManifestFacts = (facts, packageJson, directory, rootDirectory, roo
|
|
|
34213
34343
|
sourceDirectory: directory
|
|
34214
34344
|
};
|
|
34215
34345
|
}
|
|
34346
|
+
const mobxSpec = getDependencySpec(packageJson, "mobx");
|
|
34347
|
+
if (mobxSpec !== null) {
|
|
34348
|
+
const nextMobxFact = {
|
|
34349
|
+
version: resolveCatalogBackedDependencyVersion({
|
|
34350
|
+
rootDirectory: directory,
|
|
34351
|
+
rootPackageJson: packageJson,
|
|
34352
|
+
packageName: "mobx",
|
|
34353
|
+
version: mobxSpec
|
|
34354
|
+
}),
|
|
34355
|
+
sourceDirectory: directory
|
|
34356
|
+
};
|
|
34357
|
+
if (shouldReplaceMobxFact(facts.mobx, nextMobxFact)) facts.mobx = nextMobxFact;
|
|
34358
|
+
}
|
|
34359
|
+
collectBindingVersion(facts, packageJson, directory, MOBX_REACT_PACKAGE_NAME);
|
|
34360
|
+
collectBindingVersion(facts, packageJson, directory, MOBX_REACT_LITE_PACKAGE_NAME);
|
|
34361
|
+
facts.hasMobxStateTree = facts.hasMobxStateTree || getDependencySpec(packageJson, MOBX_STATE_TREE_PACKAGE_NAME) !== null;
|
|
34362
|
+
facts.hasMobxReactObserver = facts.hasMobxReactObserver || getDependencySpec(packageJson, MOBX_REACT_OBSERVER_PACKAGE_NAME) !== null;
|
|
34363
|
+
const zustandSpec = getDependencySpec(packageJson, "zustand");
|
|
34364
|
+
if (zustandSpec !== null) {
|
|
34365
|
+
const nextZustandFact = {
|
|
34366
|
+
version: resolveCatalogBackedDependencyVersion({
|
|
34367
|
+
rootDirectory: directory,
|
|
34368
|
+
rootPackageJson: packageJson,
|
|
34369
|
+
packageName: "zustand",
|
|
34370
|
+
version: zustandSpec
|
|
34371
|
+
}),
|
|
34372
|
+
sourceDirectory: directory
|
|
34373
|
+
};
|
|
34374
|
+
if (shouldReplaceSupportedDependencyFact(facts.zustand, nextZustandFact, 5)) facts.zustand = nextZustandFact;
|
|
34375
|
+
}
|
|
34216
34376
|
if (facts.reanimatedVersion === null) {
|
|
34217
34377
|
const spec = getDependencySpec(packageJson, REANIMATED_DEPENDENCY_NAME);
|
|
34218
34378
|
if (spec !== null) facts.reanimatedVersion = spec;
|
|
@@ -34221,6 +34381,15 @@ const evaluateManifestFacts = (facts, packageJson, directory, rootDirectory, roo
|
|
|
34221
34381
|
const spec = getDependencySpec(packageJson, "valtio");
|
|
34222
34382
|
if (spec !== null) facts.valtioVersion = spec;
|
|
34223
34383
|
}
|
|
34384
|
+
facts.tanstackQueryVersion ??= getTanStackQueryVersion(packageJson);
|
|
34385
|
+
const styledComponentsVersion = resolveCatalogBackedDependencyVersion({
|
|
34386
|
+
rootDirectory: directory,
|
|
34387
|
+
rootPackageJson: packageJson,
|
|
34388
|
+
packageName: "styled-components",
|
|
34389
|
+
version: getStyledComponentsVersion(packageJson)
|
|
34390
|
+
});
|
|
34391
|
+
if (styledComponentsVersion && shouldReplaceStyledComponentsVersion(facts.styledComponentsVersion, styledComponentsVersion)) facts.styledComponentsVersion = styledComponentsVersion;
|
|
34392
|
+
facts.hasI18nLibrary = facts.hasI18nLibrary || hasI18nDependency(packageJson);
|
|
34224
34393
|
facts.hasReactNativeAwarePackage = facts.hasReactNativeAwarePackage || isPackageJsonReactNativeAware(packageJson);
|
|
34225
34394
|
facts.hasReanimatedAwarePackage = facts.hasReanimatedAwarePackage || isPackageJsonReanimatedAware(packageJson);
|
|
34226
34395
|
facts.hasSsrDependency = facts.hasSsrDependency || isPackageJsonSsrAware(packageJson);
|
|
@@ -34262,6 +34431,23 @@ const collectWorkspaceFacts = (rootDirectory, rootPackageJson, { collectReactGro
|
|
|
34262
34431
|
sourceDirectory: null
|
|
34263
34432
|
},
|
|
34264
34433
|
valtioVersion: null,
|
|
34434
|
+
mobx: {
|
|
34435
|
+
version: null,
|
|
34436
|
+
sourceDirectory: null
|
|
34437
|
+
},
|
|
34438
|
+
hasMobxReact: false,
|
|
34439
|
+
mobxReactVersion: null,
|
|
34440
|
+
hasMobxReactLite: false,
|
|
34441
|
+
mobxReactLiteVersion: null,
|
|
34442
|
+
hasMobxStateTree: false,
|
|
34443
|
+
hasMobxReactObserver: false,
|
|
34444
|
+
zustand: {
|
|
34445
|
+
version: null,
|
|
34446
|
+
sourceDirectory: null
|
|
34447
|
+
},
|
|
34448
|
+
tanstackQueryVersion: null,
|
|
34449
|
+
styledComponentsVersion: null,
|
|
34450
|
+
hasI18nLibrary: false,
|
|
34265
34451
|
hasReactNativeAwarePackage: false,
|
|
34266
34452
|
hasReanimatedAwarePackage: false,
|
|
34267
34453
|
hasSsrDependency: false,
|
|
@@ -34503,6 +34689,16 @@ const discoverProjectWithoutPackageJson = (directory) => {
|
|
|
34503
34689
|
tailwindVersion: null,
|
|
34504
34690
|
zodVersion: null,
|
|
34505
34691
|
zodMajorVersion: null,
|
|
34692
|
+
mobxVersion: null,
|
|
34693
|
+
mobxMajorVersion: null,
|
|
34694
|
+
hasMobxReact: false,
|
|
34695
|
+
mobxReactVersion: null,
|
|
34696
|
+
hasMobxReactLite: false,
|
|
34697
|
+
mobxReactLiteVersion: null,
|
|
34698
|
+
hasMobxStateTree: false,
|
|
34699
|
+
hasMobxReactObserver: false,
|
|
34700
|
+
zustandVersion: null,
|
|
34701
|
+
zustandMajorVersion: null,
|
|
34506
34702
|
framework: "unknown",
|
|
34507
34703
|
hasTypeScript: hasOwnTsConfig,
|
|
34508
34704
|
hasReactCompiler: false,
|
|
@@ -34513,6 +34709,9 @@ const discoverProjectWithoutPackageJson = (directory) => {
|
|
|
34513
34709
|
hasRemotion: false,
|
|
34514
34710
|
remotionVersion: null,
|
|
34515
34711
|
remotionMajorVersion: null,
|
|
34712
|
+
hasI18nLibrary: false,
|
|
34713
|
+
tanstackQueryVersion: null,
|
|
34714
|
+
styledComponentsVersion: null,
|
|
34516
34715
|
hasSsrDependency: false,
|
|
34517
34716
|
preactVersion: null,
|
|
34518
34717
|
preactMajorVersion: null,
|
|
@@ -34611,6 +34810,12 @@ const discoverProject = (directory) => {
|
|
|
34611
34810
|
packageName: SHOPIFY_FLASH_LIST_PACKAGE_NAME,
|
|
34612
34811
|
version: workspaceFacts.shopifyFlashList.version
|
|
34613
34812
|
}) : null;
|
|
34813
|
+
const zustandVersion = resolveCatalogBackedDependencyVersion({
|
|
34814
|
+
rootDirectory: directory,
|
|
34815
|
+
rootPackageJson: packageJson,
|
|
34816
|
+
packageName: "zustand",
|
|
34817
|
+
version: workspaceFacts.zustand.version
|
|
34818
|
+
});
|
|
34614
34819
|
const hasReanimated = hasReactNativeWorkspace && workspaceFacts.hasReanimatedAwarePackage;
|
|
34615
34820
|
const reanimatedVersion = hasReanimated ? workspaceFacts.reanimatedVersion : null;
|
|
34616
34821
|
const nextjsVersion = framework === "nextjs" ? resolveCatalogBackedDependencyVersion({
|
|
@@ -34625,8 +34830,15 @@ const discoverProject = (directory) => {
|
|
|
34625
34830
|
packageName: "valtio",
|
|
34626
34831
|
version: workspaceFacts.valtioVersion
|
|
34627
34832
|
});
|
|
34833
|
+
const mobxVersion = resolveCatalogBackedDependencyVersion({
|
|
34834
|
+
rootDirectory: directory,
|
|
34835
|
+
rootPackageJson: packageJson,
|
|
34836
|
+
packageName: "mobx",
|
|
34837
|
+
version: workspaceFacts.mobx.version
|
|
34838
|
+
});
|
|
34628
34839
|
const preactVersion = getPreactVersion(packageJson);
|
|
34629
34840
|
const remotionVersion = workspaceFacts.remotionVersion;
|
|
34841
|
+
const tanstackQueryVersion = getTanStackQueryVersion(packageJson) ?? workspaceFacts.tanstackQueryVersion;
|
|
34630
34842
|
const isPreES2023Target = hasTypeScript && detectPreES2023Target(directory);
|
|
34631
34843
|
const projectInfo = {
|
|
34632
34844
|
rootDirectory: directory,
|
|
@@ -34636,11 +34848,24 @@ const discoverProject = (directory) => {
|
|
|
34636
34848
|
tailwindVersion,
|
|
34637
34849
|
zodVersion,
|
|
34638
34850
|
zodMajorVersion: zodVersion === null ? null : getLowestDependencyMajor(zodVersion),
|
|
34851
|
+
mobxVersion,
|
|
34852
|
+
mobxMajorVersion: mobxVersion === null ? null : getDependencyMajorWithinSupportedRange(mobxVersion, 6),
|
|
34853
|
+
hasMobxReact: workspaceFacts.hasMobxReact,
|
|
34854
|
+
mobxReactVersion: workspaceFacts.mobxReactVersion,
|
|
34855
|
+
hasMobxReactLite: workspaceFacts.hasMobxReactLite,
|
|
34856
|
+
mobxReactLiteVersion: workspaceFacts.mobxReactLiteVersion,
|
|
34857
|
+
hasMobxStateTree: workspaceFacts.hasMobxStateTree,
|
|
34858
|
+
hasMobxReactObserver: workspaceFacts.hasMobxReactObserver,
|
|
34859
|
+
zustandVersion,
|
|
34860
|
+
zustandMajorVersion: zustandVersion === null ? null : getLowestDependencyMajor(zustandVersion),
|
|
34639
34861
|
framework,
|
|
34640
34862
|
hasTypeScript,
|
|
34641
34863
|
hasReactCompiler: detectReactCompiler(directory, packageJson),
|
|
34642
34864
|
hasReactCompilerLintPlugin: detectReactCompilerLintPlugin(directory, packageJson),
|
|
34643
|
-
hasTanStackQuery:
|
|
34865
|
+
hasTanStackQuery: tanstackQueryVersion !== null,
|
|
34866
|
+
hasI18nLibrary: workspaceFacts.hasI18nLibrary,
|
|
34867
|
+
tanstackQueryVersion,
|
|
34868
|
+
styledComponentsVersion: workspaceFacts.styledComponentsVersion,
|
|
34644
34869
|
valtioVersion,
|
|
34645
34870
|
valtioMajorVersion: valtioVersion === null ? null : getLowestDependencyMajor(valtioVersion),
|
|
34646
34871
|
hasRemotion: workspaceFacts.hasRemotionDependency,
|
|
@@ -37862,21 +38087,62 @@ const buildCapabilities = (project) => {
|
|
|
37862
38087
|
if (CLIENT_ONLY_FRAMEWORKS.has(project.framework)) capabilities.add("client-only");
|
|
37863
38088
|
if (project.isStaticExport) capabilities.add("nextjs:static-export");
|
|
37864
38089
|
if (project.nextjsMajorVersion !== null && project.nextjsMajorVersion >= 15) capabilities.add("nextjs:15");
|
|
38090
|
+
if (project.nextjsMajorVersion !== null && project.nextjsMajorVersion >= 16) capabilities.add("nextjs:16");
|
|
37865
38091
|
addMajorLadder(capabilities, "react", project.reactMajorVersion, 17, 30);
|
|
37866
38092
|
if (project.reactMajorVersion !== null && project.reactMajorVersion >= 19 && isMajorMinorAtLeast(parseReactMajorMinor(project.reactVersion), {
|
|
37867
38093
|
major: 19,
|
|
37868
38094
|
minor: 2
|
|
37869
38095
|
})) capabilities.add("react:19.2");
|
|
37870
|
-
if (project.tailwindVersion !== null)
|
|
37871
|
-
|
|
37872
|
-
|
|
37873
|
-
|
|
37874
|
-
|
|
38096
|
+
if (project.tailwindVersion !== null) {
|
|
38097
|
+
capabilities.add("tailwind");
|
|
38098
|
+
const tailwindVersion = parseTailwindMajorMinor(project.tailwindVersion);
|
|
38099
|
+
if (isMajorMinorAtLeast(tailwindVersion, {
|
|
38100
|
+
major: 3,
|
|
38101
|
+
minor: 4
|
|
38102
|
+
})) capabilities.add("tailwind:3.4");
|
|
38103
|
+
if (tailwindVersion !== null && isMajorMinorAtLeast(tailwindVersion, {
|
|
38104
|
+
major: 4,
|
|
38105
|
+
minor: 0
|
|
38106
|
+
})) capabilities.add("tailwind:4");
|
|
38107
|
+
}
|
|
37875
38108
|
if (project.zodVersion !== null) capabilities.add("zod");
|
|
37876
38109
|
if (project.zodMajorVersion !== null && project.zodMajorVersion >= 4) capabilities.add("zod:4");
|
|
38110
|
+
if (project.mobxVersion !== void 0 && project.mobxVersion !== null || project.hasMobxReact === true || project.hasMobxReactLite === true || project.hasMobxStateTree === true || project.hasMobxReactObserver === true) capabilities.add("mobx");
|
|
38111
|
+
if (project.hasMobxReact === true) capabilities.add("mobx-react");
|
|
38112
|
+
if (project.hasMobxReactLite === true) capabilities.add("mobx-react-lite");
|
|
38113
|
+
if (project.hasMobxReact === true || project.hasMobxReactLite === true) capabilities.add("mobx-react-binding");
|
|
38114
|
+
const mobxReactVersion = parseDependencyMajorMinor(project.mobxReactVersion);
|
|
38115
|
+
const mobxReactLiteVersion = parseDependencyMajorMinor(project.mobxReactLiteVersion);
|
|
38116
|
+
const hasMobxReactObserverMemoGuard = mobxReactVersion !== null && isMajorMinorAtLeast(mobxReactVersion, {
|
|
38117
|
+
major: 7,
|
|
38118
|
+
minor: 3
|
|
38119
|
+
});
|
|
38120
|
+
const hasMobxReactLiteObserverMemoGuard = mobxReactLiteVersion !== null && isMajorMinorAtLeast(mobxReactLiteVersion, {
|
|
38121
|
+
major: 3,
|
|
38122
|
+
minor: 3
|
|
38123
|
+
});
|
|
38124
|
+
if (hasMobxReactObserverMemoGuard) capabilities.add("mobx-react-observer-memo-guard");
|
|
38125
|
+
if (hasMobxReactLiteObserverMemoGuard) capabilities.add("mobx-react-lite-observer-memo-guard");
|
|
38126
|
+
if (hasMobxReactObserverMemoGuard || hasMobxReactLiteObserverMemoGuard) capabilities.add("mobx-react-binding-observer-memo-guard");
|
|
38127
|
+
if (project.hasMobxStateTree === true) capabilities.add("mobx-state-tree");
|
|
38128
|
+
if (project.hasMobxReactObserver === true) capabilities.add("mobx-react-observer");
|
|
38129
|
+
if (project.mobxMajorVersion !== void 0 && project.mobxMajorVersion !== null && project.mobxMajorVersion >= 4 && project.mobxMajorVersion <= 6) addMajorLadder(capabilities, "mobx", project.mobxMajorVersion, 4, 6);
|
|
38130
|
+
const mobxVersion = parseDependencyMajorMinor(project.mobxVersion);
|
|
38131
|
+
if (project.mobxMajorVersion === 6 && mobxVersion !== null && isMajorMinorAtLeast(mobxVersion, {
|
|
38132
|
+
major: 6,
|
|
38133
|
+
minor: 10
|
|
38134
|
+
})) capabilities.add("mobx:6.10");
|
|
38135
|
+
if (project.zustandVersion !== void 0 && project.zustandVersion !== null) capabilities.add("zustand");
|
|
38136
|
+
if (project.zustandMajorVersion !== void 0 && project.zustandMajorVersion !== null && project.zustandMajorVersion >= 1 && project.zustandMajorVersion <= 5) addMajorLadder(capabilities, "zustand", project.zustandMajorVersion, 1, 5);
|
|
37877
38137
|
if (project.isPreES2023Target) capabilities.add("pre-es2023");
|
|
37878
38138
|
if (project.hasReactCompiler) capabilities.add("react-compiler");
|
|
37879
|
-
if (project.hasTanStackQuery) capabilities.add("tanstack-query");
|
|
38139
|
+
if (Boolean(project.hasTanStackQuery) || Boolean(project.tanstackQueryVersion)) capabilities.add("tanstack-query");
|
|
38140
|
+
if (project.styledComponentsVersion) {
|
|
38141
|
+
capabilities.add("styled-components");
|
|
38142
|
+
const styledComponentsMajor = getLowestDependencyMajor(project.styledComponentsVersion);
|
|
38143
|
+
if (styledComponentsMajor !== null && styledComponentsMajor >= 6) capabilities.add("styled-components:6");
|
|
38144
|
+
}
|
|
38145
|
+
if (project.hasI18nLibrary) capabilities.add("i18n");
|
|
37880
38146
|
if (project.valtioVersion !== null) capabilities.add("valtio");
|
|
37881
38147
|
addMajorLadder(capabilities, "valtio", project.valtioMajorVersion, 1, 10);
|
|
37882
38148
|
if (project.hasRemotion) {
|
|
@@ -37897,7 +38163,7 @@ const getCapabilities = (project) => {
|
|
|
37897
38163
|
capabilitiesByProject.set(project, capabilities);
|
|
37898
38164
|
return capabilities;
|
|
37899
38165
|
};
|
|
37900
|
-
const shouldEnableRule = (requires, tags, capabilities, ignoredTags, disabledWhen) => {
|
|
38166
|
+
const shouldEnableRule = (requires, tags, capabilities, ignoredTags, disabledWhen, includedTags) => {
|
|
37901
38167
|
if (requires) {
|
|
37902
38168
|
for (const capability of requires) if (!capabilities.has(capability)) return false;
|
|
37903
38169
|
}
|
|
@@ -37908,20 +38174,29 @@ const shouldEnableRule = (requires, tags, capabilities, ignoredTags, disabledWhe
|
|
|
37908
38174
|
if (tags) {
|
|
37909
38175
|
for (const tag of tags) if (ignoredTags.has(tag)) return false;
|
|
37910
38176
|
}
|
|
38177
|
+
if (includedTags && includedTags.size > 0) {
|
|
38178
|
+
if (!tags?.some((tag) => includedTags.has(tag))) return false;
|
|
38179
|
+
}
|
|
37911
38180
|
return true;
|
|
37912
38181
|
};
|
|
38182
|
+
const shouldEnableRuleByDefaultStatus = (options) => options.defaultEnabled !== false || options.hasExplicitOverride === true || options.includeTagDefaults && options.hasIncludedTags;
|
|
37913
38183
|
const yieldToEventLoop = () => new Promise((resolve) => {
|
|
37914
38184
|
setImmediate(resolve);
|
|
37915
38185
|
});
|
|
37916
38186
|
const createSecurityScanSession = (rootDirectory, options) => {
|
|
37917
38187
|
const capabilities = options.project ? getCapabilities(options.project) : /* @__PURE__ */ new Set();
|
|
37918
38188
|
const ignoredTags = options.ignoredTags ?? /* @__PURE__ */ new Set();
|
|
38189
|
+
const includedTags = options.includedTags ?? /* @__PURE__ */ new Set();
|
|
37919
38190
|
const enabledScanRules = REACT_DOCTOR_RULES.flatMap((entry) => {
|
|
37920
38191
|
const rule = entry.rule;
|
|
37921
38192
|
const scan = rule.scan;
|
|
37922
38193
|
if (typeof scan !== "function") return [];
|
|
37923
|
-
if (
|
|
37924
|
-
|
|
38194
|
+
if (!shouldEnableRuleByDefaultStatus({
|
|
38195
|
+
defaultEnabled: rule.defaultEnabled,
|
|
38196
|
+
includeTagDefaults: options.includeTagDefaults === true,
|
|
38197
|
+
hasIncludedTags: includedTags.size > 0
|
|
38198
|
+
})) return [];
|
|
38199
|
+
if (!shouldEnableRule(rule.requires, rule.tags, capabilities, ignoredTags, rule.disabledWhen, includedTags)) return [];
|
|
37925
38200
|
return [{
|
|
37926
38201
|
entry,
|
|
37927
38202
|
scan,
|
|
@@ -39907,8 +40182,9 @@ const buildUserPluginRules = (userPlugin, severityControls) => {
|
|
|
39907
40182
|
}
|
|
39908
40183
|
return enabled;
|
|
39909
40184
|
};
|
|
39910
|
-
const createOxlintConfig = ({ pluginPath, project, customRulesOnly = false, extendsPaths = [], ignoredTags = /* @__PURE__ */ new Set(), serverAuthFunctionNames, severityControls, userPlugins = [], disableReactHooksJsPlugin = false, ruleSelection, sidecarRuleIdFilter }) => {
|
|
39911
|
-
const
|
|
40185
|
+
const createOxlintConfig = ({ pluginPath, project, customRulesOnly = false, extendsPaths = [], ignoredTags = /* @__PURE__ */ new Set(), includedTags = /* @__PURE__ */ new Set(), includeTagDefaults = false, serverAuthFunctionNames, severityControls, userPlugins = [], disableReactHooksJsPlugin = false, ruleSelection, sidecarRuleIdFilter }) => {
|
|
40186
|
+
const hasIncludedTags = includedTags.size > 0;
|
|
40187
|
+
const reactHooksJsPlugin = disableReactHooksJsPlugin || ruleSelection === "sidecar" || hasIncludedTags ? null : resolveReactHooksJsPlugin(project.hasReactCompiler || project.hasReactCompilerLintPlugin === true, customRulesOnly);
|
|
39912
40188
|
const reactCompilerRules = reactHooksJsPlugin ? applyRuleSeverityControls(filterRulesToAvailable(REACT_COMPILER_RULES, "react-hooks-js", reactHooksJsPlugin.availableRuleNames), severityControls) : {};
|
|
39913
40189
|
const jsPlugins = [];
|
|
39914
40190
|
if (reactHooksJsPlugin) jsPlugins.push(reactHooksJsPlugin.entry);
|
|
@@ -39923,9 +40199,14 @@ const createOxlintConfig = ({ pluginPath, project, customRulesOnly = false, exte
|
|
|
39923
40199
|
if (rule.scan !== void 0) continue;
|
|
39924
40200
|
if (customRulesOnly && registryEntry.originallyExternal) continue;
|
|
39925
40201
|
if (rule.framework !== "global" && !rule.requires) continue;
|
|
39926
|
-
if (!shouldEnableRule(rule.requires, rule.tags, capabilities, ignoredTags, rule.disabledWhen)) continue;
|
|
40202
|
+
if (!shouldEnableRule(rule.requires, rule.tags, capabilities, ignoredTags, rule.disabledWhen, includedTags)) continue;
|
|
39927
40203
|
const explicitRuleOverride = resolveRuleSeverityOverride({ ruleKey: registryEntry.key }, severityControls);
|
|
39928
|
-
if (
|
|
40204
|
+
if (!shouldEnableRuleByDefaultStatus({
|
|
40205
|
+
defaultEnabled: rule.defaultEnabled,
|
|
40206
|
+
includeTagDefaults,
|
|
40207
|
+
hasIncludedTags,
|
|
40208
|
+
hasExplicitOverride: explicitRuleOverride !== void 0
|
|
40209
|
+
})) continue;
|
|
39929
40210
|
const severity = resolveRuleSeverityOverride({
|
|
39930
40211
|
ruleKey: registryEntry.key,
|
|
39931
40212
|
category: rule.category
|
|
@@ -39934,7 +40215,7 @@ const createOxlintConfig = ({ pluginPath, project, customRulesOnly = false, exte
|
|
|
39934
40215
|
enabledReactDoctorRules[registryEntry.key] = severity;
|
|
39935
40216
|
}
|
|
39936
40217
|
const userPluginRules = {};
|
|
39937
|
-
if (ruleSelection !== "sidecar") for (const userPlugin of userPlugins) {
|
|
40218
|
+
if (ruleSelection !== "sidecar" && !hasIncludedTags) for (const userPlugin of userPlugins) {
|
|
39938
40219
|
Object.assign(userPluginRules, buildUserPluginRules(userPlugin, severityControls));
|
|
39939
40220
|
jsPlugins.push(userPlugin.entry);
|
|
39940
40221
|
}
|
|
@@ -40151,6 +40432,19 @@ const createSidecarLintCache = (cacheDirectory, rulesetHash) => {
|
|
|
40151
40432
|
}
|
|
40152
40433
|
};
|
|
40153
40434
|
};
|
|
40435
|
+
const fingerprintCacheByFilePath = /* @__PURE__ */ new Map();
|
|
40436
|
+
const fingerprintFileContents = (filePath, fingerprintLength) => {
|
|
40437
|
+
const fileStats = NFS.statSync(filePath, { bigint: true });
|
|
40438
|
+
const cachedFingerprint = fingerprintCacheByFilePath.get(filePath);
|
|
40439
|
+
if (cachedFingerprint?.modifiedTimeNanoseconds === fileStats.mtimeNs && cachedFingerprint.sizeBytes === fileStats.size) return cachedFingerprint.fingerprint;
|
|
40440
|
+
const fingerprint = crypto.createHash("sha256").update(NFS.readFileSync(filePath)).digest("hex").slice(0, fingerprintLength);
|
|
40441
|
+
fingerprintCacheByFilePath.set(filePath, {
|
|
40442
|
+
fingerprint,
|
|
40443
|
+
modifiedTimeNanoseconds: fileStats.mtimeNs,
|
|
40444
|
+
sizeBytes: fileStats.size
|
|
40445
|
+
});
|
|
40446
|
+
return fingerprint;
|
|
40447
|
+
};
|
|
40154
40448
|
const bundledRequire = createRequire(import.meta.url);
|
|
40155
40449
|
const childNodeVersionByBinaryPath = /* @__PURE__ */ new Map();
|
|
40156
40450
|
const resolveChildNodeVersion = (nodeBinaryPath) => {
|
|
@@ -40174,6 +40468,13 @@ const TOOLCHAIN_PACKAGE_SPECIFIERS = [
|
|
|
40174
40468
|
"oxlint-plugin-react-doctor/package.json",
|
|
40175
40469
|
"eslint-plugin-react-hooks/package.json"
|
|
40176
40470
|
];
|
|
40471
|
+
const resolvePluginFingerprint = () => {
|
|
40472
|
+
try {
|
|
40473
|
+
return fingerprintFileContents(bundledRequire.resolve("oxlint-plugin-react-doctor"), 16);
|
|
40474
|
+
} catch {
|
|
40475
|
+
return "unresolved";
|
|
40476
|
+
}
|
|
40477
|
+
};
|
|
40177
40478
|
const resolveOxlintToolchainVersions = (nodeBinaryPath = process.execPath) => {
|
|
40178
40479
|
const versions = [`node=${resolveChildNodeVersion(nodeBinaryPath)}`];
|
|
40179
40480
|
for (const specifier of TOOLCHAIN_PACKAGE_SPECIFIERS) try {
|
|
@@ -40183,6 +40484,7 @@ const resolveOxlintToolchainVersions = (nodeBinaryPath = process.execPath) => {
|
|
|
40183
40484
|
} catch {
|
|
40184
40485
|
versions.push(`${specifier}=missing`);
|
|
40185
40486
|
}
|
|
40487
|
+
versions.push(`oxlint-plugin-react-doctor#fingerprint=${resolvePluginFingerprint()}`);
|
|
40186
40488
|
return versions;
|
|
40187
40489
|
};
|
|
40188
40490
|
const esmRequire = createRequire(import.meta.url);
|
|
@@ -41658,7 +41960,7 @@ const reactHooksJsPluginDropNote = (error) => {
|
|
|
41658
41960
|
* 6. always restore disable directives + clean up the temp dir
|
|
41659
41961
|
*/
|
|
41660
41962
|
const runOxlint = async (options) => {
|
|
41661
|
-
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;
|
|
41963
|
+
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;
|
|
41662
41964
|
const serverAuthFunctionNames = Array.isArray(userConfig?.serverAuthFunctionNames) ? userConfig.serverAuthFunctionNames.filter((entry) => typeof entry === "string" && entry.length > 0) : void 0;
|
|
41663
41965
|
const severityControls = buildRuleSeverityControls(userConfig);
|
|
41664
41966
|
validateRuleRegistration();
|
|
@@ -41672,13 +41974,15 @@ const runOxlint = async (options) => {
|
|
|
41672
41974
|
}
|
|
41673
41975
|
const pluginPath = resolvePluginPath();
|
|
41674
41976
|
const extendsPaths = (adoptExistingLintConfig && !customRulesOnly ? detectUserLintConfigPaths(rootDirectory) : []).filter(canOxlintExtendConfig);
|
|
41675
|
-
const userPlugins = resolveUserPlugins(userConfig?.plugins, configSourceDirectory);
|
|
41977
|
+
const userPlugins = includedTags.size > 0 ? [] : resolveUserPlugins(userConfig?.plugins, configSourceDirectory);
|
|
41676
41978
|
const buildConfig = (overrides) => createOxlintConfig({
|
|
41677
41979
|
pluginPath,
|
|
41678
41980
|
project,
|
|
41679
41981
|
customRulesOnly,
|
|
41680
41982
|
extendsPaths: overrides.extendsPaths,
|
|
41681
41983
|
ignoredTags,
|
|
41984
|
+
includedTags,
|
|
41985
|
+
includeTagDefaults,
|
|
41682
41986
|
serverAuthFunctionNames,
|
|
41683
41987
|
severityControls,
|
|
41684
41988
|
userPlugins,
|
|
@@ -42067,6 +42371,8 @@ var Linter = class Linter extends Service()("react-doctor/Linter") {
|
|
|
42067
42371
|
respectInlineDisables: input.respectInlineDisables,
|
|
42068
42372
|
adoptExistingLintConfig: input.adoptExistingLintConfig,
|
|
42069
42373
|
ignoredTags: input.ignoredTags,
|
|
42374
|
+
includedTags: input.includedTags,
|
|
42375
|
+
includeTagDefaults: input.includeTagDefaults,
|
|
42070
42376
|
userConfig: input.userConfig ?? null,
|
|
42071
42377
|
configSourceDirectory: input.configSourceDirectory,
|
|
42072
42378
|
onPartialFailure: (reason) => {
|
|
@@ -42915,7 +43221,9 @@ const runInspect = (input, hooks = {}) => gen(function* () {
|
|
|
42915
43221
|
const securityScanFailedRef = yield* make$13(false);
|
|
42916
43222
|
const securityScanFiber = yield* forkChild(runCollect(applyPerElementPipeline(isDiffMode ? empty$4 : unwrap(tryPromise(() => checkSecurityScanCooperative(scanDirectory, {
|
|
42917
43223
|
project,
|
|
42918
|
-
ignoredTags: input.ignoredTags
|
|
43224
|
+
ignoredTags: input.ignoredTags,
|
|
43225
|
+
includedTags: input.includedTags,
|
|
43226
|
+
includeTagDefaults: input.includeTagDefaults
|
|
42919
43227
|
})).pipe(map$3((diagnostics) => fromIterable$1(diagnostics)), catch_$1(() => set(securityScanFailedRef, true).pipe(as(empty$4))))))).pipe(withSpan("SecurityScan.run")));
|
|
42920
43228
|
const shouldRunSupplyChain = !isDiffMode || (input.supplyChainManifestChanged ?? false);
|
|
42921
43229
|
const supplyChainOverlapTimeout = yield* SupplyChainOverlapTimeoutMs;
|
|
@@ -43006,6 +43314,8 @@ const runInspect = (input, hooks = {}) => gen(function* () {
|
|
|
43006
43314
|
respectInlineDisables: input.respectInlineDisables,
|
|
43007
43315
|
adoptExistingLintConfig: input.adoptExistingLintConfig,
|
|
43008
43316
|
ignoredTags: input.ignoredTags,
|
|
43317
|
+
includedTags: input.includedTags,
|
|
43318
|
+
includeTagDefaults: input.includeTagDefaults,
|
|
43009
43319
|
userConfig: resolvedConfig.config ?? void 0,
|
|
43010
43320
|
configSourceDirectory: resolvedConfig.configSourceDirectory ?? void 0,
|
|
43011
43321
|
onFileProgress: (scannedFileCount, totalFileCount) => {
|
|
@@ -45508,5 +45818,5 @@ const startLanguageServer = () => {
|
|
|
45508
45818
|
};
|
|
45509
45819
|
//#endregion
|
|
45510
45820
|
export { startLanguageServer };
|
|
45511
|
-
!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]="
|
|
45512
|
-
//# debugId=
|
|
45821
|
+
!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]="f864b0b7-d64a-58b1-8eed-e2387bc445d5")}catch(e){}}();
|
|
45822
|
+
//# debugId=f864b0b7-d64a-58b1-8eed-e2387bc445d5
|