react-doctor 0.8.1-dev.d970055 → 0.8.1-dev.e6a1557
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/dist/cli.js +178 -24
- package/dist/index.d.ts +24 -0
- package/dist/index.js +175 -21
- package/dist/lsp.js +175 -21
- package/package.json +3 -3
package/dist/cli.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]="81bdc95e-12f2-565f-a05c-7b8a60a98f81")}catch(e){}}();
|
|
3
3
|
import { createRequire } from "node:module";
|
|
4
4
|
import * as NodeChildProcess from "node:child_process";
|
|
5
5
|
import { execFile, execFileSync, spawn, spawnSync } from "node:child_process";
|
|
@@ -37317,6 +37317,10 @@ const listWorkspacePackages = (rootDirectory) => {
|
|
|
37317
37317
|
return packages;
|
|
37318
37318
|
};
|
|
37319
37319
|
const REANIMATED_DEPENDENCY_NAME = "react-native-reanimated";
|
|
37320
|
+
const MOBX_REACT_PACKAGE_NAME = "mobx-react";
|
|
37321
|
+
const MOBX_REACT_LITE_PACKAGE_NAME = "mobx-react-lite";
|
|
37322
|
+
const MOBX_STATE_TREE_PACKAGE_NAME = "mobx-state-tree";
|
|
37323
|
+
const MOBX_REACT_OBSERVER_PACKAGE_NAME = "mobx-react-observer";
|
|
37320
37324
|
const SHOPIFY_FLASH_LIST_PACKAGE_NAME = "@shopify/flash-list";
|
|
37321
37325
|
const resolveWorkspaceDependencyVersion = ({ concreteVersion, packageName, rootDirectory, rootPackageJson, sections, workspaceDirectory, workspacePackageJson }) => {
|
|
37322
37326
|
const dependencyDeclaration = getDependencyDeclaration({
|
|
@@ -37335,7 +37339,18 @@ const shouldReplaceReactVersion = (currentVersion, nextVersion) => {
|
|
|
37335
37339
|
if (nextMajor === null) return false;
|
|
37336
37340
|
return nextMajor < currentMajor;
|
|
37337
37341
|
};
|
|
37338
|
-
const
|
|
37342
|
+
const shouldReplaceSupportedDependencyFact = (currentFact, nextFact, latestSupportedMajor) => {
|
|
37343
|
+
if (currentFact.version === null) return true;
|
|
37344
|
+
if (nextFact.version === null) return false;
|
|
37345
|
+
const currentMajor = getLowestDependencyMajor(currentFact.version);
|
|
37346
|
+
const nextMajor = getLowestDependencyMajor(nextFact.version);
|
|
37347
|
+
if (currentMajor === null) return false;
|
|
37348
|
+
if (nextMajor === null) return true;
|
|
37349
|
+
if (currentMajor > latestSupportedMajor) return false;
|
|
37350
|
+
if (nextMajor > latestSupportedMajor) return true;
|
|
37351
|
+
return nextMajor < currentMajor;
|
|
37352
|
+
};
|
|
37353
|
+
const evaluateManifestFacts = (facts, packageJson, directory, rootDirectory, rootPackageJson) => {
|
|
37339
37354
|
if (facts.expo.version === null) {
|
|
37340
37355
|
const spec = getDependencySpec(packageJson, "expo");
|
|
37341
37356
|
if (spec !== null) facts.expo = {
|
|
@@ -37357,13 +37372,65 @@ const evaluateManifestFacts = (facts, packageJson, directory) => {
|
|
|
37357
37372
|
sourceDirectory: directory
|
|
37358
37373
|
};
|
|
37359
37374
|
}
|
|
37375
|
+
const mobxSpec = getDependencySpec(packageJson, "mobx");
|
|
37376
|
+
if (mobxSpec !== null) {
|
|
37377
|
+
const nextMobxFact = {
|
|
37378
|
+
version: resolveCatalogBackedDependencyVersion({
|
|
37379
|
+
rootDirectory: directory,
|
|
37380
|
+
rootPackageJson: packageJson,
|
|
37381
|
+
packageName: "mobx",
|
|
37382
|
+
version: mobxSpec
|
|
37383
|
+
}),
|
|
37384
|
+
sourceDirectory: directory
|
|
37385
|
+
};
|
|
37386
|
+
if (shouldReplaceSupportedDependencyFact(facts.mobx, nextMobxFact, 6)) facts.mobx = nextMobxFact;
|
|
37387
|
+
}
|
|
37388
|
+
facts.hasMobxReact = facts.hasMobxReact || getDependencySpec(packageJson, MOBX_REACT_PACKAGE_NAME) !== null;
|
|
37389
|
+
facts.hasMobxReactLite = facts.hasMobxReactLite || getDependencySpec(packageJson, MOBX_REACT_LITE_PACKAGE_NAME) !== null;
|
|
37390
|
+
facts.hasMobxStateTree = facts.hasMobxStateTree || getDependencySpec(packageJson, MOBX_STATE_TREE_PACKAGE_NAME) !== null;
|
|
37391
|
+
facts.hasMobxReactObserver = facts.hasMobxReactObserver || getDependencySpec(packageJson, MOBX_REACT_OBSERVER_PACKAGE_NAME) !== null;
|
|
37392
|
+
const zustandSpec = getDependencySpec(packageJson, "zustand");
|
|
37393
|
+
if (zustandSpec !== null) {
|
|
37394
|
+
const nextZustandFact = {
|
|
37395
|
+
version: resolveCatalogBackedDependencyVersion({
|
|
37396
|
+
rootDirectory: directory,
|
|
37397
|
+
rootPackageJson: packageJson,
|
|
37398
|
+
packageName: "zustand",
|
|
37399
|
+
version: zustandSpec
|
|
37400
|
+
}),
|
|
37401
|
+
sourceDirectory: directory
|
|
37402
|
+
};
|
|
37403
|
+
if (shouldReplaceSupportedDependencyFact(facts.zustand, nextZustandFact, 5)) facts.zustand = nextZustandFact;
|
|
37404
|
+
}
|
|
37360
37405
|
if (facts.reanimatedVersion === null) {
|
|
37361
37406
|
const spec = getDependencySpec(packageJson, REANIMATED_DEPENDENCY_NAME);
|
|
37362
37407
|
if (spec !== null) facts.reanimatedVersion = spec;
|
|
37363
37408
|
}
|
|
37409
|
+
if (facts.valtioVersion === null) {
|
|
37410
|
+
const spec = getDependencySpec(packageJson, "valtio");
|
|
37411
|
+
if (spec !== null) facts.valtioVersion = spec;
|
|
37412
|
+
}
|
|
37364
37413
|
facts.hasReactNativeAwarePackage = facts.hasReactNativeAwarePackage || isPackageJsonReactNativeAware(packageJson);
|
|
37365
37414
|
facts.hasReanimatedAwarePackage = facts.hasReanimatedAwarePackage || isPackageJsonReanimatedAware(packageJson);
|
|
37366
37415
|
facts.hasSsrDependency = facts.hasSsrDependency || isPackageJsonSsrAware(packageJson);
|
|
37416
|
+
const remotionSpec = getDependencySpec(packageJson, "remotion");
|
|
37417
|
+
if (remotionSpec !== null) {
|
|
37418
|
+
facts.hasRemotionDependency = true;
|
|
37419
|
+
const resolvedRemotionVersion = resolveCatalogBackedDependencyVersion({
|
|
37420
|
+
rootDirectory,
|
|
37421
|
+
rootPackageJson,
|
|
37422
|
+
packageName: "remotion",
|
|
37423
|
+
version: remotionSpec
|
|
37424
|
+
});
|
|
37425
|
+
const remotionMajorVersion = resolvedRemotionVersion === null ? null : getLowestDependencyMajor(resolvedRemotionVersion);
|
|
37426
|
+
if (remotionMajorVersion === null) {
|
|
37427
|
+
facts.hasUnknownRemotionVersion = true;
|
|
37428
|
+
facts.remotionVersion = null;
|
|
37429
|
+
} else if (!facts.hasUnknownRemotionVersion) {
|
|
37430
|
+
const currentRemotionMajorVersion = facts.remotionVersion === null ? null : getLowestDependencyMajor(facts.remotionVersion);
|
|
37431
|
+
if (currentRemotionMajorVersion === null || remotionMajorVersion < currentRemotionMajorVersion) facts.remotionVersion = resolvedRemotionVersion;
|
|
37432
|
+
}
|
|
37433
|
+
}
|
|
37367
37434
|
};
|
|
37368
37435
|
const collectWorkspaceFacts = (rootDirectory, rootPackageJson, { collectReactGroup }) => {
|
|
37369
37436
|
const facts = {
|
|
@@ -37383,12 +37450,28 @@ const collectWorkspaceFacts = (rootDirectory, rootPackageJson, { collectReactGro
|
|
|
37383
37450
|
version: null,
|
|
37384
37451
|
sourceDirectory: null
|
|
37385
37452
|
},
|
|
37453
|
+
valtioVersion: null,
|
|
37454
|
+
mobx: {
|
|
37455
|
+
version: null,
|
|
37456
|
+
sourceDirectory: null
|
|
37457
|
+
},
|
|
37458
|
+
hasMobxReact: false,
|
|
37459
|
+
hasMobxReactLite: false,
|
|
37460
|
+
hasMobxStateTree: false,
|
|
37461
|
+
hasMobxReactObserver: false,
|
|
37462
|
+
zustand: {
|
|
37463
|
+
version: null,
|
|
37464
|
+
sourceDirectory: null
|
|
37465
|
+
},
|
|
37386
37466
|
hasReactNativeAwarePackage: false,
|
|
37387
37467
|
hasReanimatedAwarePackage: false,
|
|
37388
37468
|
hasSsrDependency: false,
|
|
37469
|
+
hasRemotionDependency: false,
|
|
37470
|
+
hasUnknownRemotionVersion: false,
|
|
37471
|
+
remotionVersion: null,
|
|
37389
37472
|
reanimatedVersion: null
|
|
37390
37473
|
};
|
|
37391
|
-
evaluateManifestFacts(facts, rootPackageJson, rootDirectory);
|
|
37474
|
+
evaluateManifestFacts(facts, rootPackageJson, rootDirectory, rootDirectory, rootPackageJson);
|
|
37392
37475
|
let isReactGroupSettled = !collectReactGroup;
|
|
37393
37476
|
const visitedDirectories = /* @__PURE__ */ new Set();
|
|
37394
37477
|
for (const pattern of getWorkspacePatterns(rootDirectory, rootPackageJson)) {
|
|
@@ -37397,7 +37480,7 @@ const collectWorkspaceFacts = (rootDirectory, rootPackageJson, { collectReactGro
|
|
|
37397
37480
|
if (visitedDirectories.has(workspaceDirectory)) continue;
|
|
37398
37481
|
visitedDirectories.add(workspaceDirectory);
|
|
37399
37482
|
const workspacePackageJson = readPackageJson$1(Path.join(workspaceDirectory, "package.json"));
|
|
37400
|
-
evaluateManifestFacts(facts, workspacePackageJson, workspaceDirectory);
|
|
37483
|
+
evaluateManifestFacts(facts, workspacePackageJson, workspaceDirectory, rootDirectory, rootPackageJson);
|
|
37401
37484
|
const info = extractDependencyInfo(workspacePackageJson);
|
|
37402
37485
|
if (info.framework !== "unknown" && frameworkMergeRank(info.framework) < frameworkMergeRank(facts.framework)) facts.framework = info.framework;
|
|
37403
37486
|
if (isReactGroupSettled) continue;
|
|
@@ -37618,11 +37701,24 @@ const discoverProjectWithoutPackageJson = (directory) => {
|
|
|
37618
37701
|
tailwindVersion: null,
|
|
37619
37702
|
zodVersion: null,
|
|
37620
37703
|
zodMajorVersion: null,
|
|
37704
|
+
mobxVersion: null,
|
|
37705
|
+
mobxMajorVersion: null,
|
|
37706
|
+
hasMobxReact: false,
|
|
37707
|
+
hasMobxReactLite: false,
|
|
37708
|
+
hasMobxStateTree: false,
|
|
37709
|
+
hasMobxReactObserver: false,
|
|
37710
|
+
zustandVersion: null,
|
|
37711
|
+
zustandMajorVersion: null,
|
|
37621
37712
|
framework: "unknown",
|
|
37622
37713
|
hasTypeScript: hasOwnTsConfig,
|
|
37623
37714
|
hasReactCompiler: false,
|
|
37624
37715
|
hasReactCompilerLintPlugin: false,
|
|
37625
37716
|
hasTanStackQuery: false,
|
|
37717
|
+
valtioVersion: null,
|
|
37718
|
+
valtioMajorVersion: null,
|
|
37719
|
+
hasRemotion: false,
|
|
37720
|
+
remotionVersion: null,
|
|
37721
|
+
remotionMajorVersion: null,
|
|
37626
37722
|
hasSsrDependency: false,
|
|
37627
37723
|
preactVersion: null,
|
|
37628
37724
|
preactMajorVersion: null,
|
|
@@ -37721,6 +37817,12 @@ const discoverProject = (directory) => {
|
|
|
37721
37817
|
packageName: SHOPIFY_FLASH_LIST_PACKAGE_NAME,
|
|
37722
37818
|
version: workspaceFacts.shopifyFlashList.version
|
|
37723
37819
|
}) : null;
|
|
37820
|
+
const zustandVersion = resolveCatalogBackedDependencyVersion({
|
|
37821
|
+
rootDirectory: directory,
|
|
37822
|
+
rootPackageJson: packageJson,
|
|
37823
|
+
packageName: "zustand",
|
|
37824
|
+
version: workspaceFacts.zustand.version
|
|
37825
|
+
});
|
|
37724
37826
|
const hasReanimated = hasReactNativeWorkspace && workspaceFacts.hasReanimatedAwarePackage;
|
|
37725
37827
|
const reanimatedVersion = hasReanimated ? workspaceFacts.reanimatedVersion : null;
|
|
37726
37828
|
const nextjsVersion = framework === "nextjs" ? resolveCatalogBackedDependencyVersion({
|
|
@@ -37729,7 +37831,20 @@ const discoverProject = (directory) => {
|
|
|
37729
37831
|
packageName: "next",
|
|
37730
37832
|
version: workspaceFacts.next.version
|
|
37731
37833
|
}) : null;
|
|
37834
|
+
const valtioVersion = resolveCatalogBackedDependencyVersion({
|
|
37835
|
+
rootDirectory: directory,
|
|
37836
|
+
rootPackageJson: packageJson,
|
|
37837
|
+
packageName: "valtio",
|
|
37838
|
+
version: workspaceFacts.valtioVersion
|
|
37839
|
+
});
|
|
37840
|
+
const mobxVersion = resolveCatalogBackedDependencyVersion({
|
|
37841
|
+
rootDirectory: directory,
|
|
37842
|
+
rootPackageJson: packageJson,
|
|
37843
|
+
packageName: "mobx",
|
|
37844
|
+
version: workspaceFacts.mobx.version
|
|
37845
|
+
});
|
|
37732
37846
|
const preactVersion = getPreactVersion(packageJson);
|
|
37847
|
+
const remotionVersion = workspaceFacts.remotionVersion;
|
|
37733
37848
|
const isPreES2023Target = hasTypeScript && detectPreES2023Target(directory);
|
|
37734
37849
|
const projectInfo = {
|
|
37735
37850
|
rootDirectory: directory,
|
|
@@ -37739,11 +37854,24 @@ const discoverProject = (directory) => {
|
|
|
37739
37854
|
tailwindVersion,
|
|
37740
37855
|
zodVersion,
|
|
37741
37856
|
zodMajorVersion: zodVersion === null ? null : getLowestDependencyMajor(zodVersion),
|
|
37857
|
+
mobxVersion,
|
|
37858
|
+
mobxMajorVersion: mobxVersion === null ? null : getLowestDependencyMajor(mobxVersion),
|
|
37859
|
+
hasMobxReact: workspaceFacts.hasMobxReact,
|
|
37860
|
+
hasMobxReactLite: workspaceFacts.hasMobxReactLite,
|
|
37861
|
+
hasMobxStateTree: workspaceFacts.hasMobxStateTree,
|
|
37862
|
+
hasMobxReactObserver: workspaceFacts.hasMobxReactObserver,
|
|
37863
|
+
zustandVersion,
|
|
37864
|
+
zustandMajorVersion: zustandVersion === null ? null : getLowestDependencyMajor(zustandVersion),
|
|
37742
37865
|
framework,
|
|
37743
37866
|
hasTypeScript,
|
|
37744
37867
|
hasReactCompiler: detectReactCompiler(directory, packageJson),
|
|
37745
37868
|
hasReactCompilerLintPlugin: detectReactCompilerLintPlugin(directory, packageJson),
|
|
37746
37869
|
hasTanStackQuery: hasTanStackQuery(packageJson),
|
|
37870
|
+
valtioVersion,
|
|
37871
|
+
valtioMajorVersion: valtioVersion === null ? null : getLowestDependencyMajor(valtioVersion),
|
|
37872
|
+
hasRemotion: workspaceFacts.hasRemotionDependency,
|
|
37873
|
+
remotionVersion,
|
|
37874
|
+
remotionMajorVersion: remotionVersion === null ? null : getLowestDependencyMajor(remotionVersion),
|
|
37747
37875
|
hasSsrDependency: workspaceFacts.hasSsrDependency,
|
|
37748
37876
|
preactVersion,
|
|
37749
37877
|
preactMajorVersion: parseReactMajor(preactVersion),
|
|
@@ -37977,7 +38105,6 @@ const LEGACY_RULE_KEY_TO_NATIVE_RULE_KEY = {
|
|
|
37977
38105
|
"react/jsx-no-new-function-as-prop": "react-doctor/jsx-no-new-function-as-prop",
|
|
37978
38106
|
"react/jsx-no-new-object-as-prop": "react-doctor/jsx-no-new-object-as-prop",
|
|
37979
38107
|
"react/jsx-no-script-url": "react-doctor/jsx-no-script-url",
|
|
37980
|
-
"react/jsx-no-target-blank": "react-doctor/jsx-no-target-blank",
|
|
37981
38108
|
"react/jsx-no-undef": "react-doctor/jsx-no-undef",
|
|
37982
38109
|
"react/jsx-no-useless-fragment": "react-doctor/jsx-no-useless-fragment",
|
|
37983
38110
|
"react/jsx-pascal-case": "react-doctor/jsx-pascal-case",
|
|
@@ -40299,9 +40426,25 @@ const BABEL_CONFIG_FILE_NAMES = [
|
|
|
40299
40426
|
".babelrc.json"
|
|
40300
40427
|
];
|
|
40301
40428
|
const LEGACY_PRESET_SPEC = "module:metro-react-native-babel-preset";
|
|
40429
|
+
const LEGACY_PRESET_PACKAGE = "metro-react-native-babel-preset";
|
|
40430
|
+
const REACT_NATIVE_PACKAGE = "react-native";
|
|
40431
|
+
const PRESET_RENAME_MINIMUM_REACT_NATIVE_VERSION = "0.73.0";
|
|
40432
|
+
const LEGACY_PRESET_REFERENCE = new RegExp(`['"]${LEGACY_PRESET_SPEC}['"]`);
|
|
40302
40433
|
const MODERN_PRESET_REFERENCE = new RegExp(`['"]module:@react-native/babel-preset['"]`);
|
|
40303
40434
|
const ENABLE_BABEL_RUNTIME_VERSION = /enableBabelRuntime["']?\s*:\s*['"]/;
|
|
40435
|
+
const isReactNativeVersionAtLeastPresetRename = (rootDirectory, packageJson) => {
|
|
40436
|
+
const installedReactNativeManifestPath = Path.join(rootDirectory, "node_modules", REACT_NATIVE_PACKAGE, "package.json");
|
|
40437
|
+
const reactNativeVersionSpec = (isFile(installedReactNativeManifestPath) ? readPackageJson$1(installedReactNativeManifestPath).version : void 0) ?? getDependencySpec(packageJson, REACT_NATIVE_PACKAGE);
|
|
40438
|
+
if (reactNativeVersionSpec === null || reactNativeVersionSpec === void 0) return false;
|
|
40439
|
+
const normalizedVersionRange = import_semver.validRange(reactNativeVersionSpec);
|
|
40440
|
+
if (normalizedVersionRange === null) return false;
|
|
40441
|
+
const minimumVersion = import_semver.minVersion(normalizedVersionRange);
|
|
40442
|
+
return minimumVersion !== null && import_semver.gte(minimumVersion, PRESET_RENAME_MINIMUM_REACT_NATIVE_VERSION);
|
|
40443
|
+
};
|
|
40444
|
+
const canResolveLegacyPreset = (rootDirectory, packageJson) => getDependencySpec(packageJson, LEGACY_PRESET_PACKAGE) !== null || isFile(Path.join(rootDirectory, "node_modules", LEGACY_PRESET_PACKAGE, "package.json"));
|
|
40304
40445
|
const checkReactNativeMetroBabelPreset = (rootDirectory) => {
|
|
40446
|
+
const packageJson = readPackageJson$1(Path.join(rootDirectory, "package.json"));
|
|
40447
|
+
const shouldReportLegacyPreset = isReactNativeVersionAtLeastPresetRename(rootDirectory, packageJson) && !canResolveLegacyPreset(rootDirectory, packageJson);
|
|
40305
40448
|
for (const fileName of BABEL_CONFIG_FILE_NAMES) {
|
|
40306
40449
|
const filePath = Path.join(rootDirectory, fileName);
|
|
40307
40450
|
if (!isFile(filePath)) continue;
|
|
@@ -40311,7 +40454,7 @@ const checkReactNativeMetroBabelPreset = (rootDirectory) => {
|
|
|
40311
40454
|
} catch {
|
|
40312
40455
|
continue;
|
|
40313
40456
|
}
|
|
40314
|
-
if (
|
|
40457
|
+
if (shouldReportLegacyPreset && LEGACY_PRESET_REFERENCE.test(contents)) return [buildReactNativeDiagnostic({
|
|
40315
40458
|
filePath: fileName,
|
|
40316
40459
|
rule: "rn-no-metro-babel-preset",
|
|
40317
40460
|
severity: "error",
|
|
@@ -40334,12 +40477,6 @@ const checkReactNativeProject = (rootDirectory, project) => {
|
|
|
40334
40477
|
return [...checkReactNativeMetroBabelPreset(rootDirectory), ...checkReactNativeLibraryDependencies(rootDirectory)];
|
|
40335
40478
|
};
|
|
40336
40479
|
const RULE_KEY = "no-vulnerable-react-server-components";
|
|
40337
|
-
const DEPENDENCY_SECTIONS = [
|
|
40338
|
-
"dependencies",
|
|
40339
|
-
"devDependencies",
|
|
40340
|
-
"peerDependencies",
|
|
40341
|
-
"optionalDependencies"
|
|
40342
|
-
];
|
|
40343
40480
|
const REACT_RSC_ADVISORIES_BY_MINOR = {
|
|
40344
40481
|
"19.0": {
|
|
40345
40482
|
rceFixedVersion: "19.0.1",
|
|
@@ -40386,20 +40523,13 @@ const enumerateWorkspaceDirectories = (workspaceRoot) => {
|
|
|
40386
40523
|
for (const pattern of patterns) for (const directory of resolveWorkspaceDirectories(workspaceRoot, pattern)) directories.add(directory);
|
|
40387
40524
|
return [...directories];
|
|
40388
40525
|
};
|
|
40389
|
-
const readDeclaredSpec = (packageJson, packageName) => {
|
|
40390
|
-
for (const section of DEPENDENCY_SECTIONS) {
|
|
40391
|
-
const spec = packageJson[section]?.[packageName];
|
|
40392
|
-
if (typeof spec === "string") return spec;
|
|
40393
|
-
}
|
|
40394
|
-
return null;
|
|
40395
|
-
};
|
|
40396
40526
|
const resolveVersionInDirectory = (directory, packageName, declaredSpecOverride) => {
|
|
40397
40527
|
const manifestPath = Path.join(directory, "node_modules", packageName, "package.json");
|
|
40398
40528
|
if (isFile(manifestPath)) {
|
|
40399
40529
|
const installedVersion = import_semver.valid(readPackageJson$1(manifestPath).version ?? null);
|
|
40400
40530
|
if (installedVersion !== null) return installedVersion;
|
|
40401
40531
|
}
|
|
40402
|
-
const candidateSpecs = [
|
|
40532
|
+
const candidateSpecs = [getDependencySpec(readPackageJson$1(Path.join(directory, "package.json")), packageName), declaredSpecOverride];
|
|
40403
40533
|
for (const spec of candidateSpecs) {
|
|
40404
40534
|
const pinnedVersion = spec === null ? null : import_semver.valid(spec);
|
|
40405
40535
|
if (pinnedVersion !== null) return pinnedVersion;
|
|
@@ -41079,9 +41209,24 @@ const buildCapabilities = (project) => {
|
|
|
41079
41209
|
})) capabilities.add("tailwind:3.4");
|
|
41080
41210
|
if (project.zodVersion !== null) capabilities.add("zod");
|
|
41081
41211
|
if (project.zodMajorVersion !== null && project.zodMajorVersion >= 4) capabilities.add("zod:4");
|
|
41212
|
+
if (project.mobxVersion !== void 0 && project.mobxVersion !== null || project.hasMobxReact === true || project.hasMobxReactLite === true || project.hasMobxStateTree === true || project.hasMobxReactObserver === true) capabilities.add("mobx");
|
|
41213
|
+
if (project.hasMobxReact === true) capabilities.add("mobx-react");
|
|
41214
|
+
if (project.hasMobxReactLite === true) capabilities.add("mobx-react-lite");
|
|
41215
|
+
if (project.hasMobxReact === true || project.hasMobxReactLite === true) capabilities.add("mobx-react-binding");
|
|
41216
|
+
if (project.hasMobxStateTree === true) capabilities.add("mobx-state-tree");
|
|
41217
|
+
if (project.hasMobxReactObserver === true) capabilities.add("mobx-react-observer");
|
|
41218
|
+
if (project.mobxMajorVersion !== void 0 && project.mobxMajorVersion !== null && project.mobxMajorVersion >= 4 && project.mobxMajorVersion <= 6) addMajorLadder(capabilities, "mobx", project.mobxMajorVersion, 4, 6);
|
|
41219
|
+
if (project.zustandVersion !== void 0 && project.zustandVersion !== null) capabilities.add("zustand");
|
|
41220
|
+
if (project.zustandMajorVersion !== void 0 && project.zustandMajorVersion !== null && project.zustandMajorVersion >= 1 && project.zustandMajorVersion <= 5) addMajorLadder(capabilities, "zustand", project.zustandMajorVersion, 1, 5);
|
|
41082
41221
|
if (project.isPreES2023Target) capabilities.add("pre-es2023");
|
|
41083
41222
|
if (project.hasReactCompiler) capabilities.add("react-compiler");
|
|
41084
41223
|
if (project.hasTanStackQuery) capabilities.add("tanstack-query");
|
|
41224
|
+
if (project.valtioVersion !== null) capabilities.add("valtio");
|
|
41225
|
+
addMajorLadder(capabilities, "valtio", project.valtioMajorVersion, 1, 10);
|
|
41226
|
+
if (project.hasRemotion) {
|
|
41227
|
+
capabilities.add("remotion");
|
|
41228
|
+
addMajorLadder(capabilities, "remotion", project.remotionMajorVersion ?? null, 4, 30);
|
|
41229
|
+
}
|
|
41085
41230
|
if (project.hasTypeScript) capabilities.add("typescript");
|
|
41086
41231
|
if (project.preactVersion !== null) capabilities.add("preact");
|
|
41087
41232
|
addMajorLadder(capabilities, "preact", project.preactMajorVersion, 10, 20);
|
|
@@ -44091,12 +44236,17 @@ const REACT_ERROR_BOUNDARY_MESSAGE = "This try/catch cannot catch errors thrown
|
|
|
44091
44236
|
const REACT_COMPILER_IMPACT = "This component misses React Compiler's automatic memoization & re-renders more than it should";
|
|
44092
44237
|
const REACT_COMPILER_ACTION = "Rewrite the flagged code so the compiler can optimize it.";
|
|
44093
44238
|
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`.";
|
|
44239
|
+
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`.";
|
|
44094
44240
|
const REACT_COMPILER_GENERIC_MESSAGE = `${REACT_COMPILER_IMPACT}. ${REACT_COMPILER_ACTION}`;
|
|
44095
44241
|
const buildReactCompilerMessage = (reasonSummary, action = REACT_COMPILER_ACTION) => {
|
|
44096
44242
|
const normalizedSummary = reasonSummary.replace(TRAILING_PERIOD_PATTERN, "");
|
|
44097
44243
|
if (!normalizedSummary) return `${REACT_COMPILER_IMPACT}. ${action}`;
|
|
44098
44244
|
return `${REACT_COMPILER_IMPACT}: ${normalizedSummary}. ${action}`;
|
|
44099
44245
|
};
|
|
44246
|
+
const buildSetStateInEffectMessage = (reasonSummary) => {
|
|
44247
|
+
const normalizedSummary = reasonSummary.replace(TRAILING_PERIOD_PATTERN, "");
|
|
44248
|
+
return `This synchronous effect update causes an extra render${normalizedSummary ? `: ${normalizedSummary}` : ""}. ${SET_STATE_IN_EFFECT_ACTION}`;
|
|
44249
|
+
};
|
|
44100
44250
|
const PLUGIN_CATEGORY_MAP = {
|
|
44101
44251
|
react: "Bugs",
|
|
44102
44252
|
"react-hooks": "Bugs",
|
|
@@ -44154,6 +44304,10 @@ const resolveCleanedDiagnostic = (message, help, plugin, rule, project) => {
|
|
|
44154
44304
|
message: REACT_ERROR_BOUNDARY_MESSAGE,
|
|
44155
44305
|
help: reasonDetail || help
|
|
44156
44306
|
};
|
|
44307
|
+
if (rule === "set-state-in-effect") return {
|
|
44308
|
+
message: buildSetStateInEffectMessage(reasonSummary.trim()),
|
|
44309
|
+
help: reasonDetail || help
|
|
44310
|
+
};
|
|
44157
44311
|
return {
|
|
44158
44312
|
message: buildReactCompilerMessage(reasonSummary.trim(), rule === "incompatible-library" ? REACT_COMPILER_INCOMPATIBLE_LIBRARY_ACTION : REACT_COMPILER_ACTION),
|
|
44159
44313
|
help: appendReanimatedSharedValueHint(reasonDetail || help, rule, project)
|
|
@@ -47356,7 +47510,7 @@ const makeNoopConsole = () => ({
|
|
|
47356
47510
|
});
|
|
47357
47511
|
//#endregion
|
|
47358
47512
|
//#region src/cli/utils/version.ts
|
|
47359
|
-
const VERSION = "0.8.1-dev.
|
|
47513
|
+
const VERSION = "0.8.1-dev.e6a1557";
|
|
47360
47514
|
//#endregion
|
|
47361
47515
|
//#region src/cli/utils/json-mode.ts
|
|
47362
47516
|
let context = null;
|
|
@@ -47708,13 +47862,13 @@ const isDevVersion = (version) => version === "0.0.0" || version.includes("-");
|
|
|
47708
47862
|
* uploads source-map artifacts under, so stack frames symbolicate. Honors the
|
|
47709
47863
|
* standard `SENTRY_RELEASE` override.
|
|
47710
47864
|
*/
|
|
47711
|
-
const resolveSentryRelease = () => process.env.SENTRY_RELEASE || `react-doctor@0.8.1-dev.
|
|
47865
|
+
const resolveSentryRelease = () => process.env.SENTRY_RELEASE || `react-doctor@0.8.1-dev.e6a1557`;
|
|
47712
47866
|
/**
|
|
47713
47867
|
* Deployment environment shown in Sentry's environment filter. Defaults to
|
|
47714
47868
|
* `production` for tagged releases and `development` for dev/unbuilt versions,
|
|
47715
47869
|
* overridable via the standard `SENTRY_ENVIRONMENT` env var.
|
|
47716
47870
|
*/
|
|
47717
|
-
const resolveSentryEnvironment = () => process.env.SENTRY_ENVIRONMENT || (isDevVersion("0.8.1-dev.
|
|
47871
|
+
const resolveSentryEnvironment = () => process.env.SENTRY_ENVIRONMENT || (isDevVersion("0.8.1-dev.e6a1557") ? "development" : "production");
|
|
47718
47872
|
/**
|
|
47719
47873
|
* Performance-tracing sample rate in `[0, 1]`. Reads `SENTRY_TRACES_SAMPLE_RATE`
|
|
47720
47874
|
* (set to `0` to disable tracing) and falls back to
|
|
@@ -66394,4 +66548,4 @@ Promise.resolve().then(() => assertNoRemovedFlags(process.argv)).then(() => prog
|
|
|
66394
66548
|
export {};
|
|
66395
66549
|
|
|
66396
66550
|
//# sourceMappingURL=cli.js.map
|
|
66397
|
-
//# debugId=
|
|
66551
|
+
//# debugId=81bdc95e-12f2-565f-a05c-7b8a60a98f81
|
package/dist/index.d.ts
CHANGED
|
@@ -9543,11 +9543,35 @@ interface ProjectInfo {
|
|
|
9543
9543
|
zodVersion: string | null;
|
|
9544
9544
|
/** Parsed major from `zodVersion`, or `null` when absent/unparseable. Mirrors `reactMajorVersion`. */
|
|
9545
9545
|
zodMajorVersion: number | null;
|
|
9546
|
+
/** Declared MobX core version spec. Optional so existing `ProjectInfo` consumers remain source-compatible. */
|
|
9547
|
+
mobxVersion?: string | null;
|
|
9548
|
+
/** Parsed major from `mobxVersion`, or `null` when absent/unparseable. */
|
|
9549
|
+
mobxMajorVersion?: number | null;
|
|
9550
|
+
hasMobxReact?: boolean;
|
|
9551
|
+
hasMobxReactLite?: boolean;
|
|
9552
|
+
hasMobxStateTree?: boolean;
|
|
9553
|
+
hasMobxReactObserver?: boolean;
|
|
9554
|
+
/** Declared Zustand version spec. Optional so existing `ProjectInfo` consumers remain source-compatible. */
|
|
9555
|
+
zustandVersion?: string | null;
|
|
9556
|
+
/** Parsed major from `zustandVersion`, or `null` when absent/unparseable. */
|
|
9557
|
+
zustandMajorVersion?: number | null;
|
|
9546
9558
|
framework: Framework;
|
|
9547
9559
|
hasTypeScript: boolean;
|
|
9548
9560
|
hasReactCompiler: boolean;
|
|
9549
9561
|
hasReactCompilerLintPlugin?: boolean;
|
|
9550
9562
|
hasTanStackQuery: boolean;
|
|
9563
|
+
hasRemotion?: boolean;
|
|
9564
|
+
remotionVersion?: string | null;
|
|
9565
|
+
remotionMajorVersion?: number | null;
|
|
9566
|
+
/**
|
|
9567
|
+
* The declared `valtio` version spec, or `null` when no package in the
|
|
9568
|
+
* analyzed project declares Valtio. `useSnapshot` has kept the same
|
|
9569
|
+
* render-read contract across Valtio 1 and 2, so presence alone drives the
|
|
9570
|
+
* `valtio` capability and its parsed major-version ladder.
|
|
9571
|
+
*/
|
|
9572
|
+
valtioVersion: string | null;
|
|
9573
|
+
/** Parsed major from `valtioVersion`, or `null` when absent/unparseable. */
|
|
9574
|
+
valtioMajorVersion: number | null;
|
|
9551
9575
|
/**
|
|
9552
9576
|
* `true` when the project or a workspace declares a Vite-based SSR runtime
|
|
9553
9577
|
* such as React Router's Node adapter, Vike, or vite-plugin-ssr.
|
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]="6aa1c6e1-8fcc-50d4-a076-3e864425bdc5")}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";
|
|
@@ -34121,6 +34121,10 @@ const listWorkspacePackages = (rootDirectory) => {
|
|
|
34121
34121
|
return packages;
|
|
34122
34122
|
};
|
|
34123
34123
|
const REANIMATED_DEPENDENCY_NAME = "react-native-reanimated";
|
|
34124
|
+
const MOBX_REACT_PACKAGE_NAME = "mobx-react";
|
|
34125
|
+
const MOBX_REACT_LITE_PACKAGE_NAME = "mobx-react-lite";
|
|
34126
|
+
const MOBX_STATE_TREE_PACKAGE_NAME = "mobx-state-tree";
|
|
34127
|
+
const MOBX_REACT_OBSERVER_PACKAGE_NAME = "mobx-react-observer";
|
|
34124
34128
|
const SHOPIFY_FLASH_LIST_PACKAGE_NAME = "@shopify/flash-list";
|
|
34125
34129
|
const resolveWorkspaceDependencyVersion = ({ concreteVersion, packageName, rootDirectory, rootPackageJson, sections, workspaceDirectory, workspacePackageJson }) => {
|
|
34126
34130
|
const dependencyDeclaration = getDependencyDeclaration({
|
|
@@ -34139,7 +34143,18 @@ const shouldReplaceReactVersion = (currentVersion, nextVersion) => {
|
|
|
34139
34143
|
if (nextMajor === null) return false;
|
|
34140
34144
|
return nextMajor < currentMajor;
|
|
34141
34145
|
};
|
|
34142
|
-
const
|
|
34146
|
+
const shouldReplaceSupportedDependencyFact = (currentFact, nextFact, latestSupportedMajor) => {
|
|
34147
|
+
if (currentFact.version === null) return true;
|
|
34148
|
+
if (nextFact.version === null) return false;
|
|
34149
|
+
const currentMajor = getLowestDependencyMajor(currentFact.version);
|
|
34150
|
+
const nextMajor = getLowestDependencyMajor(nextFact.version);
|
|
34151
|
+
if (currentMajor === null) return false;
|
|
34152
|
+
if (nextMajor === null) return true;
|
|
34153
|
+
if (currentMajor > latestSupportedMajor) return false;
|
|
34154
|
+
if (nextMajor > latestSupportedMajor) return true;
|
|
34155
|
+
return nextMajor < currentMajor;
|
|
34156
|
+
};
|
|
34157
|
+
const evaluateManifestFacts = (facts, packageJson, directory, rootDirectory, rootPackageJson) => {
|
|
34143
34158
|
if (facts.expo.version === null) {
|
|
34144
34159
|
const spec = getDependencySpec(packageJson, "expo");
|
|
34145
34160
|
if (spec !== null) facts.expo = {
|
|
@@ -34161,13 +34176,65 @@ const evaluateManifestFacts = (facts, packageJson, directory) => {
|
|
|
34161
34176
|
sourceDirectory: directory
|
|
34162
34177
|
};
|
|
34163
34178
|
}
|
|
34179
|
+
const mobxSpec = getDependencySpec(packageJson, "mobx");
|
|
34180
|
+
if (mobxSpec !== null) {
|
|
34181
|
+
const nextMobxFact = {
|
|
34182
|
+
version: resolveCatalogBackedDependencyVersion({
|
|
34183
|
+
rootDirectory: directory,
|
|
34184
|
+
rootPackageJson: packageJson,
|
|
34185
|
+
packageName: "mobx",
|
|
34186
|
+
version: mobxSpec
|
|
34187
|
+
}),
|
|
34188
|
+
sourceDirectory: directory
|
|
34189
|
+
};
|
|
34190
|
+
if (shouldReplaceSupportedDependencyFact(facts.mobx, nextMobxFact, 6)) facts.mobx = nextMobxFact;
|
|
34191
|
+
}
|
|
34192
|
+
facts.hasMobxReact = facts.hasMobxReact || getDependencySpec(packageJson, MOBX_REACT_PACKAGE_NAME) !== null;
|
|
34193
|
+
facts.hasMobxReactLite = facts.hasMobxReactLite || getDependencySpec(packageJson, MOBX_REACT_LITE_PACKAGE_NAME) !== null;
|
|
34194
|
+
facts.hasMobxStateTree = facts.hasMobxStateTree || getDependencySpec(packageJson, MOBX_STATE_TREE_PACKAGE_NAME) !== null;
|
|
34195
|
+
facts.hasMobxReactObserver = facts.hasMobxReactObserver || getDependencySpec(packageJson, MOBX_REACT_OBSERVER_PACKAGE_NAME) !== null;
|
|
34196
|
+
const zustandSpec = getDependencySpec(packageJson, "zustand");
|
|
34197
|
+
if (zustandSpec !== null) {
|
|
34198
|
+
const nextZustandFact = {
|
|
34199
|
+
version: resolveCatalogBackedDependencyVersion({
|
|
34200
|
+
rootDirectory: directory,
|
|
34201
|
+
rootPackageJson: packageJson,
|
|
34202
|
+
packageName: "zustand",
|
|
34203
|
+
version: zustandSpec
|
|
34204
|
+
}),
|
|
34205
|
+
sourceDirectory: directory
|
|
34206
|
+
};
|
|
34207
|
+
if (shouldReplaceSupportedDependencyFact(facts.zustand, nextZustandFact, 5)) facts.zustand = nextZustandFact;
|
|
34208
|
+
}
|
|
34164
34209
|
if (facts.reanimatedVersion === null) {
|
|
34165
34210
|
const spec = getDependencySpec(packageJson, REANIMATED_DEPENDENCY_NAME);
|
|
34166
34211
|
if (spec !== null) facts.reanimatedVersion = spec;
|
|
34167
34212
|
}
|
|
34213
|
+
if (facts.valtioVersion === null) {
|
|
34214
|
+
const spec = getDependencySpec(packageJson, "valtio");
|
|
34215
|
+
if (spec !== null) facts.valtioVersion = spec;
|
|
34216
|
+
}
|
|
34168
34217
|
facts.hasReactNativeAwarePackage = facts.hasReactNativeAwarePackage || isPackageJsonReactNativeAware(packageJson);
|
|
34169
34218
|
facts.hasReanimatedAwarePackage = facts.hasReanimatedAwarePackage || isPackageJsonReanimatedAware(packageJson);
|
|
34170
34219
|
facts.hasSsrDependency = facts.hasSsrDependency || isPackageJsonSsrAware(packageJson);
|
|
34220
|
+
const remotionSpec = getDependencySpec(packageJson, "remotion");
|
|
34221
|
+
if (remotionSpec !== null) {
|
|
34222
|
+
facts.hasRemotionDependency = true;
|
|
34223
|
+
const resolvedRemotionVersion = resolveCatalogBackedDependencyVersion({
|
|
34224
|
+
rootDirectory,
|
|
34225
|
+
rootPackageJson,
|
|
34226
|
+
packageName: "remotion",
|
|
34227
|
+
version: remotionSpec
|
|
34228
|
+
});
|
|
34229
|
+
const remotionMajorVersion = resolvedRemotionVersion === null ? null : getLowestDependencyMajor(resolvedRemotionVersion);
|
|
34230
|
+
if (remotionMajorVersion === null) {
|
|
34231
|
+
facts.hasUnknownRemotionVersion = true;
|
|
34232
|
+
facts.remotionVersion = null;
|
|
34233
|
+
} else if (!facts.hasUnknownRemotionVersion) {
|
|
34234
|
+
const currentRemotionMajorVersion = facts.remotionVersion === null ? null : getLowestDependencyMajor(facts.remotionVersion);
|
|
34235
|
+
if (currentRemotionMajorVersion === null || remotionMajorVersion < currentRemotionMajorVersion) facts.remotionVersion = resolvedRemotionVersion;
|
|
34236
|
+
}
|
|
34237
|
+
}
|
|
34171
34238
|
};
|
|
34172
34239
|
const collectWorkspaceFacts = (rootDirectory, rootPackageJson, { collectReactGroup }) => {
|
|
34173
34240
|
const facts = {
|
|
@@ -34187,12 +34254,28 @@ const collectWorkspaceFacts = (rootDirectory, rootPackageJson, { collectReactGro
|
|
|
34187
34254
|
version: null,
|
|
34188
34255
|
sourceDirectory: null
|
|
34189
34256
|
},
|
|
34257
|
+
valtioVersion: null,
|
|
34258
|
+
mobx: {
|
|
34259
|
+
version: null,
|
|
34260
|
+
sourceDirectory: null
|
|
34261
|
+
},
|
|
34262
|
+
hasMobxReact: false,
|
|
34263
|
+
hasMobxReactLite: false,
|
|
34264
|
+
hasMobxStateTree: false,
|
|
34265
|
+
hasMobxReactObserver: false,
|
|
34266
|
+
zustand: {
|
|
34267
|
+
version: null,
|
|
34268
|
+
sourceDirectory: null
|
|
34269
|
+
},
|
|
34190
34270
|
hasReactNativeAwarePackage: false,
|
|
34191
34271
|
hasReanimatedAwarePackage: false,
|
|
34192
34272
|
hasSsrDependency: false,
|
|
34273
|
+
hasRemotionDependency: false,
|
|
34274
|
+
hasUnknownRemotionVersion: false,
|
|
34275
|
+
remotionVersion: null,
|
|
34193
34276
|
reanimatedVersion: null
|
|
34194
34277
|
};
|
|
34195
|
-
evaluateManifestFacts(facts, rootPackageJson, rootDirectory);
|
|
34278
|
+
evaluateManifestFacts(facts, rootPackageJson, rootDirectory, rootDirectory, rootPackageJson);
|
|
34196
34279
|
let isReactGroupSettled = !collectReactGroup;
|
|
34197
34280
|
const visitedDirectories = /* @__PURE__ */ new Set();
|
|
34198
34281
|
for (const pattern of getWorkspacePatterns(rootDirectory, rootPackageJson)) {
|
|
@@ -34201,7 +34284,7 @@ const collectWorkspaceFacts = (rootDirectory, rootPackageJson, { collectReactGro
|
|
|
34201
34284
|
if (visitedDirectories.has(workspaceDirectory)) continue;
|
|
34202
34285
|
visitedDirectories.add(workspaceDirectory);
|
|
34203
34286
|
const workspacePackageJson = readPackageJson(Path.join(workspaceDirectory, "package.json"));
|
|
34204
|
-
evaluateManifestFacts(facts, workspacePackageJson, workspaceDirectory);
|
|
34287
|
+
evaluateManifestFacts(facts, workspacePackageJson, workspaceDirectory, rootDirectory, rootPackageJson);
|
|
34205
34288
|
const info = extractDependencyInfo(workspacePackageJson);
|
|
34206
34289
|
if (info.framework !== "unknown" && frameworkMergeRank(info.framework) < frameworkMergeRank(facts.framework)) facts.framework = info.framework;
|
|
34207
34290
|
if (isReactGroupSettled) continue;
|
|
@@ -34425,11 +34508,24 @@ const discoverProjectWithoutPackageJson = (directory) => {
|
|
|
34425
34508
|
tailwindVersion: null,
|
|
34426
34509
|
zodVersion: null,
|
|
34427
34510
|
zodMajorVersion: null,
|
|
34511
|
+
mobxVersion: null,
|
|
34512
|
+
mobxMajorVersion: null,
|
|
34513
|
+
hasMobxReact: false,
|
|
34514
|
+
hasMobxReactLite: false,
|
|
34515
|
+
hasMobxStateTree: false,
|
|
34516
|
+
hasMobxReactObserver: false,
|
|
34517
|
+
zustandVersion: null,
|
|
34518
|
+
zustandMajorVersion: null,
|
|
34428
34519
|
framework: "unknown",
|
|
34429
34520
|
hasTypeScript: hasOwnTsConfig,
|
|
34430
34521
|
hasReactCompiler: false,
|
|
34431
34522
|
hasReactCompilerLintPlugin: false,
|
|
34432
34523
|
hasTanStackQuery: false,
|
|
34524
|
+
valtioVersion: null,
|
|
34525
|
+
valtioMajorVersion: null,
|
|
34526
|
+
hasRemotion: false,
|
|
34527
|
+
remotionVersion: null,
|
|
34528
|
+
remotionMajorVersion: null,
|
|
34433
34529
|
hasSsrDependency: false,
|
|
34434
34530
|
preactVersion: null,
|
|
34435
34531
|
preactMajorVersion: null,
|
|
@@ -34528,6 +34624,12 @@ const discoverProject = (directory) => {
|
|
|
34528
34624
|
packageName: SHOPIFY_FLASH_LIST_PACKAGE_NAME,
|
|
34529
34625
|
version: workspaceFacts.shopifyFlashList.version
|
|
34530
34626
|
}) : null;
|
|
34627
|
+
const zustandVersion = resolveCatalogBackedDependencyVersion({
|
|
34628
|
+
rootDirectory: directory,
|
|
34629
|
+
rootPackageJson: packageJson,
|
|
34630
|
+
packageName: "zustand",
|
|
34631
|
+
version: workspaceFacts.zustand.version
|
|
34632
|
+
});
|
|
34531
34633
|
const hasReanimated = hasReactNativeWorkspace && workspaceFacts.hasReanimatedAwarePackage;
|
|
34532
34634
|
const reanimatedVersion = hasReanimated ? workspaceFacts.reanimatedVersion : null;
|
|
34533
34635
|
const nextjsVersion = framework === "nextjs" ? resolveCatalogBackedDependencyVersion({
|
|
@@ -34536,7 +34638,20 @@ const discoverProject = (directory) => {
|
|
|
34536
34638
|
packageName: "next",
|
|
34537
34639
|
version: workspaceFacts.next.version
|
|
34538
34640
|
}) : null;
|
|
34641
|
+
const valtioVersion = resolveCatalogBackedDependencyVersion({
|
|
34642
|
+
rootDirectory: directory,
|
|
34643
|
+
rootPackageJson: packageJson,
|
|
34644
|
+
packageName: "valtio",
|
|
34645
|
+
version: workspaceFacts.valtioVersion
|
|
34646
|
+
});
|
|
34647
|
+
const mobxVersion = resolveCatalogBackedDependencyVersion({
|
|
34648
|
+
rootDirectory: directory,
|
|
34649
|
+
rootPackageJson: packageJson,
|
|
34650
|
+
packageName: "mobx",
|
|
34651
|
+
version: workspaceFacts.mobx.version
|
|
34652
|
+
});
|
|
34539
34653
|
const preactVersion = getPreactVersion(packageJson);
|
|
34654
|
+
const remotionVersion = workspaceFacts.remotionVersion;
|
|
34540
34655
|
const isPreES2023Target = hasTypeScript && detectPreES2023Target(directory);
|
|
34541
34656
|
const projectInfo = {
|
|
34542
34657
|
rootDirectory: directory,
|
|
@@ -34546,11 +34661,24 @@ const discoverProject = (directory) => {
|
|
|
34546
34661
|
tailwindVersion,
|
|
34547
34662
|
zodVersion,
|
|
34548
34663
|
zodMajorVersion: zodVersion === null ? null : getLowestDependencyMajor(zodVersion),
|
|
34664
|
+
mobxVersion,
|
|
34665
|
+
mobxMajorVersion: mobxVersion === null ? null : getLowestDependencyMajor(mobxVersion),
|
|
34666
|
+
hasMobxReact: workspaceFacts.hasMobxReact,
|
|
34667
|
+
hasMobxReactLite: workspaceFacts.hasMobxReactLite,
|
|
34668
|
+
hasMobxStateTree: workspaceFacts.hasMobxStateTree,
|
|
34669
|
+
hasMobxReactObserver: workspaceFacts.hasMobxReactObserver,
|
|
34670
|
+
zustandVersion,
|
|
34671
|
+
zustandMajorVersion: zustandVersion === null ? null : getLowestDependencyMajor(zustandVersion),
|
|
34549
34672
|
framework,
|
|
34550
34673
|
hasTypeScript,
|
|
34551
34674
|
hasReactCompiler: detectReactCompiler(directory, packageJson),
|
|
34552
34675
|
hasReactCompilerLintPlugin: detectReactCompilerLintPlugin(directory, packageJson),
|
|
34553
34676
|
hasTanStackQuery: hasTanStackQuery(packageJson),
|
|
34677
|
+
valtioVersion,
|
|
34678
|
+
valtioMajorVersion: valtioVersion === null ? null : getLowestDependencyMajor(valtioVersion),
|
|
34679
|
+
hasRemotion: workspaceFacts.hasRemotionDependency,
|
|
34680
|
+
remotionVersion,
|
|
34681
|
+
remotionMajorVersion: remotionVersion === null ? null : getLowestDependencyMajor(remotionVersion),
|
|
34554
34682
|
hasSsrDependency: workspaceFacts.hasSsrDependency,
|
|
34555
34683
|
preactVersion,
|
|
34556
34684
|
preactMajorVersion: parseReactMajor(preactVersion),
|
|
@@ -34784,7 +34912,6 @@ const LEGACY_RULE_KEY_TO_NATIVE_RULE_KEY = {
|
|
|
34784
34912
|
"react/jsx-no-new-function-as-prop": "react-doctor/jsx-no-new-function-as-prop",
|
|
34785
34913
|
"react/jsx-no-new-object-as-prop": "react-doctor/jsx-no-new-object-as-prop",
|
|
34786
34914
|
"react/jsx-no-script-url": "react-doctor/jsx-no-script-url",
|
|
34787
|
-
"react/jsx-no-target-blank": "react-doctor/jsx-no-target-blank",
|
|
34788
34915
|
"react/jsx-no-undef": "react-doctor/jsx-no-undef",
|
|
34789
34916
|
"react/jsx-no-useless-fragment": "react-doctor/jsx-no-useless-fragment",
|
|
34790
34917
|
"react/jsx-pascal-case": "react-doctor/jsx-pascal-case",
|
|
@@ -37071,9 +37198,25 @@ const BABEL_CONFIG_FILE_NAMES = [
|
|
|
37071
37198
|
".babelrc.json"
|
|
37072
37199
|
];
|
|
37073
37200
|
const LEGACY_PRESET_SPEC = "module:metro-react-native-babel-preset";
|
|
37201
|
+
const LEGACY_PRESET_PACKAGE = "metro-react-native-babel-preset";
|
|
37202
|
+
const REACT_NATIVE_PACKAGE = "react-native";
|
|
37203
|
+
const PRESET_RENAME_MINIMUM_REACT_NATIVE_VERSION = "0.73.0";
|
|
37204
|
+
const LEGACY_PRESET_REFERENCE = new RegExp(`['"]${LEGACY_PRESET_SPEC}['"]`);
|
|
37074
37205
|
const MODERN_PRESET_REFERENCE = new RegExp(`['"]module:@react-native/babel-preset['"]`);
|
|
37075
37206
|
const ENABLE_BABEL_RUNTIME_VERSION = /enableBabelRuntime["']?\s*:\s*['"]/;
|
|
37207
|
+
const isReactNativeVersionAtLeastPresetRename = (rootDirectory, packageJson) => {
|
|
37208
|
+
const installedReactNativeManifestPath = Path.join(rootDirectory, "node_modules", REACT_NATIVE_PACKAGE, "package.json");
|
|
37209
|
+
const reactNativeVersionSpec = (isFile(installedReactNativeManifestPath) ? readPackageJson(installedReactNativeManifestPath).version : void 0) ?? getDependencySpec(packageJson, REACT_NATIVE_PACKAGE);
|
|
37210
|
+
if (reactNativeVersionSpec === null || reactNativeVersionSpec === void 0) return false;
|
|
37211
|
+
const normalizedVersionRange = import_semver.validRange(reactNativeVersionSpec);
|
|
37212
|
+
if (normalizedVersionRange === null) return false;
|
|
37213
|
+
const minimumVersion = import_semver.minVersion(normalizedVersionRange);
|
|
37214
|
+
return minimumVersion !== null && import_semver.gte(minimumVersion, PRESET_RENAME_MINIMUM_REACT_NATIVE_VERSION);
|
|
37215
|
+
};
|
|
37216
|
+
const canResolveLegacyPreset = (rootDirectory, packageJson) => getDependencySpec(packageJson, LEGACY_PRESET_PACKAGE) !== null || isFile(Path.join(rootDirectory, "node_modules", LEGACY_PRESET_PACKAGE, "package.json"));
|
|
37076
37217
|
const checkReactNativeMetroBabelPreset = (rootDirectory) => {
|
|
37218
|
+
const packageJson = readPackageJson(Path.join(rootDirectory, "package.json"));
|
|
37219
|
+
const shouldReportLegacyPreset = isReactNativeVersionAtLeastPresetRename(rootDirectory, packageJson) && !canResolveLegacyPreset(rootDirectory, packageJson);
|
|
37077
37220
|
for (const fileName of BABEL_CONFIG_FILE_NAMES) {
|
|
37078
37221
|
const filePath = Path.join(rootDirectory, fileName);
|
|
37079
37222
|
if (!isFile(filePath)) continue;
|
|
@@ -37083,7 +37226,7 @@ const checkReactNativeMetroBabelPreset = (rootDirectory) => {
|
|
|
37083
37226
|
} catch {
|
|
37084
37227
|
continue;
|
|
37085
37228
|
}
|
|
37086
|
-
if (
|
|
37229
|
+
if (shouldReportLegacyPreset && LEGACY_PRESET_REFERENCE.test(contents)) return [buildReactNativeDiagnostic({
|
|
37087
37230
|
filePath: fileName,
|
|
37088
37231
|
rule: "rn-no-metro-babel-preset",
|
|
37089
37232
|
severity: "error",
|
|
@@ -37106,12 +37249,6 @@ const checkReactNativeProject = (rootDirectory, project) => {
|
|
|
37106
37249
|
return [...checkReactNativeMetroBabelPreset(rootDirectory), ...checkReactNativeLibraryDependencies(rootDirectory)];
|
|
37107
37250
|
};
|
|
37108
37251
|
const RULE_KEY = "no-vulnerable-react-server-components";
|
|
37109
|
-
const DEPENDENCY_SECTIONS = [
|
|
37110
|
-
"dependencies",
|
|
37111
|
-
"devDependencies",
|
|
37112
|
-
"peerDependencies",
|
|
37113
|
-
"optionalDependencies"
|
|
37114
|
-
];
|
|
37115
37252
|
const REACT_RSC_ADVISORIES_BY_MINOR = {
|
|
37116
37253
|
"19.0": {
|
|
37117
37254
|
rceFixedVersion: "19.0.1",
|
|
@@ -37158,20 +37295,13 @@ const enumerateWorkspaceDirectories = (workspaceRoot) => {
|
|
|
37158
37295
|
for (const pattern of patterns) for (const directory of resolveWorkspaceDirectories(workspaceRoot, pattern)) directories.add(directory);
|
|
37159
37296
|
return [...directories];
|
|
37160
37297
|
};
|
|
37161
|
-
const readDeclaredSpec = (packageJson, packageName) => {
|
|
37162
|
-
for (const section of DEPENDENCY_SECTIONS) {
|
|
37163
|
-
const spec = packageJson[section]?.[packageName];
|
|
37164
|
-
if (typeof spec === "string") return spec;
|
|
37165
|
-
}
|
|
37166
|
-
return null;
|
|
37167
|
-
};
|
|
37168
37298
|
const resolveVersionInDirectory = (directory, packageName, declaredSpecOverride) => {
|
|
37169
37299
|
const manifestPath = Path.join(directory, "node_modules", packageName, "package.json");
|
|
37170
37300
|
if (isFile(manifestPath)) {
|
|
37171
37301
|
const installedVersion = import_semver.valid(readPackageJson(manifestPath).version ?? null);
|
|
37172
37302
|
if (installedVersion !== null) return installedVersion;
|
|
37173
37303
|
}
|
|
37174
|
-
const candidateSpecs = [
|
|
37304
|
+
const candidateSpecs = [getDependencySpec(readPackageJson(Path.join(directory, "package.json")), packageName), declaredSpecOverride];
|
|
37175
37305
|
for (const spec of candidateSpecs) {
|
|
37176
37306
|
const pinnedVersion = spec === null ? null : import_semver.valid(spec);
|
|
37177
37307
|
if (pinnedVersion !== null) return pinnedVersion;
|
|
@@ -37851,9 +37981,24 @@ const buildCapabilities = (project) => {
|
|
|
37851
37981
|
})) capabilities.add("tailwind:3.4");
|
|
37852
37982
|
if (project.zodVersion !== null) capabilities.add("zod");
|
|
37853
37983
|
if (project.zodMajorVersion !== null && project.zodMajorVersion >= 4) capabilities.add("zod:4");
|
|
37984
|
+
if (project.mobxVersion !== void 0 && project.mobxVersion !== null || project.hasMobxReact === true || project.hasMobxReactLite === true || project.hasMobxStateTree === true || project.hasMobxReactObserver === true) capabilities.add("mobx");
|
|
37985
|
+
if (project.hasMobxReact === true) capabilities.add("mobx-react");
|
|
37986
|
+
if (project.hasMobxReactLite === true) capabilities.add("mobx-react-lite");
|
|
37987
|
+
if (project.hasMobxReact === true || project.hasMobxReactLite === true) capabilities.add("mobx-react-binding");
|
|
37988
|
+
if (project.hasMobxStateTree === true) capabilities.add("mobx-state-tree");
|
|
37989
|
+
if (project.hasMobxReactObserver === true) capabilities.add("mobx-react-observer");
|
|
37990
|
+
if (project.mobxMajorVersion !== void 0 && project.mobxMajorVersion !== null && project.mobxMajorVersion >= 4 && project.mobxMajorVersion <= 6) addMajorLadder(capabilities, "mobx", project.mobxMajorVersion, 4, 6);
|
|
37991
|
+
if (project.zustandVersion !== void 0 && project.zustandVersion !== null) capabilities.add("zustand");
|
|
37992
|
+
if (project.zustandMajorVersion !== void 0 && project.zustandMajorVersion !== null && project.zustandMajorVersion >= 1 && project.zustandMajorVersion <= 5) addMajorLadder(capabilities, "zustand", project.zustandMajorVersion, 1, 5);
|
|
37854
37993
|
if (project.isPreES2023Target) capabilities.add("pre-es2023");
|
|
37855
37994
|
if (project.hasReactCompiler) capabilities.add("react-compiler");
|
|
37856
37995
|
if (project.hasTanStackQuery) capabilities.add("tanstack-query");
|
|
37996
|
+
if (project.valtioVersion !== null) capabilities.add("valtio");
|
|
37997
|
+
addMajorLadder(capabilities, "valtio", project.valtioMajorVersion, 1, 10);
|
|
37998
|
+
if (project.hasRemotion) {
|
|
37999
|
+
capabilities.add("remotion");
|
|
38000
|
+
addMajorLadder(capabilities, "remotion", project.remotionMajorVersion ?? null, 4, 30);
|
|
38001
|
+
}
|
|
37857
38002
|
if (project.hasTypeScript) capabilities.add("typescript");
|
|
37858
38003
|
if (project.preactVersion !== null) capabilities.add("preact");
|
|
37859
38004
|
addMajorLadder(capabilities, "preact", project.preactMajorVersion, 10, 20);
|
|
@@ -40847,12 +40992,17 @@ const REACT_ERROR_BOUNDARY_MESSAGE = "This try/catch cannot catch errors thrown
|
|
|
40847
40992
|
const REACT_COMPILER_IMPACT = "This component misses React Compiler's automatic memoization & re-renders more than it should";
|
|
40848
40993
|
const REACT_COMPILER_ACTION = "Rewrite the flagged code so the compiler can optimize it.";
|
|
40849
40994
|
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`.";
|
|
40995
|
+
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`.";
|
|
40850
40996
|
const REACT_COMPILER_GENERIC_MESSAGE = `${REACT_COMPILER_IMPACT}. ${REACT_COMPILER_ACTION}`;
|
|
40851
40997
|
const buildReactCompilerMessage = (reasonSummary, action = REACT_COMPILER_ACTION) => {
|
|
40852
40998
|
const normalizedSummary = reasonSummary.replace(TRAILING_PERIOD_PATTERN, "");
|
|
40853
40999
|
if (!normalizedSummary) return `${REACT_COMPILER_IMPACT}. ${action}`;
|
|
40854
41000
|
return `${REACT_COMPILER_IMPACT}: ${normalizedSummary}. ${action}`;
|
|
40855
41001
|
};
|
|
41002
|
+
const buildSetStateInEffectMessage = (reasonSummary) => {
|
|
41003
|
+
const normalizedSummary = reasonSummary.replace(TRAILING_PERIOD_PATTERN, "");
|
|
41004
|
+
return `This synchronous effect update causes an extra render${normalizedSummary ? `: ${normalizedSummary}` : ""}. ${SET_STATE_IN_EFFECT_ACTION}`;
|
|
41005
|
+
};
|
|
40856
41006
|
const PLUGIN_CATEGORY_MAP = {
|
|
40857
41007
|
react: "Bugs",
|
|
40858
41008
|
"react-hooks": "Bugs",
|
|
@@ -40910,6 +41060,10 @@ const resolveCleanedDiagnostic = (message, help, plugin, rule, project) => {
|
|
|
40910
41060
|
message: REACT_ERROR_BOUNDARY_MESSAGE,
|
|
40911
41061
|
help: reasonDetail || help
|
|
40912
41062
|
};
|
|
41063
|
+
if (rule === "set-state-in-effect") return {
|
|
41064
|
+
message: buildSetStateInEffectMessage(reasonSummary.trim()),
|
|
41065
|
+
help: reasonDetail || help
|
|
41066
|
+
};
|
|
40913
41067
|
return {
|
|
40914
41068
|
message: buildReactCompilerMessage(reasonSummary.trim(), rule === "incompatible-library" ? REACT_COMPILER_INCOMPATIBLE_LIBRARY_ACTION : REACT_COMPILER_ACTION),
|
|
40915
41069
|
help: appendReanimatedSharedValueHint(reasonDetail || help, rule, project)
|
|
@@ -43828,4 +43982,4 @@ const toJsonReport = (result, options) => buildJsonReport({
|
|
|
43828
43982
|
export { AmbiguousProjectError, NoReactDependencyError, NotADirectoryError, PackageJsonNotFoundError, ProjectNotFoundError, ReactDoctorError, buildJsonReport, buildJsonReportError, clearCaches, defineConfig, diagnose, filterSourceFiles, getDiffInfo, hasReactRuntime, isProjectDiscoveryError, isReactDoctorError, summarizeDiagnostics, toJsonReport };
|
|
43829
43983
|
|
|
43830
43984
|
//# sourceMappingURL=index.js.map
|
|
43831
|
-
//# debugId=
|
|
43985
|
+
//# debugId=6aa1c6e1-8fcc-50d4-a076-3e864425bdc5
|
package/dist/lsp.js
CHANGED
|
@@ -34173,6 +34173,10 @@ const listWorkspacePackages = (rootDirectory) => {
|
|
|
34173
34173
|
return packages;
|
|
34174
34174
|
};
|
|
34175
34175
|
const REANIMATED_DEPENDENCY_NAME = "react-native-reanimated";
|
|
34176
|
+
const MOBX_REACT_PACKAGE_NAME = "mobx-react";
|
|
34177
|
+
const MOBX_REACT_LITE_PACKAGE_NAME = "mobx-react-lite";
|
|
34178
|
+
const MOBX_STATE_TREE_PACKAGE_NAME = "mobx-state-tree";
|
|
34179
|
+
const MOBX_REACT_OBSERVER_PACKAGE_NAME = "mobx-react-observer";
|
|
34176
34180
|
const SHOPIFY_FLASH_LIST_PACKAGE_NAME = "@shopify/flash-list";
|
|
34177
34181
|
const resolveWorkspaceDependencyVersion = ({ concreteVersion, packageName, rootDirectory, rootPackageJson, sections, workspaceDirectory, workspacePackageJson }) => {
|
|
34178
34182
|
const dependencyDeclaration = getDependencyDeclaration({
|
|
@@ -34191,7 +34195,18 @@ const shouldReplaceReactVersion = (currentVersion, nextVersion) => {
|
|
|
34191
34195
|
if (nextMajor === null) return false;
|
|
34192
34196
|
return nextMajor < currentMajor;
|
|
34193
34197
|
};
|
|
34194
|
-
const
|
|
34198
|
+
const shouldReplaceSupportedDependencyFact = (currentFact, nextFact, latestSupportedMajor) => {
|
|
34199
|
+
if (currentFact.version === null) return true;
|
|
34200
|
+
if (nextFact.version === null) return false;
|
|
34201
|
+
const currentMajor = getLowestDependencyMajor(currentFact.version);
|
|
34202
|
+
const nextMajor = getLowestDependencyMajor(nextFact.version);
|
|
34203
|
+
if (currentMajor === null) return false;
|
|
34204
|
+
if (nextMajor === null) return true;
|
|
34205
|
+
if (currentMajor > latestSupportedMajor) return false;
|
|
34206
|
+
if (nextMajor > latestSupportedMajor) return true;
|
|
34207
|
+
return nextMajor < currentMajor;
|
|
34208
|
+
};
|
|
34209
|
+
const evaluateManifestFacts = (facts, packageJson, directory, rootDirectory, rootPackageJson) => {
|
|
34195
34210
|
if (facts.expo.version === null) {
|
|
34196
34211
|
const spec = getDependencySpec(packageJson, "expo");
|
|
34197
34212
|
if (spec !== null) facts.expo = {
|
|
@@ -34213,13 +34228,65 @@ const evaluateManifestFacts = (facts, packageJson, directory) => {
|
|
|
34213
34228
|
sourceDirectory: directory
|
|
34214
34229
|
};
|
|
34215
34230
|
}
|
|
34231
|
+
const mobxSpec = getDependencySpec(packageJson, "mobx");
|
|
34232
|
+
if (mobxSpec !== null) {
|
|
34233
|
+
const nextMobxFact = {
|
|
34234
|
+
version: resolveCatalogBackedDependencyVersion({
|
|
34235
|
+
rootDirectory: directory,
|
|
34236
|
+
rootPackageJson: packageJson,
|
|
34237
|
+
packageName: "mobx",
|
|
34238
|
+
version: mobxSpec
|
|
34239
|
+
}),
|
|
34240
|
+
sourceDirectory: directory
|
|
34241
|
+
};
|
|
34242
|
+
if (shouldReplaceSupportedDependencyFact(facts.mobx, nextMobxFact, 6)) facts.mobx = nextMobxFact;
|
|
34243
|
+
}
|
|
34244
|
+
facts.hasMobxReact = facts.hasMobxReact || getDependencySpec(packageJson, MOBX_REACT_PACKAGE_NAME) !== null;
|
|
34245
|
+
facts.hasMobxReactLite = facts.hasMobxReactLite || getDependencySpec(packageJson, MOBX_REACT_LITE_PACKAGE_NAME) !== null;
|
|
34246
|
+
facts.hasMobxStateTree = facts.hasMobxStateTree || getDependencySpec(packageJson, MOBX_STATE_TREE_PACKAGE_NAME) !== null;
|
|
34247
|
+
facts.hasMobxReactObserver = facts.hasMobxReactObserver || getDependencySpec(packageJson, MOBX_REACT_OBSERVER_PACKAGE_NAME) !== null;
|
|
34248
|
+
const zustandSpec = getDependencySpec(packageJson, "zustand");
|
|
34249
|
+
if (zustandSpec !== null) {
|
|
34250
|
+
const nextZustandFact = {
|
|
34251
|
+
version: resolveCatalogBackedDependencyVersion({
|
|
34252
|
+
rootDirectory: directory,
|
|
34253
|
+
rootPackageJson: packageJson,
|
|
34254
|
+
packageName: "zustand",
|
|
34255
|
+
version: zustandSpec
|
|
34256
|
+
}),
|
|
34257
|
+
sourceDirectory: directory
|
|
34258
|
+
};
|
|
34259
|
+
if (shouldReplaceSupportedDependencyFact(facts.zustand, nextZustandFact, 5)) facts.zustand = nextZustandFact;
|
|
34260
|
+
}
|
|
34216
34261
|
if (facts.reanimatedVersion === null) {
|
|
34217
34262
|
const spec = getDependencySpec(packageJson, REANIMATED_DEPENDENCY_NAME);
|
|
34218
34263
|
if (spec !== null) facts.reanimatedVersion = spec;
|
|
34219
34264
|
}
|
|
34265
|
+
if (facts.valtioVersion === null) {
|
|
34266
|
+
const spec = getDependencySpec(packageJson, "valtio");
|
|
34267
|
+
if (spec !== null) facts.valtioVersion = spec;
|
|
34268
|
+
}
|
|
34220
34269
|
facts.hasReactNativeAwarePackage = facts.hasReactNativeAwarePackage || isPackageJsonReactNativeAware(packageJson);
|
|
34221
34270
|
facts.hasReanimatedAwarePackage = facts.hasReanimatedAwarePackage || isPackageJsonReanimatedAware(packageJson);
|
|
34222
34271
|
facts.hasSsrDependency = facts.hasSsrDependency || isPackageJsonSsrAware(packageJson);
|
|
34272
|
+
const remotionSpec = getDependencySpec(packageJson, "remotion");
|
|
34273
|
+
if (remotionSpec !== null) {
|
|
34274
|
+
facts.hasRemotionDependency = true;
|
|
34275
|
+
const resolvedRemotionVersion = resolveCatalogBackedDependencyVersion({
|
|
34276
|
+
rootDirectory,
|
|
34277
|
+
rootPackageJson,
|
|
34278
|
+
packageName: "remotion",
|
|
34279
|
+
version: remotionSpec
|
|
34280
|
+
});
|
|
34281
|
+
const remotionMajorVersion = resolvedRemotionVersion === null ? null : getLowestDependencyMajor(resolvedRemotionVersion);
|
|
34282
|
+
if (remotionMajorVersion === null) {
|
|
34283
|
+
facts.hasUnknownRemotionVersion = true;
|
|
34284
|
+
facts.remotionVersion = null;
|
|
34285
|
+
} else if (!facts.hasUnknownRemotionVersion) {
|
|
34286
|
+
const currentRemotionMajorVersion = facts.remotionVersion === null ? null : getLowestDependencyMajor(facts.remotionVersion);
|
|
34287
|
+
if (currentRemotionMajorVersion === null || remotionMajorVersion < currentRemotionMajorVersion) facts.remotionVersion = resolvedRemotionVersion;
|
|
34288
|
+
}
|
|
34289
|
+
}
|
|
34223
34290
|
};
|
|
34224
34291
|
const collectWorkspaceFacts = (rootDirectory, rootPackageJson, { collectReactGroup }) => {
|
|
34225
34292
|
const facts = {
|
|
@@ -34239,12 +34306,28 @@ const collectWorkspaceFacts = (rootDirectory, rootPackageJson, { collectReactGro
|
|
|
34239
34306
|
version: null,
|
|
34240
34307
|
sourceDirectory: null
|
|
34241
34308
|
},
|
|
34309
|
+
valtioVersion: null,
|
|
34310
|
+
mobx: {
|
|
34311
|
+
version: null,
|
|
34312
|
+
sourceDirectory: null
|
|
34313
|
+
},
|
|
34314
|
+
hasMobxReact: false,
|
|
34315
|
+
hasMobxReactLite: false,
|
|
34316
|
+
hasMobxStateTree: false,
|
|
34317
|
+
hasMobxReactObserver: false,
|
|
34318
|
+
zustand: {
|
|
34319
|
+
version: null,
|
|
34320
|
+
sourceDirectory: null
|
|
34321
|
+
},
|
|
34242
34322
|
hasReactNativeAwarePackage: false,
|
|
34243
34323
|
hasReanimatedAwarePackage: false,
|
|
34244
34324
|
hasSsrDependency: false,
|
|
34325
|
+
hasRemotionDependency: false,
|
|
34326
|
+
hasUnknownRemotionVersion: false,
|
|
34327
|
+
remotionVersion: null,
|
|
34245
34328
|
reanimatedVersion: null
|
|
34246
34329
|
};
|
|
34247
|
-
evaluateManifestFacts(facts, rootPackageJson, rootDirectory);
|
|
34330
|
+
evaluateManifestFacts(facts, rootPackageJson, rootDirectory, rootDirectory, rootPackageJson);
|
|
34248
34331
|
let isReactGroupSettled = !collectReactGroup;
|
|
34249
34332
|
const visitedDirectories = /* @__PURE__ */ new Set();
|
|
34250
34333
|
for (const pattern of getWorkspacePatterns(rootDirectory, rootPackageJson)) {
|
|
@@ -34253,7 +34336,7 @@ const collectWorkspaceFacts = (rootDirectory, rootPackageJson, { collectReactGro
|
|
|
34253
34336
|
if (visitedDirectories.has(workspaceDirectory)) continue;
|
|
34254
34337
|
visitedDirectories.add(workspaceDirectory);
|
|
34255
34338
|
const workspacePackageJson = readPackageJson(Path.join(workspaceDirectory, "package.json"));
|
|
34256
|
-
evaluateManifestFacts(facts, workspacePackageJson, workspaceDirectory);
|
|
34339
|
+
evaluateManifestFacts(facts, workspacePackageJson, workspaceDirectory, rootDirectory, rootPackageJson);
|
|
34257
34340
|
const info = extractDependencyInfo(workspacePackageJson);
|
|
34258
34341
|
if (info.framework !== "unknown" && frameworkMergeRank(info.framework) < frameworkMergeRank(facts.framework)) facts.framework = info.framework;
|
|
34259
34342
|
if (isReactGroupSettled) continue;
|
|
@@ -34477,11 +34560,24 @@ const discoverProjectWithoutPackageJson = (directory) => {
|
|
|
34477
34560
|
tailwindVersion: null,
|
|
34478
34561
|
zodVersion: null,
|
|
34479
34562
|
zodMajorVersion: null,
|
|
34563
|
+
mobxVersion: null,
|
|
34564
|
+
mobxMajorVersion: null,
|
|
34565
|
+
hasMobxReact: false,
|
|
34566
|
+
hasMobxReactLite: false,
|
|
34567
|
+
hasMobxStateTree: false,
|
|
34568
|
+
hasMobxReactObserver: false,
|
|
34569
|
+
zustandVersion: null,
|
|
34570
|
+
zustandMajorVersion: null,
|
|
34480
34571
|
framework: "unknown",
|
|
34481
34572
|
hasTypeScript: hasOwnTsConfig,
|
|
34482
34573
|
hasReactCompiler: false,
|
|
34483
34574
|
hasReactCompilerLintPlugin: false,
|
|
34484
34575
|
hasTanStackQuery: false,
|
|
34576
|
+
valtioVersion: null,
|
|
34577
|
+
valtioMajorVersion: null,
|
|
34578
|
+
hasRemotion: false,
|
|
34579
|
+
remotionVersion: null,
|
|
34580
|
+
remotionMajorVersion: null,
|
|
34485
34581
|
hasSsrDependency: false,
|
|
34486
34582
|
preactVersion: null,
|
|
34487
34583
|
preactMajorVersion: null,
|
|
@@ -34580,6 +34676,12 @@ const discoverProject = (directory) => {
|
|
|
34580
34676
|
packageName: SHOPIFY_FLASH_LIST_PACKAGE_NAME,
|
|
34581
34677
|
version: workspaceFacts.shopifyFlashList.version
|
|
34582
34678
|
}) : null;
|
|
34679
|
+
const zustandVersion = resolveCatalogBackedDependencyVersion({
|
|
34680
|
+
rootDirectory: directory,
|
|
34681
|
+
rootPackageJson: packageJson,
|
|
34682
|
+
packageName: "zustand",
|
|
34683
|
+
version: workspaceFacts.zustand.version
|
|
34684
|
+
});
|
|
34583
34685
|
const hasReanimated = hasReactNativeWorkspace && workspaceFacts.hasReanimatedAwarePackage;
|
|
34584
34686
|
const reanimatedVersion = hasReanimated ? workspaceFacts.reanimatedVersion : null;
|
|
34585
34687
|
const nextjsVersion = framework === "nextjs" ? resolveCatalogBackedDependencyVersion({
|
|
@@ -34588,7 +34690,20 @@ const discoverProject = (directory) => {
|
|
|
34588
34690
|
packageName: "next",
|
|
34589
34691
|
version: workspaceFacts.next.version
|
|
34590
34692
|
}) : null;
|
|
34693
|
+
const valtioVersion = resolveCatalogBackedDependencyVersion({
|
|
34694
|
+
rootDirectory: directory,
|
|
34695
|
+
rootPackageJson: packageJson,
|
|
34696
|
+
packageName: "valtio",
|
|
34697
|
+
version: workspaceFacts.valtioVersion
|
|
34698
|
+
});
|
|
34699
|
+
const mobxVersion = resolveCatalogBackedDependencyVersion({
|
|
34700
|
+
rootDirectory: directory,
|
|
34701
|
+
rootPackageJson: packageJson,
|
|
34702
|
+
packageName: "mobx",
|
|
34703
|
+
version: workspaceFacts.mobx.version
|
|
34704
|
+
});
|
|
34591
34705
|
const preactVersion = getPreactVersion(packageJson);
|
|
34706
|
+
const remotionVersion = workspaceFacts.remotionVersion;
|
|
34592
34707
|
const isPreES2023Target = hasTypeScript && detectPreES2023Target(directory);
|
|
34593
34708
|
const projectInfo = {
|
|
34594
34709
|
rootDirectory: directory,
|
|
@@ -34598,11 +34713,24 @@ const discoverProject = (directory) => {
|
|
|
34598
34713
|
tailwindVersion,
|
|
34599
34714
|
zodVersion,
|
|
34600
34715
|
zodMajorVersion: zodVersion === null ? null : getLowestDependencyMajor(zodVersion),
|
|
34716
|
+
mobxVersion,
|
|
34717
|
+
mobxMajorVersion: mobxVersion === null ? null : getLowestDependencyMajor(mobxVersion),
|
|
34718
|
+
hasMobxReact: workspaceFacts.hasMobxReact,
|
|
34719
|
+
hasMobxReactLite: workspaceFacts.hasMobxReactLite,
|
|
34720
|
+
hasMobxStateTree: workspaceFacts.hasMobxStateTree,
|
|
34721
|
+
hasMobxReactObserver: workspaceFacts.hasMobxReactObserver,
|
|
34722
|
+
zustandVersion,
|
|
34723
|
+
zustandMajorVersion: zustandVersion === null ? null : getLowestDependencyMajor(zustandVersion),
|
|
34601
34724
|
framework,
|
|
34602
34725
|
hasTypeScript,
|
|
34603
34726
|
hasReactCompiler: detectReactCompiler(directory, packageJson),
|
|
34604
34727
|
hasReactCompilerLintPlugin: detectReactCompilerLintPlugin(directory, packageJson),
|
|
34605
34728
|
hasTanStackQuery: hasTanStackQuery(packageJson),
|
|
34729
|
+
valtioVersion,
|
|
34730
|
+
valtioMajorVersion: valtioVersion === null ? null : getLowestDependencyMajor(valtioVersion),
|
|
34731
|
+
hasRemotion: workspaceFacts.hasRemotionDependency,
|
|
34732
|
+
remotionVersion,
|
|
34733
|
+
remotionMajorVersion: remotionVersion === null ? null : getLowestDependencyMajor(remotionVersion),
|
|
34606
34734
|
hasSsrDependency: workspaceFacts.hasSsrDependency,
|
|
34607
34735
|
preactVersion,
|
|
34608
34736
|
preactMajorVersion: parseReactMajor(preactVersion),
|
|
@@ -34836,7 +34964,6 @@ const LEGACY_RULE_KEY_TO_NATIVE_RULE_KEY = {
|
|
|
34836
34964
|
"react/jsx-no-new-function-as-prop": "react-doctor/jsx-no-new-function-as-prop",
|
|
34837
34965
|
"react/jsx-no-new-object-as-prop": "react-doctor/jsx-no-new-object-as-prop",
|
|
34838
34966
|
"react/jsx-no-script-url": "react-doctor/jsx-no-script-url",
|
|
34839
|
-
"react/jsx-no-target-blank": "react-doctor/jsx-no-target-blank",
|
|
34840
34967
|
"react/jsx-no-undef": "react-doctor/jsx-no-undef",
|
|
34841
34968
|
"react/jsx-no-useless-fragment": "react-doctor/jsx-no-useless-fragment",
|
|
34842
34969
|
"react/jsx-pascal-case": "react-doctor/jsx-pascal-case",
|
|
@@ -37049,9 +37176,25 @@ const BABEL_CONFIG_FILE_NAMES = [
|
|
|
37049
37176
|
".babelrc.json"
|
|
37050
37177
|
];
|
|
37051
37178
|
const LEGACY_PRESET_SPEC = "module:metro-react-native-babel-preset";
|
|
37179
|
+
const LEGACY_PRESET_PACKAGE = "metro-react-native-babel-preset";
|
|
37180
|
+
const REACT_NATIVE_PACKAGE = "react-native";
|
|
37181
|
+
const PRESET_RENAME_MINIMUM_REACT_NATIVE_VERSION = "0.73.0";
|
|
37182
|
+
const LEGACY_PRESET_REFERENCE = new RegExp(`['"]${LEGACY_PRESET_SPEC}['"]`);
|
|
37052
37183
|
const MODERN_PRESET_REFERENCE = new RegExp(`['"]module:@react-native/babel-preset['"]`);
|
|
37053
37184
|
const ENABLE_BABEL_RUNTIME_VERSION = /enableBabelRuntime["']?\s*:\s*['"]/;
|
|
37185
|
+
const isReactNativeVersionAtLeastPresetRename = (rootDirectory, packageJson) => {
|
|
37186
|
+
const installedReactNativeManifestPath = Path.join(rootDirectory, "node_modules", REACT_NATIVE_PACKAGE, "package.json");
|
|
37187
|
+
const reactNativeVersionSpec = (isFile(installedReactNativeManifestPath) ? readPackageJson(installedReactNativeManifestPath).version : void 0) ?? getDependencySpec(packageJson, REACT_NATIVE_PACKAGE);
|
|
37188
|
+
if (reactNativeVersionSpec === null || reactNativeVersionSpec === void 0) return false;
|
|
37189
|
+
const normalizedVersionRange = import_semver.validRange(reactNativeVersionSpec);
|
|
37190
|
+
if (normalizedVersionRange === null) return false;
|
|
37191
|
+
const minimumVersion = import_semver.minVersion(normalizedVersionRange);
|
|
37192
|
+
return minimumVersion !== null && import_semver.gte(minimumVersion, PRESET_RENAME_MINIMUM_REACT_NATIVE_VERSION);
|
|
37193
|
+
};
|
|
37194
|
+
const canResolveLegacyPreset = (rootDirectory, packageJson) => getDependencySpec(packageJson, LEGACY_PRESET_PACKAGE) !== null || isFile(Path.join(rootDirectory, "node_modules", LEGACY_PRESET_PACKAGE, "package.json"));
|
|
37054
37195
|
const checkReactNativeMetroBabelPreset = (rootDirectory) => {
|
|
37196
|
+
const packageJson = readPackageJson(Path.join(rootDirectory, "package.json"));
|
|
37197
|
+
const shouldReportLegacyPreset = isReactNativeVersionAtLeastPresetRename(rootDirectory, packageJson) && !canResolveLegacyPreset(rootDirectory, packageJson);
|
|
37055
37198
|
for (const fileName of BABEL_CONFIG_FILE_NAMES) {
|
|
37056
37199
|
const filePath = Path.join(rootDirectory, fileName);
|
|
37057
37200
|
if (!isFile(filePath)) continue;
|
|
@@ -37061,7 +37204,7 @@ const checkReactNativeMetroBabelPreset = (rootDirectory) => {
|
|
|
37061
37204
|
} catch {
|
|
37062
37205
|
continue;
|
|
37063
37206
|
}
|
|
37064
|
-
if (
|
|
37207
|
+
if (shouldReportLegacyPreset && LEGACY_PRESET_REFERENCE.test(contents)) return [buildReactNativeDiagnostic({
|
|
37065
37208
|
filePath: fileName,
|
|
37066
37209
|
rule: "rn-no-metro-babel-preset",
|
|
37067
37210
|
severity: "error",
|
|
@@ -37084,12 +37227,6 @@ const checkReactNativeProject = (rootDirectory, project) => {
|
|
|
37084
37227
|
return [...checkReactNativeMetroBabelPreset(rootDirectory), ...checkReactNativeLibraryDependencies(rootDirectory)];
|
|
37085
37228
|
};
|
|
37086
37229
|
const RULE_KEY = "no-vulnerable-react-server-components";
|
|
37087
|
-
const DEPENDENCY_SECTIONS = [
|
|
37088
|
-
"dependencies",
|
|
37089
|
-
"devDependencies",
|
|
37090
|
-
"peerDependencies",
|
|
37091
|
-
"optionalDependencies"
|
|
37092
|
-
];
|
|
37093
37230
|
const REACT_RSC_ADVISORIES_BY_MINOR = {
|
|
37094
37231
|
"19.0": {
|
|
37095
37232
|
rceFixedVersion: "19.0.1",
|
|
@@ -37136,20 +37273,13 @@ const enumerateWorkspaceDirectories = (workspaceRoot) => {
|
|
|
37136
37273
|
for (const pattern of patterns) for (const directory of resolveWorkspaceDirectories(workspaceRoot, pattern)) directories.add(directory);
|
|
37137
37274
|
return [...directories];
|
|
37138
37275
|
};
|
|
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
|
-
};
|
|
37146
37276
|
const resolveVersionInDirectory = (directory, packageName, declaredSpecOverride) => {
|
|
37147
37277
|
const manifestPath = Path.join(directory, "node_modules", packageName, "package.json");
|
|
37148
37278
|
if (isFile(manifestPath)) {
|
|
37149
37279
|
const installedVersion = import_semver.valid(readPackageJson(manifestPath).version ?? null);
|
|
37150
37280
|
if (installedVersion !== null) return installedVersion;
|
|
37151
37281
|
}
|
|
37152
|
-
const candidateSpecs = [
|
|
37282
|
+
const candidateSpecs = [getDependencySpec(readPackageJson(Path.join(directory, "package.json")), packageName), declaredSpecOverride];
|
|
37153
37283
|
for (const spec of candidateSpecs) {
|
|
37154
37284
|
const pinnedVersion = spec === null ? null : import_semver.valid(spec);
|
|
37155
37285
|
if (pinnedVersion !== null) return pinnedVersion;
|
|
@@ -37829,9 +37959,24 @@ const buildCapabilities = (project) => {
|
|
|
37829
37959
|
})) capabilities.add("tailwind:3.4");
|
|
37830
37960
|
if (project.zodVersion !== null) capabilities.add("zod");
|
|
37831
37961
|
if (project.zodMajorVersion !== null && project.zodMajorVersion >= 4) capabilities.add("zod:4");
|
|
37962
|
+
if (project.mobxVersion !== void 0 && project.mobxVersion !== null || project.hasMobxReact === true || project.hasMobxReactLite === true || project.hasMobxStateTree === true || project.hasMobxReactObserver === true) capabilities.add("mobx");
|
|
37963
|
+
if (project.hasMobxReact === true) capabilities.add("mobx-react");
|
|
37964
|
+
if (project.hasMobxReactLite === true) capabilities.add("mobx-react-lite");
|
|
37965
|
+
if (project.hasMobxReact === true || project.hasMobxReactLite === true) capabilities.add("mobx-react-binding");
|
|
37966
|
+
if (project.hasMobxStateTree === true) capabilities.add("mobx-state-tree");
|
|
37967
|
+
if (project.hasMobxReactObserver === true) capabilities.add("mobx-react-observer");
|
|
37968
|
+
if (project.mobxMajorVersion !== void 0 && project.mobxMajorVersion !== null && project.mobxMajorVersion >= 4 && project.mobxMajorVersion <= 6) addMajorLadder(capabilities, "mobx", project.mobxMajorVersion, 4, 6);
|
|
37969
|
+
if (project.zustandVersion !== void 0 && project.zustandVersion !== null) capabilities.add("zustand");
|
|
37970
|
+
if (project.zustandMajorVersion !== void 0 && project.zustandMajorVersion !== null && project.zustandMajorVersion >= 1 && project.zustandMajorVersion <= 5) addMajorLadder(capabilities, "zustand", project.zustandMajorVersion, 1, 5);
|
|
37832
37971
|
if (project.isPreES2023Target) capabilities.add("pre-es2023");
|
|
37833
37972
|
if (project.hasReactCompiler) capabilities.add("react-compiler");
|
|
37834
37973
|
if (project.hasTanStackQuery) capabilities.add("tanstack-query");
|
|
37974
|
+
if (project.valtioVersion !== null) capabilities.add("valtio");
|
|
37975
|
+
addMajorLadder(capabilities, "valtio", project.valtioMajorVersion, 1, 10);
|
|
37976
|
+
if (project.hasRemotion) {
|
|
37977
|
+
capabilities.add("remotion");
|
|
37978
|
+
addMajorLadder(capabilities, "remotion", project.remotionMajorVersion ?? null, 4, 30);
|
|
37979
|
+
}
|
|
37835
37980
|
if (project.hasTypeScript) capabilities.add("typescript");
|
|
37836
37981
|
if (project.preactVersion !== null) capabilities.add("preact");
|
|
37837
37982
|
addMajorLadder(capabilities, "preact", project.preactMajorVersion, 10, 20);
|
|
@@ -40825,12 +40970,17 @@ const REACT_ERROR_BOUNDARY_MESSAGE = "This try/catch cannot catch errors thrown
|
|
|
40825
40970
|
const REACT_COMPILER_IMPACT = "This component misses React Compiler's automatic memoization & re-renders more than it should";
|
|
40826
40971
|
const REACT_COMPILER_ACTION = "Rewrite the flagged code so the compiler can optimize it.";
|
|
40827
40972
|
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`.";
|
|
40973
|
+
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`.";
|
|
40828
40974
|
const REACT_COMPILER_GENERIC_MESSAGE = `${REACT_COMPILER_IMPACT}. ${REACT_COMPILER_ACTION}`;
|
|
40829
40975
|
const buildReactCompilerMessage = (reasonSummary, action = REACT_COMPILER_ACTION) => {
|
|
40830
40976
|
const normalizedSummary = reasonSummary.replace(TRAILING_PERIOD_PATTERN, "");
|
|
40831
40977
|
if (!normalizedSummary) return `${REACT_COMPILER_IMPACT}. ${action}`;
|
|
40832
40978
|
return `${REACT_COMPILER_IMPACT}: ${normalizedSummary}. ${action}`;
|
|
40833
40979
|
};
|
|
40980
|
+
const buildSetStateInEffectMessage = (reasonSummary) => {
|
|
40981
|
+
const normalizedSummary = reasonSummary.replace(TRAILING_PERIOD_PATTERN, "");
|
|
40982
|
+
return `This synchronous effect update causes an extra render${normalizedSummary ? `: ${normalizedSummary}` : ""}. ${SET_STATE_IN_EFFECT_ACTION}`;
|
|
40983
|
+
};
|
|
40834
40984
|
const PLUGIN_CATEGORY_MAP = {
|
|
40835
40985
|
react: "Bugs",
|
|
40836
40986
|
"react-hooks": "Bugs",
|
|
@@ -40888,6 +41038,10 @@ const resolveCleanedDiagnostic = (message, help, plugin, rule, project) => {
|
|
|
40888
41038
|
message: REACT_ERROR_BOUNDARY_MESSAGE,
|
|
40889
41039
|
help: reasonDetail || help
|
|
40890
41040
|
};
|
|
41041
|
+
if (rule === "set-state-in-effect") return {
|
|
41042
|
+
message: buildSetStateInEffectMessage(reasonSummary.trim()),
|
|
41043
|
+
help: reasonDetail || help
|
|
41044
|
+
};
|
|
40891
41045
|
return {
|
|
40892
41046
|
message: buildReactCompilerMessage(reasonSummary.trim(), rule === "incompatible-library" ? REACT_COMPILER_INCOMPATIBLE_LIBRARY_ACTION : REACT_COMPILER_ACTION),
|
|
40893
41047
|
help: appendReanimatedSharedValueHint(reasonDetail || help, rule, project)
|
|
@@ -45448,5 +45602,5 @@ const startLanguageServer = () => {
|
|
|
45448
45602
|
};
|
|
45449
45603
|
//#endregion
|
|
45450
45604
|
export { startLanguageServer };
|
|
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]="
|
|
45452
|
-
//# debugId=
|
|
45605
|
+
!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]="f2369b82-a22a-50e5-b71b-2ceb30eaee9f")}catch(e){}}();
|
|
45606
|
+
//# debugId=f2369b82-a22a-50e5-b71b-2ceb30eaee9f
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "react-doctor",
|
|
3
|
-
"version": "0.8.1-dev.
|
|
3
|
+
"version": "0.8.1-dev.e6a1557",
|
|
4
4
|
"description": "Your agent writes bad React. This catches it",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"accessibility",
|
|
@@ -65,7 +65,7 @@
|
|
|
65
65
|
"vscode-languageserver-textdocument": "^1.0.12",
|
|
66
66
|
"vscode-uri": "^3.1.0",
|
|
67
67
|
"yaml": "^2.9.0",
|
|
68
|
-
"oxlint-plugin-react-doctor": "0.8.1-dev.
|
|
68
|
+
"oxlint-plugin-react-doctor": "0.8.1-dev.e6a1557",
|
|
69
69
|
"deslop-js": "0.8.1"
|
|
70
70
|
},
|
|
71
71
|
"devDependencies": {
|
|
@@ -74,8 +74,8 @@
|
|
|
74
74
|
"@xterm/headless": "^6.0.0",
|
|
75
75
|
"commander": "^14.0.3",
|
|
76
76
|
"ora": "^9.4.0",
|
|
77
|
-
"@react-doctor/api": "0.8.1",
|
|
78
77
|
"@react-doctor/core": "0.8.1",
|
|
78
|
+
"@react-doctor/api": "0.8.1",
|
|
79
79
|
"@react-doctor/language-server": "0.8.1"
|
|
80
80
|
},
|
|
81
81
|
"engines": {
|