react-doctor 0.4.2-dev.25cc69b → 0.4.2-dev.48e61bc

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/lsp.js CHANGED
@@ -6,6 +6,7 @@ import * as path$1 from "node:path";
6
6
  import path from "node:path";
7
7
  import * as Schema from "effect/Schema";
8
8
  import { spawn, spawnSync } from "node:child_process";
9
+ import * as ts from "typescript";
9
10
  import reactDoctorPlugin, { ALL_REACT_DOCTOR_RULE_KEYS, FRAMEWORK_SPECIFIC_RULE_KEYS, MOTION_LIBRARY_PACKAGES, REACT_COMPILER_RULES, REACT_DOCTOR_RULES } from "oxlint-plugin-react-doctor";
10
11
  import * as Cause from "effect/Cause";
11
12
  import * as Effect from "effect/Effect";
@@ -29,7 +30,6 @@ import * as NodeFileSystem from "@effect/platform-node-shared/NodeFileSystem";
29
30
  import * as NodePath from "@effect/platform-node-shared/NodePath";
30
31
  import * as ChildProcess from "effect/unstable/process/ChildProcess";
31
32
  import { ChildProcessSpawner } from "effect/unstable/process/ChildProcessSpawner";
32
- import * as ts from "typescript";
33
33
  import { gzipSync } from "node:zlib";
34
34
  import crypto from "node:crypto";
35
35
  import * as Exit from "effect/Exit";
@@ -2136,8 +2136,8 @@ const isFile = (filePath) => {
2136
2136
  return false;
2137
2137
  }
2138
2138
  };
2139
- const SOURCE_FILE_PATTERN = /\.(tsx?|jsx?)$/;
2140
- const GENERATED_BUNDLE_FILE_PATTERN = /\.(iife|umd|global|min)\.js$/i;
2139
+ const SOURCE_FILE_PATTERN = /\.(tsx?|jsx?|mts|mjs)$/;
2140
+ const GENERATED_BUNDLE_FILE_PATTERN = /\.(iife|umd|global|min)\.m?js$/i;
2141
2141
  const MINIFIED_SNIFF_BYTES = 65536;
2142
2142
  const GIT_LS_FILES_MAX_BUFFER_BYTES = 50 * 1024 * 1024;
