eslint-plugin-react-hooks-extra 2.0.0-next.180 → 2.0.0-next.181
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 +8 -8
- package/package.json +9 -9
package/dist/index.js
CHANGED
|
@@ -31,7 +31,7 @@ const rules = { "react-hooks-extra/no-direct-set-state-in-use-effect": "warn" };
|
|
|
31
31
|
//#endregion
|
|
32
32
|
//#region package.json
|
|
33
33
|
var name = "eslint-plugin-react-hooks-extra";
|
|
34
|
-
var version = "2.0.0-next.
|
|
34
|
+
var version = "2.0.0-next.181";
|
|
35
35
|
|
|
36
36
|
//#endregion
|
|
37
37
|
//#region src/utils/create-rule.ts
|
|
@@ -171,9 +171,9 @@ function create(context) {
|
|
|
171
171
|
});
|
|
172
172
|
return;
|
|
173
173
|
default: {
|
|
174
|
-
const
|
|
175
|
-
if (
|
|
176
|
-
else getOrElseUpdate(setStateInHookCallbacks,
|
|
174
|
+
const init = AST.findParentNode(node, isVariableDeclaratorFromHookCall)?.init;
|
|
175
|
+
if (init == null) getOrElseUpdate(setStateCallsByFn, pEntry.node, () => []).push(node);
|
|
176
|
+
else getOrElseUpdate(setStateInHookCallbacks, init, () => []).push(node);
|
|
177
177
|
}
|
|
178
178
|
}
|
|
179
179
|
}).with("useEffect", () => {
|
|
@@ -192,15 +192,15 @@ function create(context) {
|
|
|
192
192
|
const parent = node.parent.parent;
|
|
193
193
|
if (parent.type !== AST_NODE_TYPES.CallExpression) break;
|
|
194
194
|
if (!ER.isUseMemoCall(parent)) break;
|
|
195
|
-
const
|
|
196
|
-
if (
|
|
195
|
+
const init = AST.findParentNode(parent, isVariableDeclaratorFromHookCall)?.init;
|
|
196
|
+
if (init != null) getOrElseUpdate(setStateInEffectArg, init, () => []).push(node);
|
|
197
197
|
break;
|
|
198
198
|
}
|
|
199
199
|
case AST_NODE_TYPES.CallExpression:
|
|
200
200
|
if (node !== node.parent.arguments.at(0)) break;
|
|
201
201
|
if (ER.isUseCallbackCall(node.parent)) {
|
|
202
|
-
const
|
|
203
|
-
if (
|
|
202
|
+
const init = AST.findParentNode(node.parent, isVariableDeclaratorFromHookCall)?.init;
|
|
203
|
+
if (init != null) getOrElseUpdate(setStateInEffectArg, init, () => []).push(node);
|
|
204
204
|
break;
|
|
205
205
|
}
|
|
206
206
|
if (ER.isUseEffectLikeCall(node.parent)) getOrElseUpdate(setStateInEffectSetup, node.parent, () => []).push(node);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "eslint-plugin-react-hooks-extra",
|
|
3
|
-
"version": "2.0.0-next.
|
|
3
|
+
"version": "2.0.0-next.181",
|
|
4
4
|
"description": "ESLint React's ESLint plugin for React Hooks related rules.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"react",
|
|
@@ -42,17 +42,17 @@
|
|
|
42
42
|
"@typescript-eslint/utils": "^8.43.0",
|
|
43
43
|
"string-ts": "^2.2.1",
|
|
44
44
|
"ts-pattern": "^5.8.0",
|
|
45
|
-
"@eslint-react/ast": "2.0.0-next.
|
|
46
|
-
"@eslint-react/core": "2.0.0-next.
|
|
47
|
-
"@eslint-react/
|
|
48
|
-
"@eslint-react/
|
|
49
|
-
"@eslint-react/
|
|
50
|
-
"@eslint-react/var": "2.0.0-next.
|
|
45
|
+
"@eslint-react/ast": "2.0.0-next.181",
|
|
46
|
+
"@eslint-react/core": "2.0.0-next.181",
|
|
47
|
+
"@eslint-react/kit": "2.0.0-next.181",
|
|
48
|
+
"@eslint-react/shared": "2.0.0-next.181",
|
|
49
|
+
"@eslint-react/eff": "2.0.0-next.181",
|
|
50
|
+
"@eslint-react/var": "2.0.0-next.181"
|
|
51
51
|
},
|
|
52
52
|
"devDependencies": {
|
|
53
|
-
"@types/react": "^19.1.
|
|
53
|
+
"@types/react": "^19.1.13",
|
|
54
54
|
"@types/react-dom": "^19.1.9",
|
|
55
|
-
"tsdown": "^0.15.
|
|
55
|
+
"tsdown": "^0.15.1",
|
|
56
56
|
"@local/configs": "0.0.0"
|
|
57
57
|
},
|
|
58
58
|
"peerDependencies": {
|