react-doctor 0.5.1-dev.94f9f4f → 0.5.1-dev.9cc6555

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
@@ -19283,6 +19283,7 @@ var Diagnostic = class extends Class("Diagnostic")({
19283
19283
  endLine: optional(Number$1),
19284
19284
  endColumn: optional(Number$1),
19285
19285
  category: String$1,
19286
+ fileContext: optional(Literals(["test", "story"])),
19286
19287
  suppressionHint: optional(String$1),
19287
19288
  relatedLocations: optional(ArraySchema(DiagnosticRelatedLocation))
19288
19289
  }) {};
@@ -34630,8 +34631,10 @@ const isFileIgnoredByPatterns = (filePath, rootDirectory, patterns) => {
34630
34631
  const relativePath = toRelativePath(filePath, rootDirectory);
34631
34632
  return patterns.some((pattern) => pattern.test(relativePath));
34632
34633
  };
34634
+ const SCRIPT_EXTENSION_FRAGMENT = "[cm]?[jt]sx?";
34635
+ const STORY_FILE_SUFFIX_PATTERN = new RegExp(`\\.(?:stories|story)\\.(?:${SCRIPT_EXTENSION_FRAGMENT})$`);
34636
+ const TEST_FILE_SUFFIX_PATTERN = new RegExp(`\\.(?:test|spec|fixture|fixtures)\\.(?:${SCRIPT_EXTENSION_FRAGMENT})$`);
34633
34637
  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
34638
  const FIXTURE_PROJECT_PATTERN = /\/(?:fixtures|__fixtures__)\//;
34636
34639
  const SOURCE_ROOT_PATTERN = /\/(?:src|app|lib|components|pages|features|modules|packages|apps|frontend|client)\//g;
