react-doctor 0.8.1-dev.1839566 → 0.8.1-dev.26b4a0c

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 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]="c24708ed-97a3-59cc-81f7-4cf277ab29f2")}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]="24153a3f-aef9-53fd-8dff-9b016a9613fb")}catch(e){}}();
3
3
  import { createRequire } from "node:module";
4
4
  import * as NodeChildProcess from "node:child_process";
5
5
  import { execFile, execFileSync, spawn, spawnSync } from "node:child_process";
@@ -44091,12 +44091,17 @@ const REACT_ERROR_BOUNDARY_MESSAGE = "This try/catch cannot catch errors thrown
44091
44091
  const REACT_COMPILER_IMPACT = "This component misses React Compiler's automatic memoization & re-renders more than it should";
44092
44092
  const REACT_COMPILER_ACTION = "Rewrite the flagged code so the compiler can optimize it.";
44093
44093
  const REACT_COMPILER_INCOMPATIBLE_LIBRARY_ACTION = "It's how the library works, not a bug in your code. Memoize values you pass from it into other memoized components, or suppress it with `// react-doctor-disable-next-line react-hooks-js/incompatible-library`.";
44094
+ const SET_STATE_IN_EFFECT_ACTION = "Prefer deriving or initializing the value before render. If the effect must read a browser API after mount, treat this as advisory or suppress it with `// react-doctor-disable-next-line react-hooks-js/set-state-in-effect`.";
44094
44095
  const REACT_COMPILER_GENERIC_MESSAGE = `${REACT_COMPILER_IMPACT}. ${REACT_COMPILER_ACTION}`;
44095
44096
  const buildReactCompilerMessage = (reasonSummary, action = REACT_COMPILER_ACTION) => {
44096
44097
  const normalizedSummary = reasonSummary.replace(TRAILING_PERIOD_PATTERN, "");
44097
44098
  if (!normalizedSummary) return `${REACT_COMPILER_IMPACT}. ${action}`;
44098
44099
  return `${REACT_COMPILER_IMPACT}: ${normalizedSummary}. ${action}`;
44099
44100
  };
