eslint-plugin-react-hooks-extra 1.5.11-next.9 → 1.5.12-beta.10
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 +51 -64
- package/dist/index.mjs +52 -65
- 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.
|
|
18
|
+
var version = "1.5.12-beta.10";
|
|
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.1.
|
|
59
|
+
// ../../../node_modules/.pnpm/effect@3.1.5/node_modules/effect/dist/esm/Function.js
|
|
60
60
|
var Function_exports = {};
|
|
61
61
|
__export(Function_exports, {
|
|
62
62
|
SK: () => SK,
|
|
@@ -231,10 +231,10 @@ 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.1.
|
|
234
|
+
// ../../../node_modules/.pnpm/effect@3.1.5/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.1.
|
|
237
|
+
// ../../../node_modules/.pnpm/effect@3.1.5/node_modules/effect/dist/esm/internal/doNotation.js
|
|
238
238
|
var let_ = (map2) => dual(3, (self, name2, f) => map2(self, (a) => Object.assign({}, a, {
|
|
239
239
|
[name2]: f(a)
|
|
240
240
|
})));
|
|
@@ -245,11 +245,11 @@ var bind = (map2, flatMap2) => dual(3, (self, name2, f) => flatMap2(self, (a) =>
|
|
|
245
245
|
[name2]: b2
|
|
246
246
|
}))));
|
|
247
247
|
|
|
248
|
-
// ../../../node_modules/.pnpm/effect@3.1.
|
|
249
|
-
var moduleVersion = "3.1.
|
|
248
|
+
// ../../../node_modules/.pnpm/effect@3.1.5/node_modules/effect/dist/esm/internal/version.js
|
|
249
|
+
var moduleVersion = "3.1.5";
|
|
250
250
|
var getCurrentVersion = () => moduleVersion;
|
|
251
251
|
|
|
252
|
-
// ../../../node_modules/.pnpm/effect@3.1.
|
|
252
|
+
// ../../../node_modules/.pnpm/effect@3.1.5/node_modules/effect/dist/esm/GlobalValue.js
|
|
253
253
|
var globalStoreId = /* @__PURE__ */ Symbol.for(`effect/GlobalValue/globalStoreId/${/* @__PURE__ */ getCurrentVersion()}`);
|
|
254
254
|
if (!(globalStoreId in globalThis)) {
|
|
255
255
|
globalThis[globalStoreId] = /* @__PURE__ */ new Map();
|
|
@@ -262,17 +262,17 @@ var globalValue = (id, compute) => {
|
|
|
262
262
|
return globalStore.get(id);
|
|
263
263
|
};
|
|
264
264
|
|
|
265
|
-
// ../../../node_modules/.pnpm/effect@3.1.
|
|
265
|
+
// ../../../node_modules/.pnpm/effect@3.1.5/node_modules/effect/dist/esm/Predicate.js
|
|
266
266
|
var isFunction2 = isFunction;
|
|
267
267
|
var isRecordOrArray = (input) => typeof input === "object" && input !== null;
|
|
268
268
|
var isObject = (input) => isRecordOrArray(input) || isFunction2(input);
|
|
269
269
|
var hasProperty = /* @__PURE__ */ dual(2, (self, property) => isObject(self) && property in self);
|
|
270
270
|
var isNullable = (input) => input === null || input === void 0;
|
|
271
271
|
|
|
272
|
-
// ../../../node_modules/.pnpm/effect@3.1.
|
|
272
|
+
// ../../../node_modules/.pnpm/effect@3.1.5/node_modules/effect/dist/esm/internal/errors.js
|
|
273
273
|
var getBugErrorMessage = (message) => `BUG: ${message} - please report an issue at https://github.com/Effect-TS/effect/issues`;
|
|
274
274
|
|
|
275
|
-
// ../../../node_modules/.pnpm/effect@3.1.
|
|
275
|
+
// ../../../node_modules/.pnpm/effect@3.1.5/node_modules/effect/dist/esm/Utils.js
|
|
276
276
|
var GenKindTypeId = /* @__PURE__ */ Symbol.for("effect/Gen/GenKind");
|
|
277
277
|
var isGenKind = (u2) => isObject(u2) && GenKindTypeId in u2;
|
|
278
278
|
var GenKindImpl = class {
|
|
@@ -516,11 +516,14 @@ var structuralRegionState = /* @__PURE__ */ globalValue("effect/Utils/isStructur
|
|
|
516
516
|
tester: void 0
|
|
517
517
|
}));
|
|
518
518
|
|
|
519
|
-
// ../../../node_modules/.pnpm/effect@3.1.
|
|
519
|
+
// ../../../node_modules/.pnpm/effect@3.1.5/node_modules/effect/dist/esm/Hash.js
|
|
520
520
|
var randomHashCache = /* @__PURE__ */ globalValue(/* @__PURE__ */ Symbol.for("effect/Hash/randomHashCache"), () => /* @__PURE__ */ new WeakMap());
|
|
521
521
|
var pcgr = /* @__PURE__ */ globalValue(/* @__PURE__ */ Symbol.for("effect/Hash/pcgr"), () => new PCGRandom());
|
|
522
522
|
var symbol = /* @__PURE__ */ Symbol.for("effect/Hash");
|
|
523
523
|
var hash = (self) => {
|
|
524
|
+
if (structuralRegionState.enabled === true) {
|
|
525
|
+
return 0;
|
|
526
|
+
}
|
|
524
527
|
switch (typeof self) {
|
|
525
528
|
case "number":
|
|
526
529
|
return number(self);
|
|
@@ -550,9 +553,6 @@ var hash = (self) => {
|
|
|
550
553
|
}
|
|
551
554
|
};
|
|
552
555
|
var random = (self) => {
|
|
553
|
-
if (structuralRegionState.enabled === true) {
|
|
554
|
-
return 0;
|
|
555
|
-
}
|
|
556
556
|
if (!randomHashCache.has(self)) {
|
|
557
557
|
randomHashCache.set(self, number(pcgr.integer(Number.MAX_SAFE_INTEGER)));
|
|
558
558
|
}
|
|
@@ -585,39 +585,27 @@ var cached = function() {
|
|
|
585
585
|
if (arguments.length === 1) {
|
|
586
586
|
const self2 = arguments[0];
|
|
587
587
|
return function(hash3) {
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
}
|
|
595
|
-
return hash3;
|
|
596
|
-
},
|
|
597
|
-
enumerable: false
|
|
598
|
-
});
|
|
599
|
-
}
|
|
588
|
+
Object.defineProperty(self2, symbol, {
|
|
589
|
+
value() {
|
|
590
|
+
return hash3;
|
|
591
|
+
},
|
|
592
|
+
enumerable: false
|
|
593
|
+
});
|
|
600
594
|
return hash3;
|
|
601
595
|
};
|
|
602
596
|
}
|
|
603
597
|
const self = arguments[0];
|
|
604
598
|
const hash2 = arguments[1];
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
}
|
|
612
|
-
return hash2;
|
|
613
|
-
},
|
|
614
|
-
enumerable: false
|
|
615
|
-
});
|
|
616
|
-
}
|
|
599
|
+
Object.defineProperty(self, symbol, {
|
|
600
|
+
value() {
|
|
601
|
+
return hash2;
|
|
602
|
+
},
|
|
603
|
+
enumerable: false
|
|
604
|
+
});
|
|
617
605
|
return hash2;
|
|
618
606
|
};
|
|
619
607
|
|
|
620
|
-
// ../../../node_modules/.pnpm/effect@3.1.
|
|
608
|
+
// ../../../node_modules/.pnpm/effect@3.1.5/node_modules/effect/dist/esm/Equal.js
|
|
621
609
|
var symbol2 = /* @__PURE__ */ Symbol.for("effect/Equal");
|
|
622
610
|
function equals() {
|
|
623
611
|
if (arguments.length === 1) {
|
|
@@ -636,7 +624,11 @@ function compareBoth(self, that) {
|
|
|
636
624
|
if (selfType === "object" || selfType === "function") {
|
|
637
625
|
if (self !== null && that !== null) {
|
|
638
626
|
if (isEqual(self) && isEqual(that)) {
|
|
639
|
-
|
|
627
|
+
if (hash(self) === hash(that) && self[symbol2](that)) {
|
|
628
|
+
return true;
|
|
629
|
+
} else {
|
|
630
|
+
return structuralRegionState.enabled && structuralRegionState.tester ? structuralRegionState.tester(self, that) : false;
|
|
631
|
+
}
|
|
640
632
|
}
|
|
641
633
|
}
|
|
642
634
|
if (structuralRegionState.enabled) {
|
|
@@ -663,7 +655,7 @@ function compareBoth(self, that) {
|
|
|
663
655
|
var isEqual = (u2) => hasProperty(u2, symbol2);
|
|
664
656
|
var equivalence = () => equals;
|
|
665
657
|
|
|
666
|
-
// ../../../node_modules/.pnpm/effect@3.1.
|
|
658
|
+
// ../../../node_modules/.pnpm/effect@3.1.5/node_modules/effect/dist/esm/Inspectable.js
|
|
667
659
|
var NodeInspectSymbol = /* @__PURE__ */ Symbol.for("nodejs.util.inspect.custom");
|
|
668
660
|
var toJSON = (x2) => {
|
|
669
661
|
if (hasProperty(x2, "toJSON") && isFunction2(x2["toJSON"]) && x2["toJSON"].length === 0) {
|
|
@@ -675,7 +667,7 @@ var toJSON = (x2) => {
|
|
|
675
667
|
};
|
|
676
668
|
var format = (x2) => JSON.stringify(x2, null, 2);
|
|
677
669
|
|
|
678
|
-
// ../../../node_modules/.pnpm/effect@3.1.
|
|
670
|
+
// ../../../node_modules/.pnpm/effect@3.1.5/node_modules/effect/dist/esm/Pipeable.js
|
|
679
671
|
var pipeArguments = (self, args) => {
|
|
680
672
|
switch (args.length) {
|
|
681
673
|
case 1:
|
|
@@ -706,7 +698,7 @@ var pipeArguments = (self, args) => {
|
|
|
706
698
|
}
|
|
707
699
|
};
|
|
708
700
|
|
|
709
|
-
// ../../../node_modules/.pnpm/effect@3.1.
|
|
701
|
+
// ../../../node_modules/.pnpm/effect@3.1.5/node_modules/effect/dist/esm/internal/effectable.js
|
|
710
702
|
var EffectTypeId = /* @__PURE__ */ Symbol.for("effect/Effect");
|
|
711
703
|
var StreamTypeId = /* @__PURE__ */ Symbol.for("effect/Stream");
|
|
712
704
|
var SinkTypeId = /* @__PURE__ */ Symbol.for("effect/Sink");
|
|
@@ -767,7 +759,7 @@ var EffectPrototype = {
|
|
|
767
759
|
}
|
|
768
760
|
};
|
|
769
761
|
|
|
770
|
-
// ../../../node_modules/.pnpm/effect@3.1.
|
|
762
|
+
// ../../../node_modules/.pnpm/effect@3.1.5/node_modules/effect/dist/esm/internal/option.js
|
|
771
763
|
var TypeId = /* @__PURE__ */ Symbol.for("effect/Option");
|
|
772
764
|
var CommonProto = {
|
|
773
765
|
...EffectPrototype,
|
|
@@ -785,7 +777,7 @@ var SomeProto = /* @__PURE__ */ Object.assign(/* @__PURE__ */ Object.create(Comm
|
|
|
785
777
|
_tag: "Some",
|
|
786
778
|
_op: "Some",
|
|
787
779
|
[symbol2](that) {
|
|
788
|
-
return isOption(that) && isSome(that) && equals(
|
|
780
|
+
return isOption(that) && isSome(that) && equals(this.value, that.value);
|
|
789
781
|
},
|
|
790
782
|
[symbol]() {
|
|
791
783
|
return cached(this, combine(hash(this._tag))(hash(this.value)));
|
|
@@ -825,7 +817,7 @@ var some = (value) => {
|
|
|
825
817
|
return a;
|
|
826
818
|
};
|
|
827
819
|
|
|
828
|
-
// ../../../node_modules/.pnpm/effect@3.1.
|
|
820
|
+
// ../../../node_modules/.pnpm/effect@3.1.5/node_modules/effect/dist/esm/internal/either.js
|
|
829
821
|
var TypeId2 = /* @__PURE__ */ Symbol.for("effect/Either");
|
|
830
822
|
var CommonProto2 = {
|
|
831
823
|
...EffectPrototype,
|
|
@@ -843,7 +835,7 @@ var RightProto = /* @__PURE__ */ Object.assign(/* @__PURE__ */ Object.create(Com
|
|
|
843
835
|
_tag: "Right",
|
|
844
836
|
_op: "Right",
|
|
845
837
|
[symbol2](that) {
|
|
846
|
-
return isEither(that) && isRight(that) && equals(
|
|
838
|
+
return isEither(that) && isRight(that) && equals(this.right, that.right);
|
|
847
839
|
},
|
|
848
840
|
[symbol]() {
|
|
849
841
|
return combine(hash(this._tag))(hash(this.right));
|
|
@@ -860,7 +852,7 @@ var LeftProto = /* @__PURE__ */ Object.assign(/* @__PURE__ */ Object.create(Comm
|
|
|
860
852
|
_tag: "Left",
|
|
861
853
|
_op: "Left",
|
|
862
854
|
[symbol2](that) {
|
|
863
|
-
return isEither(that) && isLeft(that) && equals(
|
|
855
|
+
return isEither(that) && isLeft(that) && equals(this.left, that.left);
|
|
864
856
|
},
|
|
865
857
|
[symbol]() {
|
|
866
858
|
return combine(hash(this._tag))(hash(this.left));
|
|
@@ -889,7 +881,7 @@ var right = (right2) => {
|
|
|
889
881
|
var getLeft = (self) => isRight(self) ? none : some(self.left);
|
|
890
882
|
var getRight = (self) => isLeft(self) ? none : some(self.right);
|
|
891
883
|
|
|
892
|
-
// ../../../node_modules/.pnpm/effect@3.1.
|
|
884
|
+
// ../../../node_modules/.pnpm/effect@3.1.5/node_modules/effect/dist/esm/Option.js
|
|
893
885
|
var Option_exports = {};
|
|
894
886
|
__export(Option_exports, {
|
|
895
887
|
Do: () => Do,
|
|
@@ -951,10 +943,10 @@ __export(Option_exports, {
|
|
|
951
943
|
zipWith: () => zipWith
|
|
952
944
|
});
|
|
953
945
|
|
|
954
|
-
// ../../../node_modules/.pnpm/effect@3.1.
|
|
946
|
+
// ../../../node_modules/.pnpm/effect@3.1.5/node_modules/effect/dist/esm/Order.js
|
|
955
947
|
var make2 = (compare) => (self, that) => self === that ? 0 : compare(self, that);
|
|
956
948
|
|
|
957
|
-
// ../../../node_modules/.pnpm/effect@3.1.
|
|
949
|
+
// ../../../node_modules/.pnpm/effect@3.1.5/node_modules/effect/dist/esm/Option.js
|
|
958
950
|
var TypeId3 = /* @__PURE__ */ Symbol.for("effect/Option");
|
|
959
951
|
var none2 = () => none;
|
|
960
952
|
var some2 = some;
|
|
@@ -1298,8 +1290,6 @@ var z = class _z {
|
|
|
1298
1290
|
return this;
|
|
1299
1291
|
}
|
|
1300
1292
|
};
|
|
1301
|
-
|
|
1302
|
-
// src/rules/ensure-use-callback-has-non-empty-deps.ts
|
|
1303
1293
|
var RULE_NAME2 = "ensure-use-callback-has-non-empty-deps";
|
|
1304
1294
|
var ensure_use_callback_has_non_empty_deps_default = createRule({
|
|
1305
1295
|
meta: {
|
|
@@ -1315,14 +1305,13 @@ var ensure_use_callback_has_non_empty_deps_default = createRule({
|
|
|
1315
1305
|
},
|
|
1316
1306
|
name: RULE_NAME2,
|
|
1317
1307
|
create(context) {
|
|
1318
|
-
const alias =
|
|
1319
|
-
const pragma = jsx.getPragmaFromContext(context);
|
|
1308
|
+
const alias = valibot.parse(shared.ESLintSettingsSchema, context.settings).reactOptions?.additionalHooks?.useCallback ?? [];
|
|
1320
1309
|
return {
|
|
1321
1310
|
CallExpression(node) {
|
|
1322
1311
|
const initialScope = context.sourceCode.getScope(node);
|
|
1323
1312
|
if (!core.isReactHookCall(node))
|
|
1324
1313
|
return;
|
|
1325
|
-
if (!core.isUseCallbackCall(node, context
|
|
1314
|
+
if (!core.isUseCallbackCall(node, context) && !alias.some(Function_exports.flip(core.isReactHookCallWithNameLoose)(node))) {
|
|
1326
1315
|
return;
|
|
1327
1316
|
}
|
|
1328
1317
|
const [_2, deps] = node.arguments;
|
|
@@ -1368,14 +1357,13 @@ var ensure_use_memo_has_non_empty_deps_default = createRule({
|
|
|
1368
1357
|
},
|
|
1369
1358
|
name: RULE_NAME3,
|
|
1370
1359
|
create(context) {
|
|
1371
|
-
const alias =
|
|
1372
|
-
const pragma = jsx.getPragmaFromContext(context);
|
|
1360
|
+
const alias = valibot.parse(shared.ESLintSettingsSchema, context.settings).reactOptions?.additionalHooks?.useMemo ?? [];
|
|
1373
1361
|
return {
|
|
1374
1362
|
CallExpression(node) {
|
|
1375
1363
|
const initialScope = context.sourceCode.getScope(node);
|
|
1376
1364
|
if (!core.isReactHookCall(node))
|
|
1377
1365
|
return;
|
|
1378
|
-
if (!core.isUseMemoCall(node, context
|
|
1366
|
+
if (!core.isUseMemoCall(node, context) && !alias.some(Function_exports.flip(core.isReactHookCallWithNameLoose)(node)))
|
|
1379
1367
|
return;
|
|
1380
1368
|
const [_2, deps] = node.arguments;
|
|
1381
1369
|
if (!deps) {
|
|
@@ -1406,7 +1394,7 @@ var ensure_use_memo_has_non_empty_deps_default = createRule({
|
|
|
1406
1394
|
defaultOptions: []
|
|
1407
1395
|
});
|
|
1408
1396
|
var RULE_NAME4 = "prefer-use-state-lazy-initialization";
|
|
1409
|
-
var ALLOW_LIST =
|
|
1397
|
+
var ALLOW_LIST = ["Boolean", "String", "Number"];
|
|
1410
1398
|
var prefer_use_state_lazy_initialization_default = createRule({
|
|
1411
1399
|
meta: {
|
|
1412
1400
|
type: "problem",
|
|
@@ -1421,13 +1409,12 @@ var prefer_use_state_lazy_initialization_default = createRule({
|
|
|
1421
1409
|
},
|
|
1422
1410
|
name: RULE_NAME4,
|
|
1423
1411
|
create(context) {
|
|
1424
|
-
const alias =
|
|
1425
|
-
const pragma = jsx.getPragmaFromContext(context);
|
|
1412
|
+
const alias = valibot.parse(shared.ESLintSettingsSchema, context.settings).reactOptions?.additionalHooks?.useState ?? [];
|
|
1426
1413
|
return {
|
|
1427
1414
|
CallExpression(node) {
|
|
1428
1415
|
if (!core.isReactHookCall(node))
|
|
1429
1416
|
return;
|
|
1430
|
-
if (!core.isUseStateCall(node, context
|
|
1417
|
+
if (!core.isUseStateCall(node, context) && !alias.some(Function_exports.flip(core.isReactHookCallWithNameLoose)(node)))
|
|
1431
1418
|
return;
|
|
1432
1419
|
const [useStateInput] = node.arguments;
|
|
1433
1420
|
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,
|
|
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.
|
|
16
|
+
var version = "1.5.12-beta.10";
|
|
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.1.
|
|
57
|
+
// ../../../node_modules/.pnpm/effect@3.1.5/node_modules/effect/dist/esm/Function.js
|
|
58
58
|
var Function_exports = {};
|
|
59
59
|
__export(Function_exports, {
|
|
60
60
|
SK: () => SK,
|
|
@@ -229,10 +229,10 @@ 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.1.
|
|
232
|
+
// ../../../node_modules/.pnpm/effect@3.1.5/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.1.
|
|
235
|
+
// ../../../node_modules/.pnpm/effect@3.1.5/node_modules/effect/dist/esm/internal/doNotation.js
|
|
236
236
|
var let_ = (map2) => dual(3, (self, name2, f) => map2(self, (a) => Object.assign({}, a, {
|
|
237
237
|
[name2]: f(a)
|
|
238
238
|
})));
|
|
@@ -243,11 +243,11 @@ var bind = (map2, flatMap2) => dual(3, (self, name2, f) => flatMap2(self, (a) =>
|
|
|
243
243
|
[name2]: b2
|
|
244
244
|
}))));
|
|
245
245
|
|
|
246
|
-
// ../../../node_modules/.pnpm/effect@3.1.
|
|
247
|
-
var moduleVersion = "3.1.
|
|
246
|
+
// ../../../node_modules/.pnpm/effect@3.1.5/node_modules/effect/dist/esm/internal/version.js
|
|
247
|
+
var moduleVersion = "3.1.5";
|
|
248
248
|
var getCurrentVersion = () => moduleVersion;
|
|
249
249
|
|
|
250
|
-
// ../../../node_modules/.pnpm/effect@3.1.
|
|
250
|
+
// ../../../node_modules/.pnpm/effect@3.1.5/node_modules/effect/dist/esm/GlobalValue.js
|
|
251
251
|
var globalStoreId = /* @__PURE__ */ Symbol.for(`effect/GlobalValue/globalStoreId/${/* @__PURE__ */ getCurrentVersion()}`);
|
|
252
252
|
if (!(globalStoreId in globalThis)) {
|
|
253
253
|
globalThis[globalStoreId] = /* @__PURE__ */ new Map();
|
|
@@ -260,17 +260,17 @@ var globalValue = (id, compute) => {
|
|
|
260
260
|
return globalStore.get(id);
|
|
261
261
|
};
|
|
262
262
|
|
|
263
|
-
// ../../../node_modules/.pnpm/effect@3.1.
|
|
263
|
+
// ../../../node_modules/.pnpm/effect@3.1.5/node_modules/effect/dist/esm/Predicate.js
|
|
264
264
|
var isFunction2 = isFunction;
|
|
265
265
|
var isRecordOrArray = (input) => typeof input === "object" && input !== null;
|
|
266
266
|
var isObject = (input) => isRecordOrArray(input) || isFunction2(input);
|
|
267
267
|
var hasProperty = /* @__PURE__ */ dual(2, (self, property) => isObject(self) && property in self);
|
|
268
268
|
var isNullable = (input) => input === null || input === void 0;
|
|
269
269
|
|
|
270
|
-
// ../../../node_modules/.pnpm/effect@3.1.
|
|
270
|
+
// ../../../node_modules/.pnpm/effect@3.1.5/node_modules/effect/dist/esm/internal/errors.js
|
|
271
271
|
var getBugErrorMessage = (message) => `BUG: ${message} - please report an issue at https://github.com/Effect-TS/effect/issues`;
|
|
272
272
|
|
|
273
|
-
// ../../../node_modules/.pnpm/effect@3.1.
|
|
273
|
+
// ../../../node_modules/.pnpm/effect@3.1.5/node_modules/effect/dist/esm/Utils.js
|
|
274
274
|
var GenKindTypeId = /* @__PURE__ */ Symbol.for("effect/Gen/GenKind");
|
|
275
275
|
var isGenKind = (u2) => isObject(u2) && GenKindTypeId in u2;
|
|
276
276
|
var GenKindImpl = class {
|
|
@@ -514,11 +514,14 @@ var structuralRegionState = /* @__PURE__ */ globalValue("effect/Utils/isStructur
|
|
|
514
514
|
tester: void 0
|
|
515
515
|
}));
|
|
516
516
|
|
|
517
|
-
// ../../../node_modules/.pnpm/effect@3.1.
|
|
517
|
+
// ../../../node_modules/.pnpm/effect@3.1.5/node_modules/effect/dist/esm/Hash.js
|
|
518
518
|
var randomHashCache = /* @__PURE__ */ globalValue(/* @__PURE__ */ Symbol.for("effect/Hash/randomHashCache"), () => /* @__PURE__ */ new WeakMap());
|
|
519
519
|
var pcgr = /* @__PURE__ */ globalValue(/* @__PURE__ */ Symbol.for("effect/Hash/pcgr"), () => new PCGRandom());
|
|
520
520
|
var symbol = /* @__PURE__ */ Symbol.for("effect/Hash");
|
|
521
521
|
var hash = (self) => {
|
|
522
|
+
if (structuralRegionState.enabled === true) {
|
|
523
|
+
return 0;
|
|
524
|
+
}
|
|
522
525
|
switch (typeof self) {
|
|
523
526
|
case "number":
|
|
524
527
|
return number(self);
|
|
@@ -548,9 +551,6 @@ var hash = (self) => {
|
|
|
548
551
|
}
|
|
549
552
|
};
|
|
550
553
|
var random = (self) => {
|
|
551
|
-
if (structuralRegionState.enabled === true) {
|
|
552
|
-
return 0;
|
|
553
|
-
}
|
|
554
554
|
if (!randomHashCache.has(self)) {
|
|
555
555
|
randomHashCache.set(self, number(pcgr.integer(Number.MAX_SAFE_INTEGER)));
|
|
556
556
|
}
|
|
@@ -583,39 +583,27 @@ var cached = function() {
|
|
|
583
583
|
if (arguments.length === 1) {
|
|
584
584
|
const self2 = arguments[0];
|
|
585
585
|
return function(hash3) {
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
}
|
|
593
|
-
return hash3;
|
|
594
|
-
},
|
|
595
|
-
enumerable: false
|
|
596
|
-
});
|
|
597
|
-
}
|
|
586
|
+
Object.defineProperty(self2, symbol, {
|
|
587
|
+
value() {
|
|
588
|
+
return hash3;
|
|
589
|
+
},
|
|
590
|
+
enumerable: false
|
|
591
|
+
});
|
|
598
592
|
return hash3;
|
|
599
593
|
};
|
|
600
594
|
}
|
|
601
595
|
const self = arguments[0];
|
|
602
596
|
const hash2 = arguments[1];
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
}
|
|
610
|
-
return hash2;
|
|
611
|
-
},
|
|
612
|
-
enumerable: false
|
|
613
|
-
});
|
|
614
|
-
}
|
|
597
|
+
Object.defineProperty(self, symbol, {
|
|
598
|
+
value() {
|
|
599
|
+
return hash2;
|
|
600
|
+
},
|
|
601
|
+
enumerable: false
|
|
602
|
+
});
|
|
615
603
|
return hash2;
|
|
616
604
|
};
|
|
617
605
|
|
|
618
|
-
// ../../../node_modules/.pnpm/effect@3.1.
|
|
606
|
+
// ../../../node_modules/.pnpm/effect@3.1.5/node_modules/effect/dist/esm/Equal.js
|
|
619
607
|
var symbol2 = /* @__PURE__ */ Symbol.for("effect/Equal");
|
|
620
608
|
function equals() {
|
|
621
609
|
if (arguments.length === 1) {
|
|
@@ -634,7 +622,11 @@ function compareBoth(self, that) {
|
|
|
634
622
|
if (selfType === "object" || selfType === "function") {
|
|
635
623
|
if (self !== null && that !== null) {
|
|
636
624
|
if (isEqual(self) && isEqual(that)) {
|
|
637
|
-
|
|
625
|
+
if (hash(self) === hash(that) && self[symbol2](that)) {
|
|
626
|
+
return true;
|
|
627
|
+
} else {
|
|
628
|
+
return structuralRegionState.enabled && structuralRegionState.tester ? structuralRegionState.tester(self, that) : false;
|
|
629
|
+
}
|
|
638
630
|
}
|
|
639
631
|
}
|
|
640
632
|
if (structuralRegionState.enabled) {
|
|
@@ -661,7 +653,7 @@ function compareBoth(self, that) {
|
|
|
661
653
|
var isEqual = (u2) => hasProperty(u2, symbol2);
|
|
662
654
|
var equivalence = () => equals;
|
|
663
655
|
|
|
664
|
-
// ../../../node_modules/.pnpm/effect@3.1.
|
|
656
|
+
// ../../../node_modules/.pnpm/effect@3.1.5/node_modules/effect/dist/esm/Inspectable.js
|
|
665
657
|
var NodeInspectSymbol = /* @__PURE__ */ Symbol.for("nodejs.util.inspect.custom");
|
|
666
658
|
var toJSON = (x2) => {
|
|
667
659
|
if (hasProperty(x2, "toJSON") && isFunction2(x2["toJSON"]) && x2["toJSON"].length === 0) {
|
|
@@ -673,7 +665,7 @@ var toJSON = (x2) => {
|
|
|
673
665
|
};
|
|
674
666
|
var format = (x2) => JSON.stringify(x2, null, 2);
|
|
675
667
|
|
|
676
|
-
// ../../../node_modules/.pnpm/effect@3.1.
|
|
668
|
+
// ../../../node_modules/.pnpm/effect@3.1.5/node_modules/effect/dist/esm/Pipeable.js
|
|
677
669
|
var pipeArguments = (self, args) => {
|
|
678
670
|
switch (args.length) {
|
|
679
671
|
case 1:
|
|
@@ -704,7 +696,7 @@ var pipeArguments = (self, args) => {
|
|
|
704
696
|
}
|
|
705
697
|
};
|
|
706
698
|
|
|
707
|
-
// ../../../node_modules/.pnpm/effect@3.1.
|
|
699
|
+
// ../../../node_modules/.pnpm/effect@3.1.5/node_modules/effect/dist/esm/internal/effectable.js
|
|
708
700
|
var EffectTypeId = /* @__PURE__ */ Symbol.for("effect/Effect");
|
|
709
701
|
var StreamTypeId = /* @__PURE__ */ Symbol.for("effect/Stream");
|
|
710
702
|
var SinkTypeId = /* @__PURE__ */ Symbol.for("effect/Sink");
|
|
@@ -765,7 +757,7 @@ var EffectPrototype = {
|
|
|
765
757
|
}
|
|
766
758
|
};
|
|
767
759
|
|
|
768
|
-
// ../../../node_modules/.pnpm/effect@3.1.
|
|
760
|
+
// ../../../node_modules/.pnpm/effect@3.1.5/node_modules/effect/dist/esm/internal/option.js
|
|
769
761
|
var TypeId = /* @__PURE__ */ Symbol.for("effect/Option");
|
|
770
762
|
var CommonProto = {
|
|
771
763
|
...EffectPrototype,
|
|
@@ -783,7 +775,7 @@ var SomeProto = /* @__PURE__ */ Object.assign(/* @__PURE__ */ Object.create(Comm
|
|
|
783
775
|
_tag: "Some",
|
|
784
776
|
_op: "Some",
|
|
785
777
|
[symbol2](that) {
|
|
786
|
-
return isOption(that) && isSome(that) && equals(
|
|
778
|
+
return isOption(that) && isSome(that) && equals(this.value, that.value);
|
|
787
779
|
},
|
|
788
780
|
[symbol]() {
|
|
789
781
|
return cached(this, combine(hash(this._tag))(hash(this.value)));
|
|
@@ -823,7 +815,7 @@ var some = (value) => {
|
|
|
823
815
|
return a;
|
|
824
816
|
};
|
|
825
817
|
|
|
826
|
-
// ../../../node_modules/.pnpm/effect@3.1.
|
|
818
|
+
// ../../../node_modules/.pnpm/effect@3.1.5/node_modules/effect/dist/esm/internal/either.js
|
|
827
819
|
var TypeId2 = /* @__PURE__ */ Symbol.for("effect/Either");
|
|
828
820
|
var CommonProto2 = {
|
|
829
821
|
...EffectPrototype,
|
|
@@ -841,7 +833,7 @@ var RightProto = /* @__PURE__ */ Object.assign(/* @__PURE__ */ Object.create(Com
|
|
|
841
833
|
_tag: "Right",
|
|
842
834
|
_op: "Right",
|
|
843
835
|
[symbol2](that) {
|
|
844
|
-
return isEither(that) && isRight(that) && equals(
|
|
836
|
+
return isEither(that) && isRight(that) && equals(this.right, that.right);
|
|
845
837
|
},
|
|
846
838
|
[symbol]() {
|
|
847
839
|
return combine(hash(this._tag))(hash(this.right));
|
|
@@ -858,7 +850,7 @@ var LeftProto = /* @__PURE__ */ Object.assign(/* @__PURE__ */ Object.create(Comm
|
|
|
858
850
|
_tag: "Left",
|
|
859
851
|
_op: "Left",
|
|
860
852
|
[symbol2](that) {
|
|
861
|
-
return isEither(that) && isLeft(that) && equals(
|
|
853
|
+
return isEither(that) && isLeft(that) && equals(this.left, that.left);
|
|
862
854
|
},
|
|
863
855
|
[symbol]() {
|
|
864
856
|
return combine(hash(this._tag))(hash(this.left));
|
|
@@ -887,7 +879,7 @@ var right = (right2) => {
|
|
|
887
879
|
var getLeft = (self) => isRight(self) ? none : some(self.left);
|
|
888
880
|
var getRight = (self) => isLeft(self) ? none : some(self.right);
|
|
889
881
|
|
|
890
|
-
// ../../../node_modules/.pnpm/effect@3.1.
|
|
882
|
+
// ../../../node_modules/.pnpm/effect@3.1.5/node_modules/effect/dist/esm/Option.js
|
|
891
883
|
var Option_exports = {};
|
|
892
884
|
__export(Option_exports, {
|
|
893
885
|
Do: () => Do,
|
|
@@ -949,10 +941,10 @@ __export(Option_exports, {
|
|
|
949
941
|
zipWith: () => zipWith
|
|
950
942
|
});
|
|
951
943
|
|
|
952
|
-
// ../../../node_modules/.pnpm/effect@3.1.
|
|
944
|
+
// ../../../node_modules/.pnpm/effect@3.1.5/node_modules/effect/dist/esm/Order.js
|
|
953
945
|
var make2 = (compare) => (self, that) => self === that ? 0 : compare(self, that);
|
|
954
946
|
|
|
955
|
-
// ../../../node_modules/.pnpm/effect@3.1.
|
|
947
|
+
// ../../../node_modules/.pnpm/effect@3.1.5/node_modules/effect/dist/esm/Option.js
|
|
956
948
|
var TypeId3 = /* @__PURE__ */ Symbol.for("effect/Option");
|
|
957
949
|
var none2 = () => none;
|
|
958
950
|
var some2 = some;
|
|
@@ -1296,8 +1288,6 @@ var z = class _z {
|
|
|
1296
1288
|
return this;
|
|
1297
1289
|
}
|
|
1298
1290
|
};
|
|
1299
|
-
|
|
1300
|
-
// src/rules/ensure-use-callback-has-non-empty-deps.ts
|
|
1301
1291
|
var RULE_NAME2 = "ensure-use-callback-has-non-empty-deps";
|
|
1302
1292
|
var ensure_use_callback_has_non_empty_deps_default = createRule({
|
|
1303
1293
|
meta: {
|
|
@@ -1313,14 +1303,13 @@ var ensure_use_callback_has_non_empty_deps_default = createRule({
|
|
|
1313
1303
|
},
|
|
1314
1304
|
name: RULE_NAME2,
|
|
1315
1305
|
create(context) {
|
|
1316
|
-
const alias =
|
|
1317
|
-
const pragma = getPragmaFromContext(context);
|
|
1306
|
+
const alias = parse(ESLintSettingsSchema, context.settings).reactOptions?.additionalHooks?.useCallback ?? [];
|
|
1318
1307
|
return {
|
|
1319
1308
|
CallExpression(node) {
|
|
1320
1309
|
const initialScope = context.sourceCode.getScope(node);
|
|
1321
1310
|
if (!isReactHookCall(node))
|
|
1322
1311
|
return;
|
|
1323
|
-
if (!isUseCallbackCall(node, context
|
|
1312
|
+
if (!isUseCallbackCall(node, context) && !alias.some(Function_exports.flip(isReactHookCallWithNameLoose)(node))) {
|
|
1324
1313
|
return;
|
|
1325
1314
|
}
|
|
1326
1315
|
const [_2, deps] = node.arguments;
|
|
@@ -1366,14 +1355,13 @@ var ensure_use_memo_has_non_empty_deps_default = createRule({
|
|
|
1366
1355
|
},
|
|
1367
1356
|
name: RULE_NAME3,
|
|
1368
1357
|
create(context) {
|
|
1369
|
-
const alias =
|
|
1370
|
-
const pragma = getPragmaFromContext(context);
|
|
1358
|
+
const alias = parse(ESLintSettingsSchema, context.settings).reactOptions?.additionalHooks?.useMemo ?? [];
|
|
1371
1359
|
return {
|
|
1372
1360
|
CallExpression(node) {
|
|
1373
1361
|
const initialScope = context.sourceCode.getScope(node);
|
|
1374
1362
|
if (!isReactHookCall(node))
|
|
1375
1363
|
return;
|
|
1376
|
-
if (!isUseMemoCall(node, context
|
|
1364
|
+
if (!isUseMemoCall(node, context) && !alias.some(Function_exports.flip(isReactHookCallWithNameLoose)(node)))
|
|
1377
1365
|
return;
|
|
1378
1366
|
const [_2, deps] = node.arguments;
|
|
1379
1367
|
if (!deps) {
|
|
@@ -1404,7 +1392,7 @@ var ensure_use_memo_has_non_empty_deps_default = createRule({
|
|
|
1404
1392
|
defaultOptions: []
|
|
1405
1393
|
});
|
|
1406
1394
|
var RULE_NAME4 = "prefer-use-state-lazy-initialization";
|
|
1407
|
-
var ALLOW_LIST =
|
|
1395
|
+
var ALLOW_LIST = ["Boolean", "String", "Number"];
|
|
1408
1396
|
var prefer_use_state_lazy_initialization_default = createRule({
|
|
1409
1397
|
meta: {
|
|
1410
1398
|
type: "problem",
|
|
@@ -1419,13 +1407,12 @@ var prefer_use_state_lazy_initialization_default = createRule({
|
|
|
1419
1407
|
},
|
|
1420
1408
|
name: RULE_NAME4,
|
|
1421
1409
|
create(context) {
|
|
1422
|
-
const alias =
|
|
1423
|
-
const pragma = getPragmaFromContext(context);
|
|
1410
|
+
const alias = parse(ESLintSettingsSchema, context.settings).reactOptions?.additionalHooks?.useState ?? [];
|
|
1424
1411
|
return {
|
|
1425
1412
|
CallExpression(node) {
|
|
1426
1413
|
if (!isReactHookCall(node))
|
|
1427
1414
|
return;
|
|
1428
|
-
if (!isUseStateCall(node, context
|
|
1415
|
+
if (!isUseStateCall(node, context) && !alias.some(Function_exports.flip(isReactHookCallWithNameLoose)(node)))
|
|
1429
1416
|
return;
|
|
1430
1417
|
const [useStateInput] = node.arguments;
|
|
1431
1418
|
if (!useStateInput)
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "eslint-plugin-react-hooks-extra",
|
|
3
|
-
"version": "1.5.
|
|
3
|
+
"version": "1.5.12-beta.10",
|
|
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.
|
|
39
|
-
"@typescript-eslint/scope-manager": "^7.
|
|
40
|
-
"@typescript-eslint/type-utils": "^7.
|
|
41
|
-
"@typescript-eslint/types": "^7.
|
|
42
|
-
"@typescript-eslint/utils": "^7.
|
|
38
|
+
"@typescript-eslint/parser": "^7.9.0",
|
|
39
|
+
"@typescript-eslint/scope-manager": "^7.9.0",
|
|
40
|
+
"@typescript-eslint/type-utils": "^7.9.0",
|
|
41
|
+
"@typescript-eslint/types": "^7.9.0",
|
|
42
|
+
"@typescript-eslint/utils": "^7.9.0",
|
|
43
43
|
"string-ts": "2.1.1",
|
|
44
|
-
"
|
|
45
|
-
"@eslint-react/
|
|
46
|
-
"@eslint-react/shared": "1.5.
|
|
47
|
-
"@eslint-react/
|
|
48
|
-
"@eslint-react/
|
|
49
|
-
"@eslint-react/
|
|
50
|
-
"@eslint-react/
|
|
44
|
+
"valibot": "0.30.0",
|
|
45
|
+
"@eslint-react/ast": "1.5.12-beta.10",
|
|
46
|
+
"@eslint-react/shared": "1.5.12-beta.10",
|
|
47
|
+
"@eslint-react/core": "1.5.12-beta.10",
|
|
48
|
+
"@eslint-react/jsx": "1.5.12-beta.10",
|
|
49
|
+
"@eslint-react/tools": "1.5.12-beta.10",
|
|
50
|
+
"@eslint-react/types": "1.5.12-beta.10",
|
|
51
|
+
"@eslint-react/var": "1.5.12-beta.10"
|
|
51
52
|
},
|
|
52
53
|
"devDependencies": {
|
|
53
|
-
"effect": "3.1.
|
|
54
|
+
"effect": "3.1.5"
|
|
54
55
|
},
|
|
55
56
|
"peerDependencies": {
|
|
56
57
|
"@typescript-eslint/parser": "^7.5.0",
|
|
57
|
-
"eslint": "^9.
|
|
58
|
+
"eslint": "^8.57.0 || ^9.0.0",
|
|
58
59
|
"typescript": "^5.3.3"
|
|
59
60
|
},
|
|
60
61
|
"engines": {
|