2143
2143
  const IGNORED_DIRECTORIES = new Set([
@@ -3052,6 +3052,194 @@ const resolveEffectiveReactMajor = (reactVersion, packageJson) => {
3052
3052
  if (peerFloor === null) return hasUpperBoundOnlyPeerRange(peerReactRange) ? null : installedReactMajor;
3053
3053
  return installedReactMajor !== null ? Math.min(installedReactMajor, peerFloor) : peerFloor;
3054
3054
  };
3055
+ const JSX_FILE_PATTERN = /\.(tsx|jsx)$/;
3056
+ const MILLISECONDS_PER_SECOND = 1e3;
3057
+ const SCORE_API_URL = "https://www.react.doctor/api/score";
3058
+ const FETCH_TIMEOUT_MS = 1e4;
3059
+ const GITHUB_VIEWER_PERMISSION_TIMEOUT_MS = 2e3;
3060
+ const DEFAULT_BRANCH_CANDIDATES = ["main", "master"];
3061
+ const ADOPTABLE_LINT_CONFIG_FILENAMES = [".oxlintrc.json", ".eslintrc.json"];
3062
+ const GIT_SHOW_MAX_BUFFER_BYTES = 10 * 1024 * 1024;
3063
+ const ES_TARGET_YEAR_BY_NAME = {
3064
+ es3: 1999,
3065
+ es5: 2009,
3066
+ es6: 2015,
3067
+ es2015: 2015,
3068
+ es2016: 2016,
3069
+ es2017: 2017,
3070
+ es2018: 2018,
3071
+ es2019: 2019,
3072
+ es2020: 2020,
3073
+ es2021: 2021,
3074
+ es2022: 2022,
3075
+ es2023: 2023,
3076
+ es2024: 2024,
3077
+ es2025: 2025,
3078
+ esnext: 9999
3079
+ };
3080
+ /**
3081
+ * Project-config files that `StagedFiles.materialize` copies into
3082
+ * the temp directory alongside staged sources so oxlint resolves
3083
+ * `tsconfig` / `package.json` / lint configs the same way it would
3084
+ * in the working tree. Hoisted out of the staged-files helper so
3085
+ * the constant lives next to the rest of the IO budget knobs.
3086
+ */
3087
+ const STAGED_FILES_PROJECT_CONFIG_FILENAMES = [
3088
+ "tsconfig.json",
3089
+ "tsconfig.base.json",
3090
+ "package.json",
3091
+ "doctor.config.ts",
3092
+ "doctor.config.mts",
3093
+ "doctor.config.cts",
3094
+ "doctor.config.js",
3095
+ "doctor.config.mjs",
3096
+ "doctor.config.cjs",
3097
+ "doctor.config.json",
3098
+ "doctor.config.jsonc",
3099
+ "oxlint.json",
3100
+ ".oxlintrc.json"
3101
+ ];
3102
+ const CONFIG_FINGERPRINT_FILENAMES = [
3103
+ "doctor.config.ts",
3104
+ "doctor.config.mts",
3105
+ "doctor.config.cts",
3106
+ "doctor.config.js",
3107
+ "doctor.config.mjs",
3108
+ "doctor.config.cjs",
3109
+ "doctor.config.json",
3110
+ "doctor.config.jsonc",
3111
+ "react-doctor.config.json",
3112
+ "package.json",
3113
+ "pnpm-workspace.yaml",
3114
+ "tsconfig.json",
3115
+ "tsconfig.base.json",
3116
+ ".oxlintrc.json",
3117
+ ".eslintrc.json",
3118
+ "pnpm-lock.yaml",
3119
+ "package-lock.json",
3120
+ "yarn.lock",
3121
+ "bun.lock",
3122
+ "bun.lockb",
3123
+ ".gitignore"
3124
+ ];
3125
+ const OXLINT_OUTPUT_MAX_BYTES = 50 * 1024 * 1024;
3126
+ const OXLINT_SPAWN_TIMEOUT_MS = 6e4;
3127
+ const DEAD_CODE_WORKER_MAX_OLD_SPACE_MB = 8192;
3128
+ const RECOMMENDED_PNPM_MINIMUM_RELEASE_AGE_MINUTES = 10080;
3129
+ const DIAGNOSTIC_CATEGORY_BUCKETS = [
3130
+ "Security",
3131
+ "Bugs",
3132
+ "Performance",
3133
+ "Accessibility",
3134
+ "Maintainability"
3135
+ ];
3136
+ const APP_ONLY_RULE_KEYS = new Set([
3137
+ "react-hooks-js/static-components",
3138
+ "react-doctor/no-render-prop-children",
3139
+ "react-doctor/prefer-explicit-variants"
3140
+ ]);
3141
+ const COMPILER_CLEANUP_BUCKET = "compiler-cleanup";
3142
+ const COMPILER_CLEANUP_RULE_KEYS = new Set(["react-doctor/react-compiler-no-manual-memoization"]);
3143
+ const MAX_GLOB_PATTERN_LENGTH_CHARS = 1024;
3144
+ const CONFIG_CACHE_TTL_MS = 300 * 1e3;
3145
+ const TSCONFIG_FILENAME = "tsconfig.json";
3146
+ const isRelativeExtendsValue = (extendsValue) => extendsValue.startsWith("./") || extendsValue.startsWith("../") || path$1.isAbsolute(extendsValue);
3147
+ const ensureJsonExtension = (filePath) => path$1.extname(filePath) === "" ? `${filePath}.json` : filePath;
3148
+ const resolvePackageExtendsPath = (extendsValue, fromConfigDirectory) => {
3149
+ const requireFromConfig = createRequire(path$1.join(fromConfigDirectory, "tsconfig.json"));
3150
+ const candidates = [
3151
+ extendsValue,
3152
+ ensureJsonExtension(extendsValue),
3153
+ `${extendsValue.replace(/\/$/, "")}/tsconfig.json`
3154
+ ];
3155
+ for (const candidate of candidates) try {
3156
+ return requireFromConfig.resolve(candidate);
3157
+ } catch {
3158
+ continue;
3159
+ }
3160
+ return null;
3161
+ };
3162
+ const resolveExtendsPath = (extendsValue, fromConfigDirectory) => {
3163
+ if (isRelativeExtendsValue(extendsValue)) return ensureJsonExtension(path$1.resolve(fromConfigDirectory, extendsValue));
3164
+ return resolvePackageExtendsPath(extendsValue, fromConfigDirectory);
3165
+ };
3166
+ const normalizeCompilerOptions = (compilerOptions) => {
3167
+ if (!isPlainObject(compilerOptions)) return { hasExplicitLib: false };
3168
+ const target = typeof compilerOptions.target === "string" ? compilerOptions.target : void 0;
3169
+ const hasExplicitLib = Object.hasOwn(compilerOptions, "lib");
3170
+ return {
3171
+ target,
3172
+ lib: Array.isArray(compilerOptions.lib) ? compilerOptions.lib.filter((entry) => typeof entry === "string") : void 0,
3173
+ hasExplicitLib
3174
+ };
3175
+ };
3176
+ const readTsConfig = (filePath) => {
3177
+ let content;
3178
+ try {
3179
+ content = fs$1.readFileSync(filePath, "utf-8");
3180
+ } catch {
3181
+ return null;
3182
+ }
3183
+ const parsed = ts.parseConfigFileTextToJson(filePath, content);
3184
+ if (!isPlainObject(parsed.config)) return null;
3185
+ return {
3186
+ extends: typeof parsed.config.extends === "string" ? parsed.config.extends : void 0,
3187
+ compilerOptions: normalizeCompilerOptions(parsed.config.compilerOptions)
3188
+ };
3189
+ };
3190
+ const mergeCompilerOptions = (inherited, current) => {
3191
+ const target = current.target ?? inherited?.target;
3192
+ const hasExplicitLib = current.hasExplicitLib || Boolean(inherited?.hasExplicitLib);
3193
+ return {
3194
+ target,
3195
+ lib: current.hasExplicitLib ? current.lib : inherited?.lib,
3196
+ hasExplicitLib
3197
+ };
3198
+ };
3199
+ const readResolvedCompilerOptions = (tsConfigPath, extendsDepth, visitedPaths) => {
3200
+ const realPath = fs$1.realpathSync.native(tsConfigPath);
3201
+ if (visitedPaths.has(realPath)) return null;
3202
+ const tsConfig = readTsConfig(realPath);
3203
+ if (!tsConfig) return null;
3204
+ const nextVisitedPaths = new Set(visitedPaths);
3205
+ nextVisitedPaths.add(realPath);
3206
+ if (tsConfig.extends && extendsDepth < 8) {
3207
+ const parentPath = resolveExtendsPath(tsConfig.extends, path$1.dirname(realPath));
3208
+ if (parentPath && isFile(parentPath)) return mergeCompilerOptions(readResolvedCompilerOptions(parentPath, extendsDepth + 1, nextVisitedPaths), tsConfig.compilerOptions);
3209
+ }
3210
+ return tsConfig.compilerOptions;
3211
+ };
3212
+ const targetYearIsPreES2023 = (target) => {
3213
+ const year = ES_TARGET_YEAR_BY_NAME[target.toLowerCase()];
3214
+ return year !== void 0 && year < 2023;
3215
+ };
3216
+ const libEntryIncludesES2023Array = (entry) => {
3217
+ const normalizedEntry = entry.toLowerCase();
3218
+ if (normalizedEntry === "esnext" || normalizedEntry === "esnext.array") return true;
3219
+ const esYearMatch = /^es(\d{4})(?:\.(.+))?$/.exec(normalizedEntry);
3220
+ if (!esYearMatch) return false;
3221
+ if (Number(esYearMatch[1]) < 2023) return false;
3222
+ const component = esYearMatch[2];
3223
+ return component === void 0 || component === "array";
3224
+ };
3225
+ const libIncludesES2023 = (lib) => lib.some(libEntryIncludesES2023Array);
3226
+ const compilerOptionsArePreES2023 = (compilerOptions) => {
3227
+ if (compilerOptions.hasExplicitLib) return !libIncludesES2023(compilerOptions.lib ?? []);
3228
+ if (compilerOptions.target) return targetYearIsPreES2023(compilerOptions.target);
3229
+ return false;
3230
+ };
3231
+ const compilerOptionsDeclareTargetOrLib = (compilerOptions) => compilerOptions.hasExplicitLib || compilerOptions.target !== void 0;
3232
+ const detectPreES2023FromConfig = (tsConfigPath) => {
3233
+ const compilerOptions = readResolvedCompilerOptions(tsConfigPath, 0, /* @__PURE__ */ new Set());
3234
+ if (!compilerOptions) return false;
3235
+ if (!compilerOptionsDeclareTargetOrLib(compilerOptions)) return false;
3236
+ return compilerOptionsArePreES2023(compilerOptions);
3237
+ };
3238
+ const detectPreES2023Target = (directory) => {
3239
+ const tsConfigPath = path$1.join(directory, TSCONFIG_FILENAME);
3240
+ if (isFile(tsConfigPath)) return detectPreES2023FromConfig(tsConfigPath);
3241
+ return false;
3242
+ };
3055
3243
  const REACT_DEPENDENCY_NAMES = new Set([
3056
3244
  "react",
3057
3245
  "react-native",
@@ -3256,6 +3444,7 @@ const discoverProject = (directory) => {
3256
3444
  version: findNextjsVersion(directory, packageJson)
3257
3445
  }) : null;
3258
3446
  const preactVersion = getPreactVersion(packageJson);
3447
+ const isPreES2023Target = hasTypeScript && detectPreES2023Target(directory);
3259
3448
  const projectInfo = {
3260
3449
  rootDirectory: directory,
3261
3450
  projectName,
@@ -3277,6 +3466,7 @@ const discoverProject = (directory) => {
3277
3466
  shopifyFlashListVersion,
3278
3467
  shopifyFlashListMajorVersion: shopifyFlashListVersion === null ? null : getLowestDependencyMajor(shopifyFlashListVersion),
3279
3468
  hasReanimated,
3469
+ isPreES2023Target,
3280
3470
  sourceFileCount
3281
3471
  };
3282
3472
  cachedProjectInfos.set(directory, projectInfo);
@@ -3346,56 +3536,6 @@ const isTailwindAtLeast = (detected, required) => {
3346
3536
  if (detected.major !== required.major) return detected.major > required.major;
3347
3537
  return detected.minor >= required.minor;
3348
3538
  };
3349
- const JSX_FILE_PATTERN = /\.(tsx|jsx)$/;
3350
- const MILLISECONDS_PER_SECOND = 1e3;
3351
- const SCORE_API_URL = "https://www.react.doctor/api/score";
3352
- const FETCH_TIMEOUT_MS = 1e4;
3353
- const GITHUB_VIEWER_PERMISSION_TIMEOUT_MS = 2e3;
3354
- const DEFAULT_BRANCH_CANDIDATES = ["main", "master"];
3355
- const ADOPTABLE_LINT_CONFIG_FILENAMES = [".oxlintrc.json", ".eslintrc.json"];
3356
- const GIT_SHOW_MAX_BUFFER_BYTES = 10 * 1024 * 1024;
3357
- /**
3358
- * Project-config files that `StagedFiles.materialize` copies into
3359
- * the temp directory alongside staged sources so oxlint resolves
3360
- * `tsconfig` / `package.json` / lint configs the same way it would
3361
- * in the working tree. Hoisted out of the staged-files helper so
3362
- * the constant lives next to the rest of the IO budget knobs.
3363
- */
3364
- const STAGED_FILES_PROJECT_CONFIG_FILENAMES = [
3365
- "tsconfig.json",
3366
- "tsconfig.base.json",
3367
- "package.json",
3368
- "doctor.config.ts",
3369
- "doctor.config.mts",
3370
- "doctor.config.cts",
3371
- "doctor.config.js",
3372
- "doctor.config.mjs",
3373
- "doctor.config.cjs",
3374
- "doctor.config.json",
3375
- "doctor.config.jsonc",
3376
- "oxlint.json",
3377
- ".oxlintrc.json"
3378
- ];
3379
- const OXLINT_OUTPUT_MAX_BYTES = 50 * 1024 * 1024;
3380
- const OXLINT_SPAWN_TIMEOUT_MS = 6e4;
3381
- const DEAD_CODE_WORKER_MAX_OLD_SPACE_MB = 8192;
3382
- const RECOMMENDED_PNPM_MINIMUM_RELEASE_AGE_MINUTES = 10080;
3383
- const DIAGNOSTIC_CATEGORY_BUCKETS = [
3384
- "Security",
3385
- "Bugs",
3386
- "Performance",
3387
- "Accessibility",
3388
- "Maintainability"
3389
- ];
3390
- const APP_ONLY_RULE_KEYS = new Set([
3391
- "react-hooks-js/static-components",
3392
- "react-doctor/no-render-prop-children",
3393
- "react-doctor/prefer-explicit-variants"
3394
- ]);
3395
- const COMPILER_CLEANUP_BUCKET = "compiler-cleanup";
3396
- const COMPILER_CLEANUP_RULE_KEYS = new Set(["react-doctor/react-compiler-no-manual-memoization"]);
3397
- const MAX_GLOB_PATTERN_LENGTH_CHARS = 1024;
3398
- const CONFIG_CACHE_TTL_MS = 300 * 1e3;
3399
3539
  var InvalidGlobPatternError = class extends Error {
3400
3540
  pattern;
3401
3541
  reason;
@@ -3706,7 +3846,6 @@ const LEGACY_RULE_KEY_TO_NATIVE_RULE_KEY = {
3706
3846
  "react/jsx-no-new-function-as-prop": "react-doctor/jsx-no-new-function-as-prop",
3707
3847
  "react/jsx-no-new-object-as-prop": "react-doctor/jsx-no-new-object-as-prop",
3708
3848
  "react/jsx-no-script-url": "react-doctor/jsx-no-script-url",
3709
- "react/jsx-no-target-blank": "react-doctor/jsx-no-target-blank",
3710
3849
  "react/jsx-no-undef": "react-doctor/jsx-no-undef",
3711
3850
  "react/jsx-no-useless-fragment": "react-doctor/jsx-no-useless-fragment",
3712
3851
  "react/jsx-pascal-case": "react-doctor/jsx-pascal-case",
@@ -4804,51 +4943,51 @@ const FLAGGED_DEPENDENCIES = [
4804
4943
  {
4805
4944
  packageName: "expo-modules-autolinking",
4806
4945
  rule: "expo-no-redundant-dependency",
4807
- message: "\"expo-modules-autolinking\" should not be a direct dependency — Expo installs it transitively as needed",
4946
+ message: "\"expo-modules-autolinking\" should not be a direct dependency. Expo pins the compatible version through the SDK, and a direct entry can drift to a version that breaks prebuild, Metro, or native builds",
4808
4947
  help: "Remove `expo-modules-autolinking` from your package.json"
4809
4948
  },
4810
4949
  {
4811
4950
  packageName: "expo-dev-launcher",
4812
4951
  rule: "expo-no-redundant-dependency",
4813
- message: "\"expo-dev-launcher\" should not be a direct dependency — it is pulled in by `expo-dev-client`",
4952
+ message: "\"expo-dev-launcher\" should not be a direct dependency. `expo-dev-client` pins the compatible launcher, and a direct entry can drift to a version that breaks native builds",
4814
4953
  help: "Remove `expo-dev-launcher` and depend on `expo-dev-client` instead"
4815
4954
  },
4816
4955
  {
4817
4956
  packageName: "expo-dev-menu",
4818
4957
  rule: "expo-no-redundant-dependency",
4819
- message: "\"expo-dev-menu\" should not be a direct dependency — it is pulled in by `expo-dev-client`",
4958
+ message: "\"expo-dev-menu\" should not be a direct dependency. `expo-dev-client` pins the compatible dev menu, and a direct entry can drift to a version that breaks native builds",
4820
4959
  help: "Remove `expo-dev-menu` and depend on `expo-dev-client` instead"
4821
4960
  },
4822
4961
  {
4823
4962
  packageName: "expo-modules-core",
4824
4963
  rule: "expo-no-redundant-dependency",
4825
- message: "\"expo-modules-core\" should not be a direct dependency — use the API re-exported from the `expo` package",
4964
+ message: "\"expo-modules-core\" should not be a direct dependency. Expo pins the compatible native core, and a direct entry can drift to a version that breaks prebuild or native builds",
4826
4965
  help: "Remove `expo-modules-core` from your package.json and import from `expo` instead"
4827
4966
  },
4828
4967
  {
4829
4968
  packageName: "@expo/metro-config",
4830
4969
  rule: "expo-no-redundant-dependency",
4831
- message: "\"@expo/metro-config\" should not be a direct dependency — use the `expo/metro-config` sub-export of the `expo` package",
4970
+ message: "\"@expo/metro-config\" should not be a direct dependency. Expo pins the compatible Metro config, and a direct entry can drift to a version that breaks bundling",
4832
4971
  help: "Remove `@expo/metro-config` and import `expo/metro-config` in your metro.config.js"
4833
4972
  },
4834
4973
  {
4835
4974
  packageName: "@types/react-native",
4836
4975
  rule: "expo-no-redundant-dependency",
4837
- message: "\"@types/react-native\" should not be installed — React Native ships its own types since SDK 48",
4976
+ message: "\"@types/react-native\" should not be installed. React Native ships its own types since SDK 48, so the extra package can introduce duplicate or stale type definitions",
4838
4977
  help: "Remove `@types/react-native` from your package.json",
4839
4978
  minSdkMajor: 48
4840
4979
  },
4841
4980
  {
4842
4981
  packageName: "@expo/config-plugins",
4843
4982
  rule: "expo-no-redundant-dependency",
4844
- message: "\"@expo/config-plugins\" should not be a direct dependency — use the `expo/config-plugins` sub-export of the `expo` package",
4983
+ message: "\"@expo/config-plugins\" should not be a direct dependency. Expo pins the compatible config-plugin API, and a direct entry can drift to a version that breaks prebuild",
4845
4984
  help: "Remove `@expo/config-plugins`; config-plugin authors should import from `expo/config-plugins`. See https://github.com/expo/expo/pull/18855",
4846
4985
  minSdkMajor: 48
4847
4986
  },
4848
4987
  {
4849
4988
  packageName: "@expo/prebuild-config",
4850
4989
  rule: "expo-no-redundant-dependency",
4851
- message: "\"@expo/prebuild-config\" should not be a direct dependency — Expo installs it transitively",
4990
+ message: "\"@expo/prebuild-config\" should not be a direct dependency. Expo pins the compatible prebuild config, and a direct entry can drift to a version that breaks prebuild",
4852
4991
  help: "Remove `@expo/prebuild-config` from your package.json",
4853
4992
  minSdkMajor: 53
4854
4993
  },
@@ -4862,28 +5001,28 @@ const FLAGGED_DEPENDENCIES = [
4862
5001
  {
4863
5002
  packageName: "expo-app-loading",
4864
5003
  rule: "expo-no-redundant-dependency",
4865
- message: "\"expo-app-loading\" was removed in SDK 49",
5004
+ message: "\"expo-app-loading\" was removed in SDK 49, so keeping it can leave imports unresolved after upgrading Expo",
4866
5005
  help: "Remove `expo-app-loading` and use `expo-splash-screen` instead. See https://docs.expo.dev/versions/latest/sdk/splash-screen/",
4867
5006
  minSdkMajor: 49
4868
5007
  },
4869
5008
  {
4870
5009
  packageName: "expo-firebase-analytics",
4871
5010
  rule: "expo-no-redundant-dependency",
4872
- message: "\"expo-firebase-analytics\" was removed in SDK 48",
5011
+ message: "\"expo-firebase-analytics\" was removed in SDK 48, so keeping it can leave imports unresolved or fail native builds after upgrading Expo",
4873
5012
  help: FIREBASE_HELP,
4874
5013
  minSdkMajor: 48
4875
5014
  },
4876
5015
  {
4877
5016
  packageName: "expo-firebase-recaptcha",
4878
5017
  rule: "expo-no-redundant-dependency",
4879
- message: "\"expo-firebase-recaptcha\" was removed in SDK 48",
5018
+ message: "\"expo-firebase-recaptcha\" was removed in SDK 48, so keeping it can leave imports unresolved or fail native builds after upgrading Expo",
4880
5019
  help: FIREBASE_HELP,
4881
5020
  minSdkMajor: 48
4882
5021
  },
4883
5022
  {
4884
5023
  packageName: "expo-firebase-core",
4885
5024
  rule: "expo-no-redundant-dependency",
4886
- message: "\"expo-firebase-core\" was removed in SDK 48",
5025
+ message: "\"expo-firebase-core\" was removed in SDK 48, so keeping it can leave imports unresolved or fail native builds after upgrading Expo",
4887
5026
  help: FIREBASE_HELP,
4888
5027
  minSdkMajor: 48
4889
5028
  }
@@ -4924,7 +5063,7 @@ const checkExpoGitignore = (context) => {
4924
5063
  }));
4925
5064
  if (findLocalModuleNativeFiles(rootDirectory).find((nativeFilePath) => isPathGitIgnored(rootDirectory, nativeFilePath) === true) !== void 0) diagnostics.push(buildExpoDiagnostic({
4926
5065
  rule: "expo-gitignore",
4927
- message: "The native `ios`/`android` directories of a local Expo module under `modules/` are gitignored — usually caused by an overly broad `ios`/`android` ignore rule",
5066
+ message: "The native `ios`/`android` directories of a local Expo module under `modules/` are gitignored, so required native code can be missing from CI or teammate checkouts.",
4928
5067
  help: "Use anchored patterns like `/ios` and `/android` in .gitignore so only the top-level native directories are excluded, not those inside `modules/`"
4929
5068
  }));
4930
5069
  return diagnostics;
@@ -4986,17 +5125,16 @@ const checkExpoPackageJsonConflicts = (context) => {
4986
5125
  const conflictingScriptNames = CONFLICTING_SCRIPT_NAMES.filter((scriptName) => Boolean(packageJson.scripts?.[scriptName]));
4987
5126
  if (conflictingScriptNames.length > 0) {
4988
5127
  const quotedNames = conflictingScriptNames.map((name) => `"${name}"`).join(", ");
4989
- const shadowsExpoCli = conflictingScriptNames.includes("expo");
4990
5128
  diagnostics.push(buildExpoDiagnostic({
4991
5129
  rule: "expo-package-json-conflict",
4992
- message: `package.json defines ${quotedNames} ${conflictingScriptNames.length === 1 ? "as a script that conflicts" : "as scripts that conflict"} with binaries in node_modules/.bin${shadowsExpoCli ? " — a `expo` script shadows the Expo CLI and will likely cause build failures" : ""}`,
5130
+ message: `package.json defines ${quotedNames} ${conflictingScriptNames.length === 1 ? "as a script that shadows" : "as scripts that shadow"} Expo/React Native binaries in node_modules/.bin, so tooling can run the local script instead of the expected CLI and fail builds.`,
4993
5131
  help: "Rename these scripts so they don't collide with the `expo` / `react-native` binaries"
4994
5132
  }));
4995
5133
  }
4996
5134
  const packageName = packageJson.name;
4997
5135
  if (typeof packageName === "string" && context.directDependencyNames.has(packageName)) diagnostics.push(buildExpoDiagnostic({
4998
5136
  rule: "expo-package-json-conflict",
4999
- message: `package.json "name" is "${packageName}", which collides with a dependency of the same name`,
5137
+ message: `package.json "name" is "${packageName}", which collides with a dependency of the same name, so package self-resolution can shadow the dependency and break imports that expect the installed package.`,
5000
5138
  help: "Rename your package so it no longer matches one of its dependencies"
5001
5139
  }));
5002
5140
  return diagnostics;
@@ -5067,7 +5205,7 @@ const checkExpoRouterReactNavigation = (context) => {
5067
5205
  if (reactNavigationNames.length === 0) return [];
5068
5206
  return [buildExpoDiagnostic({
5069
5207
  rule: "expo-router-no-react-navigation",
5070
- message: `As of SDK 56, expo-router is no longer compatible with react-navigation, but ${reactNavigationNames.map((name) => `"${name}"`).join(", ")} ${reactNavigationNames.length === 1 ? "is" : "are"} installed as direct ${reactNavigationNames.length === 1 ? "dependency" : "dependencies"}`,
5208
+ message: `As of SDK 56, expo-router is no longer compatible with directly installed @react-navigation packages, so keeping ${reactNavigationNames.map((name) => `"${name}"`).join(", ")} can break routing or linking behavior after the SDK upgrade.`,
5071
5209
  help: "Remove these `@react-navigation/*` packages and replace direct imports with their expo-router equivalents. See https://docs.expo.dev/router/migrate/sdk-55-to-56/"
5072
5210
  })];
5073
5211
  };
@@ -5420,7 +5558,9 @@ const highlighter = {
5420
5558
  gray: import_picocolors.default.gray,
5421
5559
  bold: import_picocolors.default.bold
5422
5560
  };
5423
- const computeJsxIncludePaths = (includePaths) => includePaths.length > 0 ? includePaths.filter((filePath) => JSX_FILE_PATTERN.test(filePath)) : void 0;
5561
+ const NEXT_ENTRY_FILE_PATTERN = /^(?:\.\/)?(?:src\/)?(?:middleware|proxy)\.(?:tsx?|jsx?|mts|mjs)$/;
5562
+ const shouldIncludeExplicitLintPath = (filePath, project) => JSX_FILE_PATTERN.test(filePath) || project?.framework === "nextjs" && NEXT_ENTRY_FILE_PATTERN.test(filePath);
5563
+ const computeExplicitLintIncludePaths = (includePaths, project) => includePaths.length > 0 ? includePaths.filter((filePath) => shouldIncludeExplicitLintPath(filePath, project)) : void 0;
5424
5564
  const LINGUIST_ATTRIBUTE_PATTERN = /^linguist-(?:vendored|generated)(?:=([a-zA-Z0-9]+))?$/i;
5425
5565
  const FALSY_VALUES = new Set([
5426
5566
  "false",
@@ -5849,7 +5989,7 @@ const checkDeadCode = async (options) => {
5849
5989
  plugin: DEAD_CODE_PLUGIN,
5850
5990
  rule: "unused-file",
5851
5991
  severity: "warning",
5852
- message: "Unused file — not reachable from any entry point",
5992
+ message: "Unused file is not reachable from any entry point, so it adds maintenance surface without shipping any code.",
5853
5993
  help: "Delete the file if it is truly unreachable, or import it from an entry point.",
5854
5994
  line: 0,
5855
5995
  column: 0,
@@ -5862,7 +6002,7 @@ const checkDeadCode = async (options) => {
5862
6002
  plugin: DEAD_CODE_PLUGIN,
5863
6003
  rule: unusedExport.isTypeOnly ? "unused-type" : "unused-export",
5864
6004
  severity: "warning",
5865
- message: `Unused ${label}: \`${unusedExport.name}\``,
6005
+ message: `Unused ${label}: \`${unusedExport.name}\` is exported but no module imports it, so it expands the public surface and can mislead callers about supported API.`,
5866
6006
  help: "Drop the `export` keyword (or remove the declaration) if no other module uses this symbol.",
5867
6007
  line: unusedExport.line,
5868
6008
  column: unusedExport.column,
@@ -5877,7 +6017,7 @@ const checkDeadCode = async (options) => {
5877
6017
  rule: unusedDependency.isDevDependency ? "unused-dev-dependency" : "unused-dependency",
5878
6018
  severity: "warning",
5879
6019
  message: `Unused ${label}: \`${unusedDependency.name}\``,
5880
- help: "Remove the dependency from package.json if it is genuinely unused.",
6020
+ help: `An unused ${label} adds install time and supply-chain surface without being used; remove it from package.json if it is genuinely unused.`,
5881
6021
  line: 0,
5882
6022
  column: 0,
5883
6023
  category: DEAD_CODE_CATEGORY
@@ -5890,7 +6030,7 @@ const checkDeadCode = async (options) => {
5890
6030
  plugin: DEAD_CODE_PLUGIN,
5891
6031
  rule: "circular-dependency",
5892
6032
  severity: "warning",
5893
- message: `Circular import cycle: ${cycle.files.map(toRelative).join(" → ")}`,
6033
+ message: `Circular import cycle: ${cycle.files.map(toRelative).join(" → ")}. Modules in the cycle can observe partially initialized exports, causing order-dependent bugs.`,
5894
6034
  help: "Break the cycle by extracting the shared code into a third module that both files import.",
5895
6035
  line: 0,
5896
6036
  column: 0,
@@ -5973,11 +6113,11 @@ const listSourceFilesViaFilesystem = (rootDirectory) => {
5973
6113
  return filePaths;
5974
6114
  };
5975
6115
  const listSourceFiles = (rootDirectory) => excludeMinifiedFiles(rootDirectory, listSourceFilesViaGit(rootDirectory) ?? listSourceFilesViaFilesystem(rootDirectory));
5976
- const resolveLintIncludePaths = (rootDirectory, userConfig) => {
6116
+ const resolveLintIncludePaths = (rootDirectory, userConfig, project) => {
5977
6117
  if (!Array.isArray(userConfig?.ignore?.files) || userConfig.ignore.files.length === 0) return;
5978
6118
  const ignoredPatterns = compileIgnoredFilePatterns(userConfig);
5979
6119
  return listSourceFiles(rootDirectory).filter((filePath) => {
5980
- if (!JSX_FILE_PATTERN.test(filePath)) return false;
6120
+ if (!shouldIncludeExplicitLintPath(filePath, project)) return false;
5981
6121
  return !isFileIgnoredByPatterns(filePath, rootDirectory, ignoredPatterns);
5982
6122
  });
5983
6123
  };
@@ -6705,6 +6845,7 @@ const buildCapabilities = (project) => {
6705
6845
  capabilities.add("zod");
6706
6846
  if (project.zodMajorVersion !== null && project.zodMajorVersion >= 4) capabilities.add("zod:4");
6707
6847
  }
6848
+ if (project.isPreES2023Target) capabilities.add("pre-es2023");
6708
6849
  if (project.hasReactCompiler) capabilities.add("react-compiler");
6709
6850
  if (project.hasTanStackQuery) capabilities.add("tanstack-query");
6710
6851
  if (project.hasTypeScript) capabilities.add("typescript");
@@ -8329,7 +8470,7 @@ const runInspect = (input, hooks = {}) => Effect.gen(function* () {
8329
8470
  directory: scanDirectory,
8330
8471
  repo
8331
8472
  }).pipe(Effect.orElseSucceed(() => null)) : Effect.succeed(null));
8332
- const lintIncludePaths = (input.skipJsxIncludeFilter ? input.includePaths.length > 0 ? [...input.includePaths] : void 0 : computeJsxIncludePaths([...input.includePaths])) ?? resolveLintIncludePaths(scanDirectory, resolvedConfig.config);
8473
+ const lintIncludePaths = (input.skipJsxIncludeFilter ? input.includePaths.length > 0 ? [...input.includePaths] : void 0 : computeExplicitLintIncludePaths([...input.includePaths], project)) ?? resolveLintIncludePaths(scanDirectory, resolvedConfig.config, project);
8333
8474
  const scannedFilePaths = input.suppressScanSummary ? (lintIncludePaths ?? (yield* filesService.listSourceFiles(scanDirectory))).map((relativePath) => path$1.resolve(scanDirectory, relativePath)) : [];
8334
8475
  const beforeLint = hooks.beforeLint ?? NO_HOOKS.beforeLint;
8335
8476
  const afterLint = hooks.afterLint ?? NO_HOOKS.afterLint;
@@ -8761,6 +8902,22 @@ const getRuleMetadata = (plugin, rule) => {
8761
8902
  defaultEnabled: definition.defaultEnabled ?? true
8762
8903
  };
8763
8904
  };
8905
+ const computeConfigFingerprint = (projectDirectory, version) => {
8906
+ const parts = [`v=${version}`];
8907
+ let directory = projectDirectory;
8908
+ for (;;) {
8909
+ for (const filename of CONFIG_FINGERPRINT_FILENAMES) try {
8910
+ const stat = fs.statSync(path.join(directory, filename));
8911
+ parts.push(`${directory}/${filename}=${stat.mtimeMs}:${stat.size}`);
8912
+ } catch {
8913
+ continue;
8914
+ }
8915
+ const parent = path.dirname(directory);
8916
+ if (parent === directory) break;
8917
+ directory = parent;
8918
+ }
8919
+ return crypto.createHash("sha1").update(parts.join("|")).digest("hex");
8920
+ };
8764
8921
  //#endregion
8765
8922
  //#region ../language-server/dist/index.js
8766
8923
  /** Display name used in client-facing messages and progress titles. */
@@ -8806,31 +8963,9 @@ const SCANNABLE_EXTENSIONS = [
8806
8963
  ".ts",
8807
8964
  ".tsx",
8808
8965
  ".js",
8809
- ".jsx"
8810
- ];
8811
- /** Filenames whose change invalidates project/config caches. */
8812
- const CONFIG_WATCH_FILENAMES = [
8813
- "doctor.config.ts",
8814
- "doctor.config.mts",
8815
- "doctor.config.cts",
8816
- "doctor.config.js",
8817
- "doctor.config.mjs",
8818
- "doctor.config.cjs",
8819
- "doctor.config.json",
8820
- "doctor.config.jsonc",
8821
- "react-doctor.config.json",
8822
- "package.json",
8823
- "pnpm-workspace.yaml",
8824
- "tsconfig.json",
8825
- "tsconfig.base.json",
8826
- ".oxlintrc.json",
8827
- ".eslintrc.json",
8828
- "pnpm-lock.yaml",
8829
- "package-lock.json",
8830
- "yarn.lock",
8831
- "bun.lock",
8832
- "bun.lockb",
8833
- ".gitignore"
8966
+ ".jsx",
8967
+ ".mts",
8968
+ ".mjs"
8834
8969
  ];
8835
8970
  const SILENT_LOGGER = {
8836
8971
  info: () => {},
@@ -9448,27 +9583,6 @@ const createProjectGraph = (options) => {
9448
9583
  }
9449
9584
  };
9450
9585
  };
9451
- /**
9452
- * Fingerprint of everything (outside file content) that affects lint
9453
- * output for a project: the React Doctor version plus the size + mtime of
9454
- * each config / manifest / lockfile. A change to any of them invalidates
9455
- * the persisted per-file lint cache, since rules, capabilities, adopted
9456
- * configs, and dependency-derived settings all flow from these files.
9457
- */
9458
- const computeConfigFingerprint = (projectDirectory, version) => {
9459
- const parts = [`v=${version}`];
9460
- let directory = projectDirectory;
9461
- for (;;) {
9462
- for (const filename of CONFIG_WATCH_FILENAMES) try {
9463
- const stat = fs.statSync(path.join(directory, filename));
9464
- parts.push(`${directory}/${filename}=${stat.mtimeMs}:${stat.size}`);
9465
- } catch {}
9466
- const parent = path.dirname(directory);
9467
- if (parent === directory) break;
9468
- directory = parent;
9469
- }
9470
- return crypto.createHash("sha1").update(parts.join("|")).digest("hex");
9471
- };
9472
9586
  const resolveCacheFilePath = (projectDirectory) => {
9473
9587
  const nodeModules = path.join(projectDirectory, "node_modules");
9474
9588
  if (fs.existsSync(nodeModules)) return path.join(nodeModules, ".cache", "react-doctor", "lint-cache.json");
@@ -10252,7 +10366,7 @@ const createServer = (connection, options = {}) => {
10252
10366
  };
10253
10367
  });
10254
10368
  connection.onInitialized(() => {
10255
- if (supportsWatchedFileRegistration) connection.client.register(DidChangeWatchedFilesNotification.type, { watchers: [{ globPattern: `**/{${CONFIG_WATCH_FILENAMES.join(",")}}` }, { globPattern: `**/*.{${SCANNABLE_EXTENSIONS.map((extension) => extension.slice(1)).join(",")}}` }] });
10369
+ if (supportsWatchedFileRegistration) connection.client.register(DidChangeWatchedFilesNotification.type, { watchers: [{ globPattern: `**/{${CONFIG_FINGERPRINT_FILENAMES.join(",")}}` }, { globPattern: `**/*.{${SCANNABLE_EXTENSIONS.map((extension) => extension.slice(1)).join(",")}}` }] });
10256
10370
  if (nodeBinaryPath === null) logger.warn(`${SERVER_DISPLAY_NAME}: no Node binary compatible with the oxlint native binding was found; lint will be skipped until you switch to a supported Node version.`);
10257
10371
  if (supportsWorkspaceFolderChange) connection.workspace.onDidChangeWorkspaceFolders((event) => {
10258
10372
  const removedRoots = event.removed.map((folder) => normalizeFsPath(uriToFsPath(folder.uri)));
@@ -10305,7 +10419,7 @@ const createServer = (connection, options = {}) => {
10305
10419
  for (const change of params.changes) {
10306
10420
  const fsPath = uriToFsPath(change.uri);
10307
10421
  const baseName = path.basename(fsPath);
10308
- if (CONFIG_WATCH_FILENAMES.some((watched) => watched === baseName)) {
10422
+ if (CONFIG_FINGERPRINT_FILENAMES.some((watched) => watched === baseName)) {
10309
10423
  configChanged = true;
10310
10424
  continue;
10311
10425
  }
@@ -10854,5 +10968,5 @@ const startLanguageServer = () => {
10854
10968
  };
10855
10969
  //#endregion
10856
10970
  export { startLanguageServer };
10857
- !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]="5715b6a9-c2ef-594e-8157-9c81132bc7fe")}catch(e){}}();
10858
- //# debugId=5715b6a9-c2ef-594e-8157-9c81132bc7fe
10971
+ !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]="5f7b056d-d1d1-509e-a834-d43361c8773e")}catch(e){}}();
10972
+ //# debugId=5f7b056d-d1d1-509e-a834-d43361c8773e
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-doctor",
3
- "version": "0.4.2-dev.25cc69b",
3
+ "version": "0.4.2-dev.48e61bc",
4
4
  "description": "Your agent writes bad React. This catches it",
5
5
  "keywords": [
6
6
  "accessibility",
@@ -66,7 +66,7 @@
66
66
  "vscode-languageserver": "^9.0.1",
67
67
  "vscode-languageserver-textdocument": "^1.0.12",
68
68
  "vscode-uri": "^3.1.0",
69
- "oxlint-plugin-react-doctor": "0.4.2-dev.25cc69b"
69
+ "oxlint-plugin-react-doctor": "0.4.2-dev.48e61bc"
70
70
  },
71
71
  "devDependencies": {
72
72
  "@types/babel__code-frame": "^7.27.0",