react-doctor 0.8.1-dev.0b0b5ac → 0.8.1-dev.21221c2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +4 -14
- package/dist/cli.js +99 -437
- package/dist/index.d.ts +0 -27
- package/dist/index.js +55 -346
- package/dist/lsp.js +55 -346
- package/dist/skills/react-doctor/SKILL.md +0 -5
- package/package.json +4 -4
package/dist/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
|
|
2
|
-
!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="
|
|
2
|
+
!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="f412a400-e7a3-5cfa-a67f-1192f6a38df2")}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";
|
|
@@ -33375,10 +33375,10 @@ const FALLBACK_TSCONFIG_FILENAMES = ["tsconfig.app.json", "tsconfig.build.json"]
|
|
|
33375
33375
|
const FRAMEWORK_PACKAGES = {
|
|
33376
33376
|
next: "nextjs",
|
|
33377
33377
|
"@tanstack/react-start": "tanstack-start",
|
|
33378
|
-
"@remix-run/react": "remix",
|
|
33379
|
-
gatsby: "gatsby",
|
|
33380
33378
|
vite: "vite",
|
|
33381
33379
|
"react-scripts": "cra",
|
|
33380
|
+
"@remix-run/react": "remix",
|
|
33381
|
+
gatsby: "gatsby",
|
|
33382
33382
|
expo: "expo",
|
|
33383
33383
|
"react-native": "react-native"
|
|
33384
33384
|
};
|
|
@@ -33402,17 +33402,11 @@ const NEXT_CONFIG_FILENAMES = [
|
|
|
33402
33402
|
];
|
|
33403
33403
|
const BABEL_CONFIG_FILENAMES = [
|
|
33404
33404
|
".babelrc",
|
|
33405
|
-
".babelrc.js",
|
|
33406
33405
|
".babelrc.json",
|
|
33407
|
-
".babelrc.cjs",
|
|
33408
|
-
".babelrc.mjs",
|
|
33409
|
-
".babelrc.cts",
|
|
33410
33406
|
"babel.config.js",
|
|
33411
33407
|
"babel.config.json",
|
|
33412
33408
|
"babel.config.cjs",
|
|
33413
|
-
"babel.config.mjs"
|
|
33414
|
-
"babel.config.ts",
|
|
33415
|
-
"babel.config.cts"
|
|
33409
|
+
"babel.config.mjs"
|
|
33416
33410
|
];
|
|
33417
33411
|
const VITE_CONFIG_FILENAMES = [
|
|
33418
33412
|
"vite.config.js",
|
|
@@ -33424,28 +33418,12 @@ const VITE_CONFIG_FILENAMES = [
|
|
|
33424
33418
|
"vitest.config.ts",
|
|
33425
33419
|
"vitest.config.js"
|
|
33426
33420
|
];
|
|
33427
|
-
const RSBUILD_CONFIG_FILENAMES = [
|
|
33428
|
-
"rsbuild.config.ts",
|
|
33429
|
-
"rsbuild.config.js",
|
|
33430
|
-
"rsbuild.config.mts",
|
|
33431
|
-
"rsbuild.config.mjs",
|
|
33432
|
-
"rsbuild.config.cts",
|
|
33433
|
-
"rsbuild.config.cjs"
|
|
33434
|
-
];
|
|
33435
|
-
const RSPACK_CONFIG_FILENAMES = [
|
|
33436
|
-
"rspack.config.ts",
|
|
33437
|
-
"rspack.config.js",
|
|
33438
|
-
"rspack.config.mts",
|
|
33439
|
-
"rspack.config.mjs",
|
|
33440
|
-
"rspack.config.cts",
|
|
33441
|
-
"rspack.config.cjs"
|
|
33442
|
-
];
|
|
33443
33421
|
const EXPO_APP_CONFIG_FILENAMES = [
|
|
33444
33422
|
"app.json",
|
|
33445
33423
|
"app.config.js",
|
|
33446
33424
|
"app.config.ts"
|
|
33447
33425
|
];
|
|
33448
|
-
const REACT_COMPILER_PACKAGE_REFERENCE_PATTERN = /babel-plugin-react-compiler|react-compiler-runtime|
|
|
33426
|
+
const REACT_COMPILER_PACKAGE_REFERENCE_PATTERN = /babel-plugin-react-compiler|react-compiler-runtime|["']react-compiler["']/;
|
|
33449
33427
|
const REACT_COMPILER_ENABLED_FLAG_PATTERN = /["']?reactCompiler["']?\s*:\s*(?:true\b|\{)/;
|
|
33450
33428
|
const STATIC_EXPORT_OUTPUT_PATTERN = /(?:^|[^.\w])["']?output["']?\s*:\s*["']export["']/m;
|
|
33451
33429
|
const hasCompilerPackage = (packageJson, compilerPackages) => {
|
|
@@ -33480,8 +33458,6 @@ const detectReactCompiler = (directory, packageJson) => {
|
|
|
33480
33458
|
if (hasCompilerInConfigFiles(directory, NEXT_CONFIG_FILENAMES)) return true;
|
|
33481
33459
|
if (hasCompilerInConfigFiles(directory, BABEL_CONFIG_FILENAMES)) return true;
|
|
33482
33460
|
if (hasCompilerInConfigFiles(directory, VITE_CONFIG_FILENAMES)) return true;
|
|
33483
|
-
if (hasCompilerInConfigFiles(directory, RSBUILD_CONFIG_FILENAMES)) return true;
|
|
33484
|
-
if (hasCompilerInConfigFiles(directory, RSPACK_CONFIG_FILENAMES)) return true;
|
|
33485
33461
|
if (hasCompilerInConfigFiles(directory, EXPO_APP_CONFIG_FILENAMES)) return true;
|
|
33486
33462
|
return hasCompilerPackageInAncestors(directory, REACT_COMPILER_TRANSFORM_PACKAGES);
|
|
33487
33463
|
};
|
|
@@ -33929,6 +33905,19 @@ const getPreactVersion = (packageJson) => {
|
|
|
33929
33905
|
...packageJson.devDependencies
|
|
33930
33906
|
}.preact ?? null;
|
|
33931
33907
|
};
|
|
33908
|
+
const TANSTACK_QUERY_PACKAGES = new Set([
|
|
33909
|
+
"@tanstack/react-query",
|
|
33910
|
+
"@tanstack/query-core",
|
|
33911
|
+
"react-query"
|
|
33912
|
+
]);
|
|
33913
|
+
const hasTanStackQuery = (packageJson) => {
|
|
33914
|
+
const allDependencies = {
|
|
33915
|
+
...packageJson.peerDependencies,
|
|
33916
|
+
...packageJson.dependencies,
|
|
33917
|
+
...packageJson.devDependencies
|
|
33918
|
+
};
|
|
33919
|
+
return Object.keys(allDependencies).some((packageName) => TANSTACK_QUERY_PACKAGES.has(packageName));
|
|
33920
|
+
};
|
|
33932
33921
|
const resolveCatalogBackedDependencyVersion = ({ rootDirectory, rootPackageJson, packageName, version }) => {
|
|
33933
33922
|
if (version === null || !isCatalogReference(version)) return version;
|
|
33934
33923
|
const catalogName = extractCatalogName(version);
|
|
@@ -34131,60 +34120,7 @@ const listWorkspacePackages = (rootDirectory) => {
|
|
|
34131
34120
|
}
|
|
34132
34121
|
return packages;
|
|
34133
34122
|
};
|
|
34134
|
-
const getPreferredDependencyVersion = ({ packageJson, packageNames }) => {
|
|
34135
|
-
const allDependencies = {
|
|
34136
|
-
...packageJson.devDependencies,
|
|
34137
|
-
...packageJson.peerDependencies,
|
|
34138
|
-
...packageJson.dependencies
|
|
34139
|
-
};
|
|
34140
|
-
for (const packageName of packageNames) {
|
|
34141
|
-
const version = allDependencies[packageName];
|
|
34142
|
-
if (version !== void 0) return version;
|
|
34143
|
-
}
|
|
34144
|
-
return null;
|
|
34145
|
-
};
|
|
34146
|
-
const TANSTACK_REACT_QUERY_PACKAGES = ["@tanstack/react-query", "react-query"];
|
|
34147
|
-
const getTanStackQueryVersion = (packageJson) => {
|
|
34148
|
-
return getPreferredDependencyVersion({
|
|
34149
|
-
packageJson,
|
|
34150
|
-
packageNames: TANSTACK_REACT_QUERY_PACKAGES
|
|
34151
|
-
});
|
|
34152
|
-
};
|
|
34153
|
-
const STYLED_COMPONENTS_PACKAGES = ["styled-components"];
|
|
34154
|
-
const getStyledComponentsVersion = (packageJson) => {
|
|
34155
|
-
return getPreferredDependencyVersion({
|
|
34156
|
-
packageJson,
|
|
34157
|
-
packageNames: STYLED_COMPONENTS_PACKAGES
|
|
34158
|
-
});
|
|
34159
|
-
};
|
|
34160
|
-
const I18N_PACKAGES = [
|
|
34161
|
-
"i18next",
|
|
34162
|
-
"react-i18next",
|
|
34163
|
-
"next-i18next",
|
|
34164
|
-
"react-intl",
|
|
34165
|
-
"next-intl",
|
|
34166
|
-
"use-intl",
|
|
34167
|
-
"@formatjs/intl",
|
|
34168
|
-
"@lingui/core",
|
|
34169
|
-
"@lingui/react",
|
|
34170
|
-
"typesafe-i18n",
|
|
34171
|
-
"@tolgee/react",
|
|
34172
|
-
"react-intl-universal"
|
|
34173
|
-
];
|
|
34174
|
-
const hasI18nDependency = (packageJson) => {
|
|
34175
|
-
const allDependencies = {
|
|
34176
|
-
...packageJson.peerDependencies,
|
|
34177
|
-
...packageJson.dependencies,
|
|
34178
|
-
...packageJson.devDependencies,
|
|
34179
|
-
...packageJson.optionalDependencies
|
|
34180
|
-
};
|
|
34181
|
-
return I18N_PACKAGES.some((packageName) => allDependencies[packageName] !== void 0);
|
|
34182
|
-
};
|
|
34183
34123
|
const REANIMATED_DEPENDENCY_NAME = "react-native-reanimated";
|
|
34184
|
-
const MOBX_REACT_PACKAGE_NAME = "mobx-react";
|
|
34185
|
-
const MOBX_REACT_LITE_PACKAGE_NAME = "mobx-react-lite";
|
|
34186
|
-
const MOBX_STATE_TREE_PACKAGE_NAME = "mobx-state-tree";
|
|
34187
|
-
const MOBX_REACT_OBSERVER_PACKAGE_NAME = "mobx-react-observer";
|
|
34188
34124
|
const SHOPIFY_FLASH_LIST_PACKAGE_NAME = "@shopify/flash-list";
|
|
34189
34125
|
const resolveWorkspaceDependencyVersion = ({ concreteVersion, packageName, rootDirectory, rootPackageJson, sections, workspaceDirectory, workspacePackageJson }) => {
|
|
34190
34126
|
const dependencyDeclaration = getDependencyDeclaration({
|
|
@@ -34203,26 +34139,7 @@ const shouldReplaceReactVersion = (currentVersion, nextVersion) => {
|
|
|
34203
34139
|
if (nextMajor === null) return false;
|
|
34204
34140
|
return nextMajor < currentMajor;
|
|
34205
34141
|
};
|
|
34206
|
-
const
|
|
34207
|
-
if (currentFact.version === null) return true;
|
|
34208
|
-
if (nextFact.version === null) return false;
|
|
34209
|
-
const currentMajor = getLowestDependencyMajor(currentFact.version);
|
|
34210
|
-
const nextMajor = getLowestDependencyMajor(nextFact.version);
|
|
34211
|
-
if (currentMajor === null) return false;
|
|
34212
|
-
if (nextMajor === null) return true;
|
|
34213
|
-
if (currentMajor > latestSupportedMajor) return false;
|
|
34214
|
-
if (nextMajor > latestSupportedMajor) return true;
|
|
34215
|
-
return nextMajor < currentMajor;
|
|
34216
|
-
};
|
|
34217
|
-
const shouldReplaceStyledComponentsVersion = (currentVersion, nextVersion) => {
|
|
34218
|
-
if (!currentVersion) return true;
|
|
34219
|
-
const currentMajor = getLowestDependencyMajor(currentVersion);
|
|
34220
|
-
const nextMajor = getLowestDependencyMajor(nextVersion);
|
|
34221
|
-
if (currentMajor === null) return nextMajor !== null && nextMajor < 6;
|
|
34222
|
-
if (nextMajor === null) return currentMajor >= 6;
|
|
34223
|
-
return nextMajor < currentMajor;
|
|
34224
|
-
};
|
|
34225
|
-
const evaluateManifestFacts = (facts, packageJson, directory, rootDirectory, rootPackageJson) => {
|
|
34142
|
+
const evaluateManifestFacts = (facts, packageJson, directory) => {
|
|
34226
34143
|
if (facts.expo.version === null) {
|
|
34227
34144
|
const spec = getDependencySpec(packageJson, "expo");
|
|
34228
34145
|
if (spec !== null) facts.expo = {
|
|
@@ -34244,74 +34161,13 @@ const evaluateManifestFacts = (facts, packageJson, directory, rootDirectory, roo
|
|
|
34244
34161
|
sourceDirectory: directory
|
|
34245
34162
|
};
|
|
34246
34163
|
}
|
|
34247
|
-
const mobxSpec = getDependencySpec(packageJson, "mobx");
|
|
34248
|
-
if (mobxSpec !== null) {
|
|
34249
|
-
const nextMobxFact = {
|
|
34250
|
-
version: resolveCatalogBackedDependencyVersion({
|
|
34251
|
-
rootDirectory: directory,
|
|
34252
|
-
rootPackageJson: packageJson,
|
|
34253
|
-
packageName: "mobx",
|
|
34254
|
-
version: mobxSpec
|
|
34255
|
-
}),
|
|
34256
|
-
sourceDirectory: directory
|
|
34257
|
-
};
|
|
34258
|
-
if (shouldReplaceSupportedDependencyFact(facts.mobx, nextMobxFact, 6)) facts.mobx = nextMobxFact;
|
|
34259
|
-
}
|
|
34260
|
-
facts.hasMobxReact = facts.hasMobxReact || getDependencySpec(packageJson, MOBX_REACT_PACKAGE_NAME) !== null;
|
|
34261
|
-
facts.hasMobxReactLite = facts.hasMobxReactLite || getDependencySpec(packageJson, MOBX_REACT_LITE_PACKAGE_NAME) !== null;
|
|
34262
|
-
facts.hasMobxStateTree = facts.hasMobxStateTree || getDependencySpec(packageJson, MOBX_STATE_TREE_PACKAGE_NAME) !== null;
|
|
34263
|
-
facts.hasMobxReactObserver = facts.hasMobxReactObserver || getDependencySpec(packageJson, MOBX_REACT_OBSERVER_PACKAGE_NAME) !== null;
|
|
34264
|
-
const zustandSpec = getDependencySpec(packageJson, "zustand");
|
|
34265
|
-
if (zustandSpec !== null) {
|
|
34266
|
-
const nextZustandFact = {
|
|
34267
|
-
version: resolveCatalogBackedDependencyVersion({
|
|
34268
|
-
rootDirectory: directory,
|
|
34269
|
-
rootPackageJson: packageJson,
|
|
34270
|
-
packageName: "zustand",
|
|
34271
|
-
version: zustandSpec
|
|
34272
|
-
}),
|
|
34273
|
-
sourceDirectory: directory
|
|
34274
|
-
};
|
|
34275
|
-
if (shouldReplaceSupportedDependencyFact(facts.zustand, nextZustandFact, 5)) facts.zustand = nextZustandFact;
|
|
34276
|
-
}
|
|
34277
34164
|
if (facts.reanimatedVersion === null) {
|
|
34278
34165
|
const spec = getDependencySpec(packageJson, REANIMATED_DEPENDENCY_NAME);
|
|
34279
34166
|
if (spec !== null) facts.reanimatedVersion = spec;
|
|
34280
34167
|
}
|
|
34281
|
-
if (facts.valtioVersion === null) {
|
|
34282
|
-
const spec = getDependencySpec(packageJson, "valtio");
|
|
34283
|
-
if (spec !== null) facts.valtioVersion = spec;
|
|
34284
|
-
}
|
|
34285
|
-
facts.tanstackQueryVersion ??= getTanStackQueryVersion(packageJson);
|
|
34286
|
-
const styledComponentsVersion = resolveCatalogBackedDependencyVersion({
|
|
34287
|
-
rootDirectory: directory,
|
|
34288
|
-
rootPackageJson: packageJson,
|
|
34289
|
-
packageName: "styled-components",
|
|
34290
|
-
version: getStyledComponentsVersion(packageJson)
|
|
34291
|
-
});
|
|
34292
|
-
if (styledComponentsVersion && shouldReplaceStyledComponentsVersion(facts.styledComponentsVersion, styledComponentsVersion)) facts.styledComponentsVersion = styledComponentsVersion;
|
|
34293
|
-
facts.hasI18nLibrary = facts.hasI18nLibrary || hasI18nDependency(packageJson);
|
|
34294
34168
|
facts.hasReactNativeAwarePackage = facts.hasReactNativeAwarePackage || isPackageJsonReactNativeAware(packageJson);
|
|
34295
34169
|
facts.hasReanimatedAwarePackage = facts.hasReanimatedAwarePackage || isPackageJsonReanimatedAware(packageJson);
|
|
34296
34170
|
facts.hasSsrDependency = facts.hasSsrDependency || isPackageJsonSsrAware(packageJson);
|
|
34297
|
-
const remotionSpec = getDependencySpec(packageJson, "remotion");
|
|
34298
|
-
if (remotionSpec !== null) {
|
|
34299
|
-
facts.hasRemotionDependency = true;
|
|
34300
|
-
const resolvedRemotionVersion = resolveCatalogBackedDependencyVersion({
|
|
34301
|
-
rootDirectory,
|
|
34302
|
-
rootPackageJson,
|
|
34303
|
-
packageName: "remotion",
|
|
34304
|
-
version: remotionSpec
|
|
34305
|
-
});
|
|
34306
|
-
const remotionMajorVersion = resolvedRemotionVersion === null ? null : getLowestDependencyMajor(resolvedRemotionVersion);
|
|
34307
|
-
if (remotionMajorVersion === null) {
|
|
34308
|
-
facts.hasUnknownRemotionVersion = true;
|
|
34309
|
-
facts.remotionVersion = null;
|
|
34310
|
-
} else if (!facts.hasUnknownRemotionVersion) {
|
|
34311
|
-
const currentRemotionMajorVersion = facts.remotionVersion === null ? null : getLowestDependencyMajor(facts.remotionVersion);
|
|
34312
|
-
if (currentRemotionMajorVersion === null || remotionMajorVersion < currentRemotionMajorVersion) facts.remotionVersion = resolvedRemotionVersion;
|
|
34313
|
-
}
|
|
34314
|
-
}
|
|
34315
34171
|
};
|
|
34316
34172
|
const collectWorkspaceFacts = (rootDirectory, rootPackageJson, { collectReactGroup }) => {
|
|
34317
34173
|
const facts = {
|
|
@@ -34331,31 +34187,12 @@ const collectWorkspaceFacts = (rootDirectory, rootPackageJson, { collectReactGro
|
|
|
34331
34187
|
version: null,
|
|
34332
34188
|
sourceDirectory: null
|
|
34333
34189
|
},
|
|
34334
|
-
valtioVersion: null,
|
|
34335
|
-
mobx: {
|
|
34336
|
-
version: null,
|
|
34337
|
-
sourceDirectory: null
|
|
34338
|
-
},
|
|
34339
|
-
hasMobxReact: false,
|
|
34340
|
-
hasMobxReactLite: false,
|
|
34341
|
-
hasMobxStateTree: false,
|
|
34342
|
-
hasMobxReactObserver: false,
|
|
34343
|
-
zustand: {
|
|
34344
|
-
version: null,
|
|
34345
|
-
sourceDirectory: null
|
|
34346
|
-
},
|
|
34347
|
-
tanstackQueryVersion: null,
|
|
34348
|
-
styledComponentsVersion: null,
|
|
34349
|
-
hasI18nLibrary: false,
|
|
34350
34190
|
hasReactNativeAwarePackage: false,
|
|
34351
34191
|
hasReanimatedAwarePackage: false,
|
|
34352
34192
|
hasSsrDependency: false,
|
|
34353
|
-
hasRemotionDependency: false,
|
|
34354
|
-
hasUnknownRemotionVersion: false,
|
|
34355
|
-
remotionVersion: null,
|
|
34356
34193
|
reanimatedVersion: null
|
|
34357
34194
|
};
|
|
34358
|
-
evaluateManifestFacts(facts, rootPackageJson, rootDirectory
|
|
34195
|
+
evaluateManifestFacts(facts, rootPackageJson, rootDirectory);
|
|
34359
34196
|
let isReactGroupSettled = !collectReactGroup;
|
|
34360
34197
|
const visitedDirectories = /* @__PURE__ */ new Set();
|
|
34361
34198
|
for (const pattern of getWorkspacePatterns(rootDirectory, rootPackageJson)) {
|
|
@@ -34364,7 +34201,7 @@ const collectWorkspaceFacts = (rootDirectory, rootPackageJson, { collectReactGro
|
|
|
34364
34201
|
if (visitedDirectories.has(workspaceDirectory)) continue;
|
|
34365
34202
|
visitedDirectories.add(workspaceDirectory);
|
|
34366
34203
|
const workspacePackageJson = readPackageJson(Path.join(workspaceDirectory, "package.json"));
|
|
34367
|
-
evaluateManifestFacts(facts, workspacePackageJson, workspaceDirectory
|
|
34204
|
+
evaluateManifestFacts(facts, workspacePackageJson, workspaceDirectory);
|
|
34368
34205
|
const info = extractDependencyInfo(workspacePackageJson);
|
|
34369
34206
|
if (info.framework !== "unknown" && frameworkMergeRank(info.framework) < frameworkMergeRank(facts.framework)) facts.framework = info.framework;
|
|
34370
34207
|
if (isReactGroupSettled) continue;
|
|
@@ -34588,27 +34425,11 @@ const discoverProjectWithoutPackageJson = (directory) => {
|
|
|
34588
34425
|
tailwindVersion: null,
|
|
34589
34426
|
zodVersion: null,
|
|
34590
34427
|
zodMajorVersion: null,
|
|
34591
|
-
mobxVersion: null,
|
|
34592
|
-
mobxMajorVersion: null,
|
|
34593
|
-
hasMobxReact: false,
|
|
34594
|
-
hasMobxReactLite: false,
|
|
34595
|
-
hasMobxStateTree: false,
|
|
34596
|
-
hasMobxReactObserver: false,
|
|
34597
|
-
zustandVersion: null,
|
|
34598
|
-
zustandMajorVersion: null,
|
|
34599
34428
|
framework: "unknown",
|
|
34600
34429
|
hasTypeScript: hasOwnTsConfig,
|
|
34601
34430
|
hasReactCompiler: false,
|
|
34602
34431
|
hasReactCompilerLintPlugin: false,
|
|
34603
34432
|
hasTanStackQuery: false,
|
|
34604
|
-
valtioVersion: null,
|
|
34605
|
-
valtioMajorVersion: null,
|
|
34606
|
-
hasRemotion: false,
|
|
34607
|
-
remotionVersion: null,
|
|
34608
|
-
remotionMajorVersion: null,
|
|
34609
|
-
hasI18nLibrary: false,
|
|
34610
|
-
tanstackQueryVersion: null,
|
|
34611
|
-
styledComponentsVersion: null,
|
|
34612
34433
|
hasSsrDependency: false,
|
|
34613
34434
|
preactVersion: null,
|
|
34614
34435
|
preactMajorVersion: null,
|
|
@@ -34707,12 +34528,6 @@ const discoverProject = (directory) => {
|
|
|
34707
34528
|
packageName: SHOPIFY_FLASH_LIST_PACKAGE_NAME,
|
|
34708
34529
|
version: workspaceFacts.shopifyFlashList.version
|
|
34709
34530
|
}) : null;
|
|
34710
|
-
const zustandVersion = resolveCatalogBackedDependencyVersion({
|
|
34711
|
-
rootDirectory: directory,
|
|
34712
|
-
rootPackageJson: packageJson,
|
|
34713
|
-
packageName: "zustand",
|
|
34714
|
-
version: workspaceFacts.zustand.version
|
|
34715
|
-
});
|
|
34716
34531
|
const hasReanimated = hasReactNativeWorkspace && workspaceFacts.hasReanimatedAwarePackage;
|
|
34717
34532
|
const reanimatedVersion = hasReanimated ? workspaceFacts.reanimatedVersion : null;
|
|
34718
34533
|
const nextjsVersion = framework === "nextjs" ? resolveCatalogBackedDependencyVersion({
|
|
@@ -34721,21 +34536,7 @@ const discoverProject = (directory) => {
|
|
|
34721
34536
|
packageName: "next",
|
|
34722
34537
|
version: workspaceFacts.next.version
|
|
34723
34538
|
}) : null;
|
|
34724
|
-
const valtioVersion = resolveCatalogBackedDependencyVersion({
|
|
34725
|
-
rootDirectory: directory,
|
|
34726
|
-
rootPackageJson: packageJson,
|
|
34727
|
-
packageName: "valtio",
|
|
34728
|
-
version: workspaceFacts.valtioVersion
|
|
34729
|
-
});
|
|
34730
|
-
const mobxVersion = resolveCatalogBackedDependencyVersion({
|
|
34731
|
-
rootDirectory: directory,
|
|
34732
|
-
rootPackageJson: packageJson,
|
|
34733
|
-
packageName: "mobx",
|
|
34734
|
-
version: workspaceFacts.mobx.version
|
|
34735
|
-
});
|
|
34736
34539
|
const preactVersion = getPreactVersion(packageJson);
|
|
34737
|
-
const remotionVersion = workspaceFacts.remotionVersion;
|
|
34738
|
-
const tanstackQueryVersion = getTanStackQueryVersion(packageJson) ?? workspaceFacts.tanstackQueryVersion;
|
|
34739
34540
|
const isPreES2023Target = hasTypeScript && detectPreES2023Target(directory);
|
|
34740
34541
|
const projectInfo = {
|
|
34741
34542
|
rootDirectory: directory,
|
|
@@ -34745,27 +34546,11 @@ const discoverProject = (directory) => {
|
|
|
34745
34546
|
tailwindVersion,
|
|
34746
34547
|
zodVersion,
|
|
34747
34548
|
zodMajorVersion: zodVersion === null ? null : getLowestDependencyMajor(zodVersion),
|
|
34748
|
-
mobxVersion,
|
|
34749
|
-
mobxMajorVersion: mobxVersion === null ? null : getLowestDependencyMajor(mobxVersion),
|
|
34750
|
-
hasMobxReact: workspaceFacts.hasMobxReact,
|
|
34751
|
-
hasMobxReactLite: workspaceFacts.hasMobxReactLite,
|
|
34752
|
-
hasMobxStateTree: workspaceFacts.hasMobxStateTree,
|
|
34753
|
-
hasMobxReactObserver: workspaceFacts.hasMobxReactObserver,
|
|
34754
|
-
zustandVersion,
|
|
34755
|
-
zustandMajorVersion: zustandVersion === null ? null : getLowestDependencyMajor(zustandVersion),
|
|
34756
34549
|
framework,
|
|
34757
34550
|
hasTypeScript,
|
|
34758
34551
|
hasReactCompiler: detectReactCompiler(directory, packageJson),
|
|
34759
34552
|
hasReactCompilerLintPlugin: detectReactCompilerLintPlugin(directory, packageJson),
|
|
34760
|
-
hasTanStackQuery:
|
|
34761
|
-
hasI18nLibrary: workspaceFacts.hasI18nLibrary,
|
|
34762
|
-
tanstackQueryVersion,
|
|
34763
|
-
styledComponentsVersion: workspaceFacts.styledComponentsVersion,
|
|
34764
|
-
valtioVersion,
|
|
34765
|
-
valtioMajorVersion: valtioVersion === null ? null : getLowestDependencyMajor(valtioVersion),
|
|
34766
|
-
hasRemotion: workspaceFacts.hasRemotionDependency,
|
|
34767
|
-
remotionVersion,
|
|
34768
|
-
remotionMajorVersion: remotionVersion === null ? null : getLowestDependencyMajor(remotionVersion),
|
|
34553
|
+
hasTanStackQuery: hasTanStackQuery(packageJson),
|
|
34769
34554
|
hasSsrDependency: workspaceFacts.hasSsrDependency,
|
|
34770
34555
|
preactVersion,
|
|
34771
34556
|
preactMajorVersion: parseReactMajor(preactVersion),
|
|
@@ -37285,25 +37070,9 @@ const BABEL_CONFIG_FILE_NAMES = [
|
|
|
37285
37070
|
".babelrc.json"
|
|
37286
37071
|
];
|
|
37287
37072
|
const LEGACY_PRESET_SPEC = "module:metro-react-native-babel-preset";
|
|
37288
|
-
const LEGACY_PRESET_PACKAGE = "metro-react-native-babel-preset";
|
|
37289
|
-
const REACT_NATIVE_PACKAGE = "react-native";
|
|
37290
|
-
const PRESET_RENAME_MINIMUM_REACT_NATIVE_VERSION = "0.73.0";
|
|
37291
|
-
const LEGACY_PRESET_REFERENCE = new RegExp(`['"]${LEGACY_PRESET_SPEC}['"]`);
|
|
37292
37073
|
const MODERN_PRESET_REFERENCE = new RegExp(`['"]module:@react-native/babel-preset['"]`);
|
|
37293
37074
|
const ENABLE_BABEL_RUNTIME_VERSION = /enableBabelRuntime["']?\s*:\s*['"]/;
|
|
37294
|
-
const isReactNativeVersionAtLeastPresetRename = (rootDirectory, packageJson) => {
|
|
37295
|
-
const installedReactNativeManifestPath = Path.join(rootDirectory, "node_modules", REACT_NATIVE_PACKAGE, "package.json");
|
|
37296
|
-
const reactNativeVersionSpec = (isFile(installedReactNativeManifestPath) ? readPackageJson(installedReactNativeManifestPath).version : void 0) ?? getDependencySpec(packageJson, REACT_NATIVE_PACKAGE);
|
|
37297
|
-
if (reactNativeVersionSpec === null || reactNativeVersionSpec === void 0) return false;
|
|
37298
|
-
const normalizedVersionRange = import_semver.validRange(reactNativeVersionSpec);
|
|
37299
|
-
if (normalizedVersionRange === null) return false;
|
|
37300
|
-
const minimumVersion = import_semver.minVersion(normalizedVersionRange);
|
|
37301
|
-
return minimumVersion !== null && import_semver.gte(minimumVersion, PRESET_RENAME_MINIMUM_REACT_NATIVE_VERSION);
|
|
37302
|
-
};
|
|
37303
|
-
const canResolveLegacyPreset = (rootDirectory, packageJson) => getDependencySpec(packageJson, LEGACY_PRESET_PACKAGE) !== null || isFile(Path.join(rootDirectory, "node_modules", LEGACY_PRESET_PACKAGE, "package.json"));
|
|
37304
37075
|
const checkReactNativeMetroBabelPreset = (rootDirectory) => {
|
|
37305
|
-
const packageJson = readPackageJson(Path.join(rootDirectory, "package.json"));
|
|
37306
|
-
const shouldReportLegacyPreset = isReactNativeVersionAtLeastPresetRename(rootDirectory, packageJson) && !canResolveLegacyPreset(rootDirectory, packageJson);
|
|
37307
37076
|
for (const fileName of BABEL_CONFIG_FILE_NAMES) {
|
|
37308
37077
|
const filePath = Path.join(rootDirectory, fileName);
|
|
37309
37078
|
if (!isFile(filePath)) continue;
|
|
@@ -37313,7 +37082,7 @@ const checkReactNativeMetroBabelPreset = (rootDirectory) => {
|
|
|
37313
37082
|
} catch {
|
|
37314
37083
|
continue;
|
|
37315
37084
|
}
|
|
37316
|
-
if (
|
|
37085
|
+
if (contents.includes(LEGACY_PRESET_SPEC)) return [buildReactNativeDiagnostic({
|
|
37317
37086
|
filePath: fileName,
|
|
37318
37087
|
rule: "rn-no-metro-babel-preset",
|
|
37319
37088
|
severity: "error",
|
|
@@ -37336,6 +37105,12 @@ const checkReactNativeProject = (rootDirectory, project) => {
|
|
|
37336
37105
|
return [...checkReactNativeMetroBabelPreset(rootDirectory), ...checkReactNativeLibraryDependencies(rootDirectory)];
|
|
37337
37106
|
};
|
|
37338
37107
|
const RULE_KEY = "no-vulnerable-react-server-components";
|
|
37108
|
+
const DEPENDENCY_SECTIONS = [
|
|
37109
|
+
"dependencies",
|
|
37110
|
+
"devDependencies",
|
|
37111
|
+
"peerDependencies",
|
|
37112
|
+
"optionalDependencies"
|
|
37113
|
+
];
|
|
37339
37114
|
const REACT_RSC_ADVISORIES_BY_MINOR = {
|
|
37340
37115
|
"19.0": {
|
|
37341
37116
|
rceFixedVersion: "19.0.1",
|
|
@@ -37382,13 +37157,20 @@ const enumerateWorkspaceDirectories = (workspaceRoot) => {
|
|
|
37382
37157
|
for (const pattern of patterns) for (const directory of resolveWorkspaceDirectories(workspaceRoot, pattern)) directories.add(directory);
|
|
37383
37158
|
return [...directories];
|
|
37384
37159
|
};
|
|
37160
|
+
const readDeclaredSpec = (packageJson, packageName) => {
|
|
37161
|
+
for (const section of DEPENDENCY_SECTIONS) {
|
|
37162
|
+
const spec = packageJson[section]?.[packageName];
|
|
37163
|
+
if (typeof spec === "string") return spec;
|
|
37164
|
+
}
|
|
37165
|
+
return null;
|
|
37166
|
+
};
|
|
37385
37167
|
const resolveVersionInDirectory = (directory, packageName, declaredSpecOverride) => {
|
|
37386
37168
|
const manifestPath = Path.join(directory, "node_modules", packageName, "package.json");
|
|
37387
37169
|
if (isFile(manifestPath)) {
|
|
37388
37170
|
const installedVersion = import_semver.valid(readPackageJson(manifestPath).version ?? null);
|
|
37389
37171
|
if (installedVersion !== null) return installedVersion;
|
|
37390
37172
|
}
|
|
37391
|
-
const candidateSpecs = [
|
|
37173
|
+
const candidateSpecs = [readDeclaredSpec(readPackageJson(Path.join(directory, "package.json")), packageName), declaredSpecOverride];
|
|
37392
37174
|
for (const spec of candidateSpecs) {
|
|
37393
37175
|
const pinnedVersion = spec === null ? null : import_semver.valid(spec);
|
|
37394
37176
|
if (pinnedVersion !== null) return pinnedVersion;
|
|
@@ -38056,50 +37838,21 @@ const buildCapabilities = (project) => {
|
|
|
38056
37838
|
if (CLIENT_ONLY_FRAMEWORKS.has(project.framework)) capabilities.add("client-only");
|
|
38057
37839
|
if (project.isStaticExport) capabilities.add("nextjs:static-export");
|
|
38058
37840
|
if (project.nextjsMajorVersion !== null && project.nextjsMajorVersion >= 15) capabilities.add("nextjs:15");
|
|
38059
|
-
if (project.nextjsMajorVersion !== null && project.nextjsMajorVersion >= 16) capabilities.add("nextjs:16");
|
|
38060
37841
|
addMajorLadder(capabilities, "react", project.reactMajorVersion, 17, 30);
|
|
38061
37842
|
if (project.reactMajorVersion !== null && project.reactMajorVersion >= 19 && isMajorMinorAtLeast(parseReactMajorMinor(project.reactVersion), {
|
|
38062
37843
|
major: 19,
|
|
38063
37844
|
minor: 2
|
|
38064
37845
|
})) capabilities.add("react:19.2");
|
|
38065
|
-
if (project.tailwindVersion !== null)
|
|
38066
|
-
|
|
38067
|
-
|
|
38068
|
-
|
|
38069
|
-
|
|
38070
|
-
minor: 4
|
|
38071
|
-
})) capabilities.add("tailwind:3.4");
|
|
38072
|
-
if (tailwindVersion !== null && isMajorMinorAtLeast(tailwindVersion, {
|
|
38073
|
-
major: 4,
|
|
38074
|
-
minor: 0
|
|
38075
|
-
})) capabilities.add("tailwind:4");
|
|
38076
|
-
}
|
|
37846
|
+
if (project.tailwindVersion !== null) capabilities.add("tailwind");
|
|
37847
|
+
if (project.tailwindVersion !== null && isMajorMinorAtLeast(parseTailwindMajorMinor(project.tailwindVersion), {
|
|
37848
|
+
major: 3,
|
|
37849
|
+
minor: 4
|
|
37850
|
+
})) capabilities.add("tailwind:3.4");
|
|
38077
37851
|
if (project.zodVersion !== null) capabilities.add("zod");
|
|
38078
37852
|
if (project.zodMajorVersion !== null && project.zodMajorVersion >= 4) capabilities.add("zod:4");
|
|
38079
|
-
if (project.mobxVersion !== void 0 && project.mobxVersion !== null || project.hasMobxReact === true || project.hasMobxReactLite === true || project.hasMobxStateTree === true || project.hasMobxReactObserver === true) capabilities.add("mobx");
|
|
38080
|
-
if (project.hasMobxReact === true) capabilities.add("mobx-react");
|
|
38081
|
-
if (project.hasMobxReactLite === true) capabilities.add("mobx-react-lite");
|
|
38082
|
-
if (project.hasMobxReact === true || project.hasMobxReactLite === true) capabilities.add("mobx-react-binding");
|
|
38083
|
-
if (project.hasMobxStateTree === true) capabilities.add("mobx-state-tree");
|
|
38084
|
-
if (project.hasMobxReactObserver === true) capabilities.add("mobx-react-observer");
|
|
38085
|
-
if (project.mobxMajorVersion !== void 0 && project.mobxMajorVersion !== null && project.mobxMajorVersion >= 4 && project.mobxMajorVersion <= 6) addMajorLadder(capabilities, "mobx", project.mobxMajorVersion, 4, 6);
|
|
38086
|
-
if (project.zustandVersion !== void 0 && project.zustandVersion !== null) capabilities.add("zustand");
|
|
38087
|
-
if (project.zustandMajorVersion !== void 0 && project.zustandMajorVersion !== null && project.zustandMajorVersion >= 1 && project.zustandMajorVersion <= 5) addMajorLadder(capabilities, "zustand", project.zustandMajorVersion, 1, 5);
|
|
38088
37853
|
if (project.isPreES2023Target) capabilities.add("pre-es2023");
|
|
38089
37854
|
if (project.hasReactCompiler) capabilities.add("react-compiler");
|
|
38090
|
-
if (
|
|
38091
|
-
if (project.styledComponentsVersion) {
|
|
38092
|
-
capabilities.add("styled-components");
|
|
38093
|
-
const styledComponentsMajor = getLowestDependencyMajor(project.styledComponentsVersion);
|
|
38094
|
-
if (styledComponentsMajor !== null && styledComponentsMajor >= 6) capabilities.add("styled-components:6");
|
|
38095
|
-
}
|
|
38096
|
-
if (project.hasI18nLibrary) capabilities.add("i18n");
|
|
38097
|
-
if (project.valtioVersion !== null) capabilities.add("valtio");
|
|
38098
|
-
addMajorLadder(capabilities, "valtio", project.valtioMajorVersion, 1, 10);
|
|
38099
|
-
if (project.hasRemotion) {
|
|
38100
|
-
capabilities.add("remotion");
|
|
38101
|
-
addMajorLadder(capabilities, "remotion", project.remotionMajorVersion ?? null, 4, 30);
|
|
38102
|
-
}
|
|
37855
|
+
if (project.hasTanStackQuery) capabilities.add("tanstack-query");
|
|
38103
37856
|
if (project.hasTypeScript) capabilities.add("typescript");
|
|
38104
37857
|
if (project.preactVersion !== null) capabilities.add("preact");
|
|
38105
37858
|
addMajorLadder(capabilities, "preact", project.preactMajorVersion, 10, 20);
|
|
@@ -38114,7 +37867,7 @@ const getCapabilities = (project) => {
|
|
|
38114
37867
|
capabilitiesByProject.set(project, capabilities);
|
|
38115
37868
|
return capabilities;
|
|
38116
37869
|
};
|
|
38117
|
-
const shouldEnableRule = (requires, tags, capabilities, ignoredTags, disabledWhen
|
|
37870
|
+
const shouldEnableRule = (requires, tags, capabilities, ignoredTags, disabledWhen) => {
|
|
38118
37871
|
if (requires) {
|
|
38119
37872
|
for (const capability of requires) if (!capabilities.has(capability)) return false;
|
|
38120
37873
|
}
|
|
@@ -38125,29 +37878,20 @@ const shouldEnableRule = (requires, tags, capabilities, ignoredTags, disabledWhe
|
|
|
38125
37878
|
if (tags) {
|
|
38126
37879
|
for (const tag of tags) if (ignoredTags.has(tag)) return false;
|
|
38127
37880
|
}
|
|
38128
|
-
if (includedTags && includedTags.size > 0) {
|
|
38129
|
-
if (!tags?.some((tag) => includedTags.has(tag))) return false;
|
|
38130
|
-
}
|
|
38131
37881
|
return true;
|
|
38132
37882
|
};
|
|
38133
|
-
const shouldEnableRuleByDefaultStatus = (options) => options.defaultEnabled !== false || options.hasExplicitOverride === true || options.includeTagDefaults && options.hasIncludedTags;
|
|
38134
37883
|
const yieldToEventLoop = () => new Promise((resolve) => {
|
|
38135
37884
|
setImmediate(resolve);
|
|
38136
37885
|
});
|
|
38137
37886
|
const createSecurityScanSession = (rootDirectory, options) => {
|
|
38138
37887
|
const capabilities = options.project ? getCapabilities(options.project) : /* @__PURE__ */ new Set();
|
|
38139
37888
|
const ignoredTags = options.ignoredTags ?? /* @__PURE__ */ new Set();
|
|
38140
|
-
const includedTags = options.includedTags ?? /* @__PURE__ */ new Set();
|
|
38141
37889
|
const enabledScanRules = REACT_DOCTOR_RULES.flatMap((entry) => {
|
|
38142
37890
|
const rule = entry.rule;
|
|
38143
37891
|
const scan = rule.scan;
|
|
38144
37892
|
if (typeof scan !== "function") return [];
|
|
38145
|
-
if (
|
|
38146
|
-
|
|
38147
|
-
includeTagDefaults: options.includeTagDefaults === true,
|
|
38148
|
-
hasIncludedTags: includedTags.size > 0
|
|
38149
|
-
})) return [];
|
|
38150
|
-
if (!shouldEnableRule(rule.requires, rule.tags, capabilities, ignoredTags, rule.disabledWhen, includedTags)) return [];
|
|
37893
|
+
if (rule.defaultEnabled === false) return [];
|
|
37894
|
+
if (!shouldEnableRule(rule.requires, rule.tags, capabilities, ignoredTags, rule.disabledWhen)) return [];
|
|
38151
37895
|
return [{
|
|
38152
37896
|
entry,
|
|
38153
37897
|
scan,
|
|
@@ -40133,9 +39877,8 @@ const buildUserPluginRules = (userPlugin, severityControls) => {
|
|
|
40133
39877
|
}
|
|
40134
39878
|
return enabled;
|
|
40135
39879
|
};
|
|
40136
|
-
const createOxlintConfig = ({ pluginPath, project, customRulesOnly = false, extendsPaths = [], ignoredTags = /* @__PURE__ */ new Set(),
|
|
40137
|
-
const
|
|
40138
|
-
const reactHooksJsPlugin = disableReactHooksJsPlugin || ruleSelection === "sidecar" || hasIncludedTags ? null : resolveReactHooksJsPlugin(project.hasReactCompiler || project.hasReactCompilerLintPlugin === true, customRulesOnly);
|
|
39880
|
+
const createOxlintConfig = ({ pluginPath, project, customRulesOnly = false, extendsPaths = [], ignoredTags = /* @__PURE__ */ new Set(), serverAuthFunctionNames, severityControls, userPlugins = [], disableReactHooksJsPlugin = false, ruleSelection, sidecarRuleIdFilter }) => {
|
|
39881
|
+
const reactHooksJsPlugin = disableReactHooksJsPlugin || ruleSelection === "sidecar" ? null : resolveReactHooksJsPlugin(project.hasReactCompiler || project.hasReactCompilerLintPlugin === true, customRulesOnly);
|
|
40139
39882
|
const reactCompilerRules = reactHooksJsPlugin ? applyRuleSeverityControls(filterRulesToAvailable(REACT_COMPILER_RULES, "react-hooks-js", reactHooksJsPlugin.availableRuleNames), severityControls) : {};
|
|
40140
39883
|
const jsPlugins = [];
|
|
40141
39884
|
if (reactHooksJsPlugin) jsPlugins.push(reactHooksJsPlugin.entry);
|
|
@@ -40150,14 +39893,9 @@ const createOxlintConfig = ({ pluginPath, project, customRulesOnly = false, exte
|
|
|
40150
39893
|
if (rule.scan !== void 0) continue;
|
|
40151
39894
|
if (customRulesOnly && registryEntry.originallyExternal) continue;
|
|
40152
39895
|
if (rule.framework !== "global" && !rule.requires) continue;
|
|
40153
|
-
if (!shouldEnableRule(rule.requires, rule.tags, capabilities, ignoredTags, rule.disabledWhen
|
|
39896
|
+
if (!shouldEnableRule(rule.requires, rule.tags, capabilities, ignoredTags, rule.disabledWhen)) continue;
|
|
40154
39897
|
const explicitRuleOverride = resolveRuleSeverityOverride({ ruleKey: registryEntry.key }, severityControls);
|
|
40155
|
-
if (
|
|
40156
|
-
defaultEnabled: rule.defaultEnabled,
|
|
40157
|
-
includeTagDefaults,
|
|
40158
|
-
hasIncludedTags,
|
|
40159
|
-
hasExplicitOverride: explicitRuleOverride !== void 0
|
|
40160
|
-
})) continue;
|
|
39898
|
+
if (rule.defaultEnabled === false && explicitRuleOverride === void 0) continue;
|
|
40161
39899
|
const severity = resolveRuleSeverityOverride({
|
|
40162
39900
|
ruleKey: registryEntry.key,
|
|
40163
39901
|
category: rule.category
|
|
@@ -40166,7 +39904,7 @@ const createOxlintConfig = ({ pluginPath, project, customRulesOnly = false, exte
|
|
|
40166
39904
|
enabledReactDoctorRules[registryEntry.key] = severity;
|
|
40167
39905
|
}
|
|
40168
39906
|
const userPluginRules = {};
|
|
40169
|
-
if (ruleSelection !== "sidecar"
|
|
39907
|
+
if (ruleSelection !== "sidecar") for (const userPlugin of userPlugins) {
|
|
40170
39908
|
Object.assign(userPluginRules, buildUserPluginRules(userPlugin, severityControls));
|
|
40171
39909
|
jsPlugins.push(userPlugin.entry);
|
|
40172
39910
|
}
|
|
@@ -40383,19 +40121,6 @@ const createSidecarLintCache = (cacheDirectory, rulesetHash) => {
|
|
|
40383
40121
|
}
|
|
40384
40122
|
};
|
|
40385
40123
|
};
|
|
40386
|
-
const fingerprintCacheByFilePath = /* @__PURE__ */ new Map();
|
|
40387
|
-
const fingerprintFileContents = (filePath, fingerprintLength) => {
|
|
40388
|
-
const fileStats = NFS.statSync(filePath, { bigint: true });
|
|
40389
|
-
const cachedFingerprint = fingerprintCacheByFilePath.get(filePath);
|
|
40390
|
-
if (cachedFingerprint?.modifiedTimeNanoseconds === fileStats.mtimeNs && cachedFingerprint.sizeBytes === fileStats.size) return cachedFingerprint.fingerprint;
|
|
40391
|
-
const fingerprint = crypto.createHash("sha256").update(NFS.readFileSync(filePath)).digest("hex").slice(0, fingerprintLength);
|
|
40392
|
-
fingerprintCacheByFilePath.set(filePath, {
|
|
40393
|
-
fingerprint,
|
|
40394
|
-
modifiedTimeNanoseconds: fileStats.mtimeNs,
|
|
40395
|
-
sizeBytes: fileStats.size
|
|
40396
|
-
});
|
|
40397
|
-
return fingerprint;
|
|
40398
|
-
};
|
|
40399
40124
|
const bundledRequire = createRequire(import.meta.url);
|
|
40400
40125
|
const childNodeVersionByBinaryPath = /* @__PURE__ */ new Map();
|
|
40401
40126
|
const resolveChildNodeVersion = (nodeBinaryPath) => {
|
|
@@ -40419,13 +40144,6 @@ const TOOLCHAIN_PACKAGE_SPECIFIERS = [
|
|
|
40419
40144
|
"oxlint-plugin-react-doctor/package.json",
|
|
40420
40145
|
"eslint-plugin-react-hooks/package.json"
|
|
40421
40146
|
];
|
|
40422
|
-
const resolvePluginFingerprint = () => {
|
|
40423
|
-
try {
|
|
40424
|
-
return fingerprintFileContents(bundledRequire.resolve("oxlint-plugin-react-doctor"), 16);
|
|
40425
|
-
} catch {
|
|
40426
|
-
return "unresolved";
|
|
40427
|
-
}
|
|
40428
|
-
};
|
|
40429
40147
|
const resolveOxlintToolchainVersions = (nodeBinaryPath = process.execPath) => {
|
|
40430
40148
|
const versions = [`node=${resolveChildNodeVersion(nodeBinaryPath)}`];
|
|
40431
40149
|
for (const specifier of TOOLCHAIN_PACKAGE_SPECIFIERS) try {
|
|
@@ -40435,7 +40153,6 @@ const resolveOxlintToolchainVersions = (nodeBinaryPath = process.execPath) => {
|
|
|
40435
40153
|
} catch {
|
|
40436
40154
|
versions.push(`${specifier}=missing`);
|
|
40437
40155
|
}
|
|
40438
|
-
versions.push(`oxlint-plugin-react-doctor#fingerprint=${resolvePluginFingerprint()}`);
|
|
40439
40156
|
return versions;
|
|
40440
40157
|
};
|
|
40441
40158
|
const esmRequire = createRequire(import.meta.url);
|
|
@@ -41911,7 +41628,7 @@ const reactHooksJsPluginDropNote = (error) => {
|
|
|
41911
41628
|
* 6. always restore disable directives + clean up the temp dir
|
|
41912
41629
|
*/
|
|
41913
41630
|
const runOxlint = async (options) => {
|
|
41914
|
-
const { rootDirectory, project, includePaths, nodeBinaryPath = process.execPath, customRulesOnly = false, respectInlineDisables = true, adoptExistingLintConfig = true, ignoredTags = /* @__PURE__ */ new Set(),
|
|
41631
|
+
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;
|
|
41915
41632
|
const serverAuthFunctionNames = Array.isArray(userConfig?.serverAuthFunctionNames) ? userConfig.serverAuthFunctionNames.filter((entry) => typeof entry === "string" && entry.length > 0) : void 0;
|
|
41916
41633
|
const severityControls = buildRuleSeverityControls(userConfig);
|
|
41917
41634
|
validateRuleRegistration();
|
|
@@ -41925,15 +41642,13 @@ const runOxlint = async (options) => {
|
|
|
41925
41642
|
}
|
|
41926
41643
|
const pluginPath = resolvePluginPath();
|
|
41927
41644
|
const extendsPaths = (adoptExistingLintConfig && !customRulesOnly ? detectUserLintConfigPaths(rootDirectory) : []).filter(canOxlintExtendConfig);
|
|
41928
|
-
const userPlugins =
|
|
41645
|
+
const userPlugins = resolveUserPlugins(userConfig?.plugins, configSourceDirectory);
|
|
41929
41646
|
const buildConfig = (overrides) => createOxlintConfig({
|
|
41930
41647
|
pluginPath,
|
|
41931
41648
|
project,
|
|
41932
41649
|
customRulesOnly,
|
|
41933
41650
|
extendsPaths: overrides.extendsPaths,
|
|
41934
41651
|
ignoredTags,
|
|
41935
|
-
includedTags,
|
|
41936
|
-
includeTagDefaults,
|
|
41937
41652
|
serverAuthFunctionNames,
|
|
41938
41653
|
severityControls,
|
|
41939
41654
|
userPlugins,
|
|
@@ -42322,8 +42037,6 @@ var Linter = class Linter extends Service()("react-doctor/Linter") {
|
|
|
42322
42037
|
respectInlineDisables: input.respectInlineDisables,
|
|
42323
42038
|
adoptExistingLintConfig: input.adoptExistingLintConfig,
|
|
42324
42039
|
ignoredTags: input.ignoredTags,
|
|
42325
|
-
includedTags: input.includedTags,
|
|
42326
|
-
includeTagDefaults: input.includeTagDefaults,
|
|
42327
42040
|
userConfig: input.userConfig ?? null,
|
|
42328
42041
|
configSourceDirectory: input.configSourceDirectory,
|
|
42329
42042
|
onPartialFailure: (reason) => {
|
|
@@ -43172,9 +42885,7 @@ const runInspect = (input, hooks = {}) => gen(function* () {
|
|
|
43172
42885
|
const securityScanFailedRef = yield* make$13(false);
|
|
43173
42886
|
const securityScanFiber = yield* forkChild(runCollect(applyPerElementPipeline(isDiffMode ? empty$4 : unwrap(tryPromise(() => checkSecurityScanCooperative(scanDirectory, {
|
|
43174
42887
|
project,
|
|
43175
|
-
ignoredTags: input.ignoredTags
|
|
43176
|
-
includedTags: input.includedTags,
|
|
43177
|
-
includeTagDefaults: input.includeTagDefaults
|
|
42888
|
+
ignoredTags: input.ignoredTags
|
|
43178
42889
|
})).pipe(map$3((diagnostics) => fromIterable$1(diagnostics)), catch_$1(() => set(securityScanFailedRef, true).pipe(as(empty$4))))))).pipe(withSpan("SecurityScan.run")));
|
|
43179
42890
|
const shouldRunSupplyChain = !isDiffMode || (input.supplyChainManifestChanged ?? false);
|
|
43180
42891
|
const supplyChainOverlapTimeout = yield* SupplyChainOverlapTimeoutMs;
|
|
@@ -43265,8 +42976,6 @@ const runInspect = (input, hooks = {}) => gen(function* () {
|
|
|
43265
42976
|
respectInlineDisables: input.respectInlineDisables,
|
|
43266
42977
|
adoptExistingLintConfig: input.adoptExistingLintConfig,
|
|
43267
42978
|
ignoredTags: input.ignoredTags,
|
|
43268
|
-
includedTags: input.includedTags,
|
|
43269
|
-
includeTagDefaults: input.includeTagDefaults,
|
|
43270
42979
|
userConfig: resolvedConfig.config ?? void 0,
|
|
43271
42980
|
configSourceDirectory: resolvedConfig.configSourceDirectory ?? void 0,
|
|
43272
42981
|
onFileProgress: (scannedFileCount, totalFileCount) => {
|
|
@@ -44127,4 +43836,4 @@ const toJsonReport = (result, options) => buildJsonReport({
|
|
|
44127
43836
|
export { AmbiguousProjectError, NoReactDependencyError, NotADirectoryError, PackageJsonNotFoundError, ProjectNotFoundError, ReactDoctorError, buildJsonReport, buildJsonReportError, clearCaches, defineConfig, diagnose, filterSourceFiles, getDiffInfo, hasReactRuntime, isProjectDiscoveryError, isReactDoctorError, summarizeDiagnostics, toJsonReport };
|
|
44128
43837
|
|
|
44129
43838
|
//# sourceMappingURL=index.js.map
|
|
44130
|
-
//# debugId=
|
|
43839
|
+
//# debugId=f412a400-e7a3-5cfa-a67f-1192f6a38df2
|