eslint-plugin-react-hooks-extra 1.6.1-next.3 → 1.7.0-beta.2

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
@@ -6,10 +6,31 @@ var ast = require('@eslint-react/ast');
6
6
  var tools = require('@eslint-react/tools');
7
7
  var _var = require('@eslint-react/var');
8
8
  var astUtils = require('@typescript-eslint/utils/ast-utils');
9
+ var R = require('remeda');
10
+
11
+ function _interopNamespace(e) {
12
+ if (e && e.__esModule) return e;
13
+ var n = Object.create(null);
14
+ if (e) {
15
+ Object.keys(e).forEach(function (k) {
16
+ if (k !== 'default') {
17
+ var d = Object.getOwnPropertyDescriptor(e, k);
18
+ Object.defineProperty(n, k, d.get ? d : {
19
+ enumerable: true,
20
+ get: function () { return e[k]; }
21
+ });
22
+ }
23
+ });
24
+ }
25
+ n.default = e;
26
+ return Object.freeze(n);
27
+ }
28
+
29
+ var R__namespace = /*#__PURE__*/_interopNamespace(R);
9
30
 
10
31
  // package.json
11
32
  var name = "eslint-plugin-react-hooks-extra";
12
- var version = "1.6.1-next.3";
33
+ var version = "1.7.0-beta.2";
13
34
  var createRule = shared.createRuleForPlugin("hooks-extra");
