react-doctor 0.4.2-dev.7cf52d8 → 0.4.2-dev.98066c2

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/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]="03c21420-4548-560c-9a26-8c22558218d8")}catch(e){}}();
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]="3464aaf0-7929-5863-b44e-a34e909e3e87")}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",
@@ -5483,7 +5482,9 @@ const highlighter = {
5483
5482
  gray: import_picocolors.default.gray,
5484
5483
  bold: import_picocolors.default.bold
5485
5484
  };
5486
- const computeJsxIncludePaths = (includePaths) => includePaths.length > 0 ? includePaths.filter((filePath) => JSX_FILE_PATTERN.test(filePath)) : void 0;
5485
+ const NEXT_ENTRY_FILE_PATTERN = /^(?:\.\/)?(?:src\/)?(?:middleware|proxy)\.(?:tsx?|jsx?|mts|mjs)$/;
5486
+ const shouldIncludeExplicitLintPath = (filePath, project) => JSX_FILE_PATTERN.test(filePath) || project?.framework === "nextjs" && NEXT_ENTRY_FILE_PATTERN.test(filePath);
5487
+ const computeExplicitLintIncludePaths = (includePaths, project) => includePaths.length > 0 ? includePaths.filter((filePath) => shouldIncludeExplicitLintPath(filePath, project)) : void 0;
5487
5488
  const LINGUIST_ATTRIBUTE_PATTERN = /^linguist-(?:vendored|generated)(?:=([a-zA-Z0-9]+))?$/i;
