react-doctor 0.8.1-dev.1839566 → 0.8.1-dev.21221c2
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 +14 -6
- package/dist/index.js +11 -3
- package/dist/lsp.js +11 -3
- package/package.json +3 -3
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]="
|
|
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]="f6c63ef7-3eca-54f6-80d8-221d85cea09b")}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";
|
|
@@ -37977,7 +37977,6 @@ const LEGACY_RULE_KEY_TO_NATIVE_RULE_KEY = {
|
|
|
37977
37977
|
"react/jsx-no-new-function-as-prop": "react-doctor/jsx-no-new-function-as-prop",
|
|
37978
37978
|
"react/jsx-no-new-object-as-prop": "react-doctor/jsx-no-new-object-as-prop",
|
|
37979
37979
|
"react/jsx-no-script-url": "react-doctor/jsx-no-script-url",
|
|
37980
|
-
"react/jsx-no-target-blank": "react-doctor/jsx-no-target-blank",
|
|
37981
37980
|
"react/jsx-no-undef": "react-doctor/jsx-no-undef",
|
|
37982
37981
|
"react/jsx-no-useless-fragment": "react-doctor/jsx-no-useless-fragment",
|
|
37983
37982
|
"react/jsx-pascal-case": "react-doctor/jsx-pascal-case",
|
|
@@ -44091,12 +44090,17 @@ const REACT_ERROR_BOUNDARY_MESSAGE = "This try/catch cannot catch errors thrown
|
|
|
44091
44090
|
const REACT_COMPILER_IMPACT = "This component misses React Compiler's automatic memoization & re-renders more than it should";
|
|
44092
44091
|
const REACT_COMPILER_ACTION = "Rewrite the flagged code so the compiler can optimize it.";
|
|
44093
44092
|
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`.";
|
|
44093
|
+
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
44094
|
const REACT_COMPILER_GENERIC_MESSAGE = `${REACT_COMPILER_IMPACT}. ${REACT_COMPILER_ACTION}`;
|
|
44095
44095
|
const buildReactCompilerMessage = (reasonSummary, action = REACT_COMPILER_ACTION) => {
|
|
44096
44096
|
const normalizedSummary = reasonSummary.replace(TRAILING_PERIOD_PATTERN, "");
|
|
44097
44097
|
if (!normalizedSummary) return `${REACT_COMPILER_IMPACT}. ${action}`;
|
|
44098
44098
|
return `${REACT_COMPILER_IMPACT}: ${normalizedSummary}. ${action}`;
|
|
44099
44099
|
};
|
|
44100
|
+
const buildSetStateInEffectMessage = (reasonSummary) => {
|
|
44101
|
+
const normalizedSummary = reasonSummary.replace(TRAILING_PERIOD_PATTERN, "");
|
|
44102
|
+
return `This synchronous effect update causes an extra render${normalizedSummary ? `: ${normalizedSummary}` : ""}. ${SET_STATE_IN_EFFECT_ACTION}`;
|
|
44103
|
+
};
|
|
44100
44104
|
const PLUGIN_CATEGORY_MAP = {
|
|
44101
44105
|
react: "Bugs",
|
|
44102
44106
|
"react-hooks": "Bugs",
|
|
@@ -44154,6 +44158,10 @@ const resolveCleanedDiagnostic = (message, help, plugin, rule, project) => {
|
|
|
44154
44158
|
message: REACT_ERROR_BOUNDARY_MESSAGE,
|
|
44155
44159
|
help: reasonDetail || help
|
|
44156
44160
|
};
|
|
44161
|
+
if (rule === "set-state-in-effect") return {
|
|
44162
|
+
message: buildSetStateInEffectMessage(reasonSummary.trim()),
|
|
44163
|
+
help: reasonDetail || help
|
|
44164
|
+
};
|
|
44157
44165
|
return {
|
|
44158
44166
|
message: buildReactCompilerMessage(reasonSummary.trim(), rule === "incompatible-library" ? REACT_COMPILER_INCOMPATIBLE_LIBRARY_ACTION : REACT_COMPILER_ACTION),
|
|
44159
44167
|
help: appendReanimatedSharedValueHint(reasonDetail || help, rule, project)
|
|
@@ -47356,7 +47364,7 @@ const makeNoopConsole = () => ({
|
|
|
47356
47364
|
});
|
|
47357
47365
|
//#endregion
|
|
47358
47366
|
//#region src/cli/utils/version.ts
|
|
47359
|
-
const VERSION = "0.8.1-dev.
|
|
47367
|
+
const VERSION = "0.8.1-dev.21221c2";
|
|
47360
47368
|
//#endregion
|
|
47361
47369
|
//#region src/cli/utils/json-mode.ts
|
|
47362
47370
|
let context = null;
|
|
@@ -47708,13 +47716,13 @@ const isDevVersion = (version) => version === "0.0.0" || version.includes("-");
|
|
|
47708
47716
|
* uploads source-map artifacts under, so stack frames symbolicate. Honors the
|
|
47709
47717
|
* standard `SENTRY_RELEASE` override.
|
|
47710
47718
|
*/
|
|
47711
|
-
const resolveSentryRelease = () => process.env.SENTRY_RELEASE || `react-doctor@0.8.1-dev.
|
|
47719
|
+
const resolveSentryRelease = () => process.env.SENTRY_RELEASE || `react-doctor@0.8.1-dev.21221c2`;
|
|
47712
47720
|
/**
|
|
47713
47721
|
* Deployment environment shown in Sentry's environment filter. Defaults to
|
|
47714
47722
|
* `production` for tagged releases and `development` for dev/unbuilt versions,
|
|
47715
47723
|
* overridable via the standard `SENTRY_ENVIRONMENT` env var.
|
|
47716
47724
|
*/
|
|
47717
|
-
const resolveSentryEnvironment = () => process.env.SENTRY_ENVIRONMENT || (isDevVersion("0.8.1-dev.
|
|
47725
|
+
const resolveSentryEnvironment = () => process.env.SENTRY_ENVIRONMENT || (isDevVersion("0.8.1-dev.21221c2") ? "development" : "production");
|
|
47718
47726
|
/**
|
|
47719
47727
|
* Performance-tracing sample rate in `[0, 1]`. Reads `SENTRY_TRACES_SAMPLE_RATE`
|
|
47720
47728
|
* (set to `0` to disable tracing) and falls back to
|
|
@@ -66394,4 +66402,4 @@ Promise.resolve().then(() => assertNoRemovedFlags(process.argv)).then(() => prog
|
|
|
66394
66402
|
export {};
|
|
66395
66403
|
|
|
66396
66404
|
//# sourceMappingURL=cli.js.map
|
|
66397
|
-
//# debugId=
|
|
66405
|
+
//# debugId=f6c63ef7-3eca-54f6-80d8-221d85cea09b
|
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]="
|
|
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]="f412a400-e7a3-5cfa-a67f-1192f6a38df2")}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";
|
|
@@ -34784,7 +34784,6 @@ const LEGACY_RULE_KEY_TO_NATIVE_RULE_KEY = {
|
|
|
34784
34784
|
"react/jsx-no-new-function-as-prop": "react-doctor/jsx-no-new-function-as-prop",
|
|
34785
34785
|
"react/jsx-no-new-object-as-prop": "react-doctor/jsx-no-new-object-as-prop",
|
|
34786
34786
|
"react/jsx-no-script-url": "react-doctor/jsx-no-script-url",
|
|
34787
|
-
"react/jsx-no-target-blank": "react-doctor/jsx-no-target-blank",
|
|
34788
34787
|
"react/jsx-no-undef": "react-doctor/jsx-no-undef",
|
|
34789
34788
|
"react/jsx-no-useless-fragment": "react-doctor/jsx-no-useless-fragment",
|
|
34790
34789
|
"react/jsx-pascal-case": "react-doctor/jsx-pascal-case",
|
|
@@ -40847,12 +40846,17 @@ const REACT_ERROR_BOUNDARY_MESSAGE = "This try/catch cannot catch errors thrown
|
|
|
40847
40846
|
const REACT_COMPILER_IMPACT = "This component misses React Compiler's automatic memoization & re-renders more than it should";
|
|
40848
40847
|
const REACT_COMPILER_ACTION = "Rewrite the flagged code so the compiler can optimize it.";
|
|
40849
40848
|
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`.";
|
|
40849
|
+
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
40850
|
const REACT_COMPILER_GENERIC_MESSAGE = `${REACT_COMPILER_IMPACT}. ${REACT_COMPILER_ACTION}`;
|
|
40851
40851
|
const buildReactCompilerMessage = (reasonSummary, action = REACT_COMPILER_ACTION) => {
|
|
40852
40852
|
const normalizedSummary = reasonSummary.replace(TRAILING_PERIOD_PATTERN, "");
|
|
40853
40853
|
if (!normalizedSummary) return `${REACT_COMPILER_IMPACT}. ${action}`;
|
|
40854
40854
|
return `${REACT_COMPILER_IMPACT}: ${normalizedSummary}. ${action}`;
|
|
40855
40855
|
};
|
|
40856
|
+
const buildSetStateInEffectMessage = (reasonSummary) => {
|
|
40857
|
+
const normalizedSummary = reasonSummary.replace(TRAILING_PERIOD_PATTERN, "");
|
|
40858
|
+
return `This synchronous effect update causes an extra render${normalizedSummary ? `: ${normalizedSummary}` : ""}. ${SET_STATE_IN_EFFECT_ACTION}`;
|
|
40859
|
+
};
|
|
40856
40860
|
const PLUGIN_CATEGORY_MAP = {
|
|
40857
40861
|
react: "Bugs",
|
|
40858
40862
|
"react-hooks": "Bugs",
|
|
@@ -40910,6 +40914,10 @@ const resolveCleanedDiagnostic = (message, help, plugin, rule, project) => {
|
|
|
40910
40914
|
message: REACT_ERROR_BOUNDARY_MESSAGE,
|
|
40911
40915
|
help: reasonDetail || help
|
|
40912
40916
|
};
|
|
40917
|
+
if (rule === "set-state-in-effect") return {
|
|
40918
|
+
message: buildSetStateInEffectMessage(reasonSummary.trim()),
|
|
40919
|
+
help: reasonDetail || help
|
|
40920
|
+
};
|
|
40913
40921
|
return {
|
|
40914
40922
|
message: buildReactCompilerMessage(reasonSummary.trim(), rule === "incompatible-library" ? REACT_COMPILER_INCOMPATIBLE_LIBRARY_ACTION : REACT_COMPILER_ACTION),
|
|
40915
40923
|
help: appendReanimatedSharedValueHint(reasonDetail || help, rule, project)
|
|
@@ -43828,4 +43836,4 @@ const toJsonReport = (result, options) => buildJsonReport({
|
|
|
43828
43836
|
export { AmbiguousProjectError, NoReactDependencyError, NotADirectoryError, PackageJsonNotFoundError, ProjectNotFoundError, ReactDoctorError, buildJsonReport, buildJsonReportError, clearCaches, defineConfig, diagnose, filterSourceFiles, getDiffInfo, hasReactRuntime, isProjectDiscoveryError, isReactDoctorError, summarizeDiagnostics, toJsonReport };
|
|
43829
43837
|
|
|
43830
43838
|
//# sourceMappingURL=index.js.map
|
|
43831
|
-
//# debugId=
|
|
43839
|
+
//# debugId=f412a400-e7a3-5cfa-a67f-1192f6a38df2
|
package/dist/lsp.js
CHANGED
|
@@ -34836,7 +34836,6 @@ const LEGACY_RULE_KEY_TO_NATIVE_RULE_KEY = {
|
|
|
34836
34836
|
"react/jsx-no-new-function-as-prop": "react-doctor/jsx-no-new-function-as-prop",
|
|
34837
34837
|
"react/jsx-no-new-object-as-prop": "react-doctor/jsx-no-new-object-as-prop",
|
|
34838
34838
|
"react/jsx-no-script-url": "react-doctor/jsx-no-script-url",
|
|
34839
|
-
"react/jsx-no-target-blank": "react-doctor/jsx-no-target-blank",
|
|
34840
34839
|
"react/jsx-no-undef": "react-doctor/jsx-no-undef",
|
|
34841
34840
|
"react/jsx-no-useless-fragment": "react-doctor/jsx-no-useless-fragment",
|
|
34842
34841
|
"react/jsx-pascal-case": "react-doctor/jsx-pascal-case",
|
|
@@ -40825,12 +40824,17 @@ const REACT_ERROR_BOUNDARY_MESSAGE = "This try/catch cannot catch errors thrown
|
|
|
40825
40824
|
const REACT_COMPILER_IMPACT = "This component misses React Compiler's automatic memoization & re-renders more than it should";
|
|
40826
40825
|
const REACT_COMPILER_ACTION = "Rewrite the flagged code so the compiler can optimize it.";
|
|
40827
40826
|
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`.";
|
|
40827
|
+
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
40828
|
const REACT_COMPILER_GENERIC_MESSAGE = `${REACT_COMPILER_IMPACT}. ${REACT_COMPILER_ACTION}`;
|
|
40829
40829
|
const buildReactCompilerMessage = (reasonSummary, action = REACT_COMPILER_ACTION) => {
|
|
40830
40830
|
const normalizedSummary = reasonSummary.replace(TRAILING_PERIOD_PATTERN, "");
|
|
40831
40831
|
if (!normalizedSummary) return `${REACT_COMPILER_IMPACT}. ${action}`;
|
|
40832
40832
|
return `${REACT_COMPILER_IMPACT}: ${normalizedSummary}. ${action}`;
|
|
40833
40833
|
};
|
|
40834
|
+
const buildSetStateInEffectMessage = (reasonSummary) => {
|
|
40835
|
+
const normalizedSummary = reasonSummary.replace(TRAILING_PERIOD_PATTERN, "");
|
|
40836
|
+
return `This synchronous effect update causes an extra render${normalizedSummary ? `: ${normalizedSummary}` : ""}. ${SET_STATE_IN_EFFECT_ACTION}`;
|
|
40837
|
+
};
|
|
40834
40838
|
const PLUGIN_CATEGORY_MAP = {
|
|
40835
40839
|
react: "Bugs",
|
|
40836
40840
|
"react-hooks": "Bugs",
|
|
@@ -40888,6 +40892,10 @@ const resolveCleanedDiagnostic = (message, help, plugin, rule, project) => {
|
|
|
40888
40892
|
message: REACT_ERROR_BOUNDARY_MESSAGE,
|
|
40889
40893
|
help: reasonDetail || help
|
|
40890
40894
|
};
|
|
40895
|
+
if (rule === "set-state-in-effect") return {
|
|
40896
|
+
message: buildSetStateInEffectMessage(reasonSummary.trim()),
|
|
40897
|
+
help: reasonDetail || help
|
|
40898
|
+
};
|
|
40891
40899
|
return {
|
|
40892
40900
|
message: buildReactCompilerMessage(reasonSummary.trim(), rule === "incompatible-library" ? REACT_COMPILER_INCOMPATIBLE_LIBRARY_ACTION : REACT_COMPILER_ACTION),
|
|
40893
40901
|
help: appendReanimatedSharedValueHint(reasonDetail || help, rule, project)
|
|
@@ -45448,5 +45456,5 @@ const startLanguageServer = () => {
|
|
|
45448
45456
|
};
|
|
45449
45457
|
//#endregion
|
|
45450
45458
|
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]="
|
|
45452
|
-
//# debugId=
|
|
45459
|
+
!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]="2e6fca06-4d93-5b9e-86fd-92bfb63393e0")}catch(e){}}();
|
|
45460
|
+
//# debugId=2e6fca06-4d93-5b9e-86fd-92bfb63393e0
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "react-doctor",
|
|
3
|
-
"version": "0.8.1-dev.
|
|
3
|
+
"version": "0.8.1-dev.21221c2",
|
|
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
|
-
"
|
|
69
|
-
"
|
|
68
|
+
"deslop-js": "0.8.1",
|
|
69
|
+
"oxlint-plugin-react-doctor": "0.8.1-dev.21221c2"
|
|
70
70
|
},
|
|
71
71
|
"devDependencies": {
|
|
72
72
|
"@types/babel__code-frame": "^7.27.0",
|