34637
34640
  const stripAboveSourceRoot = (relativePath) => {
@@ -34642,12 +34645,23 @@ const stripAboveSourceRoot = (relativePath) => {
34642
34645
  if (lastIdx >= 0) return relativePath.slice(lastIdx);
34643
34646
  return relativePath.slice(fixtureMatch.index + fixtureMatch[0].length - 1);
34644
34647
  };
34645
- const isTestFilePath = (relativePath) => {
34646
- if (relativePath.length === 0) return false;
34648
+ /**
34649
+ * Classifies where a file sits relative to shipped code. A finding in a
34650
+ * `.stories.tsx` or `.spec.ts` file never runs in front of users, so
34651
+ * renderers label those sites instead of framing them as production
34652
+ * impact (`rn-no-raw-text` in a spec doesn't say users crash).
34653
+ *
34654
+ * `"story"` is the `.stories.*` / `.story.*` suffix; `"test"` is the
34655
+ * test/spec/fixture suffixes and test directories; `"production"` is
34656
+ * the default.
34657
+ */
34658
+ const classifyFileContext = (relativePath) => {
34659
+ if (relativePath.length === 0) return "production";
34647
34660
  const forwardSlashed = relativePath.replaceAll("\\", "/");
34648
- if (TEST_FILE_SUFFIX_PATTERN.test(forwardSlashed)) return true;
34661
+ if (STORY_FILE_SUFFIX_PATTERN.test(forwardSlashed)) return "story";
34662
+ if (TEST_FILE_SUFFIX_PATTERN.test(forwardSlashed)) return "test";
34649
34663
  const scoped = stripAboveSourceRoot(forwardSlashed);
34650
- return TEST_FILE_DIRECTORY_PATTERN.test(scoped);
34664
+ return TEST_FILE_DIRECTORY_PATTERN.test(scoped) ? "test" : "production";
34651
34665
  };
34652
34666
  /**
34653
34667
  * Resolves the user-configured severity override for a rule.
@@ -34867,6 +34881,8 @@ const collectStringSet = (values) => {
34867
34881
  * 5. `rn-no-raw-text` suppression via configured `textComponents` and
34868
34882
  * `rawTextWrapperComponents` (config-driven JSX enclosure checks)
34869
34883
  * 6. inline suppressions (`// react-doctor-disable-next-line ...`)
34884
+ * 7. file-context stamping (`fileContext: "test" | "story"` on
34885
+ * survivors in non-production files, so renderers can label them)
34870
34886
  *
34871
34887
  * Returns `null` when the diagnostic is dropped, the (possibly
34872
34888
  * severity-restamped) diagnostic otherwise.
@@ -34886,7 +34902,7 @@ const buildDiagnosticPipeline = (input) => {
34886
34902
  const hasTextComponents = textComponentNames.size > 0;
34887
34903
  const hasRawTextWrappers = rawTextWrapperComponentNames.size > 0;
34888
34904
  const fileLinesCache = /* @__PURE__ */ new Map();
34889
- const testFileCache = /* @__PURE__ */ new Map();
34905
+ const fileContextCache = /* @__PURE__ */ new Map();
34890
34906
  const libraryFileCache = /* @__PURE__ */ new Map();
34891
34907
  const isLibraryFile = (filePath) => {
34892
34908
  let cached = libraryFileCache.get(filePath);
@@ -34903,11 +34919,11 @@ const buildDiagnosticPipeline = (input) => {
34903
34919
  fileLinesCache.set(filePath, lines);
34904
34920
  return lines;
34905
34921
  };
34906
- const isTest = (filePath) => {
34907
- let cached = testFileCache.get(filePath);
34922
+ const getFileContext = (filePath) => {
34923
+ let cached = fileContextCache.get(filePath);
34908
34924
  if (cached === void 0) {
34909
- cached = isTestFilePath(filePath);
34910
- testFileCache.set(filePath, cached);
34925
+ cached = classifyFileContext(filePath);
34926
+ fileContextCache.set(filePath, cached);
34911
34927
  }
34912
34928
  return cached;
34913
34929
  };
@@ -34916,7 +34932,7 @@ const buildDiagnosticPipeline = (input) => {
34916
34932
  const rule = reactDoctorPlugin.rules[diagnostic.rule];
34917
34933
  if (!rule?.tags?.includes("test-noise")) return false;
34918
34934
  if (rule.tags.includes("migration-hint")) return false;
34919
- return isTest(diagnostic.filePath);
34935
+ return getFileContext(diagnostic.filePath) !== "production";
34920
34936
  };
34921
34937
  const isRuleIgnored = (ruleIdentifier) => {
34922
34938
  for (const ignored of ignoredRules) if (isSameRuleKey(ignored, ruleIdentifier)) return true;
@@ -34973,6 +34989,11 @@ const buildDiagnosticPipeline = (input) => {
34973
34989
  };
34974
34990
  }
34975
34991
  }
34992
+ const fileContext = getFileContext(current.filePath);
34993
+ if (fileContext !== "production") current = {
34994
+ ...current,
34995
+ fileContext
34996
+ };
34976
34997
  return current;
34977
34998
  } };
34978
34999
  };
@@ -37020,6 +37041,42 @@ var Files = class Files extends Service()("react-doctor/Files") {
37020
37041
  }));
37021
37042
  };
37022
37043
  };
