react-doctor 0.5.1-dev.22268f7 → 0.5.1-dev.3de9106
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 +332 -126
- package/dist/index.d.ts +84 -39
- package/dist/index.js +225 -45
- package/dist/lsp.js +127 -40
- package/package.json +4 -4
package/dist/lsp.js
CHANGED
|
@@ -10,10 +10,11 @@ import { spawn, spawnSync } from "node:child_process";
|
|
|
10
10
|
import * as ts from "typescript";
|
|
11
11
|
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";
|
|
12
12
|
import { parseJSON5 } from "confbox";
|
|
13
|
+
import * as NodeUrl from "node:url";
|
|
14
|
+
import { fileURLToPath } from "node:url";
|
|
13
15
|
import { createJiti } from "jiti";
|
|
14
16
|
import * as Crypto from "node:crypto";
|
|
15
17
|
import crypto from "node:crypto";
|
|
16
|
-
import * as NodeUrl from "node:url";
|
|
17
18
|
import { gzipSync } from "node:zlib";
|
|
18
19
|
import { CodeActionKind, CodeActionTriggerKind, DidChangeWatchedFilesNotification, DocumentDiagnosticReportKind, FileChangeType, TextDocumentSyncKind, TextDocuments, createConnection } from "vscode-languageserver/node.js";
|
|
19
20
|
import { TextDocument } from "vscode-languageserver-textdocument";
|
|
@@ -19283,6 +19284,7 @@ var Diagnostic = class extends Class("Diagnostic")({
|
|
|
19283
19284
|
endLine: optional(Number$1),
|
|
19284
19285
|
endColumn: optional(Number$1),
|
|
19285
19286
|
category: String$1,
|
|
19287
|
+
fileContext: optional(Literals(["test", "story"])),
|
|
19286
19288
|
suppressionHint: optional(String$1),
|
|
19287
19289
|
relatedLocations: optional(ArraySchema(DiagnosticRelatedLocation))
|
|
19288
19290
|
}) {};
|
|
@@ -34630,8 +34632,10 @@ const isFileIgnoredByPatterns = (filePath, rootDirectory, patterns) => {
|
|
|
34630
34632
|
const relativePath = toRelativePath(filePath, rootDirectory);
|
|
34631
34633
|
return patterns.some((pattern) => pattern.test(relativePath));
|
|
34632
34634
|
};
|
|
34635
|
+
const SCRIPT_EXTENSION_FRAGMENT = "[cm]?[jt]sx?";
|
|
34636
|
+
const STORY_FILE_SUFFIX_PATTERN = new RegExp(`\\.(?:stories|story)\\.(?:${SCRIPT_EXTENSION_FRAGMENT})$`);
|
|
34637
|
+
const TEST_FILE_SUFFIX_PATTERN = new RegExp(`\\.(?:test|spec|fixture|fixtures)\\.(?:${SCRIPT_EXTENSION_FRAGMENT})$`);
|
|
34633
34638
|
const TEST_FILE_DIRECTORY_PATTERN = /(?:^|\/)(?:__tests__|__test__|tests|test|__mocks__|cypress|e2e|playwright)\//;
|
|
34634
|
-
const TEST_FILE_SUFFIX_PATTERN = /\.(?:test|spec|stories|story|fixture|fixtures)\.(?:[cm]?[jt]sx?)$/;
|
|
34635
34639
|
const FIXTURE_PROJECT_PATTERN = /\/(?:fixtures|__fixtures__)\//;
|
|
34636
34640
|
const SOURCE_ROOT_PATTERN = /\/(?:src|app|lib|components|pages|features|modules|packages|apps|frontend|client)\//g;
|
|
34637
34641
|
const stripAboveSourceRoot = (relativePath) => {
|
|
@@ -34642,12 +34646,23 @@ const stripAboveSourceRoot = (relativePath) => {
|
|
|
34642
34646
|
if (lastIdx >= 0) return relativePath.slice(lastIdx);
|
|
34643
34647
|
return relativePath.slice(fixtureMatch.index + fixtureMatch[0].length - 1);
|
|
34644
34648
|
};
|
|
34645
|
-
|
|
34646
|
-
|
|
34649
|
+
/**
|
|
34650
|
+
* Classifies where a file sits relative to shipped code. A finding in a
|
|
34651
|
+
* `.stories.tsx` or `.spec.ts` file never runs in front of users, so
|
|
34652
|
+
* renderers label those sites instead of framing them as production
|
|
34653
|
+
* impact (`rn-no-raw-text` in a spec doesn't say users crash).
|
|
34654
|
+
*
|
|
34655
|
+
* `"story"` is the `.stories.*` / `.story.*` suffix; `"test"` is the
|
|
34656
|
+
* test/spec/fixture suffixes and test directories; `"production"` is
|
|
34657
|
+
* the default.
|
|
34658
|
+
*/
|
|
34659
|
+
const classifyFileContext = (relativePath) => {
|
|
34660
|
+
if (relativePath.length === 0) return "production";
|
|
34647
34661
|
const forwardSlashed = relativePath.replaceAll("\\", "/");
|
|
34648
|
-
if (
|
|
34662
|
+
if (STORY_FILE_SUFFIX_PATTERN.test(forwardSlashed)) return "story";
|
|
34663
|
+
if (TEST_FILE_SUFFIX_PATTERN.test(forwardSlashed)) return "test";
|
|
34649
34664
|
const scoped = stripAboveSourceRoot(forwardSlashed);
|
|
34650
|
-
return TEST_FILE_DIRECTORY_PATTERN.test(scoped);
|
|
34665
|
+
return TEST_FILE_DIRECTORY_PATTERN.test(scoped) ? "test" : "production";
|
|
34651
34666
|
};
|
|
34652
34667
|
/**
|
|
34653
34668
|
* Resolves the user-configured severity override for a rule.
|
|
@@ -34867,6 +34882,8 @@ const collectStringSet = (values) => {
|
|
|
34867
34882
|
* 5. `rn-no-raw-text` suppression via configured `textComponents` and
|
|
34868
34883
|
* `rawTextWrapperComponents` (config-driven JSX enclosure checks)
|
|
34869
34884
|
* 6. inline suppressions (`// react-doctor-disable-next-line ...`)
|
|
34885
|
+
* 7. file-context stamping (`fileContext: "test" | "story"` on
|
|
34886
|
+
* survivors in non-production files, so renderers can label them)
|
|
34870
34887
|
*
|
|
34871
34888
|
* Returns `null` when the diagnostic is dropped, the (possibly
|
|
34872
34889
|
* severity-restamped) diagnostic otherwise.
|
|
@@ -34886,7 +34903,7 @@ const buildDiagnosticPipeline = (input) => {
|
|
|
34886
34903
|
const hasTextComponents = textComponentNames.size > 0;
|
|
34887
34904
|
const hasRawTextWrappers = rawTextWrapperComponentNames.size > 0;
|
|
34888
34905
|
const fileLinesCache = /* @__PURE__ */ new Map();
|
|
34889
|
-
const
|
|
34906
|
+
const fileContextCache = /* @__PURE__ */ new Map();
|
|
34890
34907
|
const libraryFileCache = /* @__PURE__ */ new Map();
|
|
34891
34908
|
const isLibraryFile = (filePath) => {
|
|
34892
34909
|
let cached = libraryFileCache.get(filePath);
|
|
@@ -34903,11 +34920,11 @@ const buildDiagnosticPipeline = (input) => {
|
|
|
34903
34920
|
fileLinesCache.set(filePath, lines);
|
|
34904
34921
|
return lines;
|
|
34905
34922
|
};
|
|
34906
|
-
const
|
|
34907
|
-
let cached =
|
|
34923
|
+
const getFileContext = (filePath) => {
|
|
34924
|
+
let cached = fileContextCache.get(filePath);
|
|
34908
34925
|
if (cached === void 0) {
|
|
34909
|
-
cached =
|
|
34910
|
-
|
|
34926
|
+
cached = classifyFileContext(filePath);
|
|
34927
|
+
fileContextCache.set(filePath, cached);
|
|
34911
34928
|
}
|
|
34912
34929
|
return cached;
|
|
34913
34930
|
};
|
|
@@ -34916,7 +34933,7 @@ const buildDiagnosticPipeline = (input) => {
|
|
|
34916
34933
|
const rule = reactDoctorPlugin.rules[diagnostic.rule];
|
|
34917
34934
|
if (!rule?.tags?.includes("test-noise")) return false;
|
|
34918
34935
|
if (rule.tags.includes("migration-hint")) return false;
|
|
34919
|
-
return
|
|
34936
|
+
return getFileContext(diagnostic.filePath) !== "production";
|
|
34920
34937
|
};
|
|
34921
34938
|
const isRuleIgnored = (ruleIdentifier) => {
|
|
34922
34939
|
for (const ignored of ignoredRules) if (isSameRuleKey(ignored, ruleIdentifier)) return true;
|
|
@@ -34973,6 +34990,11 @@ const buildDiagnosticPipeline = (input) => {
|
|
|
34973
34990
|
};
|
|
34974
34991
|
}
|
|
34975
34992
|
}
|
|
34993
|
+
const fileContext = getFileContext(current.filePath);
|
|
34994
|
+
if (fileContext !== "production") current = {
|
|
34995
|
+
...current,
|
|
34996
|
+
fileContext
|
|
34997
|
+
};
|
|
34976
34998
|
return current;
|
|
34977
34999
|
} };
|
|
34978
35000
|
};
|
|
@@ -35347,10 +35369,41 @@ const PACKAGE_JSON_CONFIG_KEY = "reactDoctor";
|
|
|
35347
35369
|
const LEGACY_CONFIG_FILENAME = "react-doctor.config.json";
|
|
35348
35370
|
const jiti = createJiti(import.meta.url);
|
|
35349
35371
|
const formatError = (error) => error instanceof Error ? error.message : String(error);
|
|
35350
|
-
const
|
|
35351
|
-
const imported = await
|
|
35372
|
+
const importDefaultExport = async (jitiInstance, filePath) => {
|
|
35373
|
+
const imported = await jitiInstance.import(filePath);
|
|
35352
35374
|
return imported?.default ?? imported;
|
|
35353
35375
|
};
|
|
35376
|
+
const SELF_PACKAGE_IMPORT_SPECIFIER = "react-doctor/api";
|
|
35377
|
+
const SELF_PACKAGE_RESOLVE_TARGETS = ["react-doctor/api", "@react-doctor/core"];
|
|
35378
|
+
const MODULE_NOT_FOUND_ERROR_CODES = new Set(["MODULE_NOT_FOUND", "ERR_MODULE_NOT_FOUND"]);
|
|
35379
|
+
let selfAliasJiti;
|
|
35380
|
+
const getSelfAliasJiti = () => {
|
|
35381
|
+
if (selfAliasJiti !== void 0) return selfAliasJiti;
|
|
35382
|
+
for (const resolveTarget of SELF_PACKAGE_RESOLVE_TARGETS) try {
|
|
35383
|
+
const aliasTargetPath = fileURLToPath(jiti.esmResolve(resolveTarget));
|
|
35384
|
+
selfAliasJiti = createJiti(import.meta.url, { alias: { [SELF_PACKAGE_IMPORT_SPECIFIER]: aliasTargetPath } });
|
|
35385
|
+
return selfAliasJiti;
|
|
35386
|
+
} catch {
|
|
35387
|
+
continue;
|
|
35388
|
+
}
|
|
35389
|
+
selfAliasJiti = null;
|
|
35390
|
+
return selfAliasJiti;
|
|
35391
|
+
};
|
|
35392
|
+
const isSelfPackageResolutionError = (error) => error instanceof Error && "code" in error && typeof error.code === "string" && MODULE_NOT_FOUND_ERROR_CODES.has(error.code) && error.message.includes(SELF_PACKAGE_IMPORT_SPECIFIER);
|
|
35393
|
+
const loadModuleConfig = async (filePath) => {
|
|
35394
|
+
try {
|
|
35395
|
+
return await importDefaultExport(jiti, filePath);
|
|
35396
|
+
} catch (error) {
|
|
35397
|
+
if (!isSelfPackageResolutionError(error)) throw error;
|
|
35398
|
+
const aliasJiti = getSelfAliasJiti();
|
|
35399
|
+
if (!aliasJiti) throw error;
|
|
35400
|
+
try {
|
|
35401
|
+
return await importDefaultExport(aliasJiti, filePath);
|
|
35402
|
+
} catch (retryError) {
|
|
35403
|
+
throw new Error(`${formatError(error)} (retry with ${SELF_PACKAGE_IMPORT_SPECIFIER} aliased to the running react-doctor package also failed: ${formatError(retryError)})`, { cause: retryError });
|
|
35404
|
+
}
|
|
35405
|
+
}
|
|
35406
|
+
};
|
|
35354
35407
|
const readDataConfig = (filePath) => parseJSON5(NFS.readFileSync(filePath, "utf-8"));
|
|
35355
35408
|
const readEmbeddedPackageJsonConfig = (directory) => {
|
|
35356
35409
|
const packageJsonPath = Path.join(directory, PACKAGE_JSON_FILENAME);
|
|
@@ -36010,6 +36063,17 @@ const checkPnpmHardening = (rootDirectory) => {
|
|
|
36010
36063
|
}));
|
|
36011
36064
|
return diagnostics;
|
|
36012
36065
|
};
|
|
36066
|
+
const buildReactNativeDiagnostic = (input) => ({
|
|
36067
|
+
filePath: input.filePath,
|
|
36068
|
+
plugin: "react-doctor",
|
|
36069
|
+
rule: input.rule,
|
|
36070
|
+
severity: input.severity ?? "warning",
|
|
36071
|
+
message: input.message,
|
|
36072
|
+
help: input.help,
|
|
36073
|
+
line: input.line ?? 0,
|
|
36074
|
+
column: input.column ?? 0,
|
|
36075
|
+
category: input.category ?? "Correctness"
|
|
36076
|
+
});
|
|
36013
36077
|
const BUILDER_BOB_PACKAGE = "react-native-builder-bob";
|
|
36014
36078
|
const isBuilderBobLibrary = (packageJson) => {
|
|
36015
36079
|
const bobConfig = packageJson[BUILDER_BOB_PACKAGE];
|
|
@@ -36021,17 +36085,12 @@ const checkReactNativeLibraryDependencies = (rootDirectory) => {
|
|
|
36021
36085
|
const misplaced = ["react", "react-native"].filter((name) => packageJson.dependencies?.[name] !== void 0);
|
|
36022
36086
|
if (misplaced.length === 0) return [];
|
|
36023
36087
|
const quoted = misplaced.map((name) => `"${name}"`).join(" and ");
|
|
36024
|
-
return [{
|
|
36088
|
+
return [buildReactNativeDiagnostic({
|
|
36025
36089
|
filePath: "package.json",
|
|
36026
|
-
plugin: "react-doctor",
|
|
36027
36090
|
rule: "rn-library-react-in-dependencies",
|
|
36028
|
-
severity: "warning",
|
|
36029
36091
|
message: `This react-native-builder-bob library lists ${quoted} in \`dependencies\` — that ships a second copy into consumer apps, causing "Invalid hook call" (duplicate React) and duplicate-native-module crashes.`,
|
|
36030
|
-
help: `Move ${quoted} to \`peerDependencies\` (keep ${misplaced.length === 1 ? "it" : "them"} in \`devDependencies\` for local development)
|
|
36031
|
-
|
|
36032
|
-
column: 0,
|
|
36033
|
-
category: "Correctness"
|
|
36034
|
-
}];
|
|
36092
|
+
help: `Move ${quoted} to \`peerDependencies\` (keep ${misplaced.length === 1 ? "it" : "them"} in \`devDependencies\` for local development).`
|
|
36093
|
+
})];
|
|
36035
36094
|
};
|
|
36036
36095
|
const BABEL_CONFIG_FILE_NAMES = [
|
|
36037
36096
|
"babel.config.js",
|
|
@@ -36043,6 +36102,8 @@ const BABEL_CONFIG_FILE_NAMES = [
|
|
|
36043
36102
|
".babelrc.json"
|
|
36044
36103
|
];
|
|
36045
36104
|
const LEGACY_PRESET_SPEC = "module:metro-react-native-babel-preset";
|
|
36105
|
+
const MODERN_PRESET_REFERENCE = new RegExp(`['"]module:@react-native/babel-preset['"]`);
|
|
36106
|
+
const ENABLE_BABEL_RUNTIME_VERSION = /enableBabelRuntime["']?\s*:\s*['"]/;
|
|
36046
36107
|
const checkReactNativeMetroBabelPreset = (rootDirectory) => {
|
|
36047
36108
|
for (const fileName of BABEL_CONFIG_FILE_NAMES) {
|
|
36048
36109
|
const filePath = Path.join(rootDirectory, fileName);
|
|
@@ -36053,18 +36114,20 @@ const checkReactNativeMetroBabelPreset = (rootDirectory) => {
|
|
|
36053
36114
|
} catch {
|
|
36054
36115
|
continue;
|
|
36055
36116
|
}
|
|
36056
|
-
if (
|
|
36057
|
-
return [{
|
|
36117
|
+
if (contents.includes(LEGACY_PRESET_SPEC)) return [buildReactNativeDiagnostic({
|
|
36058
36118
|
filePath: fileName,
|
|
36059
|
-
plugin: "react-doctor",
|
|
36060
36119
|
rule: "rn-no-metro-babel-preset",
|
|
36061
36120
|
severity: "error",
|
|
36062
36121
|
message: "`module:metro-react-native-babel-preset` was renamed to `@react-native/babel-preset` and is no longer installed by React Native 0.73+ — this preset reference fails to resolve and breaks the Metro/Babel transform.",
|
|
36063
|
-
help: "Replace the preset with `module:@react-native/babel-preset` (or `babel-preset-expo` on Expo) and remove the old `metro-react-native-babel-preset` dependency."
|
|
36064
|
-
|
|
36065
|
-
|
|
36066
|
-
|
|
36067
|
-
|
|
36122
|
+
help: "Replace the preset with `module:@react-native/babel-preset` (or `babel-preset-expo` on Expo) and remove the old `metro-react-native-babel-preset` dependency."
|
|
36123
|
+
})];
|
|
36124
|
+
if (MODERN_PRESET_REFERENCE.test(contents) && !ENABLE_BABEL_RUNTIME_VERSION.test(contents)) return [buildReactNativeDiagnostic({
|
|
36125
|
+
filePath: fileName,
|
|
36126
|
+
rule: "rn-no-metro-babel-runtime-version",
|
|
36127
|
+
severity: "warning",
|
|
36128
|
+
message: "`module:@react-native/babel-preset` has no `enableBabelRuntime` version, so Babel runtime helpers can be duplicated across files instead of imported once from @babel/runtime, increasing the JS bundle size.",
|
|
36129
|
+
help: "Set `enableBabelRuntime` to the @babel/runtime version from package.json, e.g. `['module:@react-native/babel-preset', { enableBabelRuntime: '^7.26.0' }]`."
|
|
36130
|
+
})];
|
|
36068
36131
|
}
|
|
36069
36132
|
return [];
|
|
36070
36133
|
};
|
|
@@ -38460,8 +38523,18 @@ const shouldSuppressLocalUseHookDiagnostic = (diagnostic, rootDirectory) => {
|
|
|
38460
38523
|
return bindingResolution !== null && !bindingResolution.isReactUseBinding;
|
|
38461
38524
|
};
|
|
38462
38525
|
const FILEPATH_WITH_LOCATION_PATTERN = /\S+\.\w+:\d+:\d+[\s\S]*$/;
|
|
38526
|
+
const LEADING_SEVERITY_LABEL_PATTERN = /^(?:Error|Warning):\s*/;
|
|
38527
|
+
const TRAILING_PERIOD_PATTERN = /\.$/;
|
|
38463
38528
|
const REACT_COMPILER_TITLE = "React Compiler can't optimize this";
|
|
38464
|
-
const
|
|
38529
|
+
const REACT_COMPILER_TODO_TITLE = "React Compiler doesn't support this syntax";
|
|
38530
|
+
const REACT_COMPILER_IMPACT = "This component misses React Compiler's automatic memoization & re-renders more than it should";
|
|
38531
|
+
const REACT_COMPILER_ACTION = "Rewrite the flagged code so the compiler can optimize it.";
|
|
38532
|
+
const REACT_COMPILER_GENERIC_MESSAGE = `${REACT_COMPILER_IMPACT}. ${REACT_COMPILER_ACTION}`;
|
|
38533
|
+
const buildReactCompilerMessage = (reasonSummary) => {
|
|
38534
|
+
const normalizedSummary = reasonSummary.replace(TRAILING_PERIOD_PATTERN, "");
|
|
38535
|
+
if (!normalizedSummary) return REACT_COMPILER_GENERIC_MESSAGE;
|
|
38536
|
+
return `${REACT_COMPILER_IMPACT}: ${normalizedSummary}. ${REACT_COMPILER_ACTION}`;
|
|
38537
|
+
};
|
|
38465
38538
|
const PLUGIN_CATEGORY_MAP = {
|
|
38466
38539
|
react: "Bugs",
|
|
38467
38540
|
"react-hooks": "Bugs",
|
|
@@ -38488,7 +38561,10 @@ const getRuleRecommendation = (ruleName, project) => {
|
|
|
38488
38561
|
};
|
|
38489
38562
|
const getRuleCategory = (ruleName) => reactDoctorPlugin.rules[ruleName]?.category;
|
|
38490
38563
|
const getRuleTitle = (ruleName) => reactDoctorPlugin.rules[ruleName]?.title;
|
|
38491
|
-
const resolveDiagnosticTitle = (plugin, rule) =>
|
|
38564
|
+
const resolveDiagnosticTitle = (plugin, rule) => {
|
|
38565
|
+
if (plugin !== "react-hooks-js") return getRuleTitle(rule);
|
|
38566
|
+
return rule === "todo" ? REACT_COMPILER_TODO_TITLE : REACT_COMPILER_TITLE;
|
|
38567
|
+
};
|
|
38492
38568
|
const cleanDiagnosticMessage = (message, help, plugin, rule, project) => {
|
|
38493
38569
|
const cleaned = resolveCleanedDiagnostic(typeof message === "string" ? message : "", typeof help === "string" ? help : "", plugin, rule, project);
|
|
38494
38570
|
return {
|
|
@@ -38497,10 +38573,19 @@ const cleanDiagnosticMessage = (message, help, plugin, rule, project) => {
|
|
|
38497
38573
|
};
|
|
38498
38574
|
};
|
|
38499
38575
|
const resolveCleanedDiagnostic = (message, help, plugin, rule, project) => {
|
|
38500
|
-
if (plugin === "react-hooks-js")
|
|
38501
|
-
message
|
|
38502
|
-
|
|
38503
|
-
|
|
38576
|
+
if (plugin === "react-hooks-js") {
|
|
38577
|
+
const bailoutReason = message.replace(FILEPATH_WITH_LOCATION_PATTERN, "").trim().replace(LEADING_SEVERITY_LABEL_PATTERN, "").trim();
|
|
38578
|
+
if (rule === "todo") return {
|
|
38579
|
+
message: REACT_COMPILER_GENERIC_MESSAGE,
|
|
38580
|
+
help: appendReanimatedSharedValueHint(bailoutReason || help, rule, project)
|
|
38581
|
+
};
|
|
38582
|
+
const [reasonSummary = "", ...reasonDetailLines] = bailoutReason.split("\n");
|
|
38583
|
+
const reasonDetail = reasonDetailLines.join("\n").trim();
|
|
38584
|
+
return {
|
|
38585
|
+
message: buildReactCompilerMessage(reasonSummary.trim()),
|
|
38586
|
+
help: appendReanimatedSharedValueHint(reasonDetail || help, rule, project)
|
|
38587
|
+
};
|
|
38588
|
+
}
|
|
38504
38589
|
return {
|
|
38505
38590
|
message: message.replace(FILEPATH_WITH_LOCATION_PATTERN, "").trim() || message,
|
|
38506
38591
|
help: help || getRuleRecommendation(rule, project) || ""
|
|
@@ -39167,7 +39252,7 @@ const ScoreApiResponseSchema = Struct({
|
|
|
39167
39252
|
})))
|
|
39168
39253
|
});
|
|
39169
39254
|
const parseScoreResult = (value) => getOrNull(decodeUnknownOption(ScoreApiResponseSchema)(value));
|
|
39170
|
-
const
|
|
39255
|
+
const stripLocalFileFields = (diagnostics) => diagnostics.map(({ filePath: _filePath, fileContext: _fileContext, ...rest }) => rest);
|
|
39171
39256
|
const isAbortError = (error) => error instanceof Error && (error.name === "AbortError" || error.name === "TimeoutError");
|
|
39172
39257
|
const describeFailure = (error) => {
|
|
39173
39258
|
if (isAbortError(error)) return `timed out after ${FETCH_TIMEOUT_MS / 1e3}s`;
|
|
@@ -39180,7 +39265,7 @@ const calculateScore = async (diagnostics, options = {}) => {
|
|
|
39180
39265
|
const requestUrl = options.isCi ? `${SCORE_API_URL}?ci=1` : SCORE_API_URL;
|
|
39181
39266
|
try {
|
|
39182
39267
|
const compressedBody = gzipSync(JSON.stringify({
|
|
39183
|
-
diagnostics:
|
|
39268
|
+
diagnostics: stripLocalFileFields(diagnostics),
|
|
39184
39269
|
...options.metadata?.repo ? { repo: options.metadata.repo } : {},
|
|
39185
39270
|
...options.metadata?.sha ? { sha: options.metadata.sha } : {},
|
|
39186
39271
|
...options.metadata?.framework ? { framework: options.metadata.framework } : {},
|
|
@@ -41709,6 +41794,8 @@ const METRIC = {
|
|
|
41709
41794
|
cliInvoked: "cli.invoked",
|
|
41710
41795
|
cliError: "cli.error",
|
|
41711
41796
|
projectDetected: "project.detected",
|
|
41797
|
+
projectPathSelected: "project.path_selected",
|
|
41798
|
+
projectConfigSelected: "project.config_selected",
|
|
41712
41799
|
scanCompleted: "scan.completed",
|
|
41713
41800
|
scanDuration: "scan.duration",
|
|
41714
41801
|
scanPhaseDuration: "scan.phase_duration",
|
|
@@ -42052,5 +42139,5 @@ const startLanguageServer = () => {
|
|
|
42052
42139
|
};
|
|
42053
42140
|
//#endregion
|
|
42054
42141
|
export { startLanguageServer };
|
|
42055
|
-
!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]="
|
|
42056
|
-
//# debugId=
|
|
42142
|
+
!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]="56107f8d-59c1-54a1-8422-625ba4b630a0")}catch(e){}}();
|
|
42143
|
+
//# debugId=56107f8d-59c1-54a1-8422-625ba4b630a0
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "react-doctor",
|
|
3
|
-
"version": "0.5.1-dev.
|
|
3
|
+
"version": "0.5.1-dev.3de9106",
|
|
4
4
|
"description": "Your agent writes bad React. This catches it",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"accessibility",
|
|
@@ -54,7 +54,7 @@
|
|
|
54
54
|
"agent-install": "0.0.5",
|
|
55
55
|
"conf": "^15.1.0",
|
|
56
56
|
"confbox": "^0.2.4",
|
|
57
|
-
"deslop-js": "^0.0.
|
|
57
|
+
"deslop-js": "^0.0.24",
|
|
58
58
|
"eslint-plugin-react-hooks": "^7.1.1",
|
|
59
59
|
"jiti": "^2.7.0",
|
|
60
60
|
"magicast": "^0.5.3",
|
|
@@ -64,7 +64,7 @@
|
|
|
64
64
|
"vscode-languageserver": "^9.0.1",
|
|
65
65
|
"vscode-languageserver-textdocument": "^1.0.12",
|
|
66
66
|
"vscode-uri": "^3.1.0",
|
|
67
|
-
"oxlint-plugin-react-doctor": "0.5.1-dev.
|
|
67
|
+
"oxlint-plugin-react-doctor": "0.5.1-dev.3de9106"
|
|
68
68
|
},
|
|
69
69
|
"devDependencies": {
|
|
70
70
|
"@types/babel__code-frame": "^7.27.0",
|
|
@@ -72,8 +72,8 @@
|
|
|
72
72
|
"@xterm/headless": "^6.0.0",
|
|
73
73
|
"commander": "^14.0.3",
|
|
74
74
|
"ora": "^9.4.0",
|
|
75
|
-
"@react-doctor/core": "0.5.1",
|
|
76
75
|
"@react-doctor/api": "0.5.1",
|
|
76
|
+
"@react-doctor/core": "0.5.1",
|
|
77
77
|
"@react-doctor/language-server": "0.5.1"
|
|
78
78
|
},
|
|
79
79
|
"engines": {
|