eslint-plugin-react-hooks-extra 1.45.3 → 1.45.4-beta.5
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 +9 -9
- package/dist/index.mjs +10 -10
- package/package.json +8 -8
package/dist/index.js
CHANGED
|
@@ -52,7 +52,7 @@ var rules = {
|
|
|
52
52
|
|
|
53
53
|
// package.json
|
|
54
54
|
var name2 = "eslint-plugin-react-hooks-extra";
|
|
55
|
-
var version = "1.45.
|
|
55
|
+
var version = "1.45.4-beta.5";
|
|
56
56
|
var createRule = utils.ESLintUtils.RuleCreator(shared.getDocsUrl("hooks-extra"));
|
|
57
57
|
function isFromHookCall(context, name3, settings, predicate = eff.constTrue) {
|
|
58
58
|
const hookAlias = settings.additionalHooks[name3] ?? [];
|
|
@@ -169,10 +169,10 @@ function useNoDirectSetStateInUseEffect(context, options) {
|
|
|
169
169
|
const setupFunctionRef = { current: null };
|
|
170
170
|
const setupFunctionIdentifiers = [];
|
|
171
171
|
const indFunctionCalls = [];
|
|
172
|
-
const indSetStateCalls = /* @__PURE__ */ new
|
|
173
|
-
const indSetStateCallsInUseEffectArg0 = /* @__PURE__ */ new
|
|
172
|
+
const indSetStateCalls = /* @__PURE__ */ new WeakMap();
|
|
173
|
+
const indSetStateCallsInUseEffectArg0 = /* @__PURE__ */ new WeakMap();
|
|
174
174
|
const indSetStateCallsInUseEffectSetup = /* @__PURE__ */ new Map();
|
|
175
|
-
const indSetStateCallsInUseMemoOrCallback = /* @__PURE__ */ new
|
|
175
|
+
const indSetStateCallsInUseMemoOrCallback = /* @__PURE__ */ new WeakMap();
|
|
176
176
|
const onSetupFunctionEnter = (node) => {
|
|
177
177
|
setupFunctionRef.current = node;
|
|
178
178
|
};
|
|
@@ -222,8 +222,8 @@ function useNoDirectSetStateInUseEffect(context, options) {
|
|
|
222
222
|
}
|
|
223
223
|
default: {
|
|
224
224
|
const vd = AST__namespace.findParentNode(node, isVariableDeclaratorFromHookCall);
|
|
225
|
-
if (vd == null) eff.
|
|
226
|
-
else eff.
|
|
225
|
+
if (vd == null) eff.getOrElseUpdate(indSetStateCalls, pEntry.node, () => []).push(node);
|
|
226
|
+
else eff.getOrElseUpdate(indSetStateCallsInUseMemoOrCallback, vd.init, () => []).push(node);
|
|
227
227
|
}
|
|
228
228
|
}
|
|
229
229
|
}).with(useEffectKind, () => {
|
|
@@ -252,7 +252,7 @@ function useNoDirectSetStateInUseEffect(context, options) {
|
|
|
252
252
|
}
|
|
253
253
|
const vd = AST__namespace.findParentNode(parent, isVariableDeclaratorFromHookCall);
|
|
254
254
|
if (vd != null) {
|
|
255
|
-
eff.
|
|
255
|
+
eff.getOrElseUpdate(indSetStateCallsInUseEffectArg0, vd.init, () => []).push(node);
|
|
256
256
|
}
|
|
257
257
|
break;
|
|
258
258
|
}
|
|
@@ -263,12 +263,12 @@ function useNoDirectSetStateInUseEffect(context, options) {
|
|
|
263
263
|
if (isUseCallbackCall2(node.parent)) {
|
|
264
264
|
const vd = AST__namespace.findParentNode(node.parent, isVariableDeclaratorFromHookCall);
|
|
265
265
|
if (vd != null) {
|
|
266
|
-
eff.
|
|
266
|
+
eff.getOrElseUpdate(indSetStateCallsInUseEffectArg0, vd.init, () => []).push(node);
|
|
267
267
|
}
|
|
268
268
|
break;
|
|
269
269
|
}
|
|
270
270
|
if (isUseEffectLikeCall(node.parent)) {
|
|
271
|
-
eff.
|
|
271
|
+
eff.getOrElseUpdate(indSetStateCallsInUseEffectSetup, node.parent, () => []).push(node);
|
|
272
272
|
}
|
|
273
273
|
}
|
|
274
274
|
}
|
package/dist/index.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as AST from '@eslint-react/ast';
|
|
2
2
|
import * as ER7 from '@eslint-react/core';
|
|
3
|
-
import { identity,
|
|
3
|
+
import { identity, getOrElseUpdate, constVoid, constTrue } from '@eslint-react/eff';
|
|
4
4
|
import { getDocsUrl, getSettingsFromContext } from '@eslint-react/shared';
|
|
5
5
|
import * as VAR4 from '@eslint-react/var';
|
|
6
6
|
import { AST_NODE_TYPES } from '@typescript-eslint/types';
|
|
@@ -28,7 +28,7 @@ var rules = {
|
|
|
28
28
|
|
|
29
29
|
// package.json
|
|
30
30
|
var name2 = "eslint-plugin-react-hooks-extra";
|
|
31
|
-
var version = "1.45.
|
|
31
|
+
var version = "1.45.4-beta.5";
|
|
32
32
|
var createRule = ESLintUtils.RuleCreator(getDocsUrl("hooks-extra"));
|
|
33
33
|
function isFromHookCall(context, name3, settings, predicate = constTrue) {
|
|
34
34
|
const hookAlias = settings.additionalHooks[name3] ?? [];
|
|
@@ -145,10 +145,10 @@ function useNoDirectSetStateInUseEffect(context, options) {
|
|
|
145
145
|
const setupFunctionRef = { current: null };
|
|
146
146
|
const setupFunctionIdentifiers = [];
|
|
147
147
|
const indFunctionCalls = [];
|
|
148
|
-
const indSetStateCalls = /* @__PURE__ */ new
|
|
149
|
-
const indSetStateCallsInUseEffectArg0 = /* @__PURE__ */ new
|
|
148
|
+
const indSetStateCalls = /* @__PURE__ */ new WeakMap();
|
|
149
|
+
const indSetStateCallsInUseEffectArg0 = /* @__PURE__ */ new WeakMap();
|
|
150
150
|
const indSetStateCallsInUseEffectSetup = /* @__PURE__ */ new Map();
|
|
151
|
-
const indSetStateCallsInUseMemoOrCallback = /* @__PURE__ */ new
|
|
151
|
+
const indSetStateCallsInUseMemoOrCallback = /* @__PURE__ */ new WeakMap();
|
|
152
152
|
const onSetupFunctionEnter = (node) => {
|
|
153
153
|
setupFunctionRef.current = node;
|
|
154
154
|
};
|
|
@@ -198,8 +198,8 @@ function useNoDirectSetStateInUseEffect(context, options) {
|
|
|
198
198
|
}
|
|
199
199
|
default: {
|
|
200
200
|
const vd = AST.findParentNode(node, isVariableDeclaratorFromHookCall);
|
|
201
|
-
if (vd == null)
|
|
202
|
-
else
|
|
201
|
+
if (vd == null) getOrElseUpdate(indSetStateCalls, pEntry.node, () => []).push(node);
|
|
202
|
+
else getOrElseUpdate(indSetStateCallsInUseMemoOrCallback, vd.init, () => []).push(node);
|
|
203
203
|
}
|
|
204
204
|
}
|
|
205
205
|
}).with(useEffectKind, () => {
|
|
@@ -228,7 +228,7 @@ function useNoDirectSetStateInUseEffect(context, options) {
|
|
|
228
228
|
}
|
|
229
229
|
const vd = AST.findParentNode(parent, isVariableDeclaratorFromHookCall);
|
|
230
230
|
if (vd != null) {
|
|
231
|
-
|
|
231
|
+
getOrElseUpdate(indSetStateCallsInUseEffectArg0, vd.init, () => []).push(node);
|
|
232
232
|
}
|
|
233
233
|
break;
|
|
234
234
|
}
|
|
@@ -239,12 +239,12 @@ function useNoDirectSetStateInUseEffect(context, options) {
|
|
|
239
239
|
if (isUseCallbackCall2(node.parent)) {
|
|
240
240
|
const vd = AST.findParentNode(node.parent, isVariableDeclaratorFromHookCall);
|
|
241
241
|
if (vd != null) {
|
|
242
|
-
|
|
242
|
+
getOrElseUpdate(indSetStateCallsInUseEffectArg0, vd.init, () => []).push(node);
|
|
243
243
|
}
|
|
244
244
|
break;
|
|
245
245
|
}
|
|
246
246
|
if (isUseEffectLikeCall(node.parent)) {
|
|
247
|
-
|
|
247
|
+
getOrElseUpdate(indSetStateCallsInUseEffectSetup, node.parent, () => []).push(node);
|
|
248
248
|
}
|
|
249
249
|
}
|
|
250
250
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "eslint-plugin-react-hooks-extra",
|
|
3
|
-
"version": "1.45.
|
|
3
|
+
"version": "1.45.4-beta.5",
|
|
4
4
|
"description": "ESLint React's ESLint plugin for React Hooks related rules.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"react",
|
|
@@ -50,13 +50,13 @@
|
|
|
50
50
|
"@typescript-eslint/utils": "^8.29.1",
|
|
51
51
|
"string-ts": "^2.2.1",
|
|
52
52
|
"ts-pattern": "^5.7.0",
|
|
53
|
-
"@eslint-react/ast": "1.45.
|
|
54
|
-
"@eslint-react/
|
|
55
|
-
"@eslint-react/
|
|
56
|
-
"@eslint-react/
|
|
57
|
-
"@eslint-react/
|
|
58
|
-
"@eslint-react/
|
|
59
|
-
"@eslint-react/
|
|
53
|
+
"@eslint-react/ast": "1.45.4-beta.5",
|
|
54
|
+
"@eslint-react/eff": "1.45.4-beta.5",
|
|
55
|
+
"@eslint-react/jsx": "1.45.4-beta.5",
|
|
56
|
+
"@eslint-react/core": "1.45.4-beta.5",
|
|
57
|
+
"@eslint-react/shared": "1.45.4-beta.5",
|
|
58
|
+
"@eslint-react/var": "1.45.4-beta.5",
|
|
59
|
+
"@eslint-react/kit": "1.45.4-beta.5"
|
|
60
60
|
},
|
|
61
61
|
"devDependencies": {
|
|
62
62
|
"@types/react": "^19.1.1",
|