eslint-plugin-react-hooks-extra 1.24.0-beta.0 → 1.24.0-beta.1

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 CHANGED
@@ -31,7 +31,7 @@ var VAR5__namespace = /*#__PURE__*/_interopNamespace(VAR5);
31
31
 
32
32
  // package.json
33
33
  var name = "eslint-plugin-react-hooks-extra";
34
- var version = "1.24.0-beta.0";
34
+ var version = "1.24.0-beta.1";
35
35
  var createRule = shared.createRuleForPlugin("hooks-extra");
36
36
  function isFromHookCall(name2, context, settings, predicate = eff.returnTrue) {
37
37
  const hookAlias = settings.additionalHooks?.[name2] ?? [];
@@ -203,13 +203,10 @@ var no_direct_set_state_in_use_effect_default = createRule({
203
203
  CallExpression(node) {
204
204
  const setupFunction = setupFunctionRef.current;
205
205
  const pEntry = functionEntries.at(-1);
206
- if (pEntry?.node.async) {
206
+ if (pEntry == null || pEntry.node.async) {
207
207
  return;
208
208
  }
209
209
  tsPattern.match(getCallKind(node)).with("setState", () => {
210
- if (pEntry == null) {
211
- return;
212
- }
213
210
  switch (true) {
214
211
  case (pEntry.node === setupFunction || pEntry.kind === "immediate"): {
215
212
  context.report({
@@ -223,7 +220,7 @@ var no_direct_set_state_in_use_effect_default = createRule({
223
220
  }
224
221
  default: {
225
222
  const variableDeclarator = AST__namespace.findParentNodeGuard(node, isVariableDeclaratorFromHookCall);
226
- if (variableDeclarator === eff._) {
223
+ if (variableDeclarator == null) {
227
224
  const calls = indSetStateCalls.get(pEntry.node) ?? [];
228
225
  indSetStateCalls.set(pEntry.node, [...calls, node]);
229
226
  return;
@@ -239,7 +236,7 @@ var no_direct_set_state_in_use_effect_default = createRule({
239
236
  }
240
237
  setupFunctionIdentifiers.push(...AST__namespace.getNestedIdentifiers(node));
241
238
  }).with("other", () => {
242
- if (pEntry?.node !== setupFunction) {
239
+ if (pEntry.node !== setupFunction) {
243
240
  return;
244
241
  }
245
242
  indFunctionCalls.push(node);
@@ -420,13 +417,10 @@ var no_direct_set_state_in_use_layout_effect_default = createRule({
420
417
  CallExpression(node) {
421
418
  const setupFunction = setupFunctionRef.current;
422
419
  const pEntry = functionEntries.at(-1);
423
- if (pEntry?.node.async) {
420
+ if (pEntry == null || pEntry.node.async) {
424
421
  return;
425
422
  }
426
423
  tsPattern.match(getCallKind(node)).with("setState", () => {
427
- if (pEntry == null) {
428
- return;
429
- }
430
424
  switch (true) {
431
425
  case (pEntry.node === setupFunction || pEntry.kind === "immediate"): {
432
426
  context.report({
@@ -440,7 +434,7 @@ var no_direct_set_state_in_use_layout_effect_default = createRule({
440
434
  }
441
435
  default: {
442
436
  const variableDeclarator = AST__namespace.findParentNodeGuard(node, isVariableDeclaratorFromHookCall);
443
- if (variableDeclarator === eff._) {
437
+ if (variableDeclarator == null) {
444
438
  const calls = indSetStateCalls.get(pEntry.node) ?? [];
445
439
  indSetStateCalls.set(pEntry.node, [...calls, node]);
446
440
  return;
@@ -456,7 +450,7 @@ var no_direct_set_state_in_use_layout_effect_default = createRule({
456
450
  }
457
451
  setupFunctionIdentifiers.push(...AST__namespace.getNestedIdentifiers(node));
458
452
  }).with("other", () => {
459
- if (pEntry?.node !== setupFunction) {
453
+ if (pEntry.node !== setupFunction) {
460
454
  return;
461
455
  }
462
456
  indFunctionCalls.push(node);
@@ -625,7 +619,7 @@ var no_unnecessary_use_callback_default = createRule({
625
619
  }
626
620
  return variableNode;
627
621
  }).otherwise(() => eff._);
628
- if (arg0Node === eff._) return;
622
+ if (arg0Node == null) return;
629
623
  const arg0NodeScope = context.sourceCode.getScope(arg0Node);
630
624
  const arg0NodeReferences = VAR5__namespace.getChidScopes(arg0NodeScope).flatMap((x) => x.references);
631
625
  const isReferencedToComponentScope = arg0NodeReferences.some((x) => x.resolved?.scope.block === component);
@@ -708,7 +702,7 @@ var no_unnecessary_use_memo_default = createRule({
708
702
  }
709
703
  return variableNode;
710
704
  }).otherwise(() => eff._);
711
- if (arg0Node === eff._) return;
705
+ if (arg0Node == null) return;
712
706
  const arg0NodeScope = context.sourceCode.getScope(arg0Node);
713
707
  const arg0NodeReferences = VAR5__namespace.getChidScopes(arg0NodeScope).flatMap((x) => x.references);
714
708
  const isReferencedToComponentScope = arg0NodeReferences.some((x) => x.resolved?.scope.block === component);
package/dist/index.mjs CHANGED
@@ -8,7 +8,7 @@ import { match } from 'ts-pattern';
8
8
 
9
9
  // package.json
10
10
  var name = "eslint-plugin-react-hooks-extra";
11
- var version = "1.24.0-beta.0";
11
+ var version = "1.24.0-beta.1";
12
12
  var createRule = createRuleForPlugin("hooks-extra");
13
13
  function isFromHookCall(name2, context, settings, predicate = returnTrue) {
14
14
  const hookAlias = settings.additionalHooks?.[name2] ?? [];
@@ -180,13 +180,10 @@ var no_direct_set_state_in_use_effect_default = createRule({
180
180
  CallExpression(node) {
181
181
  const setupFunction = setupFunctionRef.current;
182
182
  const pEntry = functionEntries.at(-1);
183
- if (pEntry?.node.async) {
183
+ if (pEntry == null || pEntry.node.async) {
184
184
  return;
185
185
  }
186
186
  match(getCallKind(node)).with("setState", () => {
187
- if (pEntry == null) {
188
- return;
189
- }
190
187
  switch (true) {
191
188
  case (pEntry.node === setupFunction || pEntry.kind === "immediate"): {
192
189
  context.report({
@@ -200,7 +197,7 @@ var no_direct_set_state_in_use_effect_default = createRule({
200
197
  }
201
198
  default: {
202
199
  const variableDeclarator = AST.findParentNodeGuard(node, isVariableDeclaratorFromHookCall);
203
- if (variableDeclarator === _) {
200
+ if (variableDeclarator == null) {
204
201
  const calls = indSetStateCalls.get(pEntry.node) ?? [];
205
202
  indSetStateCalls.set(pEntry.node, [...calls, node]);
206
203
  return;
@@ -216,7 +213,7 @@ var no_direct_set_state_in_use_effect_default = createRule({
216
213
  }
217
214
  setupFunctionIdentifiers.push(...AST.getNestedIdentifiers(node));
218
215
  }).with("other", () => {
219
- if (pEntry?.node !== setupFunction) {
216
+ if (pEntry.node !== setupFunction) {
220
217
  return;
221
218
  }
222
219
  indFunctionCalls.push(node);
@@ -397,13 +394,10 @@ var no_direct_set_state_in_use_layout_effect_default = createRule({
397
394
  CallExpression(node) {
398
395
  const setupFunction = setupFunctionRef.current;
399
396
  const pEntry = functionEntries.at(-1);
400
- if (pEntry?.node.async) {
397
+ if (pEntry == null || pEntry.node.async) {
401
398
  return;
402
399
  }
403
400
  match(getCallKind(node)).with("setState", () => {
404
- if (pEntry == null) {
405
- return;
406
- }
407
401
  switch (true) {
408
402
  case (pEntry.node === setupFunction || pEntry.kind === "immediate"): {
409
403
  context.report({
@@ -417,7 +411,7 @@ var no_direct_set_state_in_use_layout_effect_default = createRule({
417
411
  }
418
412
  default: {
419
413
  const variableDeclarator = AST.findParentNodeGuard(node, isVariableDeclaratorFromHookCall);
420
- if (variableDeclarator === _) {
414
+ if (variableDeclarator == null) {
421
415
  const calls = indSetStateCalls.get(pEntry.node) ?? [];
422
416
  indSetStateCalls.set(pEntry.node, [...calls, node]);
423
417
  return;
@@ -433,7 +427,7 @@ var no_direct_set_state_in_use_layout_effect_default = createRule({
433
427
  }
434
428
  setupFunctionIdentifiers.push(...AST.getNestedIdentifiers(node));
435
429
  }).with("other", () => {
436
- if (pEntry?.node !== setupFunction) {
430
+ if (pEntry.node !== setupFunction) {
437
431
  return;
438
432
  }
439
433
  indFunctionCalls.push(node);
@@ -602,7 +596,7 @@ var no_unnecessary_use_callback_default = createRule({
602
596
  }
603
597
  return variableNode;
604
598
  }).otherwise(() => _);
605
- if (arg0Node === _) return;
599
+ if (arg0Node == null) return;
606
600
  const arg0NodeScope = context.sourceCode.getScope(arg0Node);
607
601
  const arg0NodeReferences = VAR5.getChidScopes(arg0NodeScope).flatMap((x) => x.references);
608
602
  const isReferencedToComponentScope = arg0NodeReferences.some((x) => x.resolved?.scope.block === component);
@@ -685,7 +679,7 @@ var no_unnecessary_use_memo_default = createRule({
685
679
  }
686
680
  return variableNode;
687
681
  }).otherwise(() => _);
688
- if (arg0Node === _) return;
682
+ if (arg0Node == null) return;
689
683
  const arg0NodeScope = context.sourceCode.getScope(arg0Node);
690
684
  const arg0NodeReferences = VAR5.getChidScopes(arg0NodeScope).flatMap((x) => x.references);
691
685
  const isReferencedToComponentScope = arg0NodeReferences.some((x) => x.resolved?.scope.block === component);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "eslint-plugin-react-hooks-extra",
3
- "version": "1.24.0-beta.0",
3
+ "version": "1.24.0-beta.1",
4
4
  "description": "ESLint React's ESLint plugin for React Hooks related rules.",
5
5
  "keywords": [
6
6
  "react",
@@ -48,17 +48,17 @@
48
48
  "@typescript-eslint/utils": "^8.19.1",
49
49
  "string-ts": "^2.2.0",
50
50
  "ts-pattern": "^5.6.0",
51
- "@eslint-react/ast": "1.24.0-beta.0",
52
- "@eslint-react/core": "1.24.0-beta.0",
53
- "@eslint-react/jsx": "1.24.0-beta.0",
54
- "@eslint-react/shared": "1.24.0-beta.0",
55
- "@eslint-react/var": "1.24.0-beta.0",
56
- "@eslint-react/eff": "1.24.0-beta.0",
57
- "@eslint-react/types": "1.24.0-beta.0"
51
+ "@eslint-react/ast": "1.24.0-beta.1",
52
+ "@eslint-react/eff": "1.24.0-beta.1",
53
+ "@eslint-react/jsx": "1.24.0-beta.1",
54
+ "@eslint-react/shared": "1.24.0-beta.1",
55
+ "@eslint-react/var": "1.24.0-beta.1",
56
+ "@eslint-react/core": "1.24.0-beta.1",
57
+ "@eslint-react/types": "1.24.0-beta.1"
58
58
  },
59
59
  "devDependencies": {
60
- "@types/react": "^19.0.4",
61
- "@types/react-dom": "^19.0.2",
60
+ "@types/react": "^19.0.5",
61
+ "@types/react-dom": "^19.0.3",
62
62
  "tsup": "^8.3.5",
63
63
  "@workspace/configs": "0.0.0"
64
64
  },