5488
5489
  const FALSY_VALUES = new Set([
5489
5490
  "false",
@@ -6036,11 +6037,11 @@ const listSourceFilesViaFilesystem = (rootDirectory) => {
6036
6037
  return filePaths;
6037
6038
  };
6038
6039
  const listSourceFiles = (rootDirectory) => excludeMinifiedFiles(rootDirectory, listSourceFilesViaGit(rootDirectory) ?? listSourceFilesViaFilesystem(rootDirectory));
6039
- const resolveLintIncludePaths = (rootDirectory, userConfig) => {
6040
+ const resolveLintIncludePaths = (rootDirectory, userConfig, project) => {
6040
6041
  if (!Array.isArray(userConfig?.ignore?.files) || userConfig.ignore.files.length === 0) return;
6041
6042
  const ignoredPatterns = compileIgnoredFilePatterns(userConfig);
6042
6043
  return listSourceFiles(rootDirectory).filter((filePath) => {
6043
- if (!JSX_FILE_PATTERN.test(filePath)) return false;
6044
+ if (!shouldIncludeExplicitLintPath(filePath, project)) return false;
6044
6045
  return !isFileIgnoredByPatterns(filePath, rootDirectory, ignoredPatterns);
6045
6046
  });
6046
6047
  };
@@ -8392,7 +8393,7 @@ const runInspect = (input, hooks = {}) => Effect.gen(function* () {
8392
8393
  directory: scanDirectory,
8393
8394
  repo
8394
8395
  }).pipe(Effect.orElseSucceed(() => null)) : Effect.succeed(null));
8395
- const lintIncludePaths = (input.skipJsxIncludeFilter ? input.includePaths.length > 0 ? [...input.includePaths] : void 0 : computeJsxIncludePaths([...input.includePaths])) ?? resolveLintIncludePaths(scanDirectory, resolvedConfig.config);
8396
+ const lintIncludePaths = (input.skipJsxIncludeFilter ? input.includePaths.length > 0 ? [...input.includePaths] : void 0 : computeExplicitLintIncludePaths([...input.includePaths], project)) ?? resolveLintIncludePaths(scanDirectory, resolvedConfig.config, project);
8396
8397
  const scannedFilePaths = input.suppressScanSummary ? (lintIncludePaths ?? (yield* filesService.listSourceFiles(scanDirectory))).map((relativePath) => path$1.resolve(scanDirectory, relativePath)) : [];
8397
8398
  const beforeLint = hooks.beforeLint ?? NO_HOOKS.beforeLint;
8398
8399
  const afterLint = hooks.afterLint ?? NO_HOOKS.afterLint;
@@ -8990,4 +8991,4 @@ const toJsonReport = (result, options) => buildJsonReport({
8990
8991
  export { AmbiguousProjectError, NoReactDependencyError, NotADirectoryError, PackageJsonNotFoundError, ProjectNotFoundError, ReactDoctorError, buildJsonReport, buildJsonReportError, clearCaches, defineConfig, diagnose, filterSourceFiles, getDiffInfo, isProjectDiscoveryError, isReactDoctorError, summarizeDiagnostics, toJsonReport };
8991
8992
 
8992
8993
  //# sourceMappingURL=index.js.map
8993
- //# debugId=03c21420-4548-560c-9a26-8c22558218d8
8994
+ //# debugId=3464aaf0-7929-5863-b44e-a34e909e3e87
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",
@@ -5420,7 +5419,9 @@ const highlighter = {
5420
5419
  gray: import_picocolors.default.gray,
5421
5420
  bold: import_picocolors.default.bold
5422
5421
  };
5423
- const computeJsxIncludePaths = (includePaths) => includePaths.length > 0 ? includePaths.filter((filePath) => JSX_FILE_PATTERN.test(filePath)) : void 0;
5422
+ const NEXT_ENTRY_FILE_PATTERN = /^(?:\.\/)?(?:src\/)?(?:middleware|proxy)\.(?:tsx?|jsx?|mts|mjs)$/;
5423
+ const shouldIncludeExplicitLintPath = (filePath, project) => JSX_FILE_PATTERN.test(filePath) || project?.framework === "nextjs" && NEXT_ENTRY_FILE_PATTERN.test(filePath);
5424
+ const computeExplicitLintIncludePaths = (includePaths, project) => includePaths.length > 0 ? includePaths.filter((filePath) => shouldIncludeExplicitLintPath(filePath, project)) : void 0;
5424
5425
  const LINGUIST_ATTRIBUTE_PATTERN = /^linguist-(?:vendored|generated)(?:=([a-zA-Z0-9]+))?$/i;
5425
5426
  const FALSY_VALUES = new Set([
5426
5427
  "false",
@@ -5973,11 +5974,11 @@ const listSourceFilesViaFilesystem = (rootDirectory) => {
5973
5974
  return filePaths;
5974
5975
  };
5975
5976
  const listSourceFiles = (rootDirectory) => excludeMinifiedFiles(rootDirectory, listSourceFilesViaGit(rootDirectory) ?? listSourceFilesViaFilesystem(rootDirectory));
5976
- const resolveLintIncludePaths = (rootDirectory, userConfig) => {
5977
+ const resolveLintIncludePaths = (rootDirectory, userConfig, project) => {
5977
5978
  if (!Array.isArray(userConfig?.ignore?.files) || userConfig.ignore.files.length === 0) return;
5978
5979
  const ignoredPatterns = compileIgnoredFilePatterns(userConfig);
5979
5980
  return listSourceFiles(rootDirectory).filter((filePath) => {
5980
- if (!JSX_FILE_PATTERN.test(filePath)) return false;
5981
+ if (!shouldIncludeExplicitLintPath(filePath, project)) return false;
5981
5982
  return !isFileIgnoredByPatterns(filePath, rootDirectory, ignoredPatterns);
5982
5983
  });
5983
5984
  };
@@ -8329,7 +8330,7 @@ const runInspect = (input, hooks = {}) => Effect.gen(function* () {
8329
8330
  directory: scanDirectory,
8330
8331
  repo
8331
8332
  }).pipe(Effect.orElseSucceed(() => null)) : Effect.succeed(null));
8332
- const lintIncludePaths = (input.skipJsxIncludeFilter ? input.includePaths.length > 0 ? [...input.includePaths] : void 0 : computeJsxIncludePaths([...input.includePaths])) ?? resolveLintIncludePaths(scanDirectory, resolvedConfig.config);
8333
+ const lintIncludePaths = (input.skipJsxIncludeFilter ? input.includePaths.length > 0 ? [...input.includePaths] : void 0 : computeExplicitLintIncludePaths([...input.includePaths], project)) ?? resolveLintIncludePaths(scanDirectory, resolvedConfig.config, project);
8333
8334
  const scannedFilePaths = input.suppressScanSummary ? (lintIncludePaths ?? (yield* filesService.listSourceFiles(scanDirectory))).map((relativePath) => path$1.resolve(scanDirectory, relativePath)) : [];
8334
8335
  const beforeLint = hooks.beforeLint ?? NO_HOOKS.beforeLint;
8335
8336
  const afterLint = hooks.afterLint ?? NO_HOOKS.afterLint;
@@ -8806,7 +8807,9 @@ const SCANNABLE_EXTENSIONS = [
8806
8807
  ".ts",
8807
8808
  ".tsx",
8808
8809
  ".js",
8809
- ".jsx"
8810
+ ".jsx",
8811
+ ".mts",
8812
+ ".mjs"
8810
8813
  ];
8811
8814
  /** Filenames whose change invalidates project/config caches. */
8812
8815
  const CONFIG_WATCH_FILENAMES = [
@@ -10854,5 +10857,5 @@ const startLanguageServer = () => {
10854
10857
  };
10855
10858
  //#endregion
10856
10859
  export { startLanguageServer };
10857
- !function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="5715b6a9-c2ef-594e-8157-9c81132bc7fe")}catch(e){}}();
10858
- //# debugId=5715b6a9-c2ef-594e-8157-9c81132bc7fe
10860
+ !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]="feb075a7-adf0-5222-af8d-6ea6a4523050")}catch(e){}}();
10861
+ //# debugId=feb075a7-adf0-5222-af8d-6ea6a4523050
@@ -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.1.0"
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), use the `doctor-explain` skill (alias `/doctor-config`). 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`).
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
 
@@ -1,14 +1,11 @@
1
- ---
2
- name: doctor-explain
3
- description: Explain React Doctor rules and configure which ones run via doctor.config.* (or package.json#reactDoctor). Use when the user types `/doctor-explain` or `/doctor-config`, asks why a rule fired, disagrees with a rule, wants to disable/enable a rule, silence a category or tag, tune CI/PR noise, or asks "what does this rule mean". Covers the `react-doctor rules` CLI (list, explain, set, enable, disable, category, ignore-tag) and how config layers combine: ignore.tags disables matching rules before linting, rules over categories sets severity, surfaces controls visibility only.
4
- version: "1.0.0"
5
- ---
1
+ # Explaining and configuring rules
6
2
 
7
- # Doctor Explain
3
+ Explain React Doctor rules and edit `doctor.config.*` safely. Use this when a user
4
+ wants to understand a rule or change which rules run — not for fixing diagnostics
5
+ (that is the main `react-doctor` skill / `/doctor`).
8
6
 
9
- Explains React Doctor rules and edits `doctor.config.*` safely. Use this when a user wants to understand a rule or change which rules run — not for fixing diagnostics (that is the `react-doctor` skill / `/doctor`).
10
-
11
- Triggers: `/doctor-explain`, `/doctor-config`, "why did this rule fire", "I disagree with this rule", "turn this rule off", "stop flagging X", "too noisy", "disable design rules".
7
+ Triggers: "why did this rule fire", "I disagree with this rule", "turn this rule off",
8
+ "stop flagging X", "too noisy", "disable design rules".
12
9
 
13
10
  ## Workflow
14
11
 
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "react-doctor",
3
- "version": "0.4.2-dev.7cf52d8",
4
- "description": "Diagnose and fix React codebases for security, performance, correctness, accessibility, bundle-size, and architecture issues",
3
+ "version": "0.4.2-dev.98066c2",
4
+ "description": "Your agent writes bad React. This catches it",
5
5
  "keywords": [
6
6
  "accessibility",
7
7
  "diagnostics",
@@ -21,7 +21,7 @@
21
21
  "url": "https://github.com/millionco/react-doctor/issues"
22
22
  },
23
23
  "license": "MIT",
24
- "author": "Aiden Bai",
24
+ "author": "Million Software, Inc",
25
25
  "repository": {
26
26
  "type": "git",
27
27
  "url": "https://github.com/millionco/react-doctor.git",
@@ -66,7 +66,7 @@
66
66
  "vscode-languageserver": "^9.0.1",
67
67
  "vscode-languageserver-textdocument": "^1.0.12",
68
68
  "vscode-uri": "^3.1.0",
69
- "oxlint-plugin-react-doctor": "0.4.2-dev.7cf52d8"
69
+ "oxlint-plugin-react-doctor": "0.4.2-dev.98066c2"
70
70
  },
71
71
  "devDependencies": {
72
72
  "@types/babel__code-frame": "^7.27.0",