14
35
  function isFromUseStateCall(context, useStateAlias) {
15
36
  return (topLevelId) => {
@@ -458,7 +479,7 @@ var no_direct_set_state_in_use_effect_default = createRule({
458
479
  create(context) {
459
480
  const settings = shared.decodeSettings(context.settings);
460
481
  const { useEffect: useEffectAlias = [], useState: useStateAlias = [] } = settings.additionalHooks ?? {};
461
- const functionStack = tools.MutList.make();
482
+ const functionStack = [];
462
483
  const effectFunctionRef = tools.MutRef.make(null);
463
484
  const effectFunctionIdentifiers = [];
464
485
  const indirectFunctionCalls = [];
@@ -472,18 +493,18 @@ var no_direct_set_state_in_use_effect_default = createRule({
472
493
  return {
473
494
  ":function"(node) {
474
495
  const functionKind = getFunctionKind(node, context, useEffectAlias);
475
- tools.MutList.append(functionStack, [node, functionKind]);
496
+ functionStack.push([node, functionKind]);
476
497
  $(functionKind).with("effect", () => {
477
498
  onEffectFunctionEnter(node);
478
499
  }).otherwise(tools.F.constVoid);
479
500
  },
480
501
  ":function:exit"(node) {
481
502
  onEffectFunctionExit(node);
482
- tools.MutList.pop(functionStack);
503
+ functionStack.pop();
483
504
  },
484
505
  CallExpression(node) {
485
506
  const effectFn = tools.MutRef.get(effectFunctionRef);
486
- const [parentFn, parentFnKind] = tools.MutList.tail(functionStack) ?? [];
507
+ const [parentFn, parentFnKind] = R__namespace.last(functionStack) ?? [];
487
508
  if (parentFn?.async) return;
488
509
  const callKind = getCallKind(node, context, useStateAlias, useEffectAlias);
489
510
  $(callKind).with("setState", () => {
@@ -569,7 +590,7 @@ var no_direct_set_state_in_use_layout_effect_default = createRule({
569
590
  create(context) {
570
591
  const settings = shared.decodeSettings(context.settings);
571
592
  const { useLayoutEffect: useLayoutEffectAlias = [], useState: useStateAlias = [] } = settings.additionalHooks ?? {};
572
- const functionStack = tools.MutList.make();
593
+ const functionStack = [];
573
594
  const effectFunctionRef = tools.MutRef.make(null);
574
595
  const effectFunctionIdentifiers = [];
575
596
  const indirectFunctionCalls = [];
@@ -583,18 +604,18 @@ var no_direct_set_state_in_use_layout_effect_default = createRule({
583
604
  return {
584
605
  ":function"(node) {
585
606
  const functionKind = getFunctionKind2(node, context, useLayoutEffectAlias);
586
- tools.MutList.append(functionStack, [node, functionKind]);
607
+ functionStack.push([node, functionKind]);
587
608
  $(functionKind).with("effect", () => {
588
609
  onEffectFunctionEnter(node);
589
610
  }).otherwise(tools.F.constVoid);
590
611
  },
591
612
  ":function:exit"(node) {
592
613
  onEffectFunctionExit(node);
593
- tools.MutList.pop(functionStack);
614
+ functionStack.pop();
594
615
  },
595
616
  CallExpression(node) {
596
617
  const effectFn = tools.MutRef.get(effectFunctionRef);
597
- const [parentFn, parentFnKind] = tools.MutList.tail(functionStack) ?? [];
618
+ const [parentFn, parentFnKind] = R__namespace.last(functionStack) ?? [];
598
619
  if (parentFn?.async) return;
599
620
  const callKind = getCallKind2(node, context, useStateAlias, useLayoutEffectAlias);
600
621
  $(callKind).with("setState", () => {
package/dist/index.mjs CHANGED
@@ -1,13 +1,14 @@
1
1
  import { useHookCollector, isReactHookCall, isUseCallbackCall, isReactHookCallWithNameLoose, isUseMemoCall, isUseStateCall, isReactHookCallWithNameAlias } from '@eslint-react/core';
2
2
  import { createRuleForPlugin, decodeSettings } from '@eslint-react/shared';
3
3
  import { isFunction, NodeType, is, getNestedIdentifiers, getNestedCallExpressions, isIIFE } from '@eslint-react/ast';
4
- import { F, O, MutList, MutRef } from '@eslint-react/tools';
4
+ import { F, O, MutRef } from '@eslint-react/tools';
5
5
  import { findVariable, getVariableNode } from '@eslint-react/var';
6
6
  import { getStaticValue } from '@typescript-eslint/utils/ast-utils';
7
+ import * as R from 'remeda';
7
8
 
8
9
  // package.json
9
10
  var name = "eslint-plugin-react-hooks-extra";
10
- var version = "1.6.1-next.3";
11
+ var version = "1.7.0-beta.2";
11
12
  var createRule = createRuleForPlugin("hooks-extra");
12
13
  function isFromUseStateCall(context, useStateAlias) {
13
14
  return (topLevelId) => {
@@ -456,7 +457,7 @@ var no_direct_set_state_in_use_effect_default = createRule({
456
457
  create(context) {
457
458
  const settings = decodeSettings(context.settings);
458
459
  const { useEffect: useEffectAlias = [], useState: useStateAlias = [] } = settings.additionalHooks ?? {};
459
- const functionStack = MutList.make();
460
+ const functionStack = [];
460
461
  const effectFunctionRef = MutRef.make(null);
461
462
  const effectFunctionIdentifiers = [];
462
463
  const indirectFunctionCalls = [];
@@ -470,18 +471,18 @@ var no_direct_set_state_in_use_effect_default = createRule({
470
471
  return {
471
472
  ":function"(node) {
472
473
  const functionKind = getFunctionKind(node, context, useEffectAlias);
473
- MutList.append(functionStack, [node, functionKind]);
474
+ functionStack.push([node, functionKind]);
474
475
  $(functionKind).with("effect", () => {
475
476
  onEffectFunctionEnter(node);
476
477
  }).otherwise(F.constVoid);
477
478
  },
478
479
  ":function:exit"(node) {
479
480
  onEffectFunctionExit(node);
480
- MutList.pop(functionStack);
481
+ functionStack.pop();
481
482
  },
482
483
  CallExpression(node) {
483
484
  const effectFn = MutRef.get(effectFunctionRef);
484
- const [parentFn, parentFnKind] = MutList.tail(functionStack) ?? [];
485
+ const [parentFn, parentFnKind] = R.last(functionStack) ?? [];
485
486
  if (parentFn?.async) return;
486
487
  const callKind = getCallKind(node, context, useStateAlias, useEffectAlias);
487
488
  $(callKind).with("setState", () => {
@@ -567,7 +568,7 @@ var no_direct_set_state_in_use_layout_effect_default = createRule({
567
568
  create(context) {
568
569
  const settings = decodeSettings(context.settings);
569
570
  const { useLayoutEffect: useLayoutEffectAlias = [], useState: useStateAlias = [] } = settings.additionalHooks ?? {};
570
- const functionStack = MutList.make();
571
+ const functionStack = [];
571
572
  const effectFunctionRef = MutRef.make(null);
572
573
  const effectFunctionIdentifiers = [];
573
574
  const indirectFunctionCalls = [];
@@ -581,18 +582,18 @@ var no_direct_set_state_in_use_layout_effect_default = createRule({
581
582
  return {
582
583
  ":function"(node) {
583
584
  const functionKind = getFunctionKind2(node, context, useLayoutEffectAlias);
584
- MutList.append(functionStack, [node, functionKind]);
585
+ functionStack.push([node, functionKind]);
585
586
  $(functionKind).with("effect", () => {
586
587
  onEffectFunctionEnter(node);
587
588
  }).otherwise(F.constVoid);
588
589
  },
589
590
  ":function:exit"(node) {
590
591
  onEffectFunctionExit(node);
591
- MutList.pop(functionStack);
592
+ functionStack.pop();
592
593
  },
593
594
  CallExpression(node) {
594
595
  const effectFn = MutRef.get(effectFunctionRef);
595
- const [parentFn, parentFnKind] = MutList.tail(functionStack) ?? [];
596
+ const [parentFn, parentFnKind] = R.last(functionStack) ?? [];
596
597
  if (parentFn?.async) return;
597
598
  const callKind = getCallKind2(node, context, useStateAlias, useLayoutEffectAlias);
598
599
  $(callKind).with("setState", () => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "eslint-plugin-react-hooks-extra",
3
- "version": "1.6.1-next.3",
3
+ "version": "1.7.0-beta.2",
4
4
  "description": "ESLint React's ESLint plugin for React Hooks related rules.",
5
5
  "homepage": "https://github.com/rel1cx/eslint-react",
6
6
  "bugs": {
@@ -35,17 +35,18 @@
35
35
  "./package.json"
36
36
  ],
37
37
  "dependencies": {
38
- "@typescript-eslint/scope-manager": "^7.17.0",
39
- "@typescript-eslint/type-utils": "^7.17.0",
40
- "@typescript-eslint/types": "^7.17.0",
41
- "@typescript-eslint/utils": "^7.17.0",
42
- "@eslint-react/ast": "1.6.1-next.3",
43
- "@eslint-react/core": "1.6.1-next.3",
44
- "@eslint-react/jsx": "1.6.1-next.3",
45
- "@eslint-react/shared": "1.6.1-next.3",
46
- "@eslint-react/types": "1.6.1-next.3",
47
- "@eslint-react/tools": "1.6.1-next.3",
48
- "@eslint-react/var": "1.6.1-next.3"
38
+ "@typescript-eslint/scope-manager": "^7.18.0",
39
+ "@typescript-eslint/type-utils": "^7.18.0",
40
+ "@typescript-eslint/types": "^7.18.0",
41
+ "@typescript-eslint/utils": "^7.18.0",
42
+ "remeda": "^2.6.0",
43
+ "@eslint-react/shared": "1.7.0-beta.2",
44
+ "@eslint-react/jsx": "1.7.0-beta.2",
45
+ "@eslint-react/ast": "1.7.0-beta.2",
46
+ "@eslint-react/tools": "1.7.0-beta.2",
47
+ "@eslint-react/types": "1.7.0-beta.2",
48
+ "@eslint-react/var": "1.7.0-beta.2",
49
+ "@eslint-react/core": "1.7.0-beta.2"
49
50
  },
50
51
  "devDependencies": {
51
52
  "@types/react": "^18.3.3",