eslint-plugin-react-x 3.0.0-next.17 → 3.0.0-next.18
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 +15 -13
- package/package.json +6 -6
package/dist/index.js
CHANGED
|
@@ -69,7 +69,7 @@ const rules$7 = {
|
|
|
69
69
|
//#endregion
|
|
70
70
|
//#region package.json
|
|
71
71
|
var name$6 = "eslint-plugin-react-x";
|
|
72
|
-
var version = "3.0.0-next.
|
|
72
|
+
var version = "3.0.0-next.18";
|
|
73
73
|
|
|
74
74
|
//#endregion
|
|
75
75
|
//#region src/utils/create-rule.ts
|
|
@@ -2787,18 +2787,20 @@ function create$17(context) {
|
|
|
2787
2787
|
getOrElseUpdate(constructions, functionEntry.node, () => []).push(construction);
|
|
2788
2788
|
},
|
|
2789
2789
|
"Program:exit"(program) {
|
|
2790
|
-
for (const { node: component, directives } of ctx.getAllComponents(program))
|
|
2791
|
-
if (directives.some((d) => d.directive === "use memo"))
|
|
2792
|
-
const
|
|
2793
|
-
|
|
2794
|
-
|
|
2795
|
-
|
|
2796
|
-
|
|
2797
|
-
|
|
2798
|
-
|
|
2799
|
-
|
|
2800
|
-
|
|
2801
|
-
|
|
2790
|
+
for (const { node: component, directives } of ctx.getAllComponents(program)) {
|
|
2791
|
+
if (compilationMode === "annotation" && directives.some((d) => d.directive === "use memo")) continue;
|
|
2792
|
+
for (const construction of constructions.get(component) ?? []) {
|
|
2793
|
+
const { kind, node: constructionNode } = construction;
|
|
2794
|
+
const suggestion = kind === "function" ? "Consider wrapping it in a useCallback hook." : "Consider wrapping it in a useMemo hook.";
|
|
2795
|
+
context.report({
|
|
2796
|
+
messageId: "unstableContextValue",
|
|
2797
|
+
node: constructionNode,
|
|
2798
|
+
data: {
|
|
2799
|
+
kind: ast.getHumanReadableKind(constructionNode),
|
|
2800
|
+
suggestion
|
|
2801
|
+
}
|
|
2802
|
+
});
|
|
2803
|
+
}
|
|
2802
2804
|
}
|
|
2803
2805
|
}
|
|
2804
2806
|
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "eslint-plugin-react-x",
|
|
3
|
-
"version": "3.0.0-next.
|
|
3
|
+
"version": "3.0.0-next.18",
|
|
4
4
|
"description": "A set of composable ESLint rules for libraries and frameworks that use React as a UI runtime.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"react",
|
|
@@ -45,11 +45,11 @@
|
|
|
45
45
|
"is-immutable-type": "^5.0.1",
|
|
46
46
|
"ts-api-utils": "^2.4.0",
|
|
47
47
|
"ts-pattern": "^5.9.0",
|
|
48
|
-
"@eslint-react/
|
|
49
|
-
"@eslint-react/
|
|
50
|
-
"@eslint-react/
|
|
51
|
-
"@eslint-react/var": "3.0.0-next.
|
|
52
|
-
"@eslint-react/
|
|
48
|
+
"@eslint-react/ast": "3.0.0-next.18",
|
|
49
|
+
"@eslint-react/core": "3.0.0-next.18",
|
|
50
|
+
"@eslint-react/eff": "3.0.0-next.18",
|
|
51
|
+
"@eslint-react/var": "3.0.0-next.18",
|
|
52
|
+
"@eslint-react/shared": "3.0.0-next.18"
|
|
53
53
|
},
|
|
54
54
|
"devDependencies": {
|
|
55
55
|
"@types/react": "^19.2.14",
|