37044
+ const HUNK_HEADER_PATTERN = /^@@ -\d+(?:,\d+)? \+(\d+)(?:,(\d+))? @@/;
37045
+ /**
37046
+ * Parses a `git diff --unified=0` patch into the inclusive 1-based line ranges
37047
+ * each file added or modified on the new side. Files are keyed by the path in
37048
+ * the `+++ b/<path>` header (with `--relative`, relative to the diff's cwd).
37049
+ * Added/renamed/modified files appear; pure deletions (`+++ /dev/null`) are
37050
+ * skipped because they have no new-side line to report on.
37051
+ */
37052
+ const parseChangedLineRanges = (patch) => {
37053
+ const rangesByFile = /* @__PURE__ */ new Map();
37054
+ let currentRanges = null;
37055
+ for (const line of patch.split("\n")) {
37056
+ if (line.startsWith("+++ ")) {
37057
+ const target = line.slice(4).trim();
37058
+ if (target === "/dev/null") {
37059
+ currentRanges = null;
37060
+ continue;
37061
+ }
37062
+ const file = target.startsWith("b/") ? target.slice(2) : target;
37063
+ currentRanges = rangesByFile.get(file) ?? [];
37064
+ rangesByFile.set(file, currentRanges);
37065
+ continue;
37066
+ }
37067
+ if (currentRanges === null) continue;
37068
+ const hunk = HUNK_HEADER_PATTERN.exec(line);
37069
+ if (hunk === null) continue;
37070
+ const start = Number(hunk[1]);
37071
+ const lineCount = hunk[2] === void 0 ? 1 : Number(hunk[2]);
37072
+ if (lineCount <= 0) continue;
37073
+ currentRanges.push([start, start + lineCount - 1]);
37074
+ }
37075
+ return [...rangesByFile].filter(([, ranges]) => ranges.length > 0).map(([file, ranges]) => ({
37076
+ file,
37077
+ ranges
37078
+ }));
37079
+ };
37023
37080
  const trimOrNull = (value) => {
37024
37081
  const trimmed = value.trim();
37025
37082
  return trimmed.length === 0 ? null : trimmed;
@@ -37385,6 +37442,22 @@ var Git = class Git extends Service()("react-doctor/Git") {
37385
37442
  status: result.status,
37386
37443
  stdout: result.stdout
37387
37444
  };
37445
+ }),
37446
+ changedLineRanges: ({ directory, baseRef, cached, files }) => gen(function* () {
37447
+ if (files.length === 0) return [];
37448
+ if (baseRef !== void 0 && !isSafeGitRevision(baseRef)) return null;
37449
+ const result = yield* runGit(directory, [
37450
+ "diff",
37451
+ "--unified=0",
37452
+ "--diff-filter=ACMR",
37453
+ "--relative",
37454
+ ...cached ? ["--cached"] : [],
37455
+ ...baseRef !== void 0 ? [baseRef] : [],
37456
+ "--",
37457
+ ...files
37458
+ ]);
37459
+ if (result.status !== 0) return null;
37460
+ return parseChangedLineRanges(result.stdout);
37388
37461
  })
37389
37462
  });
37390
37463
  })).pipe(provide$2(layer$2.pipe(provide$2(mergeAll$1(layer$1, layer)))));
@@ -37415,7 +37488,8 @@ var Git = class Git extends Service()("react-doctor/Git") {
37415
37488
  status: matches.length === 0 ? 1 : 0,
37416
37489
  stdout
37417
37490
  };
37418
- })
37491
+ }),
37492
+ changedLineRanges: () => succeed$2(snapshot.changedLineRanges ?? [])
37419
37493
  }));
37420
37494
  };
37421
37495
  const estimateArgsLength = (args) => args.reduce((total, argument) => total + argument.length + 1, 0);
@@ -38407,8 +38481,18 @@ const shouldSuppressLocalUseHookDiagnostic = (diagnostic, rootDirectory) => {
38407
38481
  return bindingResolution !== null && !bindingResolution.isReactUseBinding;
38408
38482
  };
38409
38483
  const FILEPATH_WITH_LOCATION_PATTERN = /\S+\.\w+:\d+:\d+[\s\S]*$/;
38484
+ const LEADING_SEVERITY_LABEL_PATTERN = /^(?:Error|Warning):\s*/;
38485
+ const TRAILING_PERIOD_PATTERN = /\.$/;
38410
38486
  const REACT_COMPILER_TITLE = "React Compiler can't optimize this";
