react-doctor 0.8.1-dev.0b0b5ac → 0.8.1-dev.1839566
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 +100 -446
- package/dist/index.d.ts +0 -27
- package/dist/index.js +56 -355
- package/dist/lsp.js +56 -355
- package/dist/skills/react-doctor/SKILL.md +0 -5
- package/package.json +5 -5
package/dist/lsp.js
CHANGED
|
@@ -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
|
-
"@remix-run/react": "remix",
|
|
33431
|
-
gatsby: "gatsby",
|
|
33432
33430
|
vite: "vite",
|
|
33433
33431
|
"react-scripts": "cra",
|
|
33432
|
+
"@remix-run/react": "remix",
|
|
33433
|
+
gatsby: "gatsby",
|
|
33434
33434
|
expo: "expo",
|
|
33435
33435
|
"react-native": "react-native"
|
|
33436
33436
|
};
|
|
@@ -33454,17 +33454,11 @@ const NEXT_CONFIG_FILENAMES = [
|
|
|
33454
33454
|
];
|
|
33455
33455
|
const BABEL_CONFIG_FILENAMES = [
|
|
33456
33456
|
".babelrc",
|
|
33457
|
-
".babelrc.js",
|
|
33458
33457
|
".babelrc.json",
|
|
33459
|
-
".babelrc.cjs",
|
|
33460
|
-
".babelrc.mjs",
|
|
33461
|
-
".babelrc.cts",
|
|
33462
33458
|
"babel.config.js",
|
|
33463
33459
|
"babel.config.json",
|
|
33464
33460
|
"babel.config.cjs",
|
|
33465
|
-
"babel.config.mjs"
|
|
33466
|
-
"babel.config.ts",
|
|
33467
|
-
"babel.config.cts"
|
|
33461
|
+
"babel.config.mjs"
|
|
33468
33462
|
];
|
|
33469
33463
|
const VITE_CONFIG_FILENAMES = [
|
|
33470
33464
|
"vite.config.js",
|
|
@@ -33476,28 +33470,12 @@ const VITE_CONFIG_FILENAMES = [
|
|
|
33476
33470
|
"vitest.config.ts",
|
|
33477
33471
|
"vitest.config.js"
|
|
33478
33472
|
];
|
|
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
|
-
];
|
|
33495
33473
|
const EXPO_APP_CONFIG_FILENAMES = [
|
|
33496
33474
|
"app.json",
|
|
33497
33475
|
"app.config.js",
|
|
33498
33476
|
"app.config.ts"
|
|
33499
33477
|
];
|
|
33500
|
-
const REACT_COMPILER_PACKAGE_REFERENCE_PATTERN = /babel-plugin-react-compiler|react-compiler-runtime|
|
|
33478
|
+
const REACT_COMPILER_PACKAGE_REFERENCE_PATTERN = /babel-plugin-react-compiler|react-compiler-runtime|["']react-compiler["']/;
|
|
33501
33479
|
const REACT_COMPILER_ENABLED_FLAG_PATTERN = /["']?reactCompiler["']?\s*:\s*(?:true\b|\{)/;
|
|
33502
33480
|
const STATIC_EXPORT_OUTPUT_PATTERN = /(?:^|[^.\w])["']?output["']?\s*:\s*["']export["']/m;
|
|
33503
33481
|
const hasCompilerPackage = (packageJson, compilerPackages) => {
|
|
@@ -33532,8 +33510,6 @@ const detectReactCompiler = (directory, packageJson) => {
|
|
|
33532
33510
|
if (hasCompilerInConfigFiles(directory, NEXT_CONFIG_FILENAMES)) return true;
|
|
33533
33511
|
if (hasCompilerInConfigFiles(directory, BABEL_CONFIG_FILENAMES)) return true;
|
|
33534
33512
|
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;
|
|
33537
33513
|
if (hasCompilerInConfigFiles(directory, EXPO_APP_CONFIG_FILENAMES)) return true;
|
|
33538
33514
|
return hasCompilerPackageInAncestors(directory, REACT_COMPILER_TRANSFORM_PACKAGES);
|
|
33539
33515
|
};
|
|
@@ -33981,6 +33957,19 @@ const getPreactVersion = (packageJson) => {
|
|
|
33981
33957
|
...packageJson.devDependencies
|
|
33982
33958
|
}.preact ?? null;
|
|
33983
33959
|
};
|
|
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
|
+
};
|
|
33984
33973
|
const resolveCatalogBackedDependencyVersion = ({ rootDirectory, rootPackageJson, packageName, version }) => {
|
|
33985
33974
|
if (version === null || !isCatalogReference(version)) return version;
|
|
33986
33975
|
const catalogName = extractCatalogName(version);
|
|
@@ -34183,60 +34172,7 @@ const listWorkspacePackages = (rootDirectory) => {
|
|
|
34183
34172
|
}
|
|
34184
34173
|
return packages;
|
|
34185
34174
|
};
|
|
34186
|
-
const getPreferredDependencyVersion = ({ packageJson, packageNames }) => {
|
|
34187
|
-
const allDependencies = {
|
|
34188
|
-
...packageJson.devDependencies,
|
|
34189
|
-
...packageJson.peerDependencies,
|
|
34190
|
-
...packageJson.dependencies
|
|
34191
|
-
};
|
|
34192
|
-
for (const packageName of packageNames) {
|
|
34193
|
-
const version = allDependencies[packageName];
|
|
34194
|
-
if (version !== void 0) return version;
|
|
34195
|
-
}
|
|
34196
|
-
return null;
|
|
34197
|
-
};
|
|
34198
|
-
const TANSTACK_REACT_QUERY_PACKAGES = ["@tanstack/react-query", "react-query"];
|
|
34199
|
-
const getTanStackQueryVersion = (packageJson) => {
|
|
34200
|
-
return getPreferredDependencyVersion({
|
|
34201
|
-
packageJson,
|
|
34202
|
-
packageNames: TANSTACK_REACT_QUERY_PACKAGES
|
|
34203
|
-
});
|
|
34204
|
-
};
|
|
34205
|
-
const STYLED_COMPONENTS_PACKAGES = ["styled-components"];
|
|
34206
|
-
const getStyledComponentsVersion = (packageJson) => {
|
|
34207
|
-
return getPreferredDependencyVersion({
|
|
34208
|
-
packageJson,
|
|
34209
|
-
packageNames: STYLED_COMPONENTS_PACKAGES
|
|
34210
|
-
});
|
|
34211
|
-
};
|
|
34212
|
-
const I18N_PACKAGES = [
|
|
34213
|
-
"i18next",
|
|
34214
|
-
"react-i18next",
|
|
34215
|
-
"next-i18next",
|
|
34216
|
-
"react-intl",
|
|
34217
|
-
"next-intl",
|
|
34218
|
-
"use-intl",
|
|
34219
|
-
"@formatjs/intl",
|
|
34220
|
-
"@lingui/core",
|
|
34221
|
-
"@lingui/react",
|
|
34222
|
-
"typesafe-i18n",
|
|
34223
|
-
"@tolgee/react",
|
|
34224
|
-
"react-intl-universal"
|
|
34225
|
-
];
|
|
34226
|
-
const hasI18nDependency = (packageJson) => {
|
|
34227
|
-
const allDependencies = {
|
|
34228
|
-
...packageJson.peerDependencies,
|
|
34229
|
-
...packageJson.dependencies,
|
|
34230
|
-
...packageJson.devDependencies,
|
|
34231
|
-
...packageJson.optionalDependencies
|
|
34232
|
-
};
|
|
34233
|
-
return I18N_PACKAGES.some((packageName) => allDependencies[packageName] !== void 0);
|
|
34234
|
-
};
|
|
34235
34175
|
const REANIMATED_DEPENDENCY_NAME = "react-native-reanimated";
|
|
34236
|
-
const MOBX_REACT_PACKAGE_NAME = "mobx-react";
|
|
34237
|
-
const MOBX_REACT_LITE_PACKAGE_NAME = "mobx-react-lite";
|
|
34238
|
-
const MOBX_STATE_TREE_PACKAGE_NAME = "mobx-state-tree";
|
|
34239
|
-
const MOBX_REACT_OBSERVER_PACKAGE_NAME = "mobx-react-observer";
|
|
34240
34176
|
const SHOPIFY_FLASH_LIST_PACKAGE_NAME = "@shopify/flash-list";
|
|
34241
34177
|
const resolveWorkspaceDependencyVersion = ({ concreteVersion, packageName, rootDirectory, rootPackageJson, sections, workspaceDirectory, workspacePackageJson }) => {
|
|
34242
34178
|
const dependencyDeclaration = getDependencyDeclaration({
|
|
@@ -34255,26 +34191,7 @@ const shouldReplaceReactVersion = (currentVersion, nextVersion) => {
|
|
|
34255
34191
|
if (nextMajor === null) return false;
|
|
34256
34192
|
return nextMajor < currentMajor;
|
|
34257
34193
|
};
|
|
34258
|
-
const
|
|
34259
|
-
if (currentFact.version === null) return true;
|
|
34260
|
-
if (nextFact.version === null) return false;
|
|
34261
|
-
const currentMajor = getLowestDependencyMajor(currentFact.version);
|
|
34262
|
-
const nextMajor = getLowestDependencyMajor(nextFact.version);
|
|
34263
|
-
if (currentMajor === null) return false;
|
|
34264
|
-
if (nextMajor === null) return true;
|
|
34265
|
-
if (currentMajor > latestSupportedMajor) return false;
|
|
34266
|
-
if (nextMajor > latestSupportedMajor) return true;
|
|
34267
|
-
return nextMajor < currentMajor;
|
|
34268
|
-
};
|
|
34269
|
-
const shouldReplaceStyledComponentsVersion = (currentVersion, nextVersion) => {
|
|
34270
|
-
if (!currentVersion) return true;
|
|
34271
|
-
const currentMajor = getLowestDependencyMajor(currentVersion);
|
|
34272
|
-
const nextMajor = getLowestDependencyMajor(nextVersion);
|
|
34273
|
-
if (currentMajor === null) return nextMajor !== null && nextMajor < 6;
|
|
34274
|
-
if (nextMajor === null) return currentMajor >= 6;
|
|
34275
|
-
return nextMajor < currentMajor;
|
|
34276
|
-
};
|
|
34277
|
-
const evaluateManifestFacts = (facts, packageJson, directory, rootDirectory, rootPackageJson) => {
|
|
34194
|
+
const evaluateManifestFacts = (facts, packageJson, directory) => {
|
|
34278
34195
|
if (facts.expo.version === null) {
|
|
34279
34196
|
const spec = getDependencySpec(packageJson, "expo");
|
|
34280
34197
|
if (spec !== null) facts.expo = {
|
|
@@ -34296,74 +34213,13 @@ const evaluateManifestFacts = (facts, packageJson, directory, rootDirectory, roo
|
|
|
34296
34213
|
sourceDirectory: directory
|
|
34297
34214
|
};
|
|
34298
34215
|
}
|
|
34299
|
-
const mobxSpec = getDependencySpec(packageJson, "mobx");
|
|
34300
|
-
if (mobxSpec !== null) {
|
|
34301
|
-
const nextMobxFact = {
|
|
34302
|
-
version: resolveCatalogBackedDependencyVersion({
|
|
34303
|
-
rootDirectory: directory,
|
|
34304
|
-
rootPackageJson: packageJson,
|
|
34305
|
-
packageName: "mobx",
|
|
34306
|
-
version: mobxSpec
|
|
34307
|
-
}),
|
|
34308
|
-
sourceDirectory: directory
|
|
34309
|
-
};
|
|
34310
|
-
if (shouldReplaceSupportedDependencyFact(facts.mobx, nextMobxFact, 6)) facts.mobx = nextMobxFact;
|
|
34311
|
-
}
|
|
34312
|
-
facts.hasMobxReact = facts.hasMobxReact || getDependencySpec(packageJson, MOBX_REACT_PACKAGE_NAME) !== null;
|
|
34313
|
-
facts.hasMobxReactLite = facts.hasMobxReactLite || getDependencySpec(packageJson, MOBX_REACT_LITE_PACKAGE_NAME) !== null;
|
|
34314
|
-
facts.hasMobxStateTree = facts.hasMobxStateTree || getDependencySpec(packageJson, MOBX_STATE_TREE_PACKAGE_NAME) !== null;
|
|
34315
|
-
facts.hasMobxReactObserver = facts.hasMobxReactObserver || getDependencySpec(packageJson, MOBX_REACT_OBSERVER_PACKAGE_NAME) !== null;
|
|
34316
|
-
const zustandSpec = getDependencySpec(packageJson, "zustand");
|
|
34317
|
-
if (zustandSpec !== null) {
|
|
34318
|
-
const nextZustandFact = {
|
|
34319
|
-
version: resolveCatalogBackedDependencyVersion({
|
|
34320
|
-
rootDirectory: directory,
|
|
34321
|
-
rootPackageJson: packageJson,
|
|
34322
|
-
packageName: "zustand",
|
|
34323
|
-
version: zustandSpec
|
|
34324
|
-
}),
|
|
34325
|
-
sourceDirectory: directory
|
|
34326
|
-
};
|
|
34327
|
-
if (shouldReplaceSupportedDependencyFact(facts.zustand, nextZustandFact, 5)) facts.zustand = nextZustandFact;
|
|
34328
|
-
}
|
|
34329
34216
|
if (facts.reanimatedVersion === null) {
|
|
34330
34217
|
const spec = getDependencySpec(packageJson, REANIMATED_DEPENDENCY_NAME);
|
|
34331
34218
|
if (spec !== null) facts.reanimatedVersion = spec;
|
|
34332
34219
|
}
|
|
34333
|
-
if (facts.valtioVersion === null) {
|
|
34334
|
-
const spec = getDependencySpec(packageJson, "valtio");
|
|
34335
|
-
if (spec !== null) facts.valtioVersion = spec;
|
|
34336
|
-
}
|
|
34337
|
-
facts.tanstackQueryVersion ??= getTanStackQueryVersion(packageJson);
|
|
34338
|
-
const styledComponentsVersion = resolveCatalogBackedDependencyVersion({
|
|
34339
|
-
rootDirectory: directory,
|
|
34340
|
-
rootPackageJson: packageJson,
|
|
34341
|
-
packageName: "styled-components",
|
|
34342
|
-
version: getStyledComponentsVersion(packageJson)
|
|
34343
|
-
});
|
|
34344
|
-
if (styledComponentsVersion && shouldReplaceStyledComponentsVersion(facts.styledComponentsVersion, styledComponentsVersion)) facts.styledComponentsVersion = styledComponentsVersion;
|
|
34345
|
-
facts.hasI18nLibrary = facts.hasI18nLibrary || hasI18nDependency(packageJson);
|
|
34346
34220
|
facts.hasReactNativeAwarePackage = facts.hasReactNativeAwarePackage || isPackageJsonReactNativeAware(packageJson);
|
|
34347
34221
|
facts.hasReanimatedAwarePackage = facts.hasReanimatedAwarePackage || isPackageJsonReanimatedAware(packageJson);
|
|
34348
34222
|
facts.hasSsrDependency = facts.hasSsrDependency || isPackageJsonSsrAware(packageJson);
|
|
34349
|
-
const remotionSpec = getDependencySpec(packageJson, "remotion");
|
|
34350
|
-
if (remotionSpec !== null) {
|
|
34351
|
-
facts.hasRemotionDependency = true;
|
|
34352
|
-
const resolvedRemotionVersion = resolveCatalogBackedDependencyVersion({
|
|
34353
|
-
rootDirectory,
|
|
34354
|
-
rootPackageJson,
|
|
34355
|
-
packageName: "remotion",
|
|
34356
|
-
version: remotionSpec
|
|
34357
|
-
});
|
|
34358
|
-
const remotionMajorVersion = resolvedRemotionVersion === null ? null : getLowestDependencyMajor(resolvedRemotionVersion);
|
|
34359
|
-
if (remotionMajorVersion === null) {
|
|
34360
|
-
facts.hasUnknownRemotionVersion = true;
|
|
34361
|
-
facts.remotionVersion = null;
|
|
34362
|
-
} else if (!facts.hasUnknownRemotionVersion) {
|
|
34363
|
-
const currentRemotionMajorVersion = facts.remotionVersion === null ? null : getLowestDependencyMajor(facts.remotionVersion);
|
|
34364
|
-
if (currentRemotionMajorVersion === null || remotionMajorVersion < currentRemotionMajorVersion) facts.remotionVersion = resolvedRemotionVersion;
|
|
34365
|
-
}
|
|
34366
|
-
}
|
|
34367
34223
|
};
|
|
34368
34224
|
const collectWorkspaceFacts = (rootDirectory, rootPackageJson, { collectReactGroup }) => {
|
|
34369
34225
|
const facts = {
|
|
@@ -34383,31 +34239,12 @@ const collectWorkspaceFacts = (rootDirectory, rootPackageJson, { collectReactGro
|
|
|
34383
34239
|
version: null,
|
|
34384
34240
|
sourceDirectory: null
|
|
34385
34241
|
},
|
|
34386
|
-
valtioVersion: null,
|
|
34387
|
-
mobx: {
|
|
34388
|
-
version: null,
|
|
34389
|
-
sourceDirectory: null
|
|
34390
|
-
},
|
|
34391
|
-
hasMobxReact: false,
|
|
34392
|
-
hasMobxReactLite: false,
|
|
34393
|
-
hasMobxStateTree: false,
|
|
34394
|
-
hasMobxReactObserver: false,
|
|
34395
|
-
zustand: {
|
|
34396
|
-
version: null,
|
|
34397
|
-
sourceDirectory: null
|
|
34398
|
-
},
|
|
34399
|
-
tanstackQueryVersion: null,
|
|
34400
|
-
styledComponentsVersion: null,
|
|
34401
|
-
hasI18nLibrary: false,
|
|
34402
34242
|
hasReactNativeAwarePackage: false,
|
|
34403
34243
|
hasReanimatedAwarePackage: false,
|
|
34404
34244
|
hasSsrDependency: false,
|
|
34405
|
-
hasRemotionDependency: false,
|
|
34406
|
-
hasUnknownRemotionVersion: false,
|
|
34407
|
-
remotionVersion: null,
|
|
34408
34245
|
reanimatedVersion: null
|
|
34409
34246
|
};
|
|
34410
|
-
evaluateManifestFacts(facts, rootPackageJson, rootDirectory
|
|
34247
|
+
evaluateManifestFacts(facts, rootPackageJson, rootDirectory);
|
|
34411
34248
|
let isReactGroupSettled = !collectReactGroup;
|
|
34412
34249
|
const visitedDirectories = /* @__PURE__ */ new Set();
|
|
34413
34250
|
for (const pattern of getWorkspacePatterns(rootDirectory, rootPackageJson)) {
|
|
@@ -34416,7 +34253,7 @@ const collectWorkspaceFacts = (rootDirectory, rootPackageJson, { collectReactGro
|
|
|
34416
34253
|
if (visitedDirectories.has(workspaceDirectory)) continue;
|
|
34417
34254
|
visitedDirectories.add(workspaceDirectory);
|
|
34418
34255
|
const workspacePackageJson = readPackageJson(Path.join(workspaceDirectory, "package.json"));
|
|
34419
|
-
evaluateManifestFacts(facts, workspacePackageJson, workspaceDirectory
|
|
34256
|
+
evaluateManifestFacts(facts, workspacePackageJson, workspaceDirectory);
|
|
34420
34257
|
const info = extractDependencyInfo(workspacePackageJson);
|
|
34421
34258
|
if (info.framework !== "unknown" && frameworkMergeRank(info.framework) < frameworkMergeRank(facts.framework)) facts.framework = info.framework;
|
|
34422
34259
|
if (isReactGroupSettled) continue;
|
|
@@ -34640,27 +34477,11 @@ const discoverProjectWithoutPackageJson = (directory) => {
|
|
|
34640
34477
|
tailwindVersion: null,
|
|
34641
34478
|
zodVersion: null,
|
|
34642
34479
|
zodMajorVersion: null,
|
|
34643
|
-
mobxVersion: null,
|
|
34644
|
-
mobxMajorVersion: null,
|
|
34645
|
-
hasMobxReact: false,
|
|
34646
|
-
hasMobxReactLite: false,
|
|
34647
|
-
hasMobxStateTree: false,
|
|
34648
|
-
hasMobxReactObserver: false,
|
|
34649
|
-
zustandVersion: null,
|
|
34650
|
-
zustandMajorVersion: null,
|
|
34651
34480
|
framework: "unknown",
|
|
34652
34481
|
hasTypeScript: hasOwnTsConfig,
|
|
34653
34482
|
hasReactCompiler: false,
|
|
34654
34483
|
hasReactCompilerLintPlugin: false,
|
|
34655
34484
|
hasTanStackQuery: false,
|
|
34656
|
-
valtioVersion: null,
|
|
34657
|
-
valtioMajorVersion: null,
|
|
34658
|
-
hasRemotion: false,
|
|
34659
|
-
remotionVersion: null,
|
|
34660
|
-
remotionMajorVersion: null,
|
|
34661
|
-
hasI18nLibrary: false,
|
|
34662
|
-
tanstackQueryVersion: null,
|
|
34663
|
-
styledComponentsVersion: null,
|
|
34664
34485
|
hasSsrDependency: false,
|
|
34665
34486
|
preactVersion: null,
|
|
34666
34487
|
preactMajorVersion: null,
|
|
@@ -34759,12 +34580,6 @@ const discoverProject = (directory) => {
|
|
|
34759
34580
|
packageName: SHOPIFY_FLASH_LIST_PACKAGE_NAME,
|
|
34760
34581
|
version: workspaceFacts.shopifyFlashList.version
|
|
34761
34582
|
}) : null;
|
|
34762
|
-
const zustandVersion = resolveCatalogBackedDependencyVersion({
|
|
34763
|
-
rootDirectory: directory,
|
|
34764
|
-
rootPackageJson: packageJson,
|
|
34765
|
-
packageName: "zustand",
|
|
34766
|
-
version: workspaceFacts.zustand.version
|
|
34767
|
-
});
|
|
34768
34583
|
const hasReanimated = hasReactNativeWorkspace && workspaceFacts.hasReanimatedAwarePackage;
|
|
34769
34584
|
const reanimatedVersion = hasReanimated ? workspaceFacts.reanimatedVersion : null;
|
|
34770
34585
|
const nextjsVersion = framework === "nextjs" ? resolveCatalogBackedDependencyVersion({
|
|
@@ -34773,21 +34588,7 @@ const discoverProject = (directory) => {
|
|
|
34773
34588
|
packageName: "next",
|
|
34774
34589
|
version: workspaceFacts.next.version
|
|
34775
34590
|
}) : null;
|
|
34776
|
-
const valtioVersion = resolveCatalogBackedDependencyVersion({
|
|
34777
|
-
rootDirectory: directory,
|
|
34778
|
-
rootPackageJson: packageJson,
|
|
34779
|
-
packageName: "valtio",
|
|
34780
|
-
version: workspaceFacts.valtioVersion
|
|
34781
|
-
});
|
|
34782
|
-
const mobxVersion = resolveCatalogBackedDependencyVersion({
|
|
34783
|
-
rootDirectory: directory,
|
|
34784
|
-
rootPackageJson: packageJson,
|
|
34785
|
-
packageName: "mobx",
|
|
34786
|
-
version: workspaceFacts.mobx.version
|
|
34787
|
-
});
|
|
34788
34591
|
const preactVersion = getPreactVersion(packageJson);
|
|
34789
|
-
const remotionVersion = workspaceFacts.remotionVersion;
|
|
34790
|
-
const tanstackQueryVersion = getTanStackQueryVersion(packageJson) ?? workspaceFacts.tanstackQueryVersion;
|
|
34791
34592
|
const isPreES2023Target = hasTypeScript && detectPreES2023Target(directory);
|
|
34792
34593
|
const projectInfo = {
|
|
34793
34594
|
rootDirectory: directory,
|
|
@@ -34797,27 +34598,11 @@ const discoverProject = (directory) => {
|
|
|
34797
34598
|
tailwindVersion,
|
|
34798
34599
|
zodVersion,
|
|
34799
34600
|
zodMajorVersion: zodVersion === null ? null : getLowestDependencyMajor(zodVersion),
|
|
34800
|
-
mobxVersion,
|
|
34801
|
-
mobxMajorVersion: mobxVersion === null ? null : getLowestDependencyMajor(mobxVersion),
|
|
34802
|
-
hasMobxReact: workspaceFacts.hasMobxReact,
|
|
34803
|
-
hasMobxReactLite: workspaceFacts.hasMobxReactLite,
|
|
34804
|
-
hasMobxStateTree: workspaceFacts.hasMobxStateTree,
|
|
34805
|
-
hasMobxReactObserver: workspaceFacts.hasMobxReactObserver,
|
|
34806
|
-
zustandVersion,
|
|
34807
|
-
zustandMajorVersion: zustandVersion === null ? null : getLowestDependencyMajor(zustandVersion),
|
|
34808
34601
|
framework,
|
|
34809
34602
|
hasTypeScript,
|
|
34810
34603
|
hasReactCompiler: detectReactCompiler(directory, packageJson),
|
|
34811
34604
|
hasReactCompilerLintPlugin: detectReactCompilerLintPlugin(directory, packageJson),
|
|
34812
|
-
hasTanStackQuery:
|
|
34813
|
-
hasI18nLibrary: workspaceFacts.hasI18nLibrary,
|
|
34814
|
-
tanstackQueryVersion,
|
|
34815
|
-
styledComponentsVersion: workspaceFacts.styledComponentsVersion,
|
|
34816
|
-
valtioVersion,
|
|
34817
|
-
valtioMajorVersion: valtioVersion === null ? null : getLowestDependencyMajor(valtioVersion),
|
|
34818
|
-
hasRemotion: workspaceFacts.hasRemotionDependency,
|
|
34819
|
-
remotionVersion,
|
|
34820
|
-
remotionMajorVersion: remotionVersion === null ? null : getLowestDependencyMajor(remotionVersion),
|
|
34605
|
+
hasTanStackQuery: hasTanStackQuery(packageJson),
|
|
34821
34606
|
hasSsrDependency: workspaceFacts.hasSsrDependency,
|
|
34822
34607
|
preactVersion,
|
|
34823
34608
|
preactMajorVersion: parseReactMajor(preactVersion),
|
|
@@ -35051,6 +34836,7 @@ const LEGACY_RULE_KEY_TO_NATIVE_RULE_KEY = {
|
|
|
35051
34836
|
"react/jsx-no-new-function-as-prop": "react-doctor/jsx-no-new-function-as-prop",
|
|
35052
34837
|
"react/jsx-no-new-object-as-prop": "react-doctor/jsx-no-new-object-as-prop",
|
|
35053
34838
|
"react/jsx-no-script-url": "react-doctor/jsx-no-script-url",
|
|
34839
|
+
"react/jsx-no-target-blank": "react-doctor/jsx-no-target-blank",
|
|
35054
34840
|
"react/jsx-no-undef": "react-doctor/jsx-no-undef",
|
|
35055
34841
|
"react/jsx-no-useless-fragment": "react-doctor/jsx-no-useless-fragment",
|
|
35056
34842
|
"react/jsx-pascal-case": "react-doctor/jsx-pascal-case",
|
|
@@ -37263,25 +37049,9 @@ const BABEL_CONFIG_FILE_NAMES = [
|
|
|
37263
37049
|
".babelrc.json"
|
|
37264
37050
|
];
|
|
37265
37051
|
const LEGACY_PRESET_SPEC = "module:metro-react-native-babel-preset";
|
|
37266
|
-
const LEGACY_PRESET_PACKAGE = "metro-react-native-babel-preset";
|
|
37267
|
-
const REACT_NATIVE_PACKAGE = "react-native";
|
|
37268
|
-
const PRESET_RENAME_MINIMUM_REACT_NATIVE_VERSION = "0.73.0";
|
|
37269
|
-
const LEGACY_PRESET_REFERENCE = new RegExp(`['"]${LEGACY_PRESET_SPEC}['"]`);
|
|
37270
37052
|
const MODERN_PRESET_REFERENCE = new RegExp(`['"]module:@react-native/babel-preset['"]`);
|
|
37271
37053
|
const ENABLE_BABEL_RUNTIME_VERSION = /enableBabelRuntime["']?\s*:\s*['"]/;
|
|
37272
|
-
const isReactNativeVersionAtLeastPresetRename = (rootDirectory, packageJson) => {
|
|
37273
|
-
const installedReactNativeManifestPath = Path.join(rootDirectory, "node_modules", REACT_NATIVE_PACKAGE, "package.json");
|
|
37274
|
-
const reactNativeVersionSpec = (isFile(installedReactNativeManifestPath) ? readPackageJson(installedReactNativeManifestPath).version : void 0) ?? getDependencySpec(packageJson, REACT_NATIVE_PACKAGE);
|
|
37275
|
-
if (reactNativeVersionSpec === null || reactNativeVersionSpec === void 0) return false;
|
|
37276
|
-
const normalizedVersionRange = import_semver.validRange(reactNativeVersionSpec);
|
|
37277
|
-
if (normalizedVersionRange === null) return false;
|
|
37278
|
-
const minimumVersion = import_semver.minVersion(normalizedVersionRange);
|
|
37279
|
-
return minimumVersion !== null && import_semver.gte(minimumVersion, PRESET_RENAME_MINIMUM_REACT_NATIVE_VERSION);
|
|
37280
|
-
};
|
|
37281
|
-
const canResolveLegacyPreset = (rootDirectory, packageJson) => getDependencySpec(packageJson, LEGACY_PRESET_PACKAGE) !== null || isFile(Path.join(rootDirectory, "node_modules", LEGACY_PRESET_PACKAGE, "package.json"));
|
|
37282
37054
|
const checkReactNativeMetroBabelPreset = (rootDirectory) => {
|
|
37283
|
-
const packageJson = readPackageJson(Path.join(rootDirectory, "package.json"));
|
|
37284
|
-
const shouldReportLegacyPreset = isReactNativeVersionAtLeastPresetRename(rootDirectory, packageJson) && !canResolveLegacyPreset(rootDirectory, packageJson);
|
|
37285
37055
|
for (const fileName of BABEL_CONFIG_FILE_NAMES) {
|
|
37286
37056
|
const filePath = Path.join(rootDirectory, fileName);
|
|
37287
37057
|
if (!isFile(filePath)) continue;
|
|
@@ -37291,7 +37061,7 @@ const checkReactNativeMetroBabelPreset = (rootDirectory) => {
|
|
|
37291
37061
|
} catch {
|
|
37292
37062
|
continue;
|
|
37293
37063
|
}
|
|
37294
|
-
if (
|
|
37064
|
+
if (contents.includes(LEGACY_PRESET_SPEC)) return [buildReactNativeDiagnostic({
|
|
37295
37065
|
filePath: fileName,
|
|
37296
37066
|
rule: "rn-no-metro-babel-preset",
|
|
37297
37067
|
severity: "error",
|
|
@@ -37314,6 +37084,12 @@ const checkReactNativeProject = (rootDirectory, project) => {
|
|
|
37314
37084
|
return [...checkReactNativeMetroBabelPreset(rootDirectory), ...checkReactNativeLibraryDependencies(rootDirectory)];
|
|
37315
37085
|
};
|
|
37316
37086
|
const RULE_KEY = "no-vulnerable-react-server-components";
|
|
37087
|
+
const DEPENDENCY_SECTIONS = [
|
|
37088
|
+
"dependencies",
|
|
37089
|
+
"devDependencies",
|
|
37090
|
+
"peerDependencies",
|
|
37091
|
+
"optionalDependencies"
|
|
37092
|
+
];
|
|
37317
37093
|
const REACT_RSC_ADVISORIES_BY_MINOR = {
|
|
37318
37094
|
"19.0": {
|
|
37319
37095
|
rceFixedVersion: "19.0.1",
|
|
@@ -37360,13 +37136,20 @@ const enumerateWorkspaceDirectories = (workspaceRoot) => {
|
|
|
37360
37136
|
for (const pattern of patterns) for (const directory of resolveWorkspaceDirectories(workspaceRoot, pattern)) directories.add(directory);
|
|
37361
37137
|
return [...directories];
|
|
37362
37138
|
};
|
|
37139
|
+
const readDeclaredSpec = (packageJson, packageName) => {
|
|
37140
|
+
for (const section of DEPENDENCY_SECTIONS) {
|
|
37141
|
+
const spec = packageJson[section]?.[packageName];
|
|
37142
|
+
if (typeof spec === "string") return spec;
|
|
37143
|
+
}
|
|
37144
|
+
return null;
|
|
37145
|
+
};
|
|
37363
37146
|
const resolveVersionInDirectory = (directory, packageName, declaredSpecOverride) => {
|
|
37364
37147
|
const manifestPath = Path.join(directory, "node_modules", packageName, "package.json");
|
|
37365
37148
|
if (isFile(manifestPath)) {
|
|
37366
37149
|
const installedVersion = import_semver.valid(readPackageJson(manifestPath).version ?? null);
|
|
37367
37150
|
if (installedVersion !== null) return installedVersion;
|
|
37368
37151
|
}
|
|
37369
|
-
const candidateSpecs = [
|
|
37152
|
+
const candidateSpecs = [readDeclaredSpec(readPackageJson(Path.join(directory, "package.json")), packageName), declaredSpecOverride];
|
|
37370
37153
|
for (const spec of candidateSpecs) {
|
|
37371
37154
|
const pinnedVersion = spec === null ? null : import_semver.valid(spec);
|
|
37372
37155
|
if (pinnedVersion !== null) return pinnedVersion;
|
|
@@ -38034,50 +37817,21 @@ const buildCapabilities = (project) => {
|
|
|
38034
37817
|
if (CLIENT_ONLY_FRAMEWORKS.has(project.framework)) capabilities.add("client-only");
|
|
38035
37818
|
if (project.isStaticExport) capabilities.add("nextjs:static-export");
|
|
38036
37819
|
if (project.nextjsMajorVersion !== null && project.nextjsMajorVersion >= 15) capabilities.add("nextjs:15");
|
|
38037
|
-
if (project.nextjsMajorVersion !== null && project.nextjsMajorVersion >= 16) capabilities.add("nextjs:16");
|
|
38038
37820
|
addMajorLadder(capabilities, "react", project.reactMajorVersion, 17, 30);
|
|
38039
37821
|
if (project.reactMajorVersion !== null && project.reactMajorVersion >= 19 && isMajorMinorAtLeast(parseReactMajorMinor(project.reactVersion), {
|
|
38040
37822
|
major: 19,
|
|
38041
37823
|
minor: 2
|
|
38042
37824
|
})) capabilities.add("react:19.2");
|
|
38043
|
-
if (project.tailwindVersion !== null)
|
|
38044
|
-
|
|
38045
|
-
|
|
38046
|
-
|
|
38047
|
-
|
|
38048
|
-
minor: 4
|
|
38049
|
-
})) capabilities.add("tailwind:3.4");
|
|
38050
|
-
if (tailwindVersion !== null && isMajorMinorAtLeast(tailwindVersion, {
|
|
38051
|
-
major: 4,
|
|
38052
|
-
minor: 0
|
|
38053
|
-
})) capabilities.add("tailwind:4");
|
|
38054
|
-
}
|
|
37825
|
+
if (project.tailwindVersion !== null) capabilities.add("tailwind");
|
|
37826
|
+
if (project.tailwindVersion !== null && isMajorMinorAtLeast(parseTailwindMajorMinor(project.tailwindVersion), {
|
|
37827
|
+
major: 3,
|
|
37828
|
+
minor: 4
|
|
37829
|
+
})) capabilities.add("tailwind:3.4");
|
|
38055
37830
|
if (project.zodVersion !== null) capabilities.add("zod");
|
|
38056
37831
|
if (project.zodMajorVersion !== null && project.zodMajorVersion >= 4) capabilities.add("zod:4");
|
|
38057
|
-
if (project.mobxVersion !== void 0 && project.mobxVersion !== null || project.hasMobxReact === true || project.hasMobxReactLite === true || project.hasMobxStateTree === true || project.hasMobxReactObserver === true) capabilities.add("mobx");
|
|
38058
|
-
if (project.hasMobxReact === true) capabilities.add("mobx-react");
|
|
38059
|
-
if (project.hasMobxReactLite === true) capabilities.add("mobx-react-lite");
|
|
38060
|
-
if (project.hasMobxReact === true || project.hasMobxReactLite === true) capabilities.add("mobx-react-binding");
|
|
38061
|
-
if (project.hasMobxStateTree === true) capabilities.add("mobx-state-tree");
|
|
38062
|
-
if (project.hasMobxReactObserver === true) capabilities.add("mobx-react-observer");
|
|
38063
|
-
if (project.mobxMajorVersion !== void 0 && project.mobxMajorVersion !== null && project.mobxMajorVersion >= 4 && project.mobxMajorVersion <= 6) addMajorLadder(capabilities, "mobx", project.mobxMajorVersion, 4, 6);
|
|
38064
|
-
if (project.zustandVersion !== void 0 && project.zustandVersion !== null) capabilities.add("zustand");
|
|
38065
|
-
if (project.zustandMajorVersion !== void 0 && project.zustandMajorVersion !== null && project.zustandMajorVersion >= 1 && project.zustandMajorVersion <= 5) addMajorLadder(capabilities, "zustand", project.zustandMajorVersion, 1, 5);
|
|
38066
37832
|
if (project.isPreES2023Target) capabilities.add("pre-es2023");
|
|
38067
37833
|
if (project.hasReactCompiler) capabilities.add("react-compiler");
|
|
38068
|
-
if (
|
|
38069
|
-
if (project.styledComponentsVersion) {
|
|
38070
|
-
capabilities.add("styled-components");
|
|
38071
|
-
const styledComponentsMajor = getLowestDependencyMajor(project.styledComponentsVersion);
|
|
38072
|
-
if (styledComponentsMajor !== null && styledComponentsMajor >= 6) capabilities.add("styled-components:6");
|
|
38073
|
-
}
|
|
38074
|
-
if (project.hasI18nLibrary) capabilities.add("i18n");
|
|
38075
|
-
if (project.valtioVersion !== null) capabilities.add("valtio");
|
|
38076
|
-
addMajorLadder(capabilities, "valtio", project.valtioMajorVersion, 1, 10);
|
|
38077
|
-
if (project.hasRemotion) {
|
|
38078
|
-
capabilities.add("remotion");
|
|
38079
|
-
addMajorLadder(capabilities, "remotion", project.remotionMajorVersion ?? null, 4, 30);
|
|
38080
|
-
}
|
|
37834
|
+
if (project.hasTanStackQuery) capabilities.add("tanstack-query");
|
|
38081
37835
|
if (project.hasTypeScript) capabilities.add("typescript");
|
|
38082
37836
|
if (project.preactVersion !== null) capabilities.add("preact");
|
|
38083
37837
|
addMajorLadder(capabilities, "preact", project.preactMajorVersion, 10, 20);
|
|
@@ -38092,7 +37846,7 @@ const getCapabilities = (project) => {
|
|
|
38092
37846
|
capabilitiesByProject.set(project, capabilities);
|
|
38093
37847
|
return capabilities;
|
|
38094
37848
|
};
|
|
38095
|
-
const shouldEnableRule = (requires, tags, capabilities, ignoredTags, disabledWhen
|
|
37849
|
+
const shouldEnableRule = (requires, tags, capabilities, ignoredTags, disabledWhen) => {
|
|
38096
37850
|
if (requires) {
|
|
38097
37851
|
for (const capability of requires) if (!capabilities.has(capability)) return false;
|
|
38098
37852
|
}
|
|
@@ -38103,29 +37857,20 @@ const shouldEnableRule = (requires, tags, capabilities, ignoredTags, disabledWhe
|
|
|
38103
37857
|
if (tags) {
|
|
38104
37858
|
for (const tag of tags) if (ignoredTags.has(tag)) return false;
|
|
38105
37859
|
}
|
|
38106
|
-
if (includedTags && includedTags.size > 0) {
|
|
38107
|
-
if (!tags?.some((tag) => includedTags.has(tag))) return false;
|
|
38108
|
-
}
|
|
38109
37860
|
return true;
|
|
38110
37861
|
};
|
|
38111
|
-
const shouldEnableRuleByDefaultStatus = (options) => options.defaultEnabled !== false || options.hasExplicitOverride === true || options.includeTagDefaults && options.hasIncludedTags;
|
|
38112
37862
|
const yieldToEventLoop = () => new Promise((resolve) => {
|
|
38113
37863
|
setImmediate(resolve);
|
|
38114
37864
|
});
|
|
38115
37865
|
const createSecurityScanSession = (rootDirectory, options) => {
|
|
38116
37866
|
const capabilities = options.project ? getCapabilities(options.project) : /* @__PURE__ */ new Set();
|
|
38117
37867
|
const ignoredTags = options.ignoredTags ?? /* @__PURE__ */ new Set();
|
|
38118
|
-
const includedTags = options.includedTags ?? /* @__PURE__ */ new Set();
|
|
38119
37868
|
const enabledScanRules = REACT_DOCTOR_RULES.flatMap((entry) => {
|
|
38120
37869
|
const rule = entry.rule;
|
|
38121
37870
|
const scan = rule.scan;
|
|
38122
37871
|
if (typeof scan !== "function") return [];
|
|
38123
|
-
if (
|
|
38124
|
-
|
|
38125
|
-
includeTagDefaults: options.includeTagDefaults === true,
|
|
38126
|
-
hasIncludedTags: includedTags.size > 0
|
|
38127
|
-
})) return [];
|
|
38128
|
-
if (!shouldEnableRule(rule.requires, rule.tags, capabilities, ignoredTags, rule.disabledWhen, includedTags)) return [];
|
|
37872
|
+
if (rule.defaultEnabled === false) return [];
|
|
37873
|
+
if (!shouldEnableRule(rule.requires, rule.tags, capabilities, ignoredTags, rule.disabledWhen)) return [];
|
|
38129
37874
|
return [{
|
|
38130
37875
|
entry,
|
|
38131
37876
|
scan,
|
|
@@ -40111,9 +39856,8 @@ const buildUserPluginRules = (userPlugin, severityControls) => {
|
|
|
40111
39856
|
}
|
|
40112
39857
|
return enabled;
|
|
40113
39858
|
};
|
|
40114
|
-
const createOxlintConfig = ({ pluginPath, project, customRulesOnly = false, extendsPaths = [], ignoredTags = /* @__PURE__ */ new Set(),
|
|
40115
|
-
const
|
|
40116
|
-
const reactHooksJsPlugin = disableReactHooksJsPlugin || ruleSelection === "sidecar" || hasIncludedTags ? null : resolveReactHooksJsPlugin(project.hasReactCompiler || project.hasReactCompilerLintPlugin === true, customRulesOnly);
|
|
39859
|
+
const createOxlintConfig = ({ pluginPath, project, customRulesOnly = false, extendsPaths = [], ignoredTags = /* @__PURE__ */ new Set(), serverAuthFunctionNames, severityControls, userPlugins = [], disableReactHooksJsPlugin = false, ruleSelection, sidecarRuleIdFilter }) => {
|
|
39860
|
+
const reactHooksJsPlugin = disableReactHooksJsPlugin || ruleSelection === "sidecar" ? null : resolveReactHooksJsPlugin(project.hasReactCompiler || project.hasReactCompilerLintPlugin === true, customRulesOnly);
|
|
40117
39861
|
const reactCompilerRules = reactHooksJsPlugin ? applyRuleSeverityControls(filterRulesToAvailable(REACT_COMPILER_RULES, "react-hooks-js", reactHooksJsPlugin.availableRuleNames), severityControls) : {};
|
|
40118
39862
|
const jsPlugins = [];
|
|
40119
39863
|
if (reactHooksJsPlugin) jsPlugins.push(reactHooksJsPlugin.entry);
|
|
@@ -40128,14 +39872,9 @@ const createOxlintConfig = ({ pluginPath, project, customRulesOnly = false, exte
|
|
|
40128
39872
|
if (rule.scan !== void 0) continue;
|
|
40129
39873
|
if (customRulesOnly && registryEntry.originallyExternal) continue;
|
|
40130
39874
|
if (rule.framework !== "global" && !rule.requires) continue;
|
|
40131
|
-
if (!shouldEnableRule(rule.requires, rule.tags, capabilities, ignoredTags, rule.disabledWhen
|
|
39875
|
+
if (!shouldEnableRule(rule.requires, rule.tags, capabilities, ignoredTags, rule.disabledWhen)) continue;
|
|
40132
39876
|
const explicitRuleOverride = resolveRuleSeverityOverride({ ruleKey: registryEntry.key }, severityControls);
|
|
40133
|
-
if (
|
|
40134
|
-
defaultEnabled: rule.defaultEnabled,
|
|
40135
|
-
includeTagDefaults,
|
|
40136
|
-
hasIncludedTags,
|
|
40137
|
-
hasExplicitOverride: explicitRuleOverride !== void 0
|
|
40138
|
-
})) continue;
|
|
39877
|
+
if (rule.defaultEnabled === false && explicitRuleOverride === void 0) continue;
|
|
40139
39878
|
const severity = resolveRuleSeverityOverride({
|
|
40140
39879
|
ruleKey: registryEntry.key,
|
|
40141
39880
|
category: rule.category
|
|
@@ -40144,7 +39883,7 @@ const createOxlintConfig = ({ pluginPath, project, customRulesOnly = false, exte
|
|
|
40144
39883
|
enabledReactDoctorRules[registryEntry.key] = severity;
|
|
40145
39884
|
}
|
|
40146
39885
|
const userPluginRules = {};
|
|
40147
|
-
if (ruleSelection !== "sidecar"
|
|
39886
|
+
if (ruleSelection !== "sidecar") for (const userPlugin of userPlugins) {
|
|
40148
39887
|
Object.assign(userPluginRules, buildUserPluginRules(userPlugin, severityControls));
|
|
40149
39888
|
jsPlugins.push(userPlugin.entry);
|
|
40150
39889
|
}
|
|
@@ -40361,19 +40100,6 @@ const createSidecarLintCache = (cacheDirectory, rulesetHash) => {
|
|
|
40361
40100
|
}
|
|
40362
40101
|
};
|
|
40363
40102
|
};
|
|
40364
|
-
const fingerprintCacheByFilePath = /* @__PURE__ */ new Map();
|
|
40365
|
-
const fingerprintFileContents = (filePath, fingerprintLength) => {
|
|
40366
|
-
const fileStats = NFS.statSync(filePath, { bigint: true });
|
|
40367
|
-
const cachedFingerprint = fingerprintCacheByFilePath.get(filePath);
|
|
40368
|
-
if (cachedFingerprint?.modifiedTimeNanoseconds === fileStats.mtimeNs && cachedFingerprint.sizeBytes === fileStats.size) return cachedFingerprint.fingerprint;
|
|
40369
|
-
const fingerprint = crypto.createHash("sha256").update(NFS.readFileSync(filePath)).digest("hex").slice(0, fingerprintLength);
|
|
40370
|
-
fingerprintCacheByFilePath.set(filePath, {
|
|
40371
|
-
fingerprint,
|
|
40372
|
-
modifiedTimeNanoseconds: fileStats.mtimeNs,
|
|
40373
|
-
sizeBytes: fileStats.size
|
|
40374
|
-
});
|
|
40375
|
-
return fingerprint;
|
|
40376
|
-
};
|
|
40377
40103
|
const bundledRequire = createRequire(import.meta.url);
|
|
40378
40104
|
const childNodeVersionByBinaryPath = /* @__PURE__ */ new Map();
|
|
40379
40105
|
const resolveChildNodeVersion = (nodeBinaryPath) => {
|
|
@@ -40397,13 +40123,6 @@ const TOOLCHAIN_PACKAGE_SPECIFIERS = [
|
|
|
40397
40123
|
"oxlint-plugin-react-doctor/package.json",
|
|
40398
40124
|
"eslint-plugin-react-hooks/package.json"
|
|
40399
40125
|
];
|
|
40400
|
-
const resolvePluginFingerprint = () => {
|
|
40401
|
-
try {
|
|
40402
|
-
return fingerprintFileContents(bundledRequire.resolve("oxlint-plugin-react-doctor"), 16);
|
|
40403
|
-
} catch {
|
|
40404
|
-
return "unresolved";
|
|
40405
|
-
}
|
|
40406
|
-
};
|
|
40407
40126
|
const resolveOxlintToolchainVersions = (nodeBinaryPath = process.execPath) => {
|
|
40408
40127
|
const versions = [`node=${resolveChildNodeVersion(nodeBinaryPath)}`];
|
|
40409
40128
|
for (const specifier of TOOLCHAIN_PACKAGE_SPECIFIERS) try {
|
|
@@ -40413,7 +40132,6 @@ const resolveOxlintToolchainVersions = (nodeBinaryPath = process.execPath) => {
|
|
|
40413
40132
|
} catch {
|
|
40414
40133
|
versions.push(`${specifier}=missing`);
|
|
40415
40134
|
}
|
|
40416
|
-
versions.push(`oxlint-plugin-react-doctor#fingerprint=${resolvePluginFingerprint()}`);
|
|
40417
40135
|
return versions;
|
|
40418
40136
|
};
|
|
40419
40137
|
const esmRequire = createRequire(import.meta.url);
|
|
@@ -41107,17 +40825,12 @@ const REACT_ERROR_BOUNDARY_MESSAGE = "This try/catch cannot catch errors thrown
|
|
|
41107
40825
|
const REACT_COMPILER_IMPACT = "This component misses React Compiler's automatic memoization & re-renders more than it should";
|
|
41108
40826
|
const REACT_COMPILER_ACTION = "Rewrite the flagged code so the compiler can optimize it.";
|
|
41109
40827
|
const REACT_COMPILER_INCOMPATIBLE_LIBRARY_ACTION = "It's how the library works, not a bug in your code. Memoize values you pass from it into other memoized components, or suppress it with `// react-doctor-disable-next-line react-hooks-js/incompatible-library`.";
|
|
41110
|
-
const SET_STATE_IN_EFFECT_ACTION = "Prefer deriving or initializing the value before render. If the effect must read a browser API after mount, treat this as advisory or suppress it with `// react-doctor-disable-next-line react-hooks-js/set-state-in-effect`.";
|
|
41111
40828
|
const REACT_COMPILER_GENERIC_MESSAGE = `${REACT_COMPILER_IMPACT}. ${REACT_COMPILER_ACTION}`;
|
|
41112
40829
|
const buildReactCompilerMessage = (reasonSummary, action = REACT_COMPILER_ACTION) => {
|
|
41113
40830
|
const normalizedSummary = reasonSummary.replace(TRAILING_PERIOD_PATTERN, "");
|
|
41114
40831
|
if (!normalizedSummary) return `${REACT_COMPILER_IMPACT}. ${action}`;
|
|
41115
40832
|
return `${REACT_COMPILER_IMPACT}: ${normalizedSummary}. ${action}`;
|
|
41116
40833
|
};
|
|
41117
|
-
const buildSetStateInEffectMessage = (reasonSummary) => {
|
|
41118
|
-
const normalizedSummary = reasonSummary.replace(TRAILING_PERIOD_PATTERN, "");
|
|
41119
|
-
return `This synchronous effect update causes an extra render${normalizedSummary ? `: ${normalizedSummary}` : ""}. ${SET_STATE_IN_EFFECT_ACTION}`;
|
|
41120
|
-
};
|
|
41121
40834
|
const PLUGIN_CATEGORY_MAP = {
|
|
41122
40835
|
react: "Bugs",
|
|
41123
40836
|
"react-hooks": "Bugs",
|
|
@@ -41175,10 +40888,6 @@ const resolveCleanedDiagnostic = (message, help, plugin, rule, project) => {
|
|
|
41175
40888
|
message: REACT_ERROR_BOUNDARY_MESSAGE,
|
|
41176
40889
|
help: reasonDetail || help
|
|
41177
40890
|
};
|
|
41178
|
-
if (rule === "set-state-in-effect") return {
|
|
41179
|
-
message: buildSetStateInEffectMessage(reasonSummary.trim()),
|
|
41180
|
-
help: reasonDetail || help
|
|
41181
|
-
};
|
|
41182
40891
|
return {
|
|
41183
40892
|
message: buildReactCompilerMessage(reasonSummary.trim(), rule === "incompatible-library" ? REACT_COMPILER_INCOMPATIBLE_LIBRARY_ACTION : REACT_COMPILER_ACTION),
|
|
41184
40893
|
help: appendReanimatedSharedValueHint(reasonDetail || help, rule, project)
|
|
@@ -41889,7 +41598,7 @@ const reactHooksJsPluginDropNote = (error) => {
|
|
|
41889
41598
|
* 6. always restore disable directives + clean up the temp dir
|
|
41890
41599
|
*/
|
|
41891
41600
|
const runOxlint = async (options) => {
|
|
41892
|
-
const { rootDirectory, project, includePaths, nodeBinaryPath = process.execPath, customRulesOnly = false, respectInlineDisables = true, adoptExistingLintConfig = true, ignoredTags = /* @__PURE__ */ new Set(),
|
|
41601
|
+
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;
|
|
41893
41602
|
const serverAuthFunctionNames = Array.isArray(userConfig?.serverAuthFunctionNames) ? userConfig.serverAuthFunctionNames.filter((entry) => typeof entry === "string" && entry.length > 0) : void 0;
|
|
41894
41603
|
const severityControls = buildRuleSeverityControls(userConfig);
|
|
41895
41604
|
validateRuleRegistration();
|
|
@@ -41903,15 +41612,13 @@ const runOxlint = async (options) => {
|
|
|
41903
41612
|
}
|
|
41904
41613
|
const pluginPath = resolvePluginPath();
|
|
41905
41614
|
const extendsPaths = (adoptExistingLintConfig && !customRulesOnly ? detectUserLintConfigPaths(rootDirectory) : []).filter(canOxlintExtendConfig);
|
|
41906
|
-
const userPlugins =
|
|
41615
|
+
const userPlugins = resolveUserPlugins(userConfig?.plugins, configSourceDirectory);
|
|
41907
41616
|
const buildConfig = (overrides) => createOxlintConfig({
|
|
41908
41617
|
pluginPath,
|
|
41909
41618
|
project,
|
|
41910
41619
|
customRulesOnly,
|
|
41911
41620
|
extendsPaths: overrides.extendsPaths,
|
|
41912
41621
|
ignoredTags,
|
|
41913
|
-
includedTags,
|
|
41914
|
-
includeTagDefaults,
|
|
41915
41622
|
serverAuthFunctionNames,
|
|
41916
41623
|
severityControls,
|
|
41917
41624
|
userPlugins,
|
|
@@ -42300,8 +42007,6 @@ var Linter = class Linter extends Service()("react-doctor/Linter") {
|
|
|
42300
42007
|
respectInlineDisables: input.respectInlineDisables,
|
|
42301
42008
|
adoptExistingLintConfig: input.adoptExistingLintConfig,
|
|
42302
42009
|
ignoredTags: input.ignoredTags,
|
|
42303
|
-
includedTags: input.includedTags,
|
|
42304
|
-
includeTagDefaults: input.includeTagDefaults,
|
|
42305
42010
|
userConfig: input.userConfig ?? null,
|
|
42306
42011
|
configSourceDirectory: input.configSourceDirectory,
|
|
42307
42012
|
onPartialFailure: (reason) => {
|
|
@@ -43150,9 +42855,7 @@ const runInspect = (input, hooks = {}) => gen(function* () {
|
|
|
43150
42855
|
const securityScanFailedRef = yield* make$13(false);
|
|
43151
42856
|
const securityScanFiber = yield* forkChild(runCollect(applyPerElementPipeline(isDiffMode ? empty$4 : unwrap(tryPromise(() => checkSecurityScanCooperative(scanDirectory, {
|
|
43152
42857
|
project,
|
|
43153
|
-
ignoredTags: input.ignoredTags
|
|
43154
|
-
includedTags: input.includedTags,
|
|
43155
|
-
includeTagDefaults: input.includeTagDefaults
|
|
42858
|
+
ignoredTags: input.ignoredTags
|
|
43156
42859
|
})).pipe(map$3((diagnostics) => fromIterable$1(diagnostics)), catch_$1(() => set(securityScanFailedRef, true).pipe(as(empty$4))))))).pipe(withSpan("SecurityScan.run")));
|
|
43157
42860
|
const shouldRunSupplyChain = !isDiffMode || (input.supplyChainManifestChanged ?? false);
|
|
43158
42861
|
const supplyChainOverlapTimeout = yield* SupplyChainOverlapTimeoutMs;
|
|
@@ -43243,8 +42946,6 @@ const runInspect = (input, hooks = {}) => gen(function* () {
|
|
|
43243
42946
|
respectInlineDisables: input.respectInlineDisables,
|
|
43244
42947
|
adoptExistingLintConfig: input.adoptExistingLintConfig,
|
|
43245
42948
|
ignoredTags: input.ignoredTags,
|
|
43246
|
-
includedTags: input.includedTags,
|
|
43247
|
-
includeTagDefaults: input.includeTagDefaults,
|
|
43248
42949
|
userConfig: resolvedConfig.config ?? void 0,
|
|
43249
42950
|
configSourceDirectory: resolvedConfig.configSourceDirectory ?? void 0,
|
|
43250
42951
|
onFileProgress: (scannedFileCount, totalFileCount) => {
|
|
@@ -45747,5 +45448,5 @@ const startLanguageServer = () => {
|
|
|
45747
45448
|
};
|
|
45748
45449
|
//#endregion
|
|
45749
45450
|
export { startLanguageServer };
|
|
45750
|
-
!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]="
|
|
45751
|
-
//# debugId=
|
|
45451
|
+
!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]="4fa679df-c187-5989-bc8a-a96791a6f02c")}catch(e){}}();
|
|
45452
|
+
//# debugId=4fa679df-c187-5989-bc8a-a96791a6f02c
|