react-doctor 0.4.1 → 0.4.2-dev.1044e29
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/LICENSE +1 -1
- package/README.md +6 -74
- package/dist/cli.js +1532 -1378
- package/dist/index.d.ts +11 -1
- package/dist/index.js +69 -32
- package/dist/lsp.js +65 -33
- package/dist/skills/react-doctor/SKILL.md +2 -2
- package/dist/skills/{doctor-explain/SKILL.md → react-doctor/references/explain.md} +6 -9
- package/package.json +7 -7
package/dist/index.d.ts
CHANGED
|
@@ -942,6 +942,16 @@ declare const filterSourceFiles: (filePaths: string[]) => string[]; //#endregion
|
|
|
942
942
|
declare const summarizeDiagnostics: (diagnostics: Diagnostic[], worstScore?: number | null, worstScoreLabel?: string | null) => JsonReportSummary; //#endregion
|
|
943
943
|
//#region src/validate-config-types.d.ts
|
|
944
944
|
//#endregion
|
|
945
|
+
//#region src/utils/define-config.d.ts
|
|
946
|
+
/**
|
|
947
|
+
* Identity helper for authoring a typed `doctor.config.{ts,js,mjs,cjs}`.
|
|
948
|
+
* Gives editor autocomplete and type-checking for the config object without
|
|
949
|
+
* an explicit `satisfies ReactDoctorConfig` annotation; returns the config
|
|
950
|
+
* untouched so the loader sees the same plain object either way.
|
|
951
|
+
*/
|
|
952
|
+
declare const defineConfig: (config: ReactDoctorConfig) => ReactDoctorConfig; //#endregion
|
|
953
|
+
//#region src/utils/group-by.d.ts
|
|
954
|
+
//#endregion
|
|
945
955
|
//#region ../api/dist/index.d.ts
|
|
946
956
|
//#region src/diagnose.d.ts
|
|
947
957
|
declare const diagnose: (directory: string, options?: DiagnoseOptions) => Promise<DiagnoseResult>;
|
|
@@ -989,5 +999,5 @@ interface ToJsonReportOptions {
|
|
|
989
999
|
}
|
|
990
1000
|
declare const toJsonReport: (result: DiagnoseResult, options: ToJsonReportOptions) => JsonReport;
|
|
991
1001
|
//#endregion
|
|
992
|
-
export { AmbiguousProjectError, type DiagnoseOptions, type DiagnoseResult, type Diagnostic, type DiffInfo, type JsonReport, type JsonReportDiffInfo, type JsonReportError, type JsonReportMode, type JsonReportProjectEntry, type JsonReportSummary, NoReactDependencyError, NotADirectoryError, PackageJsonNotFoundError, type ProjectInfo, ProjectNotFoundError, type ReactDoctorConfig, ReactDoctorError, type ScoreResult, buildJsonReport, buildJsonReportError, clearCaches, diagnose, filterSourceFiles, getDiffInfo, isProjectDiscoveryError, isReactDoctorError, summarizeDiagnostics, toJsonReport };
|
|
1002
|
+
export { AmbiguousProjectError, type DiagnoseOptions, type DiagnoseResult, type Diagnostic, type DiffInfo, type JsonReport, type JsonReportDiffInfo, type JsonReportError, type JsonReportMode, type JsonReportProjectEntry, type JsonReportSummary, NoReactDependencyError, NotADirectoryError, PackageJsonNotFoundError, type ProjectInfo, ProjectNotFoundError, type ReactDoctorConfig, ReactDoctorError, type ScoreResult, buildJsonReport, buildJsonReportError, clearCaches, defineConfig, diagnose, filterSourceFiles, getDiffInfo, isProjectDiscoveryError, isReactDoctorError, summarizeDiagnostics, toJsonReport };
|
|
993
1003
|
//# sourceMappingURL=index.d.ts.map
|
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]="1f673676-aa45-541f-9382-dcf9102ad9d3")}catch(e){}}();
|
|
3
3
|
import { createRequire } from "node:module";
|
|
4
4
|
import * as Schema from "effect/Schema";
|
|
5
5
|
import * as fs$1 from "node:fs";
|
|
@@ -2125,8 +2125,8 @@ const isFile = (filePath) => {
|
|
|
2125
2125
|
return false;
|
|
2126
2126
|
}
|
|
2127
2127
|
};
|
|
2128
|
-
const SOURCE_FILE_PATTERN = /\.(tsx?|jsx
|
|
2129
|
-
const GENERATED_BUNDLE_FILE_PATTERN = /\.(iife|umd|global|min)\.js$/i;
|
|
2128
|
+
const SOURCE_FILE_PATTERN = /\.(tsx?|jsx?|mts|mjs)$/;
|
|
2129
|
+
const GENERATED_BUNDLE_FILE_PATTERN = /\.(iife|umd|global|min)\.m?js$/i;
|
|
2130
2130
|
const MINIFIED_SNIFF_BYTES = 65536;
|
|
2131
2131
|
const GIT_LS_FILES_MAX_BUFFER_BYTES = 50 * 1024 * 1024;
|
|
2132
2132
|
const IGNORED_DIRECTORIES = new Set([
|
|
@@ -3695,7 +3695,6 @@ const LEGACY_RULE_KEY_TO_NATIVE_RULE_KEY = {
|
|
|
3695
3695
|
"react/jsx-no-new-function-as-prop": "react-doctor/jsx-no-new-function-as-prop",
|
|
3696
3696
|
"react/jsx-no-new-object-as-prop": "react-doctor/jsx-no-new-object-as-prop",
|
|
3697
3697
|
"react/jsx-no-script-url": "react-doctor/jsx-no-script-url",
|
|
3698
|
-
"react/jsx-no-target-blank": "react-doctor/jsx-no-target-blank",
|
|
3699
3698
|
"react/jsx-no-undef": "react-doctor/jsx-no-undef",
|
|
3700
3699
|
"react/jsx-no-useless-fragment": "react-doctor/jsx-no-useless-fragment",
|
|
3701
3700
|
"react/jsx-pascal-case": "react-doctor/jsx-pascal-case",
|
|
@@ -4604,6 +4603,35 @@ const loadPackageJsonConfig = (directory) => {
|
|
|
4604
4603
|
format: "package-json"
|
|
4605
4604
|
};
|
|
4606
4605
|
};
|
|
4606
|
+
const loadLegacyConfig = (directory) => {
|
|
4607
|
+
const legacyFilePath = path$1.join(directory, LEGACY_CONFIG_FILENAME);
|
|
4608
|
+
if (!isFile(legacyFilePath)) return {
|
|
4609
|
+
status: "absent",
|
|
4610
|
+
loaded: null
|
|
4611
|
+
};
|
|
4612
|
+
try {
|
|
4613
|
+
const parsed = readDataConfig(legacyFilePath);
|
|
4614
|
+
if (isPlainObject(parsed)) {
|
|
4615
|
+
warn(`${LEGACY_CONFIG_FILENAME} is deprecated — rename it to ${CONFIG_BASENAME}.json (or author a ${CONFIG_BASENAME}.ts). It is still read for now.`);
|
|
4616
|
+
return {
|
|
4617
|
+
status: "found",
|
|
4618
|
+
loaded: {
|
|
4619
|
+
config: validateConfigTypes(parsed),
|
|
4620
|
+
sourceDirectory: directory,
|
|
4621
|
+
configFilePath: legacyFilePath,
|
|
4622
|
+
format: "json"
|
|
4623
|
+
}
|
|
4624
|
+
};
|
|
4625
|
+
}
|
|
4626
|
+
warn(`${LEGACY_CONFIG_FILENAME} must contain an object, ignoring.`);
|
|
4627
|
+
} catch (error) {
|
|
4628
|
+
warn(`Failed to load ${LEGACY_CONFIG_FILENAME}: ${formatError(error)}`);
|
|
4629
|
+
}
|
|
4630
|
+
return {
|
|
4631
|
+
status: "invalid",
|
|
4632
|
+
loaded: null
|
|
4633
|
+
};
|
|
4634
|
+
};
|
|
4607
4635
|
const loadConfigFromDirectory = async (directory) => {
|
|
4608
4636
|
let sawBrokenConfigFile = false;
|
|
4609
4637
|
for (const extension of CONFIG_EXTENSIONS) {
|
|
@@ -4633,7 +4661,8 @@ const loadConfigFromDirectory = async (directory) => {
|
|
|
4633
4661
|
status: "found",
|
|
4634
4662
|
loaded: packageJsonConfig
|
|
4635
4663
|
};
|
|
4636
|
-
|
|
4664
|
+
const legacyResult = loadLegacyConfig(directory);
|
|
4665
|
+
if (legacyResult.status !== "absent") return legacyResult;
|
|
4637
4666
|
return {
|
|
4638
4667
|
status: sawBrokenConfigFile ? "invalid" : "absent",
|
|
4639
4668
|
loaded: null
|
|
@@ -4837,51 +4866,51 @@ const FLAGGED_DEPENDENCIES = [
|
|
|
4837
4866
|
{
|
|
4838
4867
|
packageName: "expo-modules-autolinking",
|
|
4839
4868
|
rule: "expo-no-redundant-dependency",
|
|
4840
|
-
message: "\"expo-modules-autolinking\" should not be a direct dependency
|
|
4869
|
+
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",
|
|
4841
4870
|
help: "Remove `expo-modules-autolinking` from your package.json"
|
|
4842
4871
|
},
|
|
4843
4872
|
{
|
|
4844
4873
|
packageName: "expo-dev-launcher",
|
|
4845
4874
|
rule: "expo-no-redundant-dependency",
|
|
4846
|
-
message: "\"expo-dev-launcher\" should not be a direct dependency
|
|
4875
|
+
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",
|
|
4847
4876
|
help: "Remove `expo-dev-launcher` and depend on `expo-dev-client` instead"
|
|
4848
4877
|
},
|
|
4849
4878
|
{
|
|
4850
4879
|
packageName: "expo-dev-menu",
|
|
4851
4880
|
rule: "expo-no-redundant-dependency",
|
|
4852
|
-
message: "\"expo-dev-menu\" should not be a direct dependency
|
|
4881
|
+
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",
|
|
4853
4882
|
help: "Remove `expo-dev-menu` and depend on `expo-dev-client` instead"
|
|
4854
4883
|
},
|
|
4855
4884
|
{
|
|
4856
4885
|
packageName: "expo-modules-core",
|
|
4857
4886
|
rule: "expo-no-redundant-dependency",
|
|
4858
|
-
message: "\"expo-modules-core\" should not be a direct dependency
|
|
4887
|
+
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",
|
|
4859
4888
|
help: "Remove `expo-modules-core` from your package.json and import from `expo` instead"
|
|
4860
4889
|
},
|
|
4861
4890
|
{
|
|
4862
4891
|
packageName: "@expo/metro-config",
|
|
4863
4892
|
rule: "expo-no-redundant-dependency",
|
|
4864
|
-
message: "\"@expo/metro-config\" should not be a direct dependency
|
|
4893
|
+
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",
|
|
4865
4894
|
help: "Remove `@expo/metro-config` and import `expo/metro-config` in your metro.config.js"
|
|
4866
4895
|
},
|
|
4867
4896
|
{
|
|
4868
4897
|
packageName: "@types/react-native",
|
|
4869
4898
|
rule: "expo-no-redundant-dependency",
|
|
4870
|
-
message: "\"@types/react-native\" should not be installed
|
|
4899
|
+
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",
|
|
4871
4900
|
help: "Remove `@types/react-native` from your package.json",
|
|
4872
4901
|
minSdkMajor: 48
|
|
4873
4902
|
},
|
|
4874
4903
|
{
|
|
4875
4904
|
packageName: "@expo/config-plugins",
|
|
4876
4905
|
rule: "expo-no-redundant-dependency",
|
|
4877
|
-
message: "\"@expo/config-plugins\" should not be a direct dependency
|
|
4906
|
+
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",
|
|
4878
4907
|
help: "Remove `@expo/config-plugins`; config-plugin authors should import from `expo/config-plugins`. See https://github.com/expo/expo/pull/18855",
|
|
4879
4908
|
minSdkMajor: 48
|
|
4880
4909
|
},
|
|
4881
4910
|
{
|
|
4882
4911
|
packageName: "@expo/prebuild-config",
|
|
4883
4912
|
rule: "expo-no-redundant-dependency",
|
|
4884
|
-
message: "\"@expo/prebuild-config\" should not be a direct dependency
|
|
4913
|
+
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",
|
|
4885
4914
|
help: "Remove `@expo/prebuild-config` from your package.json",
|
|
4886
4915
|
minSdkMajor: 53
|
|
4887
4916
|
},
|
|
@@ -4895,28 +4924,28 @@ const FLAGGED_DEPENDENCIES = [
|
|
|
4895
4924
|
{
|
|
4896
4925
|
packageName: "expo-app-loading",
|
|
4897
4926
|
rule: "expo-no-redundant-dependency",
|
|
4898
|
-
message: "\"expo-app-loading\" was removed in SDK 49",
|
|
4927
|
+
message: "\"expo-app-loading\" was removed in SDK 49, so keeping it can leave imports unresolved after upgrading Expo",
|
|
4899
4928
|
help: "Remove `expo-app-loading` and use `expo-splash-screen` instead. See https://docs.expo.dev/versions/latest/sdk/splash-screen/",
|
|
4900
4929
|
minSdkMajor: 49
|
|
4901
4930
|
},
|
|
4902
4931
|
{
|
|
4903
4932
|
packageName: "expo-firebase-analytics",
|
|
4904
4933
|
rule: "expo-no-redundant-dependency",
|
|
4905
|
-
message: "\"expo-firebase-analytics\" was removed in SDK 48",
|
|
4934
|
+
message: "\"expo-firebase-analytics\" was removed in SDK 48, so keeping it can leave imports unresolved or fail native builds after upgrading Expo",
|
|
4906
4935
|
help: FIREBASE_HELP,
|
|
4907
4936
|
minSdkMajor: 48
|
|
4908
4937
|
},
|
|
4909
4938
|
{
|
|
4910
4939
|
packageName: "expo-firebase-recaptcha",
|
|
4911
4940
|
rule: "expo-no-redundant-dependency",
|
|
4912
|
-
message: "\"expo-firebase-recaptcha\" was removed in SDK 48",
|
|
4941
|
+
message: "\"expo-firebase-recaptcha\" was removed in SDK 48, so keeping it can leave imports unresolved or fail native builds after upgrading Expo",
|
|
4913
4942
|
help: FIREBASE_HELP,
|
|
4914
4943
|
minSdkMajor: 48
|
|
4915
4944
|
},
|
|
4916
4945
|
{
|
|
4917
4946
|
packageName: "expo-firebase-core",
|
|
4918
4947
|
rule: "expo-no-redundant-dependency",
|
|
4919
|
-
message: "\"expo-firebase-core\" was removed in SDK 48",
|
|
4948
|
+
message: "\"expo-firebase-core\" was removed in SDK 48, so keeping it can leave imports unresolved or fail native builds after upgrading Expo",
|
|
4920
4949
|
help: FIREBASE_HELP,
|
|
4921
4950
|
minSdkMajor: 48
|
|
4922
4951
|
}
|
|
@@ -4957,7 +4986,7 @@ const checkExpoGitignore = (context) => {
|
|
|
4957
4986
|
}));
|
|
4958
4987
|
if (findLocalModuleNativeFiles(rootDirectory).find((nativeFilePath) => isPathGitIgnored(rootDirectory, nativeFilePath) === true) !== void 0) diagnostics.push(buildExpoDiagnostic({
|
|
4959
4988
|
rule: "expo-gitignore",
|
|
4960
|
-
message: "The native `ios`/`android` directories of a local Expo module under `modules/` are gitignored
|
|
4989
|
+
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.",
|
|
4961
4990
|
help: "Use anchored patterns like `/ios` and `/android` in .gitignore so only the top-level native directories are excluded, not those inside `modules/`"
|
|
4962
4991
|
}));
|
|
4963
4992
|
return diagnostics;
|
|
@@ -5019,17 +5048,16 @@ const checkExpoPackageJsonConflicts = (context) => {
|
|
|
5019
5048
|
const conflictingScriptNames = CONFLICTING_SCRIPT_NAMES.filter((scriptName) => Boolean(packageJson.scripts?.[scriptName]));
|
|
5020
5049
|
if (conflictingScriptNames.length > 0) {
|
|
5021
5050
|
const quotedNames = conflictingScriptNames.map((name) => `"${name}"`).join(", ");
|
|
5022
|
-
const shadowsExpoCli = conflictingScriptNames.includes("expo");
|
|
5023
5051
|
diagnostics.push(buildExpoDiagnostic({
|
|
5024
5052
|
rule: "expo-package-json-conflict",
|
|
5025
|
-
message: `package.json defines ${quotedNames} ${conflictingScriptNames.length === 1 ? "as a script that
|
|
5053
|
+
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.`,
|
|
5026
5054
|
help: "Rename these scripts so they don't collide with the `expo` / `react-native` binaries"
|
|
5027
5055
|
}));
|
|
5028
5056
|
}
|
|
5029
5057
|
const packageName = packageJson.name;
|
|
5030
5058
|
if (typeof packageName === "string" && context.directDependencyNames.has(packageName)) diagnostics.push(buildExpoDiagnostic({
|
|
5031
5059
|
rule: "expo-package-json-conflict",
|
|
5032
|
-
message: `package.json "name" is "${packageName}", which collides with a dependency of the same name
|
|
5060
|
+
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.`,
|
|
5033
5061
|
help: "Rename your package so it no longer matches one of its dependencies"
|
|
5034
5062
|
}));
|
|
5035
5063
|
return diagnostics;
|
|
@@ -5100,7 +5128,7 @@ const checkExpoRouterReactNavigation = (context) => {
|
|
|
5100
5128
|
if (reactNavigationNames.length === 0) return [];
|
|
5101
5129
|
return [buildExpoDiagnostic({
|
|
5102
5130
|
rule: "expo-router-no-react-navigation",
|
|
5103
|
-
message: `As of SDK 56, expo-router is no longer compatible with react-navigation,
|
|
5131
|
+
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.`,
|
|
5104
5132
|
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/"
|
|
5105
5133
|
})];
|
|
5106
5134
|
};
|
|
@@ -5453,7 +5481,9 @@ const highlighter = {
|
|
|
5453
5481
|
gray: import_picocolors.default.gray,
|
|
5454
5482
|
bold: import_picocolors.default.bold
|
|
5455
5483
|
};
|
|
5456
|
-
const
|
|
5484
|
+
const NEXT_ENTRY_FILE_PATTERN = /^(?:\.\/)?(?:src\/)?(?:middleware|proxy)\.(?:tsx?|jsx?|mts|mjs)$/;
|
|
5485
|
+
const shouldIncludeExplicitLintPath = (filePath, project) => JSX_FILE_PATTERN.test(filePath) || project?.framework === "nextjs" && NEXT_ENTRY_FILE_PATTERN.test(filePath);
|
|
5486
|
+
const computeExplicitLintIncludePaths = (includePaths, project) => includePaths.length > 0 ? includePaths.filter((filePath) => shouldIncludeExplicitLintPath(filePath, project)) : void 0;
|
|
5457
5487
|
const LINGUIST_ATTRIBUTE_PATTERN = /^linguist-(?:vendored|generated)(?:=([a-zA-Z0-9]+))?$/i;
|
|
5458
5488
|
const FALSY_VALUES = new Set([
|
|
5459
5489
|
"false",
|
|
@@ -5882,7 +5912,7 @@ const checkDeadCode = async (options) => {
|
|
|
5882
5912
|
plugin: DEAD_CODE_PLUGIN,
|
|
5883
5913
|
rule: "unused-file",
|
|
5884
5914
|
severity: "warning",
|
|
5885
|
-
message: "Unused file
|
|
5915
|
+
message: "Unused file is not reachable from any entry point, so it adds maintenance surface without shipping any code.",
|
|
5886
5916
|
help: "Delete the file if it is truly unreachable, or import it from an entry point.",
|
|
5887
5917
|
line: 0,
|
|
5888
5918
|
column: 0,
|
|
@@ -5895,7 +5925,7 @@ const checkDeadCode = async (options) => {
|
|
|
5895
5925
|
plugin: DEAD_CODE_PLUGIN,
|
|
5896
5926
|
rule: unusedExport.isTypeOnly ? "unused-type" : "unused-export",
|
|
5897
5927
|
severity: "warning",
|
|
5898
|
-
message: `Unused ${label}: \`${unusedExport.name}
|
|
5928
|
+
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.`,
|
|
5899
5929
|
help: "Drop the `export` keyword (or remove the declaration) if no other module uses this symbol.",
|
|
5900
5930
|
line: unusedExport.line,
|
|
5901
5931
|
column: unusedExport.column,
|
|
@@ -5909,7 +5939,7 @@ const checkDeadCode = async (options) => {
|
|
|
5909
5939
|
plugin: DEAD_CODE_PLUGIN,
|
|
5910
5940
|
rule: unusedDependency.isDevDependency ? "unused-dev-dependency" : "unused-dependency",
|
|
5911
5941
|
severity: "warning",
|
|
5912
|
-
message: `Unused ${label}: \`${unusedDependency.name}
|
|
5942
|
+
message: `Unused ${label}: \`${unusedDependency.name}\` is not imported by the project, so it adds install time and supply-chain surface without being used.`,
|
|
5913
5943
|
help: "Remove the dependency from package.json if it is genuinely unused.",
|
|
5914
5944
|
line: 0,
|
|
5915
5945
|
column: 0,
|
|
@@ -5923,7 +5953,7 @@ const checkDeadCode = async (options) => {
|
|
|
5923
5953
|
plugin: DEAD_CODE_PLUGIN,
|
|
5924
5954
|
rule: "circular-dependency",
|
|
5925
5955
|
severity: "warning",
|
|
5926
|
-
message: `Circular import cycle: ${cycle.files.map(toRelative).join(" → ")}
|
|
5956
|
+
message: `Circular import cycle: ${cycle.files.map(toRelative).join(" → ")}. Modules in the cycle can observe partially initialized exports, causing order-dependent bugs.`,
|
|
5927
5957
|
help: "Break the cycle by extracting the shared code into a third module that both files import.",
|
|
5928
5958
|
line: 0,
|
|
5929
5959
|
column: 0,
|
|
@@ -6006,11 +6036,11 @@ const listSourceFilesViaFilesystem = (rootDirectory) => {
|
|
|
6006
6036
|
return filePaths;
|
|
6007
6037
|
};
|
|
6008
6038
|
const listSourceFiles = (rootDirectory) => excludeMinifiedFiles(rootDirectory, listSourceFilesViaGit(rootDirectory) ?? listSourceFilesViaFilesystem(rootDirectory));
|
|
6009
|
-
const resolveLintIncludePaths = (rootDirectory, userConfig) => {
|
|
6039
|
+
const resolveLintIncludePaths = (rootDirectory, userConfig, project) => {
|
|
6010
6040
|
if (!Array.isArray(userConfig?.ignore?.files) || userConfig.ignore.files.length === 0) return;
|
|
6011
6041
|
const ignoredPatterns = compileIgnoredFilePatterns(userConfig);
|
|
6012
6042
|
return listSourceFiles(rootDirectory).filter((filePath) => {
|
|
6013
|
-
if (!
|
|
6043
|
+
if (!shouldIncludeExplicitLintPath(filePath, project)) return false;
|
|
6014
6044
|
return !isFileIgnoredByPatterns(filePath, rootDirectory, ignoredPatterns);
|
|
6015
6045
|
});
|
|
6016
6046
|
};
|
|
@@ -8362,7 +8392,7 @@ const runInspect = (input, hooks = {}) => Effect.gen(function* () {
|
|
|
8362
8392
|
directory: scanDirectory,
|
|
8363
8393
|
repo
|
|
8364
8394
|
}).pipe(Effect.orElseSucceed(() => null)) : Effect.succeed(null));
|
|
8365
|
-
const lintIncludePaths = (input.skipJsxIncludeFilter ? input.includePaths.length > 0 ? [...input.includePaths] : void 0 :
|
|
8395
|
+
const lintIncludePaths = (input.skipJsxIncludeFilter ? input.includePaths.length > 0 ? [...input.includePaths] : void 0 : computeExplicitLintIncludePaths([...input.includePaths], project)) ?? resolveLintIncludePaths(scanDirectory, resolvedConfig.config, project);
|
|
8366
8396
|
const scannedFilePaths = input.suppressScanSummary ? (lintIncludePaths ?? (yield* filesService.listSourceFiles(scanDirectory))).map((relativePath) => path$1.resolve(scanDirectory, relativePath)) : [];
|
|
8367
8397
|
const beforeLint = hooks.beforeLint ?? NO_HOOKS.beforeLint;
|
|
8368
8398
|
const afterLint = hooks.afterLint ?? NO_HOOKS.afterLint;
|
|
@@ -8885,6 +8915,13 @@ const filterSourceFiles = (filePaths) => filePaths.filter(isLintableSourceFile);
|
|
|
8885
8915
|
* other `clear*` helpers.
|
|
8886
8916
|
*/
|
|
8887
8917
|
const clearAutoSuppressionCaches = () => {};
|
|
8918
|
+
/**
|
|
8919
|
+
* Identity helper for authoring a typed `doctor.config.{ts,js,mjs,cjs}`.
|
|
8920
|
+
* Gives editor autocomplete and type-checking for the config object without
|
|
8921
|
+
* an explicit `satisfies ReactDoctorConfig` annotation; returns the config
|
|
8922
|
+
* untouched so the loader sees the same plain object either way.
|
|
8923
|
+
*/
|
|
8924
|
+
const defineConfig = (config) => config;
|
|
8888
8925
|
//#endregion
|
|
8889
8926
|
//#region ../api/dist/index.js
|
|
8890
8927
|
const buildDiagnoseLayer = (configLayer = Config.layerNode) => Layer.mergeAll(Project.layerNode, configLayer, DeadCode.layerNode, Files.layerNode, Git.layerNode, Linter.layerOxlint, LintPartialFailures.layerLive, Progress.layerNoop, Reporter.layerNoop, Score.layerHttp);
|
|
@@ -8950,7 +8987,7 @@ const toJsonReport = (result, options) => buildJsonReport({
|
|
|
8950
8987
|
totalElapsedMilliseconds: result.elapsedMilliseconds
|
|
8951
8988
|
});
|
|
8952
8989
|
//#endregion
|
|
8953
|
-
export { AmbiguousProjectError, NoReactDependencyError, NotADirectoryError, PackageJsonNotFoundError, ProjectNotFoundError, ReactDoctorError, buildJsonReport, buildJsonReportError, clearCaches, diagnose, filterSourceFiles, getDiffInfo, isProjectDiscoveryError, isReactDoctorError, summarizeDiagnostics, toJsonReport };
|
|
8990
|
+
export { AmbiguousProjectError, NoReactDependencyError, NotADirectoryError, PackageJsonNotFoundError, ProjectNotFoundError, ReactDoctorError, buildJsonReport, buildJsonReportError, clearCaches, defineConfig, diagnose, filterSourceFiles, getDiffInfo, isProjectDiscoveryError, isReactDoctorError, summarizeDiagnostics, toJsonReport };
|
|
8954
8991
|
|
|
8955
8992
|
//# sourceMappingURL=index.js.map
|
|
8956
|
-
//# debugId=
|
|
8993
|
+
//# debugId=1f673676-aa45-541f-9382-dcf9102ad9d3
|
package/dist/lsp.js
CHANGED
|
@@ -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([
|
|
@@ -3706,7 +3706,6 @@ const LEGACY_RULE_KEY_TO_NATIVE_RULE_KEY = {
|
|
|
3706
3706
|
"react/jsx-no-new-function-as-prop": "react-doctor/jsx-no-new-function-as-prop",
|
|
3707
3707
|
"react/jsx-no-new-object-as-prop": "react-doctor/jsx-no-new-object-as-prop",
|
|
3708
3708
|
"react/jsx-no-script-url": "react-doctor/jsx-no-script-url",
|
|
3709
|
-
"react/jsx-no-target-blank": "react-doctor/jsx-no-target-blank",
|
|
3710
3709
|
"react/jsx-no-undef": "react-doctor/jsx-no-undef",
|
|
3711
3710
|
"react/jsx-no-useless-fragment": "react-doctor/jsx-no-useless-fragment",
|
|
3712
3711
|
"react/jsx-pascal-case": "react-doctor/jsx-pascal-case",
|
|
@@ -4589,6 +4588,35 @@ const loadPackageJsonConfig = (directory) => {
|
|
|
4589
4588
|
format: "package-json"
|
|
4590
4589
|
};
|
|
4591
4590
|
};
|
|
4591
|
+
const loadLegacyConfig = (directory) => {
|
|
4592
|
+
const legacyFilePath = path$1.join(directory, LEGACY_CONFIG_FILENAME);
|
|
4593
|
+
if (!isFile(legacyFilePath)) return {
|
|
4594
|
+
status: "absent",
|
|
4595
|
+
loaded: null
|
|
4596
|
+
};
|
|
4597
|
+
try {
|
|
4598
|
+
const parsed = readDataConfig(legacyFilePath);
|
|
4599
|
+
if (isPlainObject(parsed)) {
|
|
4600
|
+
warn(`${LEGACY_CONFIG_FILENAME} is deprecated — rename it to ${CONFIG_BASENAME}.json (or author a ${CONFIG_BASENAME}.ts). It is still read for now.`);
|
|
4601
|
+
return {
|
|
4602
|
+
status: "found",
|
|
4603
|
+
loaded: {
|
|
4604
|
+
config: validateConfigTypes(parsed),
|
|
4605
|
+
sourceDirectory: directory,
|
|
4606
|
+
configFilePath: legacyFilePath,
|
|
4607
|
+
format: "json"
|
|
4608
|
+
}
|
|
4609
|
+
};
|
|
4610
|
+
}
|
|
4611
|
+
warn(`${LEGACY_CONFIG_FILENAME} must contain an object, ignoring.`);
|
|
4612
|
+
} catch (error) {
|
|
4613
|
+
warn(`Failed to load ${LEGACY_CONFIG_FILENAME}: ${formatError(error)}`);
|
|
4614
|
+
}
|
|
4615
|
+
return {
|
|
4616
|
+
status: "invalid",
|
|
4617
|
+
loaded: null
|
|
4618
|
+
};
|
|
4619
|
+
};
|
|
4592
4620
|
const loadConfigFromDirectory = async (directory) => {
|
|
4593
4621
|
let sawBrokenConfigFile = false;
|
|
4594
4622
|
for (const extension of CONFIG_EXTENSIONS) {
|
|
@@ -4618,7 +4646,8 @@ const loadConfigFromDirectory = async (directory) => {
|
|
|
4618
4646
|
status: "found",
|
|
4619
4647
|
loaded: packageJsonConfig
|
|
4620
4648
|
};
|
|
4621
|
-
|
|
4649
|
+
const legacyResult = loadLegacyConfig(directory);
|
|
4650
|
+
if (legacyResult.status !== "absent") return legacyResult;
|
|
4622
4651
|
return {
|
|
4623
4652
|
status: sawBrokenConfigFile ? "invalid" : "absent",
|
|
4624
4653
|
loaded: null
|
|
@@ -4774,51 +4803,51 @@ const FLAGGED_DEPENDENCIES = [
|
|
|
4774
4803
|
{
|
|
4775
4804
|
packageName: "expo-modules-autolinking",
|
|
4776
4805
|
rule: "expo-no-redundant-dependency",
|
|
4777
|
-
message: "\"expo-modules-autolinking\" should not be a direct dependency
|
|
4806
|
+
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",
|
|
4778
4807
|
help: "Remove `expo-modules-autolinking` from your package.json"
|
|
4779
4808
|
},
|
|
4780
4809
|
{
|
|
4781
4810
|
packageName: "expo-dev-launcher",
|
|
4782
4811
|
rule: "expo-no-redundant-dependency",
|
|
4783
|
-
message: "\"expo-dev-launcher\" should not be a direct dependency
|
|
4812
|
+
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",
|
|
4784
4813
|
help: "Remove `expo-dev-launcher` and depend on `expo-dev-client` instead"
|
|
4785
4814
|
},
|
|
4786
4815
|
{
|
|
4787
4816
|
packageName: "expo-dev-menu",
|
|
4788
4817
|
rule: "expo-no-redundant-dependency",
|
|
4789
|
-
message: "\"expo-dev-menu\" should not be a direct dependency
|
|
4818
|
+
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",
|
|
4790
4819
|
help: "Remove `expo-dev-menu` and depend on `expo-dev-client` instead"
|
|
4791
4820
|
},
|
|
4792
4821
|
{
|
|
4793
4822
|
packageName: "expo-modules-core",
|
|
4794
4823
|
rule: "expo-no-redundant-dependency",
|
|
4795
|
-
message: "\"expo-modules-core\" should not be a direct dependency
|
|
4824
|
+
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",
|
|
4796
4825
|
help: "Remove `expo-modules-core` from your package.json and import from `expo` instead"
|
|
4797
4826
|
},
|
|
4798
4827
|
{
|
|
4799
4828
|
packageName: "@expo/metro-config",
|
|
4800
4829
|
rule: "expo-no-redundant-dependency",
|
|
4801
|
-
message: "\"@expo/metro-config\" should not be a direct dependency
|
|
4830
|
+
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",
|
|
4802
4831
|
help: "Remove `@expo/metro-config` and import `expo/metro-config` in your metro.config.js"
|
|
4803
4832
|
},
|
|
4804
4833
|
{
|
|
4805
4834
|
packageName: "@types/react-native",
|
|
4806
4835
|
rule: "expo-no-redundant-dependency",
|
|
4807
|
-
message: "\"@types/react-native\" should not be installed
|
|
4836
|
+
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",
|
|
4808
4837
|
help: "Remove `@types/react-native` from your package.json",
|
|
4809
4838
|
minSdkMajor: 48
|
|
4810
4839
|
},
|
|
4811
4840
|
{
|
|
4812
4841
|
packageName: "@expo/config-plugins",
|
|
4813
4842
|
rule: "expo-no-redundant-dependency",
|
|
4814
|
-
message: "\"@expo/config-plugins\" should not be a direct dependency
|
|
4843
|
+
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",
|
|
4815
4844
|
help: "Remove `@expo/config-plugins`; config-plugin authors should import from `expo/config-plugins`. See https://github.com/expo/expo/pull/18855",
|
|
4816
4845
|
minSdkMajor: 48
|
|
4817
4846
|
},
|
|
4818
4847
|
{
|
|
4819
4848
|
packageName: "@expo/prebuild-config",
|
|
4820
4849
|
rule: "expo-no-redundant-dependency",
|
|
4821
|
-
message: "\"@expo/prebuild-config\" should not be a direct dependency
|
|
4850
|
+
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",
|
|
4822
4851
|
help: "Remove `@expo/prebuild-config` from your package.json",
|
|
4823
4852
|
minSdkMajor: 53
|
|
4824
4853
|
},
|
|
@@ -4832,28 +4861,28 @@ const FLAGGED_DEPENDENCIES = [
|
|
|
4832
4861
|
{
|
|
4833
4862
|
packageName: "expo-app-loading",
|
|
4834
4863
|
rule: "expo-no-redundant-dependency",
|
|
4835
|
-
message: "\"expo-app-loading\" was removed in SDK 49",
|
|
4864
|
+
message: "\"expo-app-loading\" was removed in SDK 49, so keeping it can leave imports unresolved after upgrading Expo",
|
|
4836
4865
|
help: "Remove `expo-app-loading` and use `expo-splash-screen` instead. See https://docs.expo.dev/versions/latest/sdk/splash-screen/",
|
|
4837
4866
|
minSdkMajor: 49
|
|
4838
4867
|
},
|
|
4839
4868
|
{
|
|
4840
4869
|
packageName: "expo-firebase-analytics",
|
|
4841
4870
|
rule: "expo-no-redundant-dependency",
|
|
4842
|
-
message: "\"expo-firebase-analytics\" was removed in SDK 48",
|
|
4871
|
+
message: "\"expo-firebase-analytics\" was removed in SDK 48, so keeping it can leave imports unresolved or fail native builds after upgrading Expo",
|
|
4843
4872
|
help: FIREBASE_HELP,
|
|
4844
4873
|
minSdkMajor: 48
|
|
4845
4874
|
},
|
|
4846
4875
|
{
|
|
4847
4876
|
packageName: "expo-firebase-recaptcha",
|
|
4848
4877
|
rule: "expo-no-redundant-dependency",
|
|
4849
|
-
message: "\"expo-firebase-recaptcha\" was removed in SDK 48",
|
|
4878
|
+
message: "\"expo-firebase-recaptcha\" was removed in SDK 48, so keeping it can leave imports unresolved or fail native builds after upgrading Expo",
|
|
4850
4879
|
help: FIREBASE_HELP,
|
|
4851
4880
|
minSdkMajor: 48
|
|
4852
4881
|
},
|
|
4853
4882
|
{
|
|
4854
4883
|
packageName: "expo-firebase-core",
|
|
4855
4884
|
rule: "expo-no-redundant-dependency",
|
|
4856
|
-
message: "\"expo-firebase-core\" was removed in SDK 48",
|
|
4885
|
+
message: "\"expo-firebase-core\" was removed in SDK 48, so keeping it can leave imports unresolved or fail native builds after upgrading Expo",
|
|
4857
4886
|
help: FIREBASE_HELP,
|
|
4858
4887
|
minSdkMajor: 48
|
|
4859
4888
|
}
|
|
@@ -4894,7 +4923,7 @@ const checkExpoGitignore = (context) => {
|
|
|
4894
4923
|
}));
|
|
4895
4924
|
if (findLocalModuleNativeFiles(rootDirectory).find((nativeFilePath) => isPathGitIgnored(rootDirectory, nativeFilePath) === true) !== void 0) diagnostics.push(buildExpoDiagnostic({
|
|
4896
4925
|
rule: "expo-gitignore",
|
|
4897
|
-
message: "The native `ios`/`android` directories of a local Expo module under `modules/` are gitignored
|
|
4926
|
+
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.",
|
|
4898
4927
|
help: "Use anchored patterns like `/ios` and `/android` in .gitignore so only the top-level native directories are excluded, not those inside `modules/`"
|
|
4899
4928
|
}));
|
|
4900
4929
|
return diagnostics;
|
|
@@ -4956,17 +4985,16 @@ const checkExpoPackageJsonConflicts = (context) => {
|
|
|
4956
4985
|
const conflictingScriptNames = CONFLICTING_SCRIPT_NAMES.filter((scriptName) => Boolean(packageJson.scripts?.[scriptName]));
|
|
4957
4986
|
if (conflictingScriptNames.length > 0) {
|
|
4958
4987
|
const quotedNames = conflictingScriptNames.map((name) => `"${name}"`).join(", ");
|
|
4959
|
-
const shadowsExpoCli = conflictingScriptNames.includes("expo");
|
|
4960
4988
|
diagnostics.push(buildExpoDiagnostic({
|
|
4961
4989
|
rule: "expo-package-json-conflict",
|
|
4962
|
-
message: `package.json defines ${quotedNames} ${conflictingScriptNames.length === 1 ? "as a script that
|
|
4990
|
+
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.`,
|
|
4963
4991
|
help: "Rename these scripts so they don't collide with the `expo` / `react-native` binaries"
|
|
4964
4992
|
}));
|
|
4965
4993
|
}
|
|
4966
4994
|
const packageName = packageJson.name;
|
|
4967
4995
|
if (typeof packageName === "string" && context.directDependencyNames.has(packageName)) diagnostics.push(buildExpoDiagnostic({
|
|
4968
4996
|
rule: "expo-package-json-conflict",
|
|
4969
|
-
message: `package.json "name" is "${packageName}", which collides with a dependency of the same name
|
|
4997
|
+
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.`,
|
|
4970
4998
|
help: "Rename your package so it no longer matches one of its dependencies"
|
|
4971
4999
|
}));
|
|
4972
5000
|
return diagnostics;
|
|
@@ -5037,7 +5065,7 @@ const checkExpoRouterReactNavigation = (context) => {
|
|
|
5037
5065
|
if (reactNavigationNames.length === 0) return [];
|
|
5038
5066
|
return [buildExpoDiagnostic({
|
|
5039
5067
|
rule: "expo-router-no-react-navigation",
|
|
5040
|
-
message: `As of SDK 56, expo-router is no longer compatible with react-navigation,
|
|
5068
|
+
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.`,
|
|
5041
5069
|
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/"
|
|
5042
5070
|
})];
|
|
5043
5071
|
};
|
|
@@ -5390,7 +5418,9 @@ const highlighter = {
|
|
|
5390
5418
|
gray: import_picocolors.default.gray,
|
|
5391
5419
|
bold: import_picocolors.default.bold
|
|
5392
5420
|
};
|
|
5393
|
-
const
|
|
5421
|
+
const NEXT_ENTRY_FILE_PATTERN = /^(?:\.\/)?(?:src\/)?(?:middleware|proxy)\.(?:tsx?|jsx?|mts|mjs)$/;
|
|
5422
|
+
const shouldIncludeExplicitLintPath = (filePath, project) => JSX_FILE_PATTERN.test(filePath) || project?.framework === "nextjs" && NEXT_ENTRY_FILE_PATTERN.test(filePath);
|
|
5423
|
+
const computeExplicitLintIncludePaths = (includePaths, project) => includePaths.length > 0 ? includePaths.filter((filePath) => shouldIncludeExplicitLintPath(filePath, project)) : void 0;
|
|
5394
5424
|
const LINGUIST_ATTRIBUTE_PATTERN = /^linguist-(?:vendored|generated)(?:=([a-zA-Z0-9]+))?$/i;
|
|
5395
5425
|
const FALSY_VALUES = new Set([
|
|
5396
5426
|
"false",
|
|
@@ -5819,7 +5849,7 @@ const checkDeadCode = async (options) => {
|
|
|
5819
5849
|
plugin: DEAD_CODE_PLUGIN,
|
|
5820
5850
|
rule: "unused-file",
|
|
5821
5851
|
severity: "warning",
|
|
5822
|
-
message: "Unused file
|
|
5852
|
+
message: "Unused file is not reachable from any entry point, so it adds maintenance surface without shipping any code.",
|
|
5823
5853
|
help: "Delete the file if it is truly unreachable, or import it from an entry point.",
|
|
5824
5854
|
line: 0,
|
|
5825
5855
|
column: 0,
|
|
@@ -5832,7 +5862,7 @@ const checkDeadCode = async (options) => {
|
|
|
5832
5862
|
plugin: DEAD_CODE_PLUGIN,
|
|
5833
5863
|
rule: unusedExport.isTypeOnly ? "unused-type" : "unused-export",
|
|
5834
5864
|
severity: "warning",
|
|
5835
|
-
message: `Unused ${label}: \`${unusedExport.name}
|
|
5865
|
+
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.`,
|
|
5836
5866
|
help: "Drop the `export` keyword (or remove the declaration) if no other module uses this symbol.",
|
|
5837
5867
|
line: unusedExport.line,
|
|
5838
5868
|
column: unusedExport.column,
|
|
@@ -5846,7 +5876,7 @@ const checkDeadCode = async (options) => {
|
|
|
5846
5876
|
plugin: DEAD_CODE_PLUGIN,
|
|
5847
5877
|
rule: unusedDependency.isDevDependency ? "unused-dev-dependency" : "unused-dependency",
|
|
5848
5878
|
severity: "warning",
|
|
5849
|
-
message: `Unused ${label}: \`${unusedDependency.name}
|
|
5879
|
+
message: `Unused ${label}: \`${unusedDependency.name}\` is not imported by the project, so it adds install time and supply-chain surface without being used.`,
|
|
5850
5880
|
help: "Remove the dependency from package.json if it is genuinely unused.",
|
|
5851
5881
|
line: 0,
|
|
5852
5882
|
column: 0,
|
|
@@ -5860,7 +5890,7 @@ const checkDeadCode = async (options) => {
|
|
|
5860
5890
|
plugin: DEAD_CODE_PLUGIN,
|
|
5861
5891
|
rule: "circular-dependency",
|
|
5862
5892
|
severity: "warning",
|
|
5863
|
-
message: `Circular import cycle: ${cycle.files.map(toRelative).join(" → ")}
|
|
5893
|
+
message: `Circular import cycle: ${cycle.files.map(toRelative).join(" → ")}. Modules in the cycle can observe partially initialized exports, causing order-dependent bugs.`,
|
|
5864
5894
|
help: "Break the cycle by extracting the shared code into a third module that both files import.",
|
|
5865
5895
|
line: 0,
|
|
5866
5896
|
column: 0,
|
|
@@ -5943,11 +5973,11 @@ const listSourceFilesViaFilesystem = (rootDirectory) => {
|
|
|
5943
5973
|
return filePaths;
|
|
5944
5974
|
};
|
|
5945
5975
|
const listSourceFiles = (rootDirectory) => excludeMinifiedFiles(rootDirectory, listSourceFilesViaGit(rootDirectory) ?? listSourceFilesViaFilesystem(rootDirectory));
|
|
5946
|
-
const resolveLintIncludePaths = (rootDirectory, userConfig) => {
|
|
5976
|
+
const resolveLintIncludePaths = (rootDirectory, userConfig, project) => {
|
|
5947
5977
|
if (!Array.isArray(userConfig?.ignore?.files) || userConfig.ignore.files.length === 0) return;
|
|
5948
5978
|
const ignoredPatterns = compileIgnoredFilePatterns(userConfig);
|
|
5949
5979
|
return listSourceFiles(rootDirectory).filter((filePath) => {
|
|
5950
|
-
if (!
|
|
5980
|
+
if (!shouldIncludeExplicitLintPath(filePath, project)) return false;
|
|
5951
5981
|
return !isFileIgnoredByPatterns(filePath, rootDirectory, ignoredPatterns);
|
|
5952
5982
|
});
|
|
5953
5983
|
};
|
|
@@ -8299,7 +8329,7 @@ const runInspect = (input, hooks = {}) => Effect.gen(function* () {
|
|
|
8299
8329
|
directory: scanDirectory,
|
|
8300
8330
|
repo
|
|
8301
8331
|
}).pipe(Effect.orElseSucceed(() => null)) : Effect.succeed(null));
|
|
8302
|
-
const lintIncludePaths = (input.skipJsxIncludeFilter ? input.includePaths.length > 0 ? [...input.includePaths] : void 0 :
|
|
8332
|
+
const lintIncludePaths = (input.skipJsxIncludeFilter ? input.includePaths.length > 0 ? [...input.includePaths] : void 0 : computeExplicitLintIncludePaths([...input.includePaths], project)) ?? resolveLintIncludePaths(scanDirectory, resolvedConfig.config, project);
|
|
8303
8333
|
const scannedFilePaths = input.suppressScanSummary ? (lintIncludePaths ?? (yield* filesService.listSourceFiles(scanDirectory))).map((relativePath) => path$1.resolve(scanDirectory, relativePath)) : [];
|
|
8304
8334
|
const beforeLint = hooks.beforeLint ?? NO_HOOKS.beforeLint;
|
|
8305
8335
|
const afterLint = hooks.afterLint ?? NO_HOOKS.afterLint;
|
|
@@ -8736,7 +8766,7 @@ const getRuleMetadata = (plugin, rule) => {
|
|
|
8736
8766
|
/** Display name used in client-facing messages and progress titles. */
|
|
8737
8767
|
const SERVER_DISPLAY_NAME = "React Doctor";
|
|
8738
8768
|
/** Server version reported in `serverInfo`; injected at build, `dev` from source. */
|
|
8739
|
-
const SERVER_VERSION = "0.2
|
|
8769
|
+
const SERVER_VERSION = "0.4.2";
|
|
8740
8770
|
/** `Diagnostic.source` shown next to every published diagnostic. */
|
|
8741
8771
|
const DIAGNOSTIC_SOURCE = "react-doctor";
|
|
8742
8772
|
/**
|
|
@@ -8776,7 +8806,9 @@ const SCANNABLE_EXTENSIONS = [
|
|
|
8776
8806
|
".ts",
|
|
8777
8807
|
".tsx",
|
|
8778
8808
|
".js",
|
|
8779
|
-
".jsx"
|
|
8809
|
+
".jsx",
|
|
8810
|
+
".mts",
|
|
8811
|
+
".mjs"
|
|
8780
8812
|
];
|
|
8781
8813
|
/** Filenames whose change invalidates project/config caches. */
|
|
8782
8814
|
const CONFIG_WATCH_FILENAMES = [
|
|
@@ -10824,5 +10856,5 @@ const startLanguageServer = () => {
|
|
|
10824
10856
|
};
|
|
10825
10857
|
//#endregion
|
|
10826
10858
|
export { startLanguageServer };
|
|
10827
|
-
!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]="
|
|
10828
|
-
//# debugId=
|
|
10859
|
+
!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]="fa23cc5b-da68-506d-a911-dedb0ca2a6b4")}catch(e){}}();
|
|
10860
|
+
//# debugId=fa23cc5b-da68-506d-a911-dedb0ca2a6b4
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: react-doctor
|
|
3
3
|
description: Use when finishing a feature, fixing a bug, before committing React code, or when the user types `/doctor`, asks to scan, triage, or clean up React diagnostics. Covers lint, accessibility, bundle size, architecture. Includes a regression check and a full local-triage workflow that fetches the canonical playbook.
|
|
4
|
-
version: "1.
|
|
4
|
+
version: "1.2.0"
|
|
5
5
|
---
|
|
6
6
|
|
|
7
7
|
# React Doctor
|
|
@@ -34,7 +34,7 @@ Pair it with the matching per-rule prompts at `https://www.react.doctor/prompts/
|
|
|
34
34
|
|
|
35
35
|
## Configuring or explaining rules
|
|
36
36
|
|
|
37
|
-
When the user wants to understand a rule, disagrees with one, or wants to disable / tune which rules run (not fix code),
|
|
37
|
+
When the user wants to understand a rule, disagrees with one, or wants to disable / tune which rules run (not fix code), read [references/explain.md](references/explain.md) and follow it. Start with `npx react-doctor@latest rules explain <rule>`, then apply the narrowest control via `npx react-doctor@latest rules disable|set|category|ignore-tag …`, which edits your `doctor.config.*` (or `package.json#reactDoctor`).
|
|
38
38
|
|
|
39
39
|
## Command
|
|
40
40
|
|