38411
- 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.";
38487
+ const REACT_COMPILER_TODO_TITLE = "React Compiler doesn't support this syntax";
38488
+ const REACT_COMPILER_IMPACT = "This component misses React Compiler's automatic memoization & re-renders more than it should";
38489
+ const REACT_COMPILER_ACTION = "Rewrite the flagged code so the compiler can optimize it.";
38490
+ const REACT_COMPILER_GENERIC_MESSAGE = `${REACT_COMPILER_IMPACT}. ${REACT_COMPILER_ACTION}`;
38491
+ const buildReactCompilerMessage = (reasonSummary) => {
38492
+ const normalizedSummary = reasonSummary.replace(TRAILING_PERIOD_PATTERN, "");
38493
+ if (!normalizedSummary) return REACT_COMPILER_GENERIC_MESSAGE;
38494
+ return `${REACT_COMPILER_IMPACT}: ${normalizedSummary}. ${REACT_COMPILER_ACTION}`;
38495
+ };
38412
38496
  const PLUGIN_CATEGORY_MAP = {
38413
38497
  react: "Bugs",
38414
38498
  "react-hooks": "Bugs",
@@ -38435,7 +38519,10 @@ const getRuleRecommendation = (ruleName, project) => {
38435
38519
  };
38436
38520
  const getRuleCategory = (ruleName) => reactDoctorPlugin.rules[ruleName]?.category;
38437
38521
  const getRuleTitle = (ruleName) => reactDoctorPlugin.rules[ruleName]?.title;
38438
- const resolveDiagnosticTitle = (plugin, rule) => plugin === "react-hooks-js" ? REACT_COMPILER_TITLE : getRuleTitle(rule);
38522
+ const resolveDiagnosticTitle = (plugin, rule) => {
38523
+ if (plugin !== "react-hooks-js") return getRuleTitle(rule);
38524
+ return rule === "todo" ? REACT_COMPILER_TODO_TITLE : REACT_COMPILER_TITLE;
38525
+ };
38439
38526
  const cleanDiagnosticMessage = (message, help, plugin, rule, project) => {
38440
38527
  const cleaned = resolveCleanedDiagnostic(typeof message === "string" ? message : "", typeof help === "string" ? help : "", plugin, rule, project);
38441
38528
  return {
@@ -38444,10 +38531,19 @@ const cleanDiagnosticMessage = (message, help, plugin, rule, project) => {
38444
38531
  };
38445
38532
  };
38446
38533
  const resolveCleanedDiagnostic = (message, help, plugin, rule, project) => {
38447
- if (plugin === "react-hooks-js") return {
38448
- message: REACT_COMPILER_MESSAGE,
38449
- help: appendReanimatedSharedValueHint(message.replace(FILEPATH_WITH_LOCATION_PATTERN, "").trim() || help, rule, project)
38450
- };
38534
+ if (plugin === "react-hooks-js") {
38535
+ const bailoutReason = message.replace(FILEPATH_WITH_LOCATION_PATTERN, "").trim().replace(LEADING_SEVERITY_LABEL_PATTERN, "").trim();
38536
+ if (rule === "todo") return {
38537
+ message: REACT_COMPILER_GENERIC_MESSAGE,
38538
+ help: appendReanimatedSharedValueHint(bailoutReason || help, rule, project)
38539
+ };
38540
+ const [reasonSummary = "", ...reasonDetailLines] = bailoutReason.split("\n");
38541
+ const reasonDetail = reasonDetailLines.join("\n").trim();
38542
+ return {
38543
+ message: buildReactCompilerMessage(reasonSummary.trim()),
38544
+ help: appendReanimatedSharedValueHint(reasonDetail || help, rule, project)
38545
+ };
38546
+ }
38451
38547
  return {
38452
38548
  message: message.replace(FILEPATH_WITH_LOCATION_PATTERN, "").trim() || message,
38453
38549
  help: help || getRuleRecommendation(rule, project) || ""
@@ -39114,7 +39210,7 @@ const ScoreApiResponseSchema = Struct({
39114
39210
  })))
39115
39211
  });
39116
39212
  const parseScoreResult = (value) => getOrNull(decodeUnknownOption(ScoreApiResponseSchema)(value));
39117
- const stripFilePaths = (diagnostics) => diagnostics.map(({ filePath: _filePath, ...rest }) => rest);
39213
+ const stripLocalFileFields = (diagnostics) => diagnostics.map(({ filePath: _filePath, fileContext: _fileContext, ...rest }) => rest);
39118
39214
  const isAbortError = (error) => error instanceof Error && (error.name === "AbortError" || error.name === "TimeoutError");
