eslint-plugin-react-hooks-extra 1.5.10 → 1.5.11-beta.12

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.
Files changed (3) hide show
  1. package/dist/index.js +99 -60
  2. package/dist/index.mjs +100 -61
  3. package/package.json +16 -15
package/dist/index.js CHANGED
@@ -4,8 +4,8 @@ var core = require('@eslint-react/core');
4
4
  require('string-ts');
5
5
  var shared = require('@eslint-react/shared');
6
6
  var ast = require('@eslint-react/ast');
7
- var jsx = require('@eslint-react/jsx');
8
7
  var _var = require('@eslint-react/var');
8
+ var valibot = require('valibot');
9
9
 
10
10
  var __defProp = Object.defineProperty;
11
11
  var __export = (target, all2) => {
@@ -15,7 +15,7 @@ var __export = (target, all2) => {
15
15
 
16
16
  // package.json
17
17
  var name = "eslint-plugin-react-hooks-extra";
18
- var version = "1.5.10";
18
+ var version = "1.5.11-beta.12";
19
19
  var createRule = shared.createRuleForPlugin("hooks-extra");
20
20
 
21
21
  // src/rules/ensure-custom-hooks-using-other-hooks.ts
@@ -56,7 +56,7 @@ var ensure_custom_hooks_using_other_hooks_default = createRule({
56
56
  defaultOptions: []
57
57
  });
58
58
 
59
- // ../../../node_modules/.pnpm/effect@3.0.7/node_modules/effect/dist/esm/Function.js
59
+ // ../../../node_modules/.pnpm/effect@3.1.2/node_modules/effect/dist/esm/Function.js
60
60
  var Function_exports = {};
61
61
  __export(Function_exports, {
62
62
  SK: () => SK,
@@ -231,14 +231,25 @@ function flow(ab, bc, cd, de, ef, fg, gh, hi, ij) {
231
231
  var hole = /* @__PURE__ */ unsafeCoerce(absurd);
232
232
  var SK = (_2, b2) => b2;
233
233
 
234
- // ../../../node_modules/.pnpm/effect@3.0.7/node_modules/effect/dist/esm/Equivalence.js
234
+ // ../../../node_modules/.pnpm/effect@3.1.2/node_modules/effect/dist/esm/Equivalence.js
235
235
  var make = (isEquivalent) => (self, that) => self === that || isEquivalent(self, that);
236
236
 
237
- // ../../../node_modules/.pnpm/effect@3.0.7/node_modules/effect/dist/esm/internal/version.js
238
- var moduleVersion = "3.0.7";
237
+ // ../../../node_modules/.pnpm/effect@3.1.2/node_modules/effect/dist/esm/internal/doNotation.js
238
+ var let_ = (map2) => dual(3, (self, name2, f) => map2(self, (a) => Object.assign({}, a, {
239
+ [name2]: f(a)
240
+ })));
241
+ var bindTo = (map2) => dual(2, (self, name2) => map2(self, (a) => ({
242
+ [name2]: a
243
+ })));
244
+ var bind = (map2, flatMap2) => dual(3, (self, name2, f) => flatMap2(self, (a) => map2(f(a), (b2) => Object.assign({}, a, {
245
+ [name2]: b2
246
+ }))));
247
+
248
+ // ../../../node_modules/.pnpm/effect@3.1.2/node_modules/effect/dist/esm/internal/version.js
249
+ var moduleVersion = "3.1.2";
239
250
  var getCurrentVersion = () => moduleVersion;
240
251
 
241
- // ../../../node_modules/.pnpm/effect@3.0.7/node_modules/effect/dist/esm/GlobalValue.js
252
+ // ../../../node_modules/.pnpm/effect@3.1.2/node_modules/effect/dist/esm/GlobalValue.js
242
253
  var globalStoreId = /* @__PURE__ */ Symbol.for(`effect/GlobalValue/globalStoreId/${/* @__PURE__ */ getCurrentVersion()}`);
243
254
  if (!(globalStoreId in globalThis)) {
244
255
  globalThis[globalStoreId] = /* @__PURE__ */ new Map();
@@ -251,17 +262,17 @@ var globalValue = (id, compute) => {
251
262
  return globalStore.get(id);
252
263
  };
253
264
 
254
- // ../../../node_modules/.pnpm/effect@3.0.7/node_modules/effect/dist/esm/Predicate.js
265
+ // ../../../node_modules/.pnpm/effect@3.1.2/node_modules/effect/dist/esm/Predicate.js
255
266
  var isFunction2 = isFunction;
256
267
  var isRecordOrArray = (input) => typeof input === "object" && input !== null;
257
268
  var isObject = (input) => isRecordOrArray(input) || isFunction2(input);
258
269
  var hasProperty = /* @__PURE__ */ dual(2, (self, property) => isObject(self) && property in self);
259
270
  var isNullable = (input) => input === null || input === void 0;
260
271
 
261
- // ../../../node_modules/.pnpm/effect@3.0.7/node_modules/effect/dist/esm/internal/errors.js
272
+ // ../../../node_modules/.pnpm/effect@3.1.2/node_modules/effect/dist/esm/internal/errors.js
262
273
  var getBugErrorMessage = (message) => `BUG: ${message} - please report an issue at https://github.com/Effect-TS/effect/issues`;
263
274
 
264
- // ../../../node_modules/.pnpm/effect@3.0.7/node_modules/effect/dist/esm/Utils.js
275
+ // ../../../node_modules/.pnpm/effect@3.1.2/node_modules/effect/dist/esm/Utils.js
265
276
  var GenKindTypeId = /* @__PURE__ */ Symbol.for("effect/Gen/GenKind");
266
277
  var isGenKind = (u2) => isObject(u2) && GenKindTypeId in u2;
267
278
  var GenKindImpl = class {
@@ -500,8 +511,12 @@ function yieldWrapGet(self) {
500
511
  }
501
512
  throw new Error(getBugErrorMessage("yieldWrapGet"));
502
513
  }
514
+ var structuralRegionState = /* @__PURE__ */ globalValue("effect/Utils/isStructuralRegion", () => ({
515
+ enabled: false,
516
+ tester: void 0
517
+ }));
503
518
 
504
- // ../../../node_modules/.pnpm/effect@3.0.7/node_modules/effect/dist/esm/Hash.js
519
+ // ../../../node_modules/.pnpm/effect@3.1.2/node_modules/effect/dist/esm/Hash.js
505
520
  var randomHashCache = /* @__PURE__ */ globalValue(/* @__PURE__ */ Symbol.for("effect/Hash/randomHashCache"), () => /* @__PURE__ */ new WeakMap());
506
521
  var pcgr = /* @__PURE__ */ globalValue(/* @__PURE__ */ Symbol.for("effect/Hash/pcgr"), () => new PCGRandom());
507
522
  var symbol = /* @__PURE__ */ Symbol.for("effect/Hash");
@@ -535,6 +550,9 @@ var hash = (self) => {
535
550
  }
536
551
  };
537
552
  var random = (self) => {
553
+ if (structuralRegionState.enabled === true) {
554
+ return 0;
555
+ }
538
556
  if (!randomHashCache.has(self)) {
539
557
  randomHashCache.set(self, number(pcgr.integer(Number.MAX_SAFE_INTEGER)));
540
558
  }
@@ -567,27 +585,39 @@ var cached = function() {
567
585
  if (arguments.length === 1) {
568
586
  const self2 = arguments[0];
569
587
  return function(hash3) {
570
- Object.defineProperty(self2, symbol, {
571
- value() {
572
- return hash3;
573
- },
574
- enumerable: false
575
- });
588
+ const original2 = self2[symbol].bind(self2);
589
+ if (structuralRegionState.enabled === false) {
590
+ Object.defineProperty(self2, symbol, {
591
+ value() {
592
+ if (structuralRegionState.enabled === true) {
593
+ return original2();
594
+ }
595
+ return hash3;
596
+ },
597
+ enumerable: false
598
+ });
599
+ }
576
600
  return hash3;
577
601
  };
578
602
  }
579
603
  const self = arguments[0];
580
604
  const hash2 = arguments[1];
581
- Object.defineProperty(self, symbol, {
582
- value() {
583
- return hash2;
584
- },
585
- enumerable: false
586
- });
605
+ const original = self[symbol].bind(self);
606
+ if (structuralRegionState.enabled === false) {
607
+ Object.defineProperty(self, symbol, {
608
+ value() {
609
+ if (structuralRegionState.enabled === true) {
610
+ return original();
611
+ }
612
+ return hash2;
613
+ },
614
+ enumerable: false
615
+ });
616
+ }
587
617
  return hash2;
588
618
  };
589
619
 
590
- // ../../../node_modules/.pnpm/effect@3.0.7/node_modules/effect/dist/esm/Equal.js
620
+ // ../../../node_modules/.pnpm/effect@3.1.2/node_modules/effect/dist/esm/Equal.js
591
621
  var symbol2 = /* @__PURE__ */ Symbol.for("effect/Equal");
592
622
  function equals() {
593
623
  if (arguments.length === 1) {
@@ -603,17 +633,37 @@ function compareBoth(self, that) {
603
633
  if (selfType !== typeof that) {
604
634
  return false;
605
635
  }
606
- if ((selfType === "object" || selfType === "function") && self !== null && that !== null) {
607
- if (isEqual(self) && isEqual(that)) {
608
- return hash(self) === hash(that) && self[symbol2](that);
636
+ if (selfType === "object" || selfType === "function") {
637
+ if (self !== null && that !== null) {
638
+ if (isEqual(self) && isEqual(that)) {
639
+ return hash(self) === hash(that) && self[symbol2](that);
640
+ }
641
+ }
642
+ if (structuralRegionState.enabled) {
643
+ if (Array.isArray(self) && Array.isArray(that)) {
644
+ return self.length === that.length && self.every((v2, i2) => compareBoth(v2, that[i2]));
645
+ }
646
+ if (Object.getPrototypeOf(self) === Object.prototype && Object.getPrototypeOf(self) === Object.prototype) {
647
+ const keysSelf = Object.keys(self);
648
+ const keysThat = Object.keys(that);
649
+ if (keysSelf.length === keysThat.length) {
650
+ for (const key of keysSelf) {
651
+ if (!(key in that && compareBoth(self[key], that[key]))) {
652
+ return structuralRegionState.tester ? structuralRegionState.tester(self, that) : false;
653
+ }
654
+ }
655
+ return true;
656
+ }
657
+ }
658
+ return structuralRegionState.tester ? structuralRegionState.tester(self, that) : false;
609
659
  }
610
660
  }
611
- return false;
661
+ return structuralRegionState.enabled && structuralRegionState.tester ? structuralRegionState.tester(self, that) : false;
612
662
  }
613
663
  var isEqual = (u2) => hasProperty(u2, symbol2);
614
664
  var equivalence = () => equals;
615
665
 
616
- // ../../../node_modules/.pnpm/effect@3.0.7/node_modules/effect/dist/esm/Inspectable.js
666
+ // ../../../node_modules/.pnpm/effect@3.1.2/node_modules/effect/dist/esm/Inspectable.js
617
667
  var NodeInspectSymbol = /* @__PURE__ */ Symbol.for("nodejs.util.inspect.custom");
618
668
  var toJSON = (x2) => {
619
669
  if (hasProperty(x2, "toJSON") && isFunction2(x2["toJSON"]) && x2["toJSON"].length === 0) {
@@ -625,7 +675,7 @@ var toJSON = (x2) => {
625
675
  };
626
676
  var format = (x2) => JSON.stringify(x2, null, 2);
627
677
 
628
- // ../../../node_modules/.pnpm/effect@3.0.7/node_modules/effect/dist/esm/Pipeable.js
678
+ // ../../../node_modules/.pnpm/effect@3.1.2/node_modules/effect/dist/esm/Pipeable.js
629
679
  var pipeArguments = (self, args) => {
630
680
  switch (args.length) {
631
681
  case 1:
@@ -656,7 +706,7 @@ var pipeArguments = (self, args) => {
656
706
  }
657
707
  };
658
708
 
659
- // ../../../node_modules/.pnpm/effect@3.0.7/node_modules/effect/dist/esm/internal/effectable.js
709
+ // ../../../node_modules/.pnpm/effect@3.1.2/node_modules/effect/dist/esm/internal/effectable.js
660
710
  var EffectTypeId = /* @__PURE__ */ Symbol.for("effect/Effect");
661
711
  var StreamTypeId = /* @__PURE__ */ Symbol.for("effect/Stream");
662
712
  var SinkTypeId = /* @__PURE__ */ Symbol.for("effect/Sink");
@@ -717,7 +767,7 @@ var EffectPrototype = {
717
767
  }
718
768
  };
719
769
 
720
- // ../../../node_modules/.pnpm/effect@3.0.7/node_modules/effect/dist/esm/internal/option.js
770
+ // ../../../node_modules/.pnpm/effect@3.1.2/node_modules/effect/dist/esm/internal/option.js
721
771
  var TypeId = /* @__PURE__ */ Symbol.for("effect/Option");
722
772
  var CommonProto = {
723
773
  ...EffectPrototype,
@@ -775,7 +825,7 @@ var some = (value) => {
775
825
  return a;
776
826
  };
777
827
 
778
- // ../../../node_modules/.pnpm/effect@3.0.7/node_modules/effect/dist/esm/internal/either.js
828
+ // ../../../node_modules/.pnpm/effect@3.1.2/node_modules/effect/dist/esm/internal/either.js
779
829
  var TypeId2 = /* @__PURE__ */ Symbol.for("effect/Either");
780
830
  var CommonProto2 = {
781
831
  ...EffectPrototype,
@@ -839,7 +889,7 @@ var right = (right2) => {
839
889
  var getLeft = (self) => isRight(self) ? none : some(self.left);
840
890
  var getRight = (self) => isLeft(self) ? none : some(self.right);
841
891
 
842
- // ../../../node_modules/.pnpm/effect@3.0.7/node_modules/effect/dist/esm/Option.js
892
+ // ../../../node_modules/.pnpm/effect@3.1.2/node_modules/effect/dist/esm/Option.js
843
893
  var Option_exports = {};
844
894
  __export(Option_exports, {
845
895
  Do: () => Do,
@@ -849,8 +899,8 @@ __export(Option_exports, {
849
899
  ap: () => ap,
850
900
  as: () => as,
851
901
  asVoid: () => asVoid,
852
- bind: () => bind,
853
- bindTo: () => bindTo,
902
+ bind: () => bind2,
903
+ bindTo: () => bindTo2,
854
904
  composeK: () => composeK,
855
905
  contains: () => contains,
856
906
  containsWith: () => containsWith,
@@ -876,7 +926,7 @@ __export(Option_exports, {
876
926
  isNone: () => isNone2,
877
927
  isOption: () => isOption2,
878
928
  isSome: () => isSome2,
879
- let: () => let_,
929
+ let: () => let_2,
880
930
  lift2: () => lift2,
881
931
  liftNullable: () => liftNullable,
882
932
  liftPredicate: () => liftPredicate,
@@ -901,10 +951,10 @@ __export(Option_exports, {
901
951
  zipWith: () => zipWith
902
952
  });
903
953
 
904
- // ../../../node_modules/.pnpm/effect@3.0.7/node_modules/effect/dist/esm/Order.js
954
+ // ../../../node_modules/.pnpm/effect@3.1.2/node_modules/effect/dist/esm/Order.js
905
955
  var make2 = (compare) => (self, that) => self === that ? 0 : compare(self, that);
906
956
 
907
- // ../../../node_modules/.pnpm/effect@3.0.7/node_modules/effect/dist/esm/Option.js
957
+ // ../../../node_modules/.pnpm/effect@3.1.2/node_modules/effect/dist/esm/Option.js
908
958
  var TypeId3 = /* @__PURE__ */ Symbol.for("effect/Option");
909
959
  var none2 = () => none;
910
960
  var some2 = some;
@@ -1034,15 +1084,9 @@ var containsWith = (isEquivalent) => dual(2, (self, a) => isNone2(self) ? false
1034
1084
  var _equivalence = /* @__PURE__ */ equivalence();
1035
1085
  var contains = /* @__PURE__ */ containsWith(_equivalence);
1036
1086
  var exists = /* @__PURE__ */ dual(2, (self, refinement) => isNone2(self) ? false : refinement(self.value));
1037
- var bindTo = /* @__PURE__ */ dual(2, (self, name2) => map(self, (a) => ({
1038
- [name2]: a
1039
- })));
1040
- var let_ = /* @__PURE__ */ dual(3, (self, name2, f) => map(self, (a) => Object.assign({}, a, {
1041
- [name2]: f(a)
1042
- })));
1043
- var bind = /* @__PURE__ */ dual(3, (self, name2, f) => flatMap(self, (a) => map(f(a), (b2) => Object.assign({}, a, {
1044
- [name2]: b2
1045
- }))));
1087
+ var bindTo2 = /* @__PURE__ */ bindTo(map);
1088
+ var let_2 = /* @__PURE__ */ let_(map);
1089
+ var bind2 = /* @__PURE__ */ bind(map, flatMap);
1046
1090
  var Do = /* @__PURE__ */ some2({});
1047
1091
  var adapter2 = /* @__PURE__ */ adapter();
1048
1092
  var gen = (f) => {
@@ -1254,8 +1298,6 @@ var z = class _z {
1254
1298
  return this;
1255
1299
  }
1256
1300
  };
1257
-
1258
- // src/rules/ensure-use-callback-has-non-empty-deps.ts
1259
1301
  var RULE_NAME2 = "ensure-use-callback-has-non-empty-deps";
1260
1302
  var ensure_use_callback_has_non_empty_deps_default = createRule({
1261
1303
  meta: {
@@ -1271,14 +1313,13 @@ var ensure_use_callback_has_non_empty_deps_default = createRule({
1271
1313
  },
1272
1314
  name: RULE_NAME2,
1273
1315
  create(context) {
1274
- const alias = shared.parseSchema(shared.ESLintSettingsSchema, context.settings).reactOptions?.additionalHooks?.useCallback ?? [];
1275
- const pragma = jsx.getPragmaFromContext(context);
1316
+ const alias = valibot.parse(shared.ESLintSettingsSchema, context.settings).reactOptions?.additionalHooks?.useCallback ?? [];
1276
1317
  return {
1277
1318
  CallExpression(node) {
1278
1319
  const initialScope = context.sourceCode.getScope(node);
1279
1320
  if (!core.isReactHookCall(node))
1280
1321
  return;
1281
- if (!core.isUseCallbackCall(node, context, pragma) && !alias.some(Function_exports.flip(core.isReactHookCallWithNameLoose)(node))) {
1322
+ if (!core.isUseCallbackCall(node, context) && !alias.some(Function_exports.flip(core.isReactHookCallWithNameLoose)(node))) {
1282
1323
  return;
1283
1324
  }
1284
1325
  const [_2, deps] = node.arguments;
@@ -1324,14 +1365,13 @@ var ensure_use_memo_has_non_empty_deps_default = createRule({
1324
1365
  },
1325
1366
  name: RULE_NAME3,
1326
1367
  create(context) {
1327
- const alias = shared.parseSchema(shared.ESLintSettingsSchema, context.settings).reactOptions?.additionalHooks?.useMemo ?? [];
1328
- const pragma = jsx.getPragmaFromContext(context);
1368
+ const alias = valibot.parse(shared.ESLintSettingsSchema, context.settings).reactOptions?.additionalHooks?.useMemo ?? [];
1329
1369
  return {
1330
1370
  CallExpression(node) {
1331
1371
  const initialScope = context.sourceCode.getScope(node);
1332
1372
  if (!core.isReactHookCall(node))
1333
1373
  return;
1334
- if (!core.isUseMemoCall(node, context, pragma) && !alias.some(Function_exports.flip(core.isReactHookCallWithNameLoose)(node)))
1374
+ if (!core.isUseMemoCall(node, context) && !alias.some(Function_exports.flip(core.isReactHookCallWithNameLoose)(node)))
1335
1375
  return;
1336
1376
  const [_2, deps] = node.arguments;
1337
1377
  if (!deps) {
@@ -1362,7 +1402,7 @@ var ensure_use_memo_has_non_empty_deps_default = createRule({
1362
1402
  defaultOptions: []
1363
1403
  });
1364
1404
  var RULE_NAME4 = "prefer-use-state-lazy-initialization";
1365
- var ALLOW_LIST = Object.freeze(["Boolean", "String", "Number"]);
1405
+ var ALLOW_LIST = ["Boolean", "String", "Number"];
1366
1406
  var prefer_use_state_lazy_initialization_default = createRule({
1367
1407
  meta: {
1368
1408
  type: "problem",
@@ -1377,13 +1417,12 @@ var prefer_use_state_lazy_initialization_default = createRule({
1377
1417
  },
1378
1418
  name: RULE_NAME4,
1379
1419
  create(context) {
1380
- const alias = shared.parseSchema(shared.ESLintSettingsSchema, context.settings).reactOptions?.additionalHooks?.useState ?? [];
1381
- const pragma = jsx.getPragmaFromContext(context);
1420
+ const alias = valibot.parse(shared.ESLintSettingsSchema, context.settings).reactOptions?.additionalHooks?.useState ?? [];
1382
1421
  return {
1383
1422
  CallExpression(node) {
1384
1423
  if (!core.isReactHookCall(node))
1385
1424
  return;
1386
- if (!core.isUseStateCall(node, context, pragma) && !alias.some(Function_exports.flip(core.isReactHookCallWithNameLoose)(node)))
1425
+ if (!core.isUseStateCall(node, context) && !alias.some(Function_exports.flip(core.isReactHookCallWithNameLoose)(node)))
1387
1426
  return;
1388
1427
  const [useStateInput] = node.arguments;
1389
1428
  if (!useStateInput)
package/dist/index.mjs CHANGED
@@ -1,9 +1,9 @@
1
1
  import { useHookCollector, isReactHookCall, isUseCallbackCall, isReactHookCallWithNameLoose, isUseMemoCall, isUseStateCall } from '@eslint-react/core';
2
2
  import 'string-ts';
3
- import { createRuleForPlugin, parseSchema, ESLintSettingsSchema } from '@eslint-react/shared';
3
+ import { createRuleForPlugin, ESLintSettingsSchema } from '@eslint-react/shared';
4
4
  import { NodeType, is, getNestedCallExpressions } from '@eslint-react/ast';
5
- import { getPragmaFromContext } from '@eslint-react/jsx';
6
5
  import { findVariable, getVariableInit } from '@eslint-react/var';
6
+ import { parse } from 'valibot';
7
7
 
8
8
  var __defProp = Object.defineProperty;
9
9
  var __export = (target, all2) => {
@@ -13,7 +13,7 @@ var __export = (target, all2) => {
13
13
 
14
14
  // package.json
15
15
  var name = "eslint-plugin-react-hooks-extra";
16
- var version = "1.5.10";
16
+ var version = "1.5.11-beta.12";
17
17
  var createRule = createRuleForPlugin("hooks-extra");
18
18
 
19
19
  // src/rules/ensure-custom-hooks-using-other-hooks.ts
@@ -54,7 +54,7 @@ var ensure_custom_hooks_using_other_hooks_default = createRule({
54
54
  defaultOptions: []
55
55
  });
56
56
 
57
- // ../../../node_modules/.pnpm/effect@3.0.7/node_modules/effect/dist/esm/Function.js
57
+ // ../../../node_modules/.pnpm/effect@3.1.2/node_modules/effect/dist/esm/Function.js
58
58
  var Function_exports = {};
59
59
  __export(Function_exports, {
60
60
  SK: () => SK,
@@ -229,14 +229,25 @@ function flow(ab, bc, cd, de, ef, fg, gh, hi, ij) {
229
229
  var hole = /* @__PURE__ */ unsafeCoerce(absurd);
230
230
  var SK = (_2, b2) => b2;
231
231
 
232
- // ../../../node_modules/.pnpm/effect@3.0.7/node_modules/effect/dist/esm/Equivalence.js
232
+ // ../../../node_modules/.pnpm/effect@3.1.2/node_modules/effect/dist/esm/Equivalence.js
233
233
  var make = (isEquivalent) => (self, that) => self === that || isEquivalent(self, that);
234
234
 
235
- // ../../../node_modules/.pnpm/effect@3.0.7/node_modules/effect/dist/esm/internal/version.js
236
- var moduleVersion = "3.0.7";
235
+ // ../../../node_modules/.pnpm/effect@3.1.2/node_modules/effect/dist/esm/internal/doNotation.js
236
+ var let_ = (map2) => dual(3, (self, name2, f) => map2(self, (a) => Object.assign({}, a, {
237
+ [name2]: f(a)
238
+ })));
239
+ var bindTo = (map2) => dual(2, (self, name2) => map2(self, (a) => ({
240
+ [name2]: a
241
+ })));
242
+ var bind = (map2, flatMap2) => dual(3, (self, name2, f) => flatMap2(self, (a) => map2(f(a), (b2) => Object.assign({}, a, {
243
+ [name2]: b2
244
+ }))));
245
+
246
+ // ../../../node_modules/.pnpm/effect@3.1.2/node_modules/effect/dist/esm/internal/version.js
247
+ var moduleVersion = "3.1.2";
237
248
  var getCurrentVersion = () => moduleVersion;
238
249
 
239
- // ../../../node_modules/.pnpm/effect@3.0.7/node_modules/effect/dist/esm/GlobalValue.js
250
+ // ../../../node_modules/.pnpm/effect@3.1.2/node_modules/effect/dist/esm/GlobalValue.js
240
251
  var globalStoreId = /* @__PURE__ */ Symbol.for(`effect/GlobalValue/globalStoreId/${/* @__PURE__ */ getCurrentVersion()}`);
241
252
  if (!(globalStoreId in globalThis)) {
242
253
  globalThis[globalStoreId] = /* @__PURE__ */ new Map();
@@ -249,17 +260,17 @@ var globalValue = (id, compute) => {
249
260
  return globalStore.get(id);
250
261
  };
251
262
 
252
- // ../../../node_modules/.pnpm/effect@3.0.7/node_modules/effect/dist/esm/Predicate.js
263
+ // ../../../node_modules/.pnpm/effect@3.1.2/node_modules/effect/dist/esm/Predicate.js
253
264
  var isFunction2 = isFunction;
254
265
  var isRecordOrArray = (input) => typeof input === "object" && input !== null;
255
266
  var isObject = (input) => isRecordOrArray(input) || isFunction2(input);
256
267
  var hasProperty = /* @__PURE__ */ dual(2, (self, property) => isObject(self) && property in self);
257
268
  var isNullable = (input) => input === null || input === void 0;
258
269
 
259
- // ../../../node_modules/.pnpm/effect@3.0.7/node_modules/effect/dist/esm/internal/errors.js
270
+ // ../../../node_modules/.pnpm/effect@3.1.2/node_modules/effect/dist/esm/internal/errors.js
260
271
  var getBugErrorMessage = (message) => `BUG: ${message} - please report an issue at https://github.com/Effect-TS/effect/issues`;
261
272
 
262
- // ../../../node_modules/.pnpm/effect@3.0.7/node_modules/effect/dist/esm/Utils.js
273
+ // ../../../node_modules/.pnpm/effect@3.1.2/node_modules/effect/dist/esm/Utils.js
263
274
  var GenKindTypeId = /* @__PURE__ */ Symbol.for("effect/Gen/GenKind");
264
275
  var isGenKind = (u2) => isObject(u2) && GenKindTypeId in u2;
265
276
  var GenKindImpl = class {
@@ -498,8 +509,12 @@ function yieldWrapGet(self) {
498
509
  }
499
510
  throw new Error(getBugErrorMessage("yieldWrapGet"));
500
511
  }
512
+ var structuralRegionState = /* @__PURE__ */ globalValue("effect/Utils/isStructuralRegion", () => ({
513
+ enabled: false,
514
+ tester: void 0
515
+ }));
501
516
 
502
- // ../../../node_modules/.pnpm/effect@3.0.7/node_modules/effect/dist/esm/Hash.js
517
+ // ../../../node_modules/.pnpm/effect@3.1.2/node_modules/effect/dist/esm/Hash.js
503
518
  var randomHashCache = /* @__PURE__ */ globalValue(/* @__PURE__ */ Symbol.for("effect/Hash/randomHashCache"), () => /* @__PURE__ */ new WeakMap());
504
519
  var pcgr = /* @__PURE__ */ globalValue(/* @__PURE__ */ Symbol.for("effect/Hash/pcgr"), () => new PCGRandom());
505
520
  var symbol = /* @__PURE__ */ Symbol.for("effect/Hash");
@@ -533,6 +548,9 @@ var hash = (self) => {
533
548
  }
534
549
  };
535
550
  var random = (self) => {
551
+ if (structuralRegionState.enabled === true) {
552
+ return 0;
553
+ }
536
554
  if (!randomHashCache.has(self)) {
537
555
  randomHashCache.set(self, number(pcgr.integer(Number.MAX_SAFE_INTEGER)));
538
556
  }
@@ -565,27 +583,39 @@ var cached = function() {
565
583
  if (arguments.length === 1) {
566
584
  const self2 = arguments[0];
567
585
  return function(hash3) {
568
- Object.defineProperty(self2, symbol, {
569
- value() {
570
- return hash3;
571
- },
572
- enumerable: false
573
- });
586
+ const original2 = self2[symbol].bind(self2);
587
+ if (structuralRegionState.enabled === false) {
588
+ Object.defineProperty(self2, symbol, {
589
+ value() {
590
+ if (structuralRegionState.enabled === true) {
591
+ return original2();
592
+ }
593
+ return hash3;
594
+ },
595
+ enumerable: false
596
+ });
597
+ }
574
598
  return hash3;
575
599
  };
576
600
  }
577
601
  const self = arguments[0];
578
602
  const hash2 = arguments[1];
579
- Object.defineProperty(self, symbol, {
580
- value() {
581
- return hash2;
582
- },
583
- enumerable: false
584
- });
603
+ const original = self[symbol].bind(self);
604
+ if (structuralRegionState.enabled === false) {
605
+ Object.defineProperty(self, symbol, {
606
+ value() {
607
+ if (structuralRegionState.enabled === true) {
608
+ return original();
609
+ }
610
+ return hash2;
611
+ },
612
+ enumerable: false
613
+ });
614
+ }
585
615
  return hash2;
586
616
  };
587
617
 
588
- // ../../../node_modules/.pnpm/effect@3.0.7/node_modules/effect/dist/esm/Equal.js
618
+ // ../../../node_modules/.pnpm/effect@3.1.2/node_modules/effect/dist/esm/Equal.js
589
619
  var symbol2 = /* @__PURE__ */ Symbol.for("effect/Equal");
590
620
  function equals() {
591
621
  if (arguments.length === 1) {
@@ -601,17 +631,37 @@ function compareBoth(self, that) {
601
631
  if (selfType !== typeof that) {
602
632
  return false;
603
633
  }
604
- if ((selfType === "object" || selfType === "function") && self !== null && that !== null) {
605
- if (isEqual(self) && isEqual(that)) {
606
- return hash(self) === hash(that) && self[symbol2](that);
634
+ if (selfType === "object" || selfType === "function") {
635
+ if (self !== null && that !== null) {
636
+ if (isEqual(self) && isEqual(that)) {
637
+ return hash(self) === hash(that) && self[symbol2](that);
638
+ }
639
+ }
640
+ if (structuralRegionState.enabled) {
641
+ if (Array.isArray(self) && Array.isArray(that)) {
642
+ return self.length === that.length && self.every((v2, i2) => compareBoth(v2, that[i2]));
643
+ }
644
+ if (Object.getPrototypeOf(self) === Object.prototype && Object.getPrototypeOf(self) === Object.prototype) {
645
+ const keysSelf = Object.keys(self);
646
+ const keysThat = Object.keys(that);
647
+ if (keysSelf.length === keysThat.length) {
648
+ for (const key of keysSelf) {
649
+ if (!(key in that && compareBoth(self[key], that[key]))) {
650
+ return structuralRegionState.tester ? structuralRegionState.tester(self, that) : false;
651
+ }
652
+ }
653
+ return true;
654
+ }
655
+ }
656
+ return structuralRegionState.tester ? structuralRegionState.tester(self, that) : false;
607
657
  }
608
658
  }
609
- return false;
659
+ return structuralRegionState.enabled && structuralRegionState.tester ? structuralRegionState.tester(self, that) : false;
610
660
  }
611
661
  var isEqual = (u2) => hasProperty(u2, symbol2);
612
662
  var equivalence = () => equals;
613
663
 
614
- // ../../../node_modules/.pnpm/effect@3.0.7/node_modules/effect/dist/esm/Inspectable.js
664
+ // ../../../node_modules/.pnpm/effect@3.1.2/node_modules/effect/dist/esm/Inspectable.js
615
665
  var NodeInspectSymbol = /* @__PURE__ */ Symbol.for("nodejs.util.inspect.custom");
616
666
  var toJSON = (x2) => {
617
667
  if (hasProperty(x2, "toJSON") && isFunction2(x2["toJSON"]) && x2["toJSON"].length === 0) {
@@ -623,7 +673,7 @@ var toJSON = (x2) => {
623
673
  };
624
674
  var format = (x2) => JSON.stringify(x2, null, 2);
625
675
 
626
- // ../../../node_modules/.pnpm/effect@3.0.7/node_modules/effect/dist/esm/Pipeable.js
676
+ // ../../../node_modules/.pnpm/effect@3.1.2/node_modules/effect/dist/esm/Pipeable.js
627
677
  var pipeArguments = (self, args) => {
628
678
  switch (args.length) {
629
679
  case 1:
@@ -654,7 +704,7 @@ var pipeArguments = (self, args) => {
654
704
  }
655
705
  };
656
706
 
657
- // ../../../node_modules/.pnpm/effect@3.0.7/node_modules/effect/dist/esm/internal/effectable.js
707
+ // ../../../node_modules/.pnpm/effect@3.1.2/node_modules/effect/dist/esm/internal/effectable.js
658
708
  var EffectTypeId = /* @__PURE__ */ Symbol.for("effect/Effect");
659
709
  var StreamTypeId = /* @__PURE__ */ Symbol.for("effect/Stream");
660
710
  var SinkTypeId = /* @__PURE__ */ Symbol.for("effect/Sink");
@@ -715,7 +765,7 @@ var EffectPrototype = {
715
765
  }
716
766
  };
717
767
 
718
- // ../../../node_modules/.pnpm/effect@3.0.7/node_modules/effect/dist/esm/internal/option.js
768
+ // ../../../node_modules/.pnpm/effect@3.1.2/node_modules/effect/dist/esm/internal/option.js
719
769
  var TypeId = /* @__PURE__ */ Symbol.for("effect/Option");
720
770
  var CommonProto = {
721
771
  ...EffectPrototype,
@@ -773,7 +823,7 @@ var some = (value) => {
773
823
  return a;
774
824
  };
775
825
 
776
- // ../../../node_modules/.pnpm/effect@3.0.7/node_modules/effect/dist/esm/internal/either.js
826
+ // ../../../node_modules/.pnpm/effect@3.1.2/node_modules/effect/dist/esm/internal/either.js
777
827
  var TypeId2 = /* @__PURE__ */ Symbol.for("effect/Either");
778
828
  var CommonProto2 = {
779
829
  ...EffectPrototype,
@@ -837,7 +887,7 @@ var right = (right2) => {
837
887
  var getLeft = (self) => isRight(self) ? none : some(self.left);
838
888
  var getRight = (self) => isLeft(self) ? none : some(self.right);
839
889
 
840
- // ../../../node_modules/.pnpm/effect@3.0.7/node_modules/effect/dist/esm/Option.js
890
+ // ../../../node_modules/.pnpm/effect@3.1.2/node_modules/effect/dist/esm/Option.js
841
891
  var Option_exports = {};
842
892
  __export(Option_exports, {
843
893
  Do: () => Do,
@@ -847,8 +897,8 @@ __export(Option_exports, {
847
897
  ap: () => ap,
848
898
  as: () => as,
849
899
  asVoid: () => asVoid,
850
- bind: () => bind,
851
- bindTo: () => bindTo,
900
+ bind: () => bind2,
901
+ bindTo: () => bindTo2,
852
902
  composeK: () => composeK,
853
903
  contains: () => contains,
854
904
  containsWith: () => containsWith,
@@ -874,7 +924,7 @@ __export(Option_exports, {
874
924
  isNone: () => isNone2,
875
925
  isOption: () => isOption2,
876
926
  isSome: () => isSome2,
877
- let: () => let_,
927
+ let: () => let_2,
878
928
  lift2: () => lift2,
879
929
  liftNullable: () => liftNullable,
880
930
  liftPredicate: () => liftPredicate,
@@ -899,10 +949,10 @@ __export(Option_exports, {
899
949
  zipWith: () => zipWith
900
950
  });
901
951
 
902
- // ../../../node_modules/.pnpm/effect@3.0.7/node_modules/effect/dist/esm/Order.js
952
+ // ../../../node_modules/.pnpm/effect@3.1.2/node_modules/effect/dist/esm/Order.js
903
953
  var make2 = (compare) => (self, that) => self === that ? 0 : compare(self, that);
904
954
 
905
- // ../../../node_modules/.pnpm/effect@3.0.7/node_modules/effect/dist/esm/Option.js
955
+ // ../../../node_modules/.pnpm/effect@3.1.2/node_modules/effect/dist/esm/Option.js
906
956
  var TypeId3 = /* @__PURE__ */ Symbol.for("effect/Option");
907
957
  var none2 = () => none;
908
958
  var some2 = some;
@@ -1032,15 +1082,9 @@ var containsWith = (isEquivalent) => dual(2, (self, a) => isNone2(self) ? false
1032
1082
  var _equivalence = /* @__PURE__ */ equivalence();
1033
1083
  var contains = /* @__PURE__ */ containsWith(_equivalence);
1034
1084
  var exists = /* @__PURE__ */ dual(2, (self, refinement) => isNone2(self) ? false : refinement(self.value));
1035
- var bindTo = /* @__PURE__ */ dual(2, (self, name2) => map(self, (a) => ({
1036
- [name2]: a
1037
- })));
1038
- var let_ = /* @__PURE__ */ dual(3, (self, name2, f) => map(self, (a) => Object.assign({}, a, {
1039
- [name2]: f(a)
1040
- })));
1041
- var bind = /* @__PURE__ */ dual(3, (self, name2, f) => flatMap(self, (a) => map(f(a), (b2) => Object.assign({}, a, {
1042
- [name2]: b2
1043
- }))));
1085
+ var bindTo2 = /* @__PURE__ */ bindTo(map);
1086
+ var let_2 = /* @__PURE__ */ let_(map);
1087
+ var bind2 = /* @__PURE__ */ bind(map, flatMap);
1044
1088
  var Do = /* @__PURE__ */ some2({});
1045
1089
  var adapter2 = /* @__PURE__ */ adapter();
1046
1090
  var gen = (f) => {
@@ -1252,8 +1296,6 @@ var z = class _z {
1252
1296
  return this;
1253
1297
  }
1254
1298
  };
1255
-
1256
- // src/rules/ensure-use-callback-has-non-empty-deps.ts
1257
1299
  var RULE_NAME2 = "ensure-use-callback-has-non-empty-deps";
1258
1300
  var ensure_use_callback_has_non_empty_deps_default = createRule({
1259
1301
  meta: {
@@ -1269,14 +1311,13 @@ var ensure_use_callback_has_non_empty_deps_default = createRule({
1269
1311
  },
1270
1312
  name: RULE_NAME2,
1271
1313
  create(context) {
1272
- const alias = parseSchema(ESLintSettingsSchema, context.settings).reactOptions?.additionalHooks?.useCallback ?? [];
1273
- const pragma = getPragmaFromContext(context);
1314
+ const alias = parse(ESLintSettingsSchema, context.settings).reactOptions?.additionalHooks?.useCallback ?? [];
1274
1315
  return {
1275
1316
  CallExpression(node) {
1276
1317
  const initialScope = context.sourceCode.getScope(node);
1277
1318
  if (!isReactHookCall(node))
1278
1319
  return;
1279
- if (!isUseCallbackCall(node, context, pragma) && !alias.some(Function_exports.flip(isReactHookCallWithNameLoose)(node))) {
1320
+ if (!isUseCallbackCall(node, context) && !alias.some(Function_exports.flip(isReactHookCallWithNameLoose)(node))) {
1280
1321
  return;
1281
1322
  }
1282
1323
  const [_2, deps] = node.arguments;
@@ -1322,14 +1363,13 @@ var ensure_use_memo_has_non_empty_deps_default = createRule({
1322
1363
  },
1323
1364
  name: RULE_NAME3,
1324
1365
  create(context) {
1325
- const alias = parseSchema(ESLintSettingsSchema, context.settings).reactOptions?.additionalHooks?.useMemo ?? [];
1326
- const pragma = getPragmaFromContext(context);
1366
+ const alias = parse(ESLintSettingsSchema, context.settings).reactOptions?.additionalHooks?.useMemo ?? [];
1327
1367
  return {
1328
1368
  CallExpression(node) {
1329
1369
  const initialScope = context.sourceCode.getScope(node);
1330
1370
  if (!isReactHookCall(node))
1331
1371
  return;
1332
- if (!isUseMemoCall(node, context, pragma) && !alias.some(Function_exports.flip(isReactHookCallWithNameLoose)(node)))
1372
+ if (!isUseMemoCall(node, context) && !alias.some(Function_exports.flip(isReactHookCallWithNameLoose)(node)))
1333
1373
  return;
1334
1374
  const [_2, deps] = node.arguments;
1335
1375
  if (!deps) {
@@ -1360,7 +1400,7 @@ var ensure_use_memo_has_non_empty_deps_default = createRule({
1360
1400
  defaultOptions: []
1361
1401
  });
1362
1402
  var RULE_NAME4 = "prefer-use-state-lazy-initialization";
1363
- var ALLOW_LIST = Object.freeze(["Boolean", "String", "Number"]);
1403
+ var ALLOW_LIST = ["Boolean", "String", "Number"];
1364
1404
  var prefer_use_state_lazy_initialization_default = createRule({
1365
1405
  meta: {
1366
1406
  type: "problem",
@@ -1375,13 +1415,12 @@ var prefer_use_state_lazy_initialization_default = createRule({
1375
1415
  },
1376
1416
  name: RULE_NAME4,
1377
1417
  create(context) {
1378
- const alias = parseSchema(ESLintSettingsSchema, context.settings).reactOptions?.additionalHooks?.useState ?? [];
1379
- const pragma = getPragmaFromContext(context);
1418
+ const alias = parse(ESLintSettingsSchema, context.settings).reactOptions?.additionalHooks?.useState ?? [];
1380
1419
  return {
1381
1420
  CallExpression(node) {
1382
1421
  if (!isReactHookCall(node))
1383
1422
  return;
1384
- if (!isUseStateCall(node, context, pragma) && !alias.some(Function_exports.flip(isReactHookCallWithNameLoose)(node)))
1423
+ if (!isUseStateCall(node, context) && !alias.some(Function_exports.flip(isReactHookCallWithNameLoose)(node)))
1385
1424
  return;
1386
1425
  const [useStateInput] = node.arguments;
1387
1426
  if (!useStateInput)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "eslint-plugin-react-hooks-extra",
3
- "version": "1.5.10",
3
+ "version": "1.5.11-beta.12",
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,26 +35,27 @@
35
35
  "./package.json"
36
36
  ],
37
37
  "dependencies": {
38
- "@typescript-eslint/parser": "^7.7.1",
39
- "@typescript-eslint/scope-manager": "^7.7.1",
40
- "@typescript-eslint/type-utils": "^7.7.1",
41
- "@typescript-eslint/types": "^7.7.1",
42
- "@typescript-eslint/utils": "^7.7.1",
38
+ "@typescript-eslint/parser": "^7.8.0",
39
+ "@typescript-eslint/scope-manager": "^7.8.0",
40
+ "@typescript-eslint/type-utils": "^7.8.0",
41
+ "@typescript-eslint/types": "^7.8.0",
42
+ "@typescript-eslint/utils": "^7.8.0",
43
43
  "string-ts": "2.1.1",
44
- "@eslint-react/ast": "1.5.10",
45
- "@eslint-react/shared": "1.5.10",
46
- "@eslint-react/core": "1.5.10",
47
- "@eslint-react/jsx": "1.5.10",
48
- "@eslint-react/tools": "1.5.10",
49
- "@eslint-react/types": "1.5.10",
50
- "@eslint-react/var": "1.5.10"
44
+ "valibot": "0.30.0",
45
+ "@eslint-react/ast": "1.5.11-beta.12",
46
+ "@eslint-react/core": "1.5.11-beta.12",
47
+ "@eslint-react/tools": "1.5.11-beta.12",
48
+ "@eslint-react/types": "1.5.11-beta.12",
49
+ "@eslint-react/var": "1.5.11-beta.12",
50
+ "@eslint-react/shared": "1.5.11-beta.12",
51
+ "@eslint-react/jsx": "1.5.11-beta.12"
51
52
  },
52
53
  "devDependencies": {
53
- "effect": "3.0.7"
54
+ "effect": "3.1.2"
54
55
  },
55
56
  "peerDependencies": {
56
57
  "@typescript-eslint/parser": "^7.5.0",
57
- "eslint": "^9.0.0",
58
+ "eslint": "^8.57.0",
58
59
  "typescript": "^5.3.3"
59
60
  },
60
61
  "engines": {