44101
+ const buildSetStateInEffectMessage = (reasonSummary) => {
44102
+ const normalizedSummary = reasonSummary.replace(TRAILING_PERIOD_PATTERN, "");
44103
+ return `This synchronous effect update causes an extra render${normalizedSummary ? `: ${normalizedSummary}` : ""}. ${SET_STATE_IN_EFFECT_ACTION}`;
44104
+ };
44100
44105
  const PLUGIN_CATEGORY_MAP = {
44101
44106
  react: "Bugs",
44102
44107
  "react-hooks": "Bugs",
@@ -44154,6 +44159,10 @@ const resolveCleanedDiagnostic = (message, help, plugin, rule, project) => {
44154
44159
  message: REACT_ERROR_BOUNDARY_MESSAGE,
44155
44160
  help: reasonDetail || help
44156
44161
  };
44162
+ if (rule === "set-state-in-effect") return {
44163
+ message: buildSetStateInEffectMessage(reasonSummary.trim()),
44164
+ help: reasonDetail || help
44165
+ };
44157
44166
  return {
44158
44167
  message: buildReactCompilerMessage(reasonSummary.trim(), rule === "incompatible-library" ? REACT_COMPILER_INCOMPATIBLE_LIBRARY_ACTION : REACT_COMPILER_ACTION),
44159
44168
  help: appendReanimatedSharedValueHint(reasonDetail || help, rule, project)
@@ -47356,7 +47365,7 @@ const makeNoopConsole = () => ({
47356
47365
  });
47357
47366
  //#endregion
47358
47367
  //#region src/cli/utils/version.ts
47359
- const VERSION = "0.8.1-dev.1839566";
47368
+ const VERSION = "0.8.1-dev.26b4a0c";
47360
47369
  //#endregion
47361
47370
  //#region src/cli/utils/json-mode.ts
47362
47371
  let context = null;
@@ -47708,13 +47717,13 @@ const isDevVersion = (version) => version === "0.0.0" || version.includes("-");
47708
47717
  * uploads source-map artifacts under, so stack frames symbolicate. Honors the
47709
47718
  * standard `SENTRY_RELEASE` override.
47710
47719
  */
47711
- const resolveSentryRelease = () => process.env.SENTRY_RELEASE || `react-doctor@0.8.1-dev.1839566`;
47720
+ const resolveSentryRelease = () => process.env.SENTRY_RELEASE || `react-doctor@0.8.1-dev.26b4a0c`;
47712
47721
  /**
47713
47722
  * Deployment environment shown in Sentry's environment filter. Defaults to
47714
47723
  * `production` for tagged releases and `development` for dev/unbuilt versions,
47715
47724
  * overridable via the standard `SENTRY_ENVIRONMENT` env var.
47716
47725
  */
47717
- const resolveSentryEnvironment = () => process.env.SENTRY_ENVIRONMENT || (isDevVersion("0.8.1-dev.1839566") ? "development" : "production");
47726
+ const resolveSentryEnvironment = () => process.env.SENTRY_ENVIRONMENT || (isDevVersion("0.8.1-dev.26b4a0c") ? "development" : "production");
47718
47727
  /**
47719
47728
  * Performance-tracing sample rate in `[0, 1]`. Reads `SENTRY_TRACES_SAMPLE_RATE`
47720
47729
  * (set to `0` to disable tracing) and falls back to
@@ -66394,4 +66403,4 @@ Promise.resolve().then(() => assertNoRemovedFlags(process.argv)).then(() => prog
66394
66403
  export {};
66395
66404
 
66396
66405
  //# sourceMappingURL=cli.js.map
66397
- //# debugId=c24708ed-97a3-59cc-81f7-4cf277ab29f2
66406
+ //# debugId=24153a3f-aef9-53fd-8dff-9b016a9613fb
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]="f645a3f8-ff1c-5f09-a174-8281db00eaa4")}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]="14f17993-c8fc-5c43-a518-2b2055f5d836")}catch(e){}}();
3
3
  import { r as __toESM$1, t as __commonJSMin$1 } from "./chunk-N93fKeF6.js";
4
4
  import { createRequire } from "node:module";
5
5
  import reactDoctorPlugin, { ALL_REACT_DOCTOR_RULE_KEYS, CROSS_FILE_DEPENDENCY_COLLECTORS, CROSS_FILE_RULE_IDS, FRAMEWORK_SPECIFIC_RULE_KEYS, FRAMEWORK_TOKENS, MOTION_LIBRARY_PACKAGES, REACT_COMPILER_RULES, REACT_DOCTOR_RULES, classifySecurityScanFile, collectCrossFileDependencyProbes, resetManifestCaches, shouldReadSecurityScanContent } from "oxlint-plugin-react-doctor";
@@ -40847,12 +40847,17 @@ const REACT_ERROR_BOUNDARY_MESSAGE = "This try/catch cannot catch errors thrown
40847
40847
  const REACT_COMPILER_IMPACT = "This component misses React Compiler's automatic memoization & re-renders more than it should";
40848
40848
  const REACT_COMPILER_ACTION = "Rewrite the flagged code so the compiler can optimize it.";
40849
40849
  const REACT_COMPILER_INCOMPATIBLE_LIBRARY_ACTION = "It's how the library works, not a bug in your code. Memoize values you pass from it into other memoized components, or suppress it with `// react-doctor-disable-next-line react-hooks-js/incompatible-library`.";
40850
+ const SET_STATE_IN_EFFECT_ACTION = "Prefer deriving or initializing the value before render. If the effect must read a browser API after mount, treat this as advisory or suppress it with `// react-doctor-disable-next-line react-hooks-js/set-state-in-effect`.";
40850
40851
  const REACT_COMPILER_GENERIC_MESSAGE = `${REACT_COMPILER_IMPACT}. ${REACT_COMPILER_ACTION}`;
40851
40852
  const buildReactCompilerMessage = (reasonSummary, action = REACT_COMPILER_ACTION) => {
40852
40853
  const normalizedSummary = reasonSummary.replace(TRAILING_PERIOD_PATTERN, "");
40853
40854
  if (!normalizedSummary) return `${REACT_COMPILER_IMPACT}. ${action}`;
40854
40855
  return `${REACT_COMPILER_IMPACT}: ${normalizedSummary}. ${action}`;
40855
40856
  };
40857
+ const buildSetStateInEffectMessage = (reasonSummary) => {
40858
+ const normalizedSummary = reasonSummary.replace(TRAILING_PERIOD_PATTERN, "");
40859
+ return `This synchronous effect update causes an extra render${normalizedSummary ? `: ${normalizedSummary}` : ""}. ${SET_STATE_IN_EFFECT_ACTION}`;
40860
+ };
40856
40861
  const PLUGIN_CATEGORY_MAP = {
40857
40862
  react: "Bugs",
40858
40863
  "react-hooks": "Bugs",
@@ -40910,6 +40915,10 @@ const resolveCleanedDiagnostic = (message, help, plugin, rule, project) => {
40910
40915
  message: REACT_ERROR_BOUNDARY_MESSAGE,
40911
40916
  help: reasonDetail || help
40912
40917
  };
40918
+ if (rule === "set-state-in-effect") return {
40919
+ message: buildSetStateInEffectMessage(reasonSummary.trim()),
40920
+ help: reasonDetail || help
40921
+ };
40913
40922
  return {
40914
40923
  message: buildReactCompilerMessage(reasonSummary.trim(), rule === "incompatible-library" ? REACT_COMPILER_INCOMPATIBLE_LIBRARY_ACTION : REACT_COMPILER_ACTION),
40915
40924
  help: appendReanimatedSharedValueHint(reasonDetail || help, rule, project)
@@ -43828,4 +43837,4 @@ const toJsonReport = (result, options) => buildJsonReport({
43828
43837
  export { AmbiguousProjectError, NoReactDependencyError, NotADirectoryError, PackageJsonNotFoundError, ProjectNotFoundError, ReactDoctorError, buildJsonReport, buildJsonReportError, clearCaches, defineConfig, diagnose, filterSourceFiles, getDiffInfo, hasReactRuntime, isProjectDiscoveryError, isReactDoctorError, summarizeDiagnostics, toJsonReport };
43829
43838
 
43830
43839
  //# sourceMappingURL=index.js.map
43831
- //# debugId=f645a3f8-ff1c-5f09-a174-8281db00eaa4
43840
+ //# debugId=14f17993-c8fc-5c43-a518-2b2055f5d836
package/dist/lsp.js CHANGED
@@ -40825,12 +40825,17 @@ const REACT_ERROR_BOUNDARY_MESSAGE = "This try/catch cannot catch errors thrown
40825
40825
  const REACT_COMPILER_IMPACT = "This component misses React Compiler's automatic memoization & re-renders more than it should";
40826
40826
  const REACT_COMPILER_ACTION = "Rewrite the flagged code so the compiler can optimize it.";
40827
40827
  const REACT_COMPILER_INCOMPATIBLE_LIBRARY_ACTION = "It's how the library works, not a bug in your code. Memoize values you pass from it into other memoized components, or suppress it with `// react-doctor-disable-next-line react-hooks-js/incompatible-library`.";
40828
+ const SET_STATE_IN_EFFECT_ACTION = "Prefer deriving or initializing the value before render. If the effect must read a browser API after mount, treat this as advisory or suppress it with `// react-doctor-disable-next-line react-hooks-js/set-state-in-effect`.";
40828
40829
  const REACT_COMPILER_GENERIC_MESSAGE = `${REACT_COMPILER_IMPACT}. ${REACT_COMPILER_ACTION}`;
40829
40830
  const buildReactCompilerMessage = (reasonSummary, action = REACT_COMPILER_ACTION) => {
40830
40831
  const normalizedSummary = reasonSummary.replace(TRAILING_PERIOD_PATTERN, "");
40831
40832
  if (!normalizedSummary) return `${REACT_COMPILER_IMPACT}. ${action}`;
40832
40833
  return `${REACT_COMPILER_IMPACT}: ${normalizedSummary}. ${action}`;
40833
40834
  };
40835
+ const buildSetStateInEffectMessage = (reasonSummary) => {
40836
+ const normalizedSummary = reasonSummary.replace(TRAILING_PERIOD_PATTERN, "");
40837
+ return `This synchronous effect update causes an extra render${normalizedSummary ? `: ${normalizedSummary}` : ""}. ${SET_STATE_IN_EFFECT_ACTION}`;
40838
+ };
40834
40839
  const PLUGIN_CATEGORY_MAP = {
40835
40840
  react: "Bugs",
40836
40841
  "react-hooks": "Bugs",
@@ -40888,6 +40893,10 @@ const resolveCleanedDiagnostic = (message, help, plugin, rule, project) => {
40888
40893
  message: REACT_ERROR_BOUNDARY_MESSAGE,
40889
40894
  help: reasonDetail || help
40890
40895
  };
40896
+ if (rule === "set-state-in-effect") return {
40897
+ message: buildSetStateInEffectMessage(reasonSummary.trim()),
40898
+ help: reasonDetail || help
40899
+ };
40891
40900
  return {
40892
40901
  message: buildReactCompilerMessage(reasonSummary.trim(), rule === "incompatible-library" ? REACT_COMPILER_INCOMPATIBLE_LIBRARY_ACTION : REACT_COMPILER_ACTION),
40893
40902
  help: appendReanimatedSharedValueHint(reasonDetail || help, rule, project)
@@ -45448,5 +45457,5 @@ const startLanguageServer = () => {
45448
45457
  };
45449
45458
  //#endregion
45450
45459
  export { startLanguageServer };
45451
- !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]="4fa679df-c187-5989-bc8a-a96791a6f02c")}catch(e){}}();
45452
- //# debugId=4fa679df-c187-5989-bc8a-a96791a6f02c
45460
+ !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]="ecc1704a-4f8c-583e-93b2-78c6feb9cfd6")}catch(e){}}();
45461
+ //# debugId=ecc1704a-4f8c-583e-93b2-78c6feb9cfd6
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-doctor",
3
- "version": "0.8.1-dev.1839566",
3
+ "version": "0.8.1-dev.26b4a0c",
4
4
  "description": "Your agent writes bad React. This catches it",
5
5
  "keywords": [
6
6
  "accessibility",
@@ -65,8 +65,8 @@
65
65
  "vscode-languageserver-textdocument": "^1.0.12",
66
66
  "vscode-uri": "^3.1.0",
67
67
  "yaml": "^2.9.0",
68
- "oxlint-plugin-react-doctor": "0.8.1-dev.1839566",
69
- "deslop-js": "0.8.1"
68
+ "deslop-js": "0.8.1",
69
+ "oxlint-plugin-react-doctor": "0.8.1-dev.26b4a0c"
70
70
  },
71
71
  "devDependencies": {
72
72
  "@types/babel__code-frame": "^7.27.0",
@@ -75,8 +75,8 @@
75
75
  "commander": "^14.0.3",
76
76
  "ora": "^9.4.0",
77
77
  "@react-doctor/core": "0.8.1",
78
- "@react-doctor/api": "0.8.1",
79
- "@react-doctor/language-server": "0.8.1"
78
+ "@react-doctor/language-server": "0.8.1",
79
+ "@react-doctor/api": "0.8.1"
80
80
  },
81
81
  "engines": {
82
82
  "node": "^20.19.0 || >=22.13.0"