react-doctor 0.5.1-dev.2f26228 → 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/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
- const isTestFilePath = (relativePath) => {
34646
- if (relativePath.length === 0) return false;
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 (TEST_FILE_SUFFIX_PATTERN.test(forwardSlashed)) return true;
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 testFileCache = /* @__PURE__ */ new Map();
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 isTest = (filePath) => {
34907
- let cached = testFileCache.get(filePath);
34923
+ const getFileContext = (filePath) => {
34924
+ let cached = fileContextCache.get(filePath);
34908
34925
  if (cached === void 0) {
34909
- cached = isTestFilePath(filePath);
34910
- testFileCache.set(filePath, cached);
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 isTest(diagnostic.filePath);
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 loadModuleConfig = async (filePath) => {
35351
- const imported = await jiti.import(filePath);
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
- line: 0,
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 (!contents.includes(LEGACY_PRESET_SPEC)) continue;
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
- line: 0,
36065
- column: 0,
36066
- category: "Correctness"
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 REACT_COMPILER_MESSAGE = "This component misses React Compiler's automatic memoization & re-renders more than it should. Rewrite the flagged code so the compiler can optimize it.";
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) => plugin === "react-hooks-js" ? REACT_COMPILER_TITLE : getRuleTitle(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") return {
38501
- message: REACT_COMPILER_MESSAGE,
38502
- help: appendReanimatedSharedValueHint(message.replace(FILEPATH_WITH_LOCATION_PATTERN, "").trim() || help, rule, project)
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 stripFilePaths = (diagnostics) => diagnostics.map(({ filePath: _filePath, ...rest }) => rest);
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: stripFilePaths(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 } : {},
@@ -39247,25 +39332,36 @@ const decodeArtifact = decodeUnknownOption(Struct({ score: optional(Struct({
39247
39332
  const SCORE_AXES = [
39248
39333
  {
39249
39334
  key: "supplyChain",
39250
- label: "supply chain"
39335
+ label: "supply chain",
39336
+ gates: true
39251
39337
  },
39252
39338
  {
39253
39339
  key: "vulnerability",
39254
- label: "vulnerability"
39340
+ label: "vulnerability",
39341
+ gates: true
39255
39342
  },
39256
39343
  {
39257
39344
  key: "maintenance",
39258
- label: "maintenance"
39345
+ label: "maintenance",
39346
+ gates: false
39259
39347
  },
39260
39348
  {
39261
39349
  key: "quality",
39262
- label: "quality"
39350
+ label: "quality",
39351
+ gates: false
39263
39352
  },
39264
39353
  {
39265
39354
  key: "license",
39266
- label: "license"
39355
+ label: "license",
39356
+ gates: false
39267
39357
  }
39268
39358
  ];
39359
+ const GATED_AXES = SCORE_AXES.filter((axis) => axis.gates);
39360
+ const worstGatedAxis = (score) => {
39361
+ let worst = GATED_AXES[0];
39362
+ for (const axis of GATED_AXES) if (score[axis.key] < score[worst.key]) worst = axis;
39363
+ return worst;
39364
+ };
39269
39365
  const clampScore = (value) => {
39270
39366
  if (!Number.isFinite(value)) return 50;
39271
39367
  return Math.min(Math.max(value, 0), 100);
@@ -39381,15 +39477,14 @@ const fetchSocketScore = (dependency) => tryPromise(async (signal) => {
39381
39477
  "socket.purl": toPurl(dependency)
39382
39478
  } }));
39383
39479
  const formatAxisScores = (score) => SCORE_AXES.map((axis) => `${axis.label} ${toHundred(score[axis.key])}`).join(", ");
39384
- const buildLowScoreDiagnostic = (dependency, score, options) => {
39385
- const overall = toHundred(score.overall);
39480
+ const buildLowScoreDiagnostic = (dependency, score, failingAxis, options) => {
39386
39481
  const packagePageUrl = `${SOCKET_PACKAGE_PAGE_BASE}/${dependency.name}/overview/${dependency.version}`;
39387
39482
  return {
39388
39483
  filePath: "package.json",
39389
39484
  plugin: SUPPLY_CHAIN_PLUGIN,
39390
39485
  rule: SUPPLY_CHAIN_RULE,
39391
39486
  severity: options.severity,
39392
- message: `\`${dependency.name}\` (declared in package.json as "${dependency.spec}", scored at ${dependency.version}) has a Socket supply-chain score of ${overall}/100 (below the minimum of ${options.minScore}). Axis scores — ${formatAxisScores(score)}.`,
39487
+ message: `\`${dependency.name}\` (declared in package.json as "${dependency.spec}", scored at ${dependency.version}) has a Socket ${failingAxis.label} score of ${toHundred(score[failingAxis.key])}/100 (below the minimum of ${options.minScore}). Axis scores — ${formatAxisScores(score)}.`,
39393
39488
  help: `Update or replace the \`"${dependency.name}": "${dependency.spec}"\` entry in package.json. Review ${dependency.name} on Socket: ${packagePageUrl}. Or raise \`supplyChain.minScore\` if you have vetted and accepted this package.`,
39394
39489
  url: packagePageUrl,
39395
39490
  line: dependency.line,
@@ -39401,7 +39496,9 @@ const buildLowScoreDiagnostic = (dependency, score, options) => {
39401
39496
  * Scores every direct dependency in the project's `package.json` against
39402
39497
  * Socket.dev's free PURL endpoint (the same one Socket Firewall's free tier
39403
39498
  * uses — no API key) and returns a diagnostic for each dependency whose
39404
- * Socket `overall` score is below the configured `minScore`.
39499
+ * worst Socket *security* axis — supply chain or vulnerability — is below
39500
+ * the configured `minScore`. The quality / maintenance / license axes are
39501
+ * reported as context but never gate (see GATED_AXES).
39405
39502
  *
39406
39503
  * Lookups run with bounded concurrency via `Effect.forEach`. The check is
39407
39504
  * total/fail-open: each per-package lookup already recovers to `null`
@@ -39419,8 +39516,9 @@ const checkSupplyChain = (input) => gen(function* () {
39419
39516
  for (let index = 0; index < dependencies.length; index += 1) {
39420
39517
  const score = scores[index];
39421
39518
  if (!score) continue;
39422
- if (toHundred(score.overall) >= options.minScore) continue;
39423
- diagnostics.push(buildLowScoreDiagnostic(dependencies[index], score, options));
39519
+ const worstAxis = worstGatedAxis(score);
39520
+ if (toHundred(score[worstAxis.key]) >= options.minScore) continue;
39521
+ diagnostics.push(buildLowScoreDiagnostic(dependencies[index], score, worstAxis, options));
39424
39522
  }
39425
39523
  return diagnostics;
39426
39524
  });
@@ -39428,7 +39526,8 @@ const checkSupplyChain = (input) => gen(function* () {
39428
39526
  * `SupplyChain` scores the project's direct dependencies against Socket.dev's
39429
39527
  * free, keyless PURL endpoint — the same lookup Socket Firewall's free tier
39430
39528
  * (`sfw`) performs — and streams a diagnostic for each dependency whose
39431
- * Socket score falls below the configured `supplyChain.minScore`.
39529
+ * worst Socket security axis (supply chain or vulnerability) falls below
39530
+ * the configured `supplyChain.minScore`.
39432
39531
  *
39433
39532
  * Runs by default (one network request per dependency); the orchestrator
39434
39533
  * provides `layerOf([])` only when the user opts out via
@@ -41695,6 +41794,8 @@ const METRIC = {
41695
41794
  cliInvoked: "cli.invoked",
41696
41795
  cliError: "cli.error",
41697
41796
  projectDetected: "project.detected",
41797
+ projectPathSelected: "project.path_selected",
41798
+ projectConfigSelected: "project.config_selected",
41698
41799
  scanCompleted: "scan.completed",
41699
41800
  scanDuration: "scan.duration",
41700
41801
  scanPhaseDuration: "scan.phase_duration",
@@ -42038,5 +42139,5 @@ const startLanguageServer = () => {
42038
42139
  };
42039
42140
  //#endregion
42040
42141
  export { startLanguageServer };
42041
- !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]="ad272c0f-4a71-56b8-8de2-799b99bcd894")}catch(e){}}();
42042
- //# debugId=ad272c0f-4a71-56b8-8de2-799b99bcd894
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.2f26228",
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,17 +54,17 @@
54
54
  "agent-install": "0.0.5",
55
55
  "conf": "^15.1.0",
56
56
  "confbox": "^0.2.4",
57
- "deslop-js": "^0.0.21",
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",
61
- "oxlint": "^1.66.0",
61
+ "oxlint": ">=1.66.0 <1.67.0",
62
62
  "prompts": "^2.4.2",
63
63
  "typescript": ">=5.0.4 <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.2f26228"
67
+ "oxlint-plugin-react-doctor": "0.5.1-dev.3de9106"
68
68
  },
69
69
  "devDependencies": {
70
70
  "@types/babel__code-frame": "^7.27.0",