39119
39215
  const describeFailure = (error) => {
39120
39216
  if (isAbortError(error)) return `timed out after ${FETCH_TIMEOUT_MS / 1e3}s`;
@@ -39127,7 +39223,7 @@ const calculateScore = async (diagnostics, options = {}) => {
39127
39223
  const requestUrl = options.isCi ? `${SCORE_API_URL}?ci=1` : SCORE_API_URL;
39128
39224
  try {
39129
39225
  const compressedBody = gzipSync(JSON.stringify({
39130
- diagnostics: stripFilePaths(diagnostics),
39226
+ diagnostics: stripLocalFileFields(diagnostics),
39131
39227
  ...options.metadata?.repo ? { repo: options.metadata.repo } : {},
39132
39228
  ...options.metadata?.sha ? { sha: options.metadata.sha } : {},
39133
39229
  ...options.metadata?.framework ? { framework: options.metadata.framework } : {},
@@ -39194,25 +39290,36 @@ const decodeArtifact = decodeUnknownOption(Struct({ score: optional(Struct({
39194
39290
  const SCORE_AXES = [
39195
39291
  {
39196
39292
  key: "supplyChain",
39197
- label: "supply chain"
39293
+ label: "supply chain",
39294
+ gates: true
39198
39295
  },
39199
39296
  {
39200
39297
  key: "vulnerability",
39201
- label: "vulnerability"
39298
+ label: "vulnerability",
39299
+ gates: true
39202
39300
  },
39203
39301
  {
39204
39302
  key: "maintenance",
39205
- label: "maintenance"
39303
+ label: "maintenance",
39304
+ gates: false
39206
39305
  },
39207
39306
  {
39208
39307
  key: "quality",
39209
- label: "quality"
39308
+ label: "quality",
39309
+ gates: false
39210
39310
  },
39211
39311
  {
39212
39312
  key: "license",
39213
- label: "license"
39313
+ label: "license",
39314
+ gates: false
39214
39315
  }
39215
39316
  ];
39317
+ const GATED_AXES = SCORE_AXES.filter((axis) => axis.gates);
39318
+ const worstGatedAxis = (score) => {
39319
+ let worst = GATED_AXES[0];
39320
+ for (const axis of GATED_AXES) if (score[axis.key] < score[worst.key]) worst = axis;
39321
+ return worst;
39322
+ };
39216
39323
  const clampScore = (value) => {
39217
39324
  if (!Number.isFinite(value)) return 50;
39218
39325
  return Math.min(Math.max(value, 0), 100);
@@ -39328,15 +39435,14 @@ const fetchSocketScore = (dependency) => tryPromise(async (signal) => {
39328
39435
  "socket.purl": toPurl(dependency)
39329
39436
  } }));
39330
39437
  const formatAxisScores = (score) => SCORE_AXES.map((axis) => `${axis.label} ${toHundred(score[axis.key])}`).join(", ");
39331
- const buildLowScoreDiagnostic = (dependency, score, options) => {
39332
- const overall = toHundred(score.overall);
39438
+ const buildLowScoreDiagnostic = (dependency, score, failingAxis, options) => {
39333
39439
  const packagePageUrl = `${SOCKET_PACKAGE_PAGE_BASE}/${dependency.name}/overview/${dependency.version}`;
39334
39440
  return {
39335
39441
  filePath: "package.json",
39336
39442
  plugin: SUPPLY_CHAIN_PLUGIN,
39337
39443
  rule: SUPPLY_CHAIN_RULE,
39338
39444
  severity: options.severity,
39339
- 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)}.`,
39445
+ 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)}.`,
39340
39446
  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.`,
39341
39447
  url: packagePageUrl,
39342
39448
  line: dependency.line,
@@ -39348,7 +39454,9 @@ const buildLowScoreDiagnostic = (dependency, score, options) => {
39348
39454
  * Scores every direct dependency in the project's `package.json` against
39349
39455
  * Socket.dev's free PURL endpoint (the same one Socket Firewall's free tier
39350
39456
  * uses — no API key) and returns a diagnostic for each dependency whose
39351
- * Socket `overall` score is below the configured `minScore`.
39457
+ * worst Socket *security* axis — supply chain or vulnerability — is below
39458
+ * the configured `minScore`. The quality / maintenance / license axes are
39459
+ * reported as context but never gate (see GATED_AXES).
39352
39460
  *
39353
39461
  * Lookups run with bounded concurrency via `Effect.forEach`. The check is
39354
39462
  * total/fail-open: each per-package lookup already recovers to `null`
@@ -39366,8 +39474,9 @@ const checkSupplyChain = (input) => gen(function* () {
39366
39474
  for (let index = 0; index < dependencies.length; index += 1) {
39367
39475
  const score = scores[index];
39368
39476
  if (!score) continue;
39369
- if (toHundred(score.overall) >= options.minScore) continue;
39370
- diagnostics.push(buildLowScoreDiagnostic(dependencies[index], score, options));
39477
+ const worstAxis = worstGatedAxis(score);
39478
+ if (toHundred(score[worstAxis.key]) >= options.minScore) continue;
39479
+ diagnostics.push(buildLowScoreDiagnostic(dependencies[index], score, worstAxis, options));
39371
39480
  }
39372
39481
  return diagnostics;
39373
39482
  });
@@ -39375,7 +39484,8 @@ const checkSupplyChain = (input) => gen(function* () {
39375
39484
  * `SupplyChain` scores the project's direct dependencies against Socket.dev's
39376
39485
  * free, keyless PURL endpoint — the same lookup Socket Firewall's free tier
39377
39486
  * (`sfw`) performs — and streams a diagnostic for each dependency whose
39378
- * Socket score falls below the configured `supplyChain.minScore`.
39487
+ * worst Socket security axis (supply chain or vulnerability) falls below
39488
+ * the configured `supplyChain.minScore`.
39379
39489
  *
39380
39490
  * Runs by default (one network request per dependency); the orchestrator
39381
39491
  * provides `layerOf([])` only when the user opts out via
@@ -41642,6 +41752,8 @@ const METRIC = {
41642
41752
  cliInvoked: "cli.invoked",
41643
41753
  cliError: "cli.error",
41644
41754
  projectDetected: "project.detected",
41755
+ projectPathSelected: "project.path_selected",
41756
+ projectConfigSelected: "project.config_selected",
41645
41757
  scanCompleted: "scan.completed",
41646
41758
  scanDuration: "scan.duration",
41647
41759
  scanPhaseDuration: "scan.phase_duration",
@@ -41985,5 +42097,5 @@ const startLanguageServer = () => {
41985
42097
  };
41986
42098
  //#endregion
41987
42099
  export { startLanguageServer };
41988
- !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]="217c2f1d-b087-575b-ba00-b912f07ad825")}catch(e){}}();
41989
- //# debugId=217c2f1d-b087-575b-ba00-b912f07ad825
42100
+ !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]="d189cded-30cd-5adf-aa54-2429b20c538b")}catch(e){}}();
42101
+ //# debugId=d189cded-30cd-5adf-aa54-2429b20c538b
@@ -10,13 +10,13 @@ Scans React codebases for security, performance, correctness, and architecture i
10
10
 
11
11
  ## After making React code changes:
12
12
 
13
- Run `npx react-doctor@latest --verbose --diff` and check the score did not regress.
13
+ Run `npx react-doctor@latest --verbose --scope changed` and check the score did not regress.
14
14
 
15
15
  If the score dropped, fix the regressions before committing.
16
16
 
17
17
  ## For general cleanup or code improvement:
18
18
 
19
- Run `npx react-doctor@latest --verbose` (without `--diff`) to scan the full codebase. Fix issues by severity — errors first, then warnings.
19
+ Run `npx react-doctor@latest --verbose` (the default `--scope full`) to scan the full codebase. Fix issues by severity — errors first, then warnings.
20
20
 
21
21
  ## /doctor — full local triage workflow
22
22
 
@@ -39,12 +39,13 @@ When the user wants to understand a rule, disagrees with one, or wants to disabl
39
39
  ## Command
40
40
 
41
41
  ```bash
42
- npx react-doctor@latest --verbose --diff
42
+ npx react-doctor@latest --verbose --scope changed
43
43
  ```
44
44
 
45
- | Flag | Purpose |
46
- | ----------- | --------------------------------------------- |
47
- | `.` | Scan current directory |
48
- | `--verbose` | Show affected files and line numbers per rule |
49
- | `--diff` | Only scan changed files vs base branch |
50
- | `--score` | Output only the numeric score |
45
+ | Flag | Purpose |
46
+ | ----------------- | ---------------------------------------------------------------- |
47
+ | `.` | Scan current directory |
48
+ | `--verbose` | Show affected files and line numbers per rule |
49
+ | `--scope changed` | Only report issues introduced vs the base branch (default: full) |
50
+ | `--scope lines` | Only report issues on the changed lines |
51
+ | `--score` | Output only the numeric score |
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-doctor",
3
- "version": "0.5.1-dev.94f9f4f",
3
+ "version": "0.5.1-dev.9cc6555",
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.23",
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.94f9f4f"
67
+ "oxlint-plugin-react-doctor": "0.5.1-dev.9cc6555"
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": {