react-doctor 0.8.1-dev.a4eaedd → 0.8.1-dev.a667b45
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 +21 -40
- package/dist/index.d.ts +0 -9
- package/dist/index.js +18 -37
- package/dist/lsp.js +18 -37
- package/package.json +2 -2
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]="24153a3f-aef9-53fd-8dff-9b016a9613fb")}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";
|
|
@@ -37361,10 +37361,6 @@ const evaluateManifestFacts = (facts, packageJson, directory) => {
|
|
|
37361
37361
|
const spec = getDependencySpec(packageJson, REANIMATED_DEPENDENCY_NAME);
|
|
37362
37362
|
if (spec !== null) facts.reanimatedVersion = spec;
|
|
37363
37363
|
}
|
|
37364
|
-
if (facts.valtioVersion === null) {
|
|
37365
|
-
const spec = getDependencySpec(packageJson, "valtio");
|
|
37366
|
-
if (spec !== null) facts.valtioVersion = spec;
|
|
37367
|
-
}
|
|
37368
37364
|
facts.hasReactNativeAwarePackage = facts.hasReactNativeAwarePackage || isPackageJsonReactNativeAware(packageJson);
|
|
37369
37365
|
facts.hasReanimatedAwarePackage = facts.hasReanimatedAwarePackage || isPackageJsonReanimatedAware(packageJson);
|
|
37370
37366
|
facts.hasSsrDependency = facts.hasSsrDependency || isPackageJsonSsrAware(packageJson);
|
|
@@ -37387,7 +37383,6 @@ const collectWorkspaceFacts = (rootDirectory, rootPackageJson, { collectReactGro
|
|
|
37387
37383
|
version: null,
|
|
37388
37384
|
sourceDirectory: null
|
|
37389
37385
|
},
|
|
37390
|
-
valtioVersion: null,
|
|
37391
37386
|
hasReactNativeAwarePackage: false,
|
|
37392
37387
|
hasReanimatedAwarePackage: false,
|
|
37393
37388
|
hasSsrDependency: false,
|
|
@@ -37628,8 +37623,6 @@ const discoverProjectWithoutPackageJson = (directory) => {
|
|
|
37628
37623
|
hasReactCompiler: false,
|
|
37629
37624
|
hasReactCompilerLintPlugin: false,
|
|
37630
37625
|
hasTanStackQuery: false,
|
|
37631
|
-
valtioVersion: null,
|
|
37632
|
-
valtioMajorVersion: null,
|
|
37633
37626
|
hasSsrDependency: false,
|
|
37634
37627
|
preactVersion: null,
|
|
37635
37628
|
preactMajorVersion: null,
|
|
@@ -37736,12 +37729,6 @@ const discoverProject = (directory) => {
|
|
|
37736
37729
|
packageName: "next",
|
|
37737
37730
|
version: workspaceFacts.next.version
|
|
37738
37731
|
}) : null;
|
|
37739
|
-
const valtioVersion = resolveCatalogBackedDependencyVersion({
|
|
37740
|
-
rootDirectory: directory,
|
|
37741
|
-
rootPackageJson: packageJson,
|
|
37742
|
-
packageName: "valtio",
|
|
37743
|
-
version: workspaceFacts.valtioVersion
|
|
37744
|
-
});
|
|
37745
37732
|
const preactVersion = getPreactVersion(packageJson);
|
|
37746
37733
|
const isPreES2023Target = hasTypeScript && detectPreES2023Target(directory);
|
|
37747
37734
|
const projectInfo = {
|
|
@@ -37757,8 +37744,6 @@ const discoverProject = (directory) => {
|
|
|
37757
37744
|
hasReactCompiler: detectReactCompiler(directory, packageJson),
|
|
37758
37745
|
hasReactCompilerLintPlugin: detectReactCompilerLintPlugin(directory, packageJson),
|
|
37759
37746
|
hasTanStackQuery: hasTanStackQuery(packageJson),
|
|
37760
|
-
valtioVersion,
|
|
37761
|
-
valtioMajorVersion: valtioVersion === null ? null : getLowestDependencyMajor(valtioVersion),
|
|
37762
37747
|
hasSsrDependency: workspaceFacts.hasSsrDependency,
|
|
37763
37748
|
preactVersion,
|
|
37764
37749
|
preactMajorVersion: parseReactMajor(preactVersion),
|
|
@@ -37992,6 +37977,7 @@ const LEGACY_RULE_KEY_TO_NATIVE_RULE_KEY = {
|
|
|
37992
37977
|
"react/jsx-no-new-function-as-prop": "react-doctor/jsx-no-new-function-as-prop",
|
|
37993
37978
|
"react/jsx-no-new-object-as-prop": "react-doctor/jsx-no-new-object-as-prop",
|
|
37994
37979
|
"react/jsx-no-script-url": "react-doctor/jsx-no-script-url",
|
|
37980
|
+
"react/jsx-no-target-blank": "react-doctor/jsx-no-target-blank",
|
|
37995
37981
|
"react/jsx-no-undef": "react-doctor/jsx-no-undef",
|
|
37996
37982
|
"react/jsx-no-useless-fragment": "react-doctor/jsx-no-useless-fragment",
|
|
37997
37983
|
"react/jsx-pascal-case": "react-doctor/jsx-pascal-case",
|
|
@@ -40313,25 +40299,9 @@ const BABEL_CONFIG_FILE_NAMES = [
|
|
|
40313
40299
|
".babelrc.json"
|
|
40314
40300
|
];
|
|
40315
40301
|
const LEGACY_PRESET_SPEC = "module:metro-react-native-babel-preset";
|
|
40316
|
-
const LEGACY_PRESET_PACKAGE = "metro-react-native-babel-preset";
|
|
40317
|
-
const REACT_NATIVE_PACKAGE = "react-native";
|
|
40318
|
-
const PRESET_RENAME_MINIMUM_REACT_NATIVE_VERSION = "0.73.0";
|
|
40319
|
-
const LEGACY_PRESET_REFERENCE = new RegExp(`['"]${LEGACY_PRESET_SPEC}['"]`);
|
|
40320
40302
|
const MODERN_PRESET_REFERENCE = new RegExp(`['"]module:@react-native/babel-preset['"]`);
|
|
40321
40303
|
const ENABLE_BABEL_RUNTIME_VERSION = /enableBabelRuntime["']?\s*:\s*['"]/;
|
|
40322
|
-
const isReactNativeVersionAtLeastPresetRename = (rootDirectory, packageJson) => {
|
|
40323
|
-
const installedReactNativeManifestPath = Path.join(rootDirectory, "node_modules", REACT_NATIVE_PACKAGE, "package.json");
|
|
40324
|
-
const reactNativeVersionSpec = (isFile(installedReactNativeManifestPath) ? readPackageJson$1(installedReactNativeManifestPath).version : void 0) ?? getDependencySpec(packageJson, REACT_NATIVE_PACKAGE);
|
|
40325
|
-
if (reactNativeVersionSpec === null || reactNativeVersionSpec === void 0) return false;
|
|
40326
|
-
const normalizedVersionRange = import_semver.validRange(reactNativeVersionSpec);
|
|
40327
|
-
if (normalizedVersionRange === null) return false;
|
|
40328
|
-
const minimumVersion = import_semver.minVersion(normalizedVersionRange);
|
|
40329
|
-
return minimumVersion !== null && import_semver.gte(minimumVersion, PRESET_RENAME_MINIMUM_REACT_NATIVE_VERSION);
|
|
40330
|
-
};
|
|
40331
|
-
const canResolveLegacyPreset = (rootDirectory, packageJson) => getDependencySpec(packageJson, LEGACY_PRESET_PACKAGE) !== null || isFile(Path.join(rootDirectory, "node_modules", LEGACY_PRESET_PACKAGE, "package.json"));
|
|
40332
40304
|
const checkReactNativeMetroBabelPreset = (rootDirectory) => {
|
|
40333
|
-
const packageJson = readPackageJson$1(Path.join(rootDirectory, "package.json"));
|
|
40334
|
-
const shouldReportLegacyPreset = isReactNativeVersionAtLeastPresetRename(rootDirectory, packageJson) && !canResolveLegacyPreset(rootDirectory, packageJson);
|
|
40335
40305
|
for (const fileName of BABEL_CONFIG_FILE_NAMES) {
|
|
40336
40306
|
const filePath = Path.join(rootDirectory, fileName);
|
|
40337
40307
|
if (!isFile(filePath)) continue;
|
|
@@ -40341,7 +40311,7 @@ const checkReactNativeMetroBabelPreset = (rootDirectory) => {
|
|
|
40341
40311
|
} catch {
|
|
40342
40312
|
continue;
|
|
40343
40313
|
}
|
|
40344
|
-
if (
|
|
40314
|
+
if (contents.includes(LEGACY_PRESET_SPEC)) return [buildReactNativeDiagnostic({
|
|
40345
40315
|
filePath: fileName,
|
|
40346
40316
|
rule: "rn-no-metro-babel-preset",
|
|
40347
40317
|
severity: "error",
|
|
@@ -40364,6 +40334,12 @@ const checkReactNativeProject = (rootDirectory, project) => {
|
|
|
40364
40334
|
return [...checkReactNativeMetroBabelPreset(rootDirectory), ...checkReactNativeLibraryDependencies(rootDirectory)];
|
|
40365
40335
|
};
|
|
40366
40336
|
const RULE_KEY = "no-vulnerable-react-server-components";
|
|
40337
|
+
const DEPENDENCY_SECTIONS = [
|
|
40338
|
+
"dependencies",
|
|
40339
|
+
"devDependencies",
|
|
40340
|
+
"peerDependencies",
|
|
40341
|
+
"optionalDependencies"
|
|
40342
|
+
];
|
|
40367
40343
|
const REACT_RSC_ADVISORIES_BY_MINOR = {
|
|
40368
40344
|
"19.0": {
|
|
40369
40345
|
rceFixedVersion: "19.0.1",
|
|
@@ -40410,13 +40386,20 @@ const enumerateWorkspaceDirectories = (workspaceRoot) => {
|
|
|
40410
40386
|
for (const pattern of patterns) for (const directory of resolveWorkspaceDirectories(workspaceRoot, pattern)) directories.add(directory);
|
|
40411
40387
|
return [...directories];
|
|
40412
40388
|
};
|
|
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
|
+
};
|
|
40413
40396
|
const resolveVersionInDirectory = (directory, packageName, declaredSpecOverride) => {
|
|
40414
40397
|
const manifestPath = Path.join(directory, "node_modules", packageName, "package.json");
|
|
40415
40398
|
if (isFile(manifestPath)) {
|
|
40416
40399
|
const installedVersion = import_semver.valid(readPackageJson$1(manifestPath).version ?? null);
|
|
40417
40400
|
if (installedVersion !== null) return installedVersion;
|
|
40418
40401
|
}
|
|
40419
|
-
const candidateSpecs = [
|
|
40402
|
+
const candidateSpecs = [readDeclaredSpec(readPackageJson$1(Path.join(directory, "package.json")), packageName), declaredSpecOverride];
|
|
40420
40403
|
for (const spec of candidateSpecs) {
|
|
40421
40404
|
const pinnedVersion = spec === null ? null : import_semver.valid(spec);
|
|
40422
40405
|
if (pinnedVersion !== null) return pinnedVersion;
|
|
@@ -41099,8 +41082,6 @@ const buildCapabilities = (project) => {
|
|
|
41099
41082
|
if (project.isPreES2023Target) capabilities.add("pre-es2023");
|
|
41100
41083
|
if (project.hasReactCompiler) capabilities.add("react-compiler");
|
|
41101
41084
|
if (project.hasTanStackQuery) capabilities.add("tanstack-query");
|
|
41102
|
-
if (project.valtioVersion !== null) capabilities.add("valtio");
|
|
41103
|
-
addMajorLadder(capabilities, "valtio", project.valtioMajorVersion, 1, 10);
|
|
41104
41085
|
if (project.hasTypeScript) capabilities.add("typescript");
|
|
41105
41086
|
if (project.preactVersion !== null) capabilities.add("preact");
|
|
41106
41087
|
addMajorLadder(capabilities, "preact", project.preactMajorVersion, 10, 20);
|
|
@@ -47384,7 +47365,7 @@ const makeNoopConsole = () => ({
|
|
|
47384
47365
|
});
|
|
47385
47366
|
//#endregion
|
|
47386
47367
|
//#region src/cli/utils/version.ts
|
|
47387
|
-
const VERSION = "0.8.1-dev.
|
|
47368
|
+
const VERSION = "0.8.1-dev.a667b45";
|
|
47388
47369
|
//#endregion
|
|
47389
47370
|
//#region src/cli/utils/json-mode.ts
|
|
47390
47371
|
let context = null;
|
|
@@ -47736,13 +47717,13 @@ const isDevVersion = (version) => version === "0.0.0" || version.includes("-");
|
|
|
47736
47717
|
* uploads source-map artifacts under, so stack frames symbolicate. Honors the
|
|
47737
47718
|
* standard `SENTRY_RELEASE` override.
|
|
47738
47719
|
*/
|
|
47739
|
-
const resolveSentryRelease = () => process.env.SENTRY_RELEASE || `react-doctor@0.8.1-dev.
|
|
47720
|
+
const resolveSentryRelease = () => process.env.SENTRY_RELEASE || `react-doctor@0.8.1-dev.a667b45`;
|
|
47740
47721
|
/**
|
|
47741
47722
|
* Deployment environment shown in Sentry's environment filter. Defaults to
|
|
47742
47723
|
* `production` for tagged releases and `development` for dev/unbuilt versions,
|
|
47743
47724
|
* overridable via the standard `SENTRY_ENVIRONMENT` env var.
|
|
47744
47725
|
*/
|
|
47745
|
-
const resolveSentryEnvironment = () => process.env.SENTRY_ENVIRONMENT || (isDevVersion("0.8.1-dev.
|
|
47726
|
+
const resolveSentryEnvironment = () => process.env.SENTRY_ENVIRONMENT || (isDevVersion("0.8.1-dev.a667b45") ? "development" : "production");
|
|
47746
47727
|
/**
|
|
47747
47728
|
* Performance-tracing sample rate in `[0, 1]`. Reads `SENTRY_TRACES_SAMPLE_RATE`
|
|
47748
47729
|
* (set to `0` to disable tracing) and falls back to
|
|
@@ -66422,4 +66403,4 @@ Promise.resolve().then(() => assertNoRemovedFlags(process.argv)).then(() => prog
|
|
|
66422
66403
|
export {};
|
|
66423
66404
|
|
|
66424
66405
|
//# sourceMappingURL=cli.js.map
|
|
66425
|
-
//# debugId=
|
|
66406
|
+
//# debugId=24153a3f-aef9-53fd-8dff-9b016a9613fb
|
package/dist/index.d.ts
CHANGED
|
@@ -9548,15 +9548,6 @@ interface ProjectInfo {
|
|
|
9548
9548
|
hasReactCompiler: boolean;
|
|
9549
9549
|
hasReactCompilerLintPlugin?: boolean;
|
|
9550
9550
|
hasTanStackQuery: boolean;
|
|
9551
|
-
/**
|
|
9552
|
-
* The declared `valtio` version spec, or `null` when no package in the
|
|
9553
|
-
* analyzed project declares Valtio. `useSnapshot` has kept the same
|
|
9554
|
-
* render-read contract across Valtio 1 and 2, so presence alone drives the
|
|
9555
|
-
* `valtio` capability and its parsed major-version ladder.
|
|
9556
|
-
*/
|
|
9557
|
-
valtioVersion: string | null;
|
|
9558
|
-
/** Parsed major from `valtioVersion`, or `null` when absent/unparseable. */
|
|
9559
|
-
valtioMajorVersion: number | null;
|
|
9560
9551
|
/**
|
|
9561
9552
|
* `true` when the project or a workspace declares a Vite-based SSR runtime
|
|
9562
9553
|
* 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]="14f17993-c8fc-5c43-a518-2b2055f5d836")}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";
|
|
@@ -34165,10 +34165,6 @@ const evaluateManifestFacts = (facts, packageJson, directory) => {
|
|
|
34165
34165
|
const spec = getDependencySpec(packageJson, REANIMATED_DEPENDENCY_NAME);
|
|
34166
34166
|
if (spec !== null) facts.reanimatedVersion = spec;
|
|
34167
34167
|
}
|
|
34168
|
-
if (facts.valtioVersion === null) {
|
|
34169
|
-
const spec = getDependencySpec(packageJson, "valtio");
|
|
34170
|
-
if (spec !== null) facts.valtioVersion = spec;
|
|
34171
|
-
}
|
|
34172
34168
|
facts.hasReactNativeAwarePackage = facts.hasReactNativeAwarePackage || isPackageJsonReactNativeAware(packageJson);
|
|
34173
34169
|
facts.hasReanimatedAwarePackage = facts.hasReanimatedAwarePackage || isPackageJsonReanimatedAware(packageJson);
|
|
34174
34170
|
facts.hasSsrDependency = facts.hasSsrDependency || isPackageJsonSsrAware(packageJson);
|
|
@@ -34191,7 +34187,6 @@ const collectWorkspaceFacts = (rootDirectory, rootPackageJson, { collectReactGro
|
|
|
34191
34187
|
version: null,
|
|
34192
34188
|
sourceDirectory: null
|
|
34193
34189
|
},
|
|
34194
|
-
valtioVersion: null,
|
|
34195
34190
|
hasReactNativeAwarePackage: false,
|
|
34196
34191
|
hasReanimatedAwarePackage: false,
|
|
34197
34192
|
hasSsrDependency: false,
|
|
@@ -34435,8 +34430,6 @@ const discoverProjectWithoutPackageJson = (directory) => {
|
|
|
34435
34430
|
hasReactCompiler: false,
|
|
34436
34431
|
hasReactCompilerLintPlugin: false,
|
|
34437
34432
|
hasTanStackQuery: false,
|
|
34438
|
-
valtioVersion: null,
|
|
34439
|
-
valtioMajorVersion: null,
|
|
34440
34433
|
hasSsrDependency: false,
|
|
34441
34434
|
preactVersion: null,
|
|
34442
34435
|
preactMajorVersion: null,
|
|
@@ -34543,12 +34536,6 @@ const discoverProject = (directory) => {
|
|
|
34543
34536
|
packageName: "next",
|
|
34544
34537
|
version: workspaceFacts.next.version
|
|
34545
34538
|
}) : null;
|
|
34546
|
-
const valtioVersion = resolveCatalogBackedDependencyVersion({
|
|
34547
|
-
rootDirectory: directory,
|
|
34548
|
-
rootPackageJson: packageJson,
|
|
34549
|
-
packageName: "valtio",
|
|
34550
|
-
version: workspaceFacts.valtioVersion
|
|
34551
|
-
});
|
|
34552
34539
|
const preactVersion = getPreactVersion(packageJson);
|
|
34553
34540
|
const isPreES2023Target = hasTypeScript && detectPreES2023Target(directory);
|
|
34554
34541
|
const projectInfo = {
|
|
@@ -34564,8 +34551,6 @@ const discoverProject = (directory) => {
|
|
|
34564
34551
|
hasReactCompiler: detectReactCompiler(directory, packageJson),
|
|
34565
34552
|
hasReactCompilerLintPlugin: detectReactCompilerLintPlugin(directory, packageJson),
|
|
34566
34553
|
hasTanStackQuery: hasTanStackQuery(packageJson),
|
|
34567
|
-
valtioVersion,
|
|
34568
|
-
valtioMajorVersion: valtioVersion === null ? null : getLowestDependencyMajor(valtioVersion),
|
|
34569
34554
|
hasSsrDependency: workspaceFacts.hasSsrDependency,
|
|
34570
34555
|
preactVersion,
|
|
34571
34556
|
preactMajorVersion: parseReactMajor(preactVersion),
|
|
@@ -34799,6 +34784,7 @@ const LEGACY_RULE_KEY_TO_NATIVE_RULE_KEY = {
|
|
|
34799
34784
|
"react/jsx-no-new-function-as-prop": "react-doctor/jsx-no-new-function-as-prop",
|
|
34800
34785
|
"react/jsx-no-new-object-as-prop": "react-doctor/jsx-no-new-object-as-prop",
|
|
34801
34786
|
"react/jsx-no-script-url": "react-doctor/jsx-no-script-url",
|
|
34787
|
+
"react/jsx-no-target-blank": "react-doctor/jsx-no-target-blank",
|
|
34802
34788
|
"react/jsx-no-undef": "react-doctor/jsx-no-undef",
|
|
34803
34789
|
"react/jsx-no-useless-fragment": "react-doctor/jsx-no-useless-fragment",
|
|
34804
34790
|
"react/jsx-pascal-case": "react-doctor/jsx-pascal-case",
|
|
@@ -37085,25 +37071,9 @@ const BABEL_CONFIG_FILE_NAMES = [
|
|
|
37085
37071
|
".babelrc.json"
|
|
37086
37072
|
];
|
|
37087
37073
|
const LEGACY_PRESET_SPEC = "module:metro-react-native-babel-preset";
|
|
37088
|
-
const LEGACY_PRESET_PACKAGE = "metro-react-native-babel-preset";
|
|
37089
|
-
const REACT_NATIVE_PACKAGE = "react-native";
|
|
37090
|
-
const PRESET_RENAME_MINIMUM_REACT_NATIVE_VERSION = "0.73.0";
|
|
37091
|
-
const LEGACY_PRESET_REFERENCE = new RegExp(`['"]${LEGACY_PRESET_SPEC}['"]`);
|
|
37092
37074
|
const MODERN_PRESET_REFERENCE = new RegExp(`['"]module:@react-native/babel-preset['"]`);
|
|
37093
37075
|
const ENABLE_BABEL_RUNTIME_VERSION = /enableBabelRuntime["']?\s*:\s*['"]/;
|
|
37094
|
-
const isReactNativeVersionAtLeastPresetRename = (rootDirectory, packageJson) => {
|
|
37095
|
-
const installedReactNativeManifestPath = Path.join(rootDirectory, "node_modules", REACT_NATIVE_PACKAGE, "package.json");
|
|
37096
|
-
const reactNativeVersionSpec = (isFile(installedReactNativeManifestPath) ? readPackageJson(installedReactNativeManifestPath).version : void 0) ?? getDependencySpec(packageJson, REACT_NATIVE_PACKAGE);
|
|
37097
|
-
if (reactNativeVersionSpec === null || reactNativeVersionSpec === void 0) return false;
|
|
37098
|
-
const normalizedVersionRange = import_semver.validRange(reactNativeVersionSpec);
|
|
37099
|
-
if (normalizedVersionRange === null) return false;
|
|
37100
|
-
const minimumVersion = import_semver.minVersion(normalizedVersionRange);
|
|
37101
|
-
return minimumVersion !== null && import_semver.gte(minimumVersion, PRESET_RENAME_MINIMUM_REACT_NATIVE_VERSION);
|
|
37102
|
-
};
|
|
37103
|
-
const canResolveLegacyPreset = (rootDirectory, packageJson) => getDependencySpec(packageJson, LEGACY_PRESET_PACKAGE) !== null || isFile(Path.join(rootDirectory, "node_modules", LEGACY_PRESET_PACKAGE, "package.json"));
|
|
37104
37076
|
const checkReactNativeMetroBabelPreset = (rootDirectory) => {
|
|
37105
|
-
const packageJson = readPackageJson(Path.join(rootDirectory, "package.json"));
|
|
37106
|
-
const shouldReportLegacyPreset = isReactNativeVersionAtLeastPresetRename(rootDirectory, packageJson) && !canResolveLegacyPreset(rootDirectory, packageJson);
|
|
37107
37077
|
for (const fileName of BABEL_CONFIG_FILE_NAMES) {
|
|
37108
37078
|
const filePath = Path.join(rootDirectory, fileName);
|
|
37109
37079
|
if (!isFile(filePath)) continue;
|
|
@@ -37113,7 +37083,7 @@ const checkReactNativeMetroBabelPreset = (rootDirectory) => {
|
|
|
37113
37083
|
} catch {
|
|
37114
37084
|
continue;
|
|
37115
37085
|
}
|
|
37116
|
-
if (
|
|
37086
|
+
if (contents.includes(LEGACY_PRESET_SPEC)) return [buildReactNativeDiagnostic({
|
|
37117
37087
|
filePath: fileName,
|
|
37118
37088
|
rule: "rn-no-metro-babel-preset",
|
|
37119
37089
|
severity: "error",
|
|
@@ -37136,6 +37106,12 @@ const checkReactNativeProject = (rootDirectory, project) => {
|
|
|
37136
37106
|
return [...checkReactNativeMetroBabelPreset(rootDirectory), ...checkReactNativeLibraryDependencies(rootDirectory)];
|
|
37137
37107
|
};
|
|
37138
37108
|
const RULE_KEY = "no-vulnerable-react-server-components";
|
|
37109
|
+
const DEPENDENCY_SECTIONS = [
|
|
37110
|
+
"dependencies",
|
|
37111
|
+
"devDependencies",
|
|
37112
|
+
"peerDependencies",
|
|
37113
|
+
"optionalDependencies"
|
|
37114
|
+
];
|
|
37139
37115
|
const REACT_RSC_ADVISORIES_BY_MINOR = {
|
|
37140
37116
|
"19.0": {
|
|
37141
37117
|
rceFixedVersion: "19.0.1",
|
|
@@ -37182,13 +37158,20 @@ const enumerateWorkspaceDirectories = (workspaceRoot) => {
|
|
|
37182
37158
|
for (const pattern of patterns) for (const directory of resolveWorkspaceDirectories(workspaceRoot, pattern)) directories.add(directory);
|
|
37183
37159
|
return [...directories];
|
|
37184
37160
|
};
|
|
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
|
+
};
|
|
37185
37168
|
const resolveVersionInDirectory = (directory, packageName, declaredSpecOverride) => {
|
|
37186
37169
|
const manifestPath = Path.join(directory, "node_modules", packageName, "package.json");
|
|
37187
37170
|
if (isFile(manifestPath)) {
|
|
37188
37171
|
const installedVersion = import_semver.valid(readPackageJson(manifestPath).version ?? null);
|
|
37189
37172
|
if (installedVersion !== null) return installedVersion;
|
|
37190
37173
|
}
|
|
37191
|
-
const candidateSpecs = [
|
|
37174
|
+
const candidateSpecs = [readDeclaredSpec(readPackageJson(Path.join(directory, "package.json")), packageName), declaredSpecOverride];
|
|
37192
37175
|
for (const spec of candidateSpecs) {
|
|
37193
37176
|
const pinnedVersion = spec === null ? null : import_semver.valid(spec);
|
|
37194
37177
|
if (pinnedVersion !== null) return pinnedVersion;
|
|
@@ -37871,8 +37854,6 @@ const buildCapabilities = (project) => {
|
|
|
37871
37854
|
if (project.isPreES2023Target) capabilities.add("pre-es2023");
|
|
37872
37855
|
if (project.hasReactCompiler) capabilities.add("react-compiler");
|
|
37873
37856
|
if (project.hasTanStackQuery) capabilities.add("tanstack-query");
|
|
37874
|
-
if (project.valtioVersion !== null) capabilities.add("valtio");
|
|
37875
|
-
addMajorLadder(capabilities, "valtio", project.valtioMajorVersion, 1, 10);
|
|
37876
37857
|
if (project.hasTypeScript) capabilities.add("typescript");
|
|
37877
37858
|
if (project.preactVersion !== null) capabilities.add("preact");
|
|
37878
37859
|
addMajorLadder(capabilities, "preact", project.preactMajorVersion, 10, 20);
|
|
@@ -43856,4 +43837,4 @@ const toJsonReport = (result, options) => buildJsonReport({
|
|
|
43856
43837
|
export { AmbiguousProjectError, NoReactDependencyError, NotADirectoryError, PackageJsonNotFoundError, ProjectNotFoundError, ReactDoctorError, buildJsonReport, buildJsonReportError, clearCaches, defineConfig, diagnose, filterSourceFiles, getDiffInfo, hasReactRuntime, isProjectDiscoveryError, isReactDoctorError, summarizeDiagnostics, toJsonReport };
|
|
43857
43838
|
|
|
43858
43839
|
//# sourceMappingURL=index.js.map
|
|
43859
|
-
//# debugId=
|
|
43840
|
+
//# debugId=14f17993-c8fc-5c43-a518-2b2055f5d836
|
package/dist/lsp.js
CHANGED
|
@@ -34217,10 +34217,6 @@ const evaluateManifestFacts = (facts, packageJson, directory) => {
|
|
|
34217
34217
|
const spec = getDependencySpec(packageJson, REANIMATED_DEPENDENCY_NAME);
|
|
34218
34218
|
if (spec !== null) facts.reanimatedVersion = spec;
|
|
34219
34219
|
}
|
|
34220
|
-
if (facts.valtioVersion === null) {
|
|
34221
|
-
const spec = getDependencySpec(packageJson, "valtio");
|
|
34222
|
-
if (spec !== null) facts.valtioVersion = spec;
|
|
34223
|
-
}
|
|
34224
34220
|
facts.hasReactNativeAwarePackage = facts.hasReactNativeAwarePackage || isPackageJsonReactNativeAware(packageJson);
|
|
34225
34221
|
facts.hasReanimatedAwarePackage = facts.hasReanimatedAwarePackage || isPackageJsonReanimatedAware(packageJson);
|
|
34226
34222
|
facts.hasSsrDependency = facts.hasSsrDependency || isPackageJsonSsrAware(packageJson);
|
|
@@ -34243,7 +34239,6 @@ const collectWorkspaceFacts = (rootDirectory, rootPackageJson, { collectReactGro
|
|
|
34243
34239
|
version: null,
|
|
34244
34240
|
sourceDirectory: null
|
|
34245
34241
|
},
|
|
34246
|
-
valtioVersion: null,
|
|
34247
34242
|
hasReactNativeAwarePackage: false,
|
|
34248
34243
|
hasReanimatedAwarePackage: false,
|
|
34249
34244
|
hasSsrDependency: false,
|
|
@@ -34487,8 +34482,6 @@ const discoverProjectWithoutPackageJson = (directory) => {
|
|
|
34487
34482
|
hasReactCompiler: false,
|
|
34488
34483
|
hasReactCompilerLintPlugin: false,
|
|
34489
34484
|
hasTanStackQuery: false,
|
|
34490
|
-
valtioVersion: null,
|
|
34491
|
-
valtioMajorVersion: null,
|
|
34492
34485
|
hasSsrDependency: false,
|
|
34493
34486
|
preactVersion: null,
|
|
34494
34487
|
preactMajorVersion: null,
|
|
@@ -34595,12 +34588,6 @@ const discoverProject = (directory) => {
|
|
|
34595
34588
|
packageName: "next",
|
|
34596
34589
|
version: workspaceFacts.next.version
|
|
34597
34590
|
}) : null;
|
|
34598
|
-
const valtioVersion = resolveCatalogBackedDependencyVersion({
|
|
34599
|
-
rootDirectory: directory,
|
|
34600
|
-
rootPackageJson: packageJson,
|
|
34601
|
-
packageName: "valtio",
|
|
34602
|
-
version: workspaceFacts.valtioVersion
|
|
34603
|
-
});
|
|
34604
34591
|
const preactVersion = getPreactVersion(packageJson);
|
|
34605
34592
|
const isPreES2023Target = hasTypeScript && detectPreES2023Target(directory);
|
|
34606
34593
|
const projectInfo = {
|
|
@@ -34616,8 +34603,6 @@ const discoverProject = (directory) => {
|
|
|
34616
34603
|
hasReactCompiler: detectReactCompiler(directory, packageJson),
|
|
34617
34604
|
hasReactCompilerLintPlugin: detectReactCompilerLintPlugin(directory, packageJson),
|
|
34618
34605
|
hasTanStackQuery: hasTanStackQuery(packageJson),
|
|
34619
|
-
valtioVersion,
|
|
34620
|
-
valtioMajorVersion: valtioVersion === null ? null : getLowestDependencyMajor(valtioVersion),
|
|
34621
34606
|
hasSsrDependency: workspaceFacts.hasSsrDependency,
|
|
34622
34607
|
preactVersion,
|
|
34623
34608
|
preactMajorVersion: parseReactMajor(preactVersion),
|
|
@@ -34851,6 +34836,7 @@ const LEGACY_RULE_KEY_TO_NATIVE_RULE_KEY = {
|
|
|
34851
34836
|
"react/jsx-no-new-function-as-prop": "react-doctor/jsx-no-new-function-as-prop",
|
|
34852
34837
|
"react/jsx-no-new-object-as-prop": "react-doctor/jsx-no-new-object-as-prop",
|
|
34853
34838
|
"react/jsx-no-script-url": "react-doctor/jsx-no-script-url",
|
|
34839
|
+
"react/jsx-no-target-blank": "react-doctor/jsx-no-target-blank",
|
|
34854
34840
|
"react/jsx-no-undef": "react-doctor/jsx-no-undef",
|
|
34855
34841
|
"react/jsx-no-useless-fragment": "react-doctor/jsx-no-useless-fragment",
|
|
34856
34842
|
"react/jsx-pascal-case": "react-doctor/jsx-pascal-case",
|
|
@@ -37063,25 +37049,9 @@ const BABEL_CONFIG_FILE_NAMES = [
|
|
|
37063
37049
|
".babelrc.json"
|
|
37064
37050
|
];
|
|
37065
37051
|
const LEGACY_PRESET_SPEC = "module:metro-react-native-babel-preset";
|
|
37066
|
-
const LEGACY_PRESET_PACKAGE = "metro-react-native-babel-preset";
|
|
37067
|
-
const REACT_NATIVE_PACKAGE = "react-native";
|
|
37068
|
-
const PRESET_RENAME_MINIMUM_REACT_NATIVE_VERSION = "0.73.0";
|
|
37069
|
-
const LEGACY_PRESET_REFERENCE = new RegExp(`['"]${LEGACY_PRESET_SPEC}['"]`);
|
|
37070
37052
|
const MODERN_PRESET_REFERENCE = new RegExp(`['"]module:@react-native/babel-preset['"]`);
|
|
37071
37053
|
const ENABLE_BABEL_RUNTIME_VERSION = /enableBabelRuntime["']?\s*:\s*['"]/;
|
|
37072
|
-
const isReactNativeVersionAtLeastPresetRename = (rootDirectory, packageJson) => {
|
|
37073
|
-
const installedReactNativeManifestPath = Path.join(rootDirectory, "node_modules", REACT_NATIVE_PACKAGE, "package.json");
|
|
37074
|
-
const reactNativeVersionSpec = (isFile(installedReactNativeManifestPath) ? readPackageJson(installedReactNativeManifestPath).version : void 0) ?? getDependencySpec(packageJson, REACT_NATIVE_PACKAGE);
|
|
37075
|
-
if (reactNativeVersionSpec === null || reactNativeVersionSpec === void 0) return false;
|
|
37076
|
-
const normalizedVersionRange = import_semver.validRange(reactNativeVersionSpec);
|
|
37077
|
-
if (normalizedVersionRange === null) return false;
|
|
37078
|
-
const minimumVersion = import_semver.minVersion(normalizedVersionRange);
|
|
37079
|
-
return minimumVersion !== null && import_semver.gte(minimumVersion, PRESET_RENAME_MINIMUM_REACT_NATIVE_VERSION);
|
|
37080
|
-
};
|
|
37081
|
-
const canResolveLegacyPreset = (rootDirectory, packageJson) => getDependencySpec(packageJson, LEGACY_PRESET_PACKAGE) !== null || isFile(Path.join(rootDirectory, "node_modules", LEGACY_PRESET_PACKAGE, "package.json"));
|
|
37082
37054
|
const checkReactNativeMetroBabelPreset = (rootDirectory) => {
|
|
37083
|
-
const packageJson = readPackageJson(Path.join(rootDirectory, "package.json"));
|
|
37084
|
-
const shouldReportLegacyPreset = isReactNativeVersionAtLeastPresetRename(rootDirectory, packageJson) && !canResolveLegacyPreset(rootDirectory, packageJson);
|
|
37085
37055
|
for (const fileName of BABEL_CONFIG_FILE_NAMES) {
|
|
37086
37056
|
const filePath = Path.join(rootDirectory, fileName);
|
|
37087
37057
|
if (!isFile(filePath)) continue;
|
|
@@ -37091,7 +37061,7 @@ const checkReactNativeMetroBabelPreset = (rootDirectory) => {
|
|
|
37091
37061
|
} catch {
|
|
37092
37062
|
continue;
|
|
37093
37063
|
}
|
|
37094
|
-
if (
|
|
37064
|
+
if (contents.includes(LEGACY_PRESET_SPEC)) return [buildReactNativeDiagnostic({
|
|
37095
37065
|
filePath: fileName,
|
|
37096
37066
|
rule: "rn-no-metro-babel-preset",
|
|
37097
37067
|
severity: "error",
|
|
@@ -37114,6 +37084,12 @@ const checkReactNativeProject = (rootDirectory, project) => {
|
|
|
37114
37084
|
return [...checkReactNativeMetroBabelPreset(rootDirectory), ...checkReactNativeLibraryDependencies(rootDirectory)];
|
|
37115
37085
|
};
|
|
37116
37086
|
const RULE_KEY = "no-vulnerable-react-server-components";
|
|
37087
|
+
const DEPENDENCY_SECTIONS = [
|
|
37088
|
+
"dependencies",
|
|
37089
|
+
"devDependencies",
|
|
37090
|
+
"peerDependencies",
|
|
37091
|
+
"optionalDependencies"
|
|
37092
|
+
];
|
|
37117
37093
|
const REACT_RSC_ADVISORIES_BY_MINOR = {
|
|
37118
37094
|
"19.0": {
|
|
37119
37095
|
rceFixedVersion: "19.0.1",
|
|
@@ -37160,13 +37136,20 @@ const enumerateWorkspaceDirectories = (workspaceRoot) => {
|
|
|
37160
37136
|
for (const pattern of patterns) for (const directory of resolveWorkspaceDirectories(workspaceRoot, pattern)) directories.add(directory);
|
|
37161
37137
|
return [...directories];
|
|
37162
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
|
+
};
|
|
37163
37146
|
const resolveVersionInDirectory = (directory, packageName, declaredSpecOverride) => {
|
|
37164
37147
|
const manifestPath = Path.join(directory, "node_modules", packageName, "package.json");
|
|
37165
37148
|
if (isFile(manifestPath)) {
|
|
37166
37149
|
const installedVersion = import_semver.valid(readPackageJson(manifestPath).version ?? null);
|
|
37167
37150
|
if (installedVersion !== null) return installedVersion;
|
|
37168
37151
|
}
|
|
37169
|
-
const candidateSpecs = [
|
|
37152
|
+
const candidateSpecs = [readDeclaredSpec(readPackageJson(Path.join(directory, "package.json")), packageName), declaredSpecOverride];
|
|
37170
37153
|
for (const spec of candidateSpecs) {
|
|
37171
37154
|
const pinnedVersion = spec === null ? null : import_semver.valid(spec);
|
|
37172
37155
|
if (pinnedVersion !== null) return pinnedVersion;
|
|
@@ -37849,8 +37832,6 @@ const buildCapabilities = (project) => {
|
|
|
37849
37832
|
if (project.isPreES2023Target) capabilities.add("pre-es2023");
|
|
37850
37833
|
if (project.hasReactCompiler) capabilities.add("react-compiler");
|
|
37851
37834
|
if (project.hasTanStackQuery) capabilities.add("tanstack-query");
|
|
37852
|
-
if (project.valtioVersion !== null) capabilities.add("valtio");
|
|
37853
|
-
addMajorLadder(capabilities, "valtio", project.valtioMajorVersion, 1, 10);
|
|
37854
37835
|
if (project.hasTypeScript) capabilities.add("typescript");
|
|
37855
37836
|
if (project.preactVersion !== null) capabilities.add("preact");
|
|
37856
37837
|
addMajorLadder(capabilities, "preact", project.preactMajorVersion, 10, 20);
|
|
@@ -45476,5 +45457,5 @@ const startLanguageServer = () => {
|
|
|
45476
45457
|
};
|
|
45477
45458
|
//#endregion
|
|
45478
45459
|
export { startLanguageServer };
|
|
45479
|
-
!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]="
|
|
45480
|
-
//# debugId=
|
|
45460
|
+
!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]="ecc1704a-4f8c-583e-93b2-78c6feb9cfd6")}catch(e){}}();
|
|
45461
|
+
//# debugId=ecc1704a-4f8c-583e-93b2-78c6feb9cfd6
|
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.a667b45",
|
|
4
4
|
"description": "Your agent writes bad React. This catches it",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"accessibility",
|
|
@@ -66,7 +66,7 @@
|
|
|
66
66
|
"vscode-uri": "^3.1.0",
|
|
67
67
|
"yaml": "^2.9.0",
|
|
68
68
|
"deslop-js": "0.8.1",
|
|
69
|
-
"oxlint-plugin-react-doctor": "0.8.1-dev.
|
|
69
|
+
"oxlint-plugin-react-doctor": "0.8.1-dev.a667b45"
|
|
70
70
|
},
|
|
71
71
|
"devDependencies": {
|
|
72
72
|
"@types/babel__code-frame": "^7.27.0",
|