eslint-plugin-react-hooks-extra 1.5.7 → 1.5.8-beta.6
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.d.mts +5 -5
- package/dist/index.d.ts +5 -5
- package/dist/index.js +106 -103
- package/dist/index.mjs +106 -103
- package/package.json +16 -15
package/dist/index.d.mts
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
import
|
|
1
|
+
import * as _typescript_eslint_utils_ts_eslint from '@typescript-eslint/utils/ts-eslint';
|
|
2
2
|
|
|
3
3
|
declare const meta: {
|
|
4
4
|
readonly name: string;
|
|
5
5
|
readonly version: string;
|
|
6
6
|
};
|
|
7
7
|
declare const rules: {
|
|
8
|
-
readonly "ensure-custom-hooks-using-other-hooks":
|
|
9
|
-
readonly "ensure-use-callback-has-non-empty-deps":
|
|
10
|
-
readonly "ensure-use-memo-has-non-empty-deps":
|
|
11
|
-
readonly "prefer-use-state-lazy-initialization":
|
|
8
|
+
readonly "ensure-custom-hooks-using-other-hooks": _typescript_eslint_utils_ts_eslint.RuleModule<"ENSURE_CUSTOM_HOOKS_USING_OTHER_HOOKS", [], _typescript_eslint_utils_ts_eslint.RuleListener>;
|
|
9
|
+
readonly "ensure-use-callback-has-non-empty-deps": _typescript_eslint_utils_ts_eslint.RuleModule<"ENSURE_USE_CALLBACK_HAS_NON_EMPTY_DEPS", [], _typescript_eslint_utils_ts_eslint.RuleListener>;
|
|
10
|
+
readonly "ensure-use-memo-has-non-empty-deps": _typescript_eslint_utils_ts_eslint.RuleModule<"ENSURE_USE_MEMO_HAS_NON_EMPTY_DEPS", [], _typescript_eslint_utils_ts_eslint.RuleListener>;
|
|
11
|
+
readonly "prefer-use-state-lazy-initialization": _typescript_eslint_utils_ts_eslint.RuleModule<"PREFER_USE_STATE_LAZY_INITIALIZATION", [], _typescript_eslint_utils_ts_eslint.RuleListener>;
|
|
12
12
|
};
|
|
13
13
|
|
|
14
14
|
export { meta, rules };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
import
|
|
1
|
+
import * as _typescript_eslint_utils_ts_eslint from '@typescript-eslint/utils/ts-eslint';
|
|
2
2
|
|
|
3
3
|
declare const meta: {
|
|
4
4
|
readonly name: string;
|
|
5
5
|
readonly version: string;
|
|
6
6
|
};
|
|
7
7
|
declare const rules: {
|
|
8
|
-
readonly "ensure-custom-hooks-using-other-hooks":
|
|
9
|
-
readonly "ensure-use-callback-has-non-empty-deps":
|
|
10
|
-
readonly "ensure-use-memo-has-non-empty-deps":
|
|
11
|
-
readonly "prefer-use-state-lazy-initialization":
|
|
8
|
+
readonly "ensure-custom-hooks-using-other-hooks": _typescript_eslint_utils_ts_eslint.RuleModule<"ENSURE_CUSTOM_HOOKS_USING_OTHER_HOOKS", [], _typescript_eslint_utils_ts_eslint.RuleListener>;
|
|
9
|
+
readonly "ensure-use-callback-has-non-empty-deps": _typescript_eslint_utils_ts_eslint.RuleModule<"ENSURE_USE_CALLBACK_HAS_NON_EMPTY_DEPS", [], _typescript_eslint_utils_ts_eslint.RuleListener>;
|
|
10
|
+
readonly "ensure-use-memo-has-non-empty-deps": _typescript_eslint_utils_ts_eslint.RuleModule<"ENSURE_USE_MEMO_HAS_NON_EMPTY_DEPS", [], _typescript_eslint_utils_ts_eslint.RuleListener>;
|
|
11
|
+
readonly "prefer-use-state-lazy-initialization": _typescript_eslint_utils_ts_eslint.RuleModule<"PREFER_USE_STATE_LAZY_INITIALIZATION", [], _typescript_eslint_utils_ts_eslint.RuleListener>;
|
|
12
12
|
};
|
|
13
13
|
|
|
14
14
|
export { meta, rules };
|
package/dist/index.js
CHANGED
|
@@ -15,25 +15,24 @@ 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.8-beta.6";
|
|
19
19
|
var createRule = shared.createRuleForPlugin("hooks-extra");
|
|
20
20
|
|
|
21
21
|
// src/rules/ensure-custom-hooks-using-other-hooks.ts
|
|
22
22
|
var RULE_NAME = "ensure-custom-hooks-using-other-hooks";
|
|
23
23
|
var ensure_custom_hooks_using_other_hooks_default = createRule({
|
|
24
|
-
name: RULE_NAME,
|
|
25
24
|
meta: {
|
|
26
25
|
type: "problem",
|
|
27
26
|
docs: {
|
|
28
27
|
description: "enforce custom hooks using other hooks",
|
|
29
28
|
requiresTypeChecking: false
|
|
30
29
|
},
|
|
31
|
-
schema: [],
|
|
32
30
|
messages: {
|
|
33
31
|
ENSURE_CUSTOM_HOOKS_USING_OTHER_HOOKS: "Custom hooks {{name}} should use other hooks"
|
|
34
|
-
}
|
|
32
|
+
},
|
|
33
|
+
schema: []
|
|
35
34
|
},
|
|
36
|
-
|
|
35
|
+
name: RULE_NAME,
|
|
37
36
|
create(context) {
|
|
38
37
|
const { ctx, listeners } = core.useHookCollector();
|
|
39
38
|
return {
|
|
@@ -53,10 +52,11 @@ var ensure_custom_hooks_using_other_hooks_default = createRule({
|
|
|
53
52
|
}
|
|
54
53
|
}
|
|
55
54
|
};
|
|
56
|
-
}
|
|
55
|
+
},
|
|
56
|
+
defaultOptions: []
|
|
57
57
|
});
|
|
58
58
|
|
|
59
|
-
// ../../../node_modules/.pnpm/effect@2.4.
|
|
59
|
+
// ../../../node_modules/.pnpm/effect@2.4.18/node_modules/effect/dist/esm/Function.js
|
|
60
60
|
var Function_exports = {};
|
|
61
61
|
__export(Function_exports, {
|
|
62
62
|
SK: () => SK,
|
|
@@ -155,7 +155,7 @@ var constUndefined = /* @__PURE__ */ constant(void 0);
|
|
|
155
155
|
var constVoid = constUndefined;
|
|
156
156
|
var flip = (f) => (...b2) => (...a) => f(...a)(...b2);
|
|
157
157
|
var compose = /* @__PURE__ */ dual(2, (ab, bc) => (a) => bc(ab(a)));
|
|
158
|
-
var absurd = (
|
|
158
|
+
var absurd = (_2) => {
|
|
159
159
|
throw new Error("Called `absurd` function which should be uncallable");
|
|
160
160
|
};
|
|
161
161
|
var tupled = (f) => (a) => f(...a);
|
|
@@ -229,13 +229,13 @@ function flow(ab, bc, cd, de, ef, fg, gh, hi, ij) {
|
|
|
229
229
|
return;
|
|
230
230
|
}
|
|
231
231
|
var hole = /* @__PURE__ */ unsafeCoerce(absurd);
|
|
232
|
-
var SK = (
|
|
232
|
+
var SK = (_2, b2) => b2;
|
|
233
233
|
|
|
234
|
-
// ../../../node_modules/.pnpm/effect@2.4.
|
|
235
|
-
var moduleVersion = "2.4.
|
|
234
|
+
// ../../../node_modules/.pnpm/effect@2.4.18/node_modules/effect/dist/esm/internal/version.js
|
|
235
|
+
var moduleVersion = "2.4.18";
|
|
236
236
|
var getCurrentVersion = () => moduleVersion;
|
|
237
237
|
|
|
238
|
-
// ../../../node_modules/.pnpm/effect@2.4.
|
|
238
|
+
// ../../../node_modules/.pnpm/effect@2.4.18/node_modules/effect/dist/esm/GlobalValue.js
|
|
239
239
|
var globalStoreId = /* @__PURE__ */ Symbol.for(`effect/GlobalValue/globalStoreId/${/* @__PURE__ */ getCurrentVersion()}`);
|
|
240
240
|
if (!(globalStoreId in globalThis)) {
|
|
241
241
|
globalThis[globalStoreId] = /* @__PURE__ */ new Map();
|
|
@@ -248,14 +248,14 @@ var globalValue = (id, compute) => {
|
|
|
248
248
|
return globalStore.get(id);
|
|
249
249
|
};
|
|
250
250
|
|
|
251
|
-
// ../../../node_modules/.pnpm/effect@2.4.
|
|
251
|
+
// ../../../node_modules/.pnpm/effect@2.4.18/node_modules/effect/dist/esm/Predicate.js
|
|
252
252
|
var isFunction2 = isFunction;
|
|
253
253
|
var isRecordOrArray = (input) => typeof input === "object" && input !== null;
|
|
254
254
|
var isObject = (input) => isRecordOrArray(input) || isFunction2(input);
|
|
255
255
|
var hasProperty = /* @__PURE__ */ dual(2, (self, property) => isObject(self) && property in self);
|
|
256
256
|
var isNullable = (input) => input === null || input === void 0;
|
|
257
257
|
|
|
258
|
-
// ../../../node_modules/.pnpm/effect@2.4.
|
|
258
|
+
// ../../../node_modules/.pnpm/effect@2.4.18/node_modules/effect/dist/esm/Utils.js
|
|
259
259
|
var GenKindTypeId = /* @__PURE__ */ Symbol.for("effect/Gen/GenKind");
|
|
260
260
|
var GenKindImpl = class {
|
|
261
261
|
value;
|
|
@@ -272,19 +272,19 @@ var GenKindImpl = class {
|
|
|
272
272
|
* @since 2.0.0
|
|
273
273
|
*/
|
|
274
274
|
get _R() {
|
|
275
|
-
return (
|
|
275
|
+
return (_2) => _2;
|
|
276
276
|
}
|
|
277
277
|
/**
|
|
278
278
|
* @since 2.0.0
|
|
279
279
|
*/
|
|
280
280
|
get _O() {
|
|
281
|
-
return (
|
|
281
|
+
return (_2) => _2;
|
|
282
282
|
}
|
|
283
283
|
/**
|
|
284
284
|
* @since 2.0.0
|
|
285
285
|
*/
|
|
286
286
|
get _E() {
|
|
287
|
-
return (
|
|
287
|
+
return (_2) => _2;
|
|
288
288
|
}
|
|
289
289
|
/**
|
|
290
290
|
* @since 2.0.0
|
|
@@ -475,7 +475,7 @@ function add64(out, aHi, aLo, bHi, bLo) {
|
|
|
475
475
|
out[1] = lo;
|
|
476
476
|
}
|
|
477
477
|
|
|
478
|
-
// ../../../node_modules/.pnpm/effect@2.4.
|
|
478
|
+
// ../../../node_modules/.pnpm/effect@2.4.18/node_modules/effect/dist/esm/Hash.js
|
|
479
479
|
var randomHashCache = /* @__PURE__ */ globalValue(/* @__PURE__ */ Symbol.for("effect/Hash/randomHashCache"), () => /* @__PURE__ */ new WeakMap());
|
|
480
480
|
var pcgr = /* @__PURE__ */ globalValue(/* @__PURE__ */ Symbol.for("effect/Hash/pcgr"), () => new PCGRandom());
|
|
481
481
|
var symbol = /* @__PURE__ */ Symbol.for("effect/Hash");
|
|
@@ -561,7 +561,7 @@ var cached = function() {
|
|
|
561
561
|
return hash2;
|
|
562
562
|
};
|
|
563
563
|
|
|
564
|
-
// ../../../node_modules/.pnpm/effect@2.4.
|
|
564
|
+
// ../../../node_modules/.pnpm/effect@2.4.18/node_modules/effect/dist/esm/Equal.js
|
|
565
565
|
var symbol2 = /* @__PURE__ */ Symbol.for("effect/Equal");
|
|
566
566
|
function equals() {
|
|
567
567
|
if (arguments.length === 1) {
|
|
@@ -587,10 +587,10 @@ function compareBoth(self, that) {
|
|
|
587
587
|
var isEqual = (u2) => hasProperty(u2, symbol2);
|
|
588
588
|
var equivalence = () => equals;
|
|
589
589
|
|
|
590
|
-
// ../../../node_modules/.pnpm/effect@2.4.
|
|
590
|
+
// ../../../node_modules/.pnpm/effect@2.4.18/node_modules/effect/dist/esm/Equivalence.js
|
|
591
591
|
var make = (isEquivalent) => (self, that) => self === that || isEquivalent(self, that);
|
|
592
592
|
|
|
593
|
-
// ../../../node_modules/.pnpm/effect@2.4.
|
|
593
|
+
// ../../../node_modules/.pnpm/effect@2.4.18/node_modules/effect/dist/esm/Inspectable.js
|
|
594
594
|
var NodeInspectSymbol = /* @__PURE__ */ Symbol.for("nodejs.util.inspect.custom");
|
|
595
595
|
var toJSON = (x2) => {
|
|
596
596
|
if (hasProperty(x2, "toJSON") && isFunction2(x2["toJSON"]) && x2["toJSON"].length === 0) {
|
|
@@ -602,7 +602,7 @@ var toJSON = (x2) => {
|
|
|
602
602
|
};
|
|
603
603
|
var format = (x2) => JSON.stringify(x2, null, 2);
|
|
604
604
|
|
|
605
|
-
// ../../../node_modules/.pnpm/effect@2.4.
|
|
605
|
+
// ../../../node_modules/.pnpm/effect@2.4.18/node_modules/effect/dist/esm/Option.js
|
|
606
606
|
var Option_exports = {};
|
|
607
607
|
__export(Option_exports, {
|
|
608
608
|
Do: () => Do,
|
|
@@ -664,7 +664,7 @@ __export(Option_exports, {
|
|
|
664
664
|
zipWith: () => zipWith
|
|
665
665
|
});
|
|
666
666
|
|
|
667
|
-
// ../../../node_modules/.pnpm/effect@2.4.
|
|
667
|
+
// ../../../node_modules/.pnpm/effect@2.4.18/node_modules/effect/dist/esm/Pipeable.js
|
|
668
668
|
var pipeArguments = (self, args) => {
|
|
669
669
|
switch (args.length) {
|
|
670
670
|
case 1:
|
|
@@ -695,47 +695,47 @@ var pipeArguments = (self, args) => {
|
|
|
695
695
|
}
|
|
696
696
|
};
|
|
697
697
|
|
|
698
|
-
// ../../../node_modules/.pnpm/effect@2.4.
|
|
698
|
+
// ../../../node_modules/.pnpm/effect@2.4.18/node_modules/effect/dist/esm/internal/effectable.js
|
|
699
699
|
var EffectTypeId = /* @__PURE__ */ Symbol.for("effect/Effect");
|
|
700
700
|
var StreamTypeId = /* @__PURE__ */ Symbol.for("effect/Stream");
|
|
701
701
|
var SinkTypeId = /* @__PURE__ */ Symbol.for("effect/Sink");
|
|
702
702
|
var ChannelTypeId = /* @__PURE__ */ Symbol.for("effect/Channel");
|
|
703
703
|
var effectVariance = {
|
|
704
704
|
/* c8 ignore next */
|
|
705
|
-
_R: (
|
|
705
|
+
_R: (_2) => _2,
|
|
706
706
|
/* c8 ignore next */
|
|
707
|
-
_E: (
|
|
707
|
+
_E: (_2) => _2,
|
|
708
708
|
/* c8 ignore next */
|
|
709
|
-
_A: (
|
|
709
|
+
_A: (_2) => _2,
|
|
710
710
|
_V: /* @__PURE__ */ getCurrentVersion()
|
|
711
711
|
};
|
|
712
712
|
var sinkVariance = {
|
|
713
713
|
/* c8 ignore next */
|
|
714
|
-
_A: (
|
|
714
|
+
_A: (_2) => _2,
|
|
715
715
|
/* c8 ignore next */
|
|
716
|
-
_In: (
|
|
716
|
+
_In: (_2) => _2,
|
|
717
717
|
/* c8 ignore next */
|
|
718
|
-
_L: (
|
|
718
|
+
_L: (_2) => _2,
|
|
719
719
|
/* c8 ignore next */
|
|
720
|
-
_E: (
|
|
720
|
+
_E: (_2) => _2,
|
|
721
721
|
/* c8 ignore next */
|
|
722
|
-
_R: (
|
|
722
|
+
_R: (_2) => _2
|
|
723
723
|
};
|
|
724
724
|
var channelVariance = {
|
|
725
725
|
/* c8 ignore next */
|
|
726
|
-
_Env: (
|
|
726
|
+
_Env: (_2) => _2,
|
|
727
727
|
/* c8 ignore next */
|
|
728
|
-
_InErr: (
|
|
728
|
+
_InErr: (_2) => _2,
|
|
729
729
|
/* c8 ignore next */
|
|
730
|
-
_InElem: (
|
|
730
|
+
_InElem: (_2) => _2,
|
|
731
731
|
/* c8 ignore next */
|
|
732
|
-
_InDone: (
|
|
732
|
+
_InDone: (_2) => _2,
|
|
733
733
|
/* c8 ignore next */
|
|
734
|
-
_OutErr: (
|
|
734
|
+
_OutErr: (_2) => _2,
|
|
735
735
|
/* c8 ignore next */
|
|
736
|
-
_OutElem: (
|
|
736
|
+
_OutElem: (_2) => _2,
|
|
737
737
|
/* c8 ignore next */
|
|
738
|
-
_OutDone: (
|
|
738
|
+
_OutDone: (_2) => _2
|
|
739
739
|
};
|
|
740
740
|
var EffectPrototype = {
|
|
741
741
|
[EffectTypeId]: effectVariance,
|
|
@@ -753,12 +753,12 @@ var EffectPrototype = {
|
|
|
753
753
|
}
|
|
754
754
|
};
|
|
755
755
|
|
|
756
|
-
// ../../../node_modules/.pnpm/effect@2.4.
|
|
756
|
+
// ../../../node_modules/.pnpm/effect@2.4.18/node_modules/effect/dist/esm/internal/option.js
|
|
757
757
|
var TypeId = /* @__PURE__ */ Symbol.for("effect/Option");
|
|
758
758
|
var CommonProto = {
|
|
759
759
|
...EffectPrototype,
|
|
760
760
|
[TypeId]: {
|
|
761
|
-
_A: (
|
|
761
|
+
_A: (_2) => _2
|
|
762
762
|
},
|
|
763
763
|
[NodeInspectSymbol]() {
|
|
764
764
|
return this.toJSON();
|
|
@@ -811,12 +811,12 @@ var some = (value) => {
|
|
|
811
811
|
return a;
|
|
812
812
|
};
|
|
813
813
|
|
|
814
|
-
// ../../../node_modules/.pnpm/effect@2.4.
|
|
814
|
+
// ../../../node_modules/.pnpm/effect@2.4.18/node_modules/effect/dist/esm/internal/either.js
|
|
815
815
|
var TypeId2 = /* @__PURE__ */ Symbol.for("effect/Either");
|
|
816
816
|
var CommonProto2 = {
|
|
817
817
|
...EffectPrototype,
|
|
818
818
|
[TypeId2]: {
|
|
819
|
-
_R: (
|
|
819
|
+
_R: (_2) => _2
|
|
820
820
|
},
|
|
821
821
|
[NodeInspectSymbol]() {
|
|
822
822
|
return this.toJSON();
|
|
@@ -875,10 +875,10 @@ var right = (right2) => {
|
|
|
875
875
|
var getLeft = (self) => isRight(self) ? none : some(self.left);
|
|
876
876
|
var getRight = (self) => isLeft(self) ? none : some(self.right);
|
|
877
877
|
|
|
878
|
-
// ../../../node_modules/.pnpm/effect@2.4.
|
|
878
|
+
// ../../../node_modules/.pnpm/effect@2.4.18/node_modules/effect/dist/esm/Order.js
|
|
879
879
|
var make2 = (compare) => (self, that) => self === that ? 0 : compare(self, that);
|
|
880
880
|
|
|
881
|
-
// ../../../node_modules/.pnpm/effect@2.4.
|
|
881
|
+
// ../../../node_modules/.pnpm/effect@2.4.18/node_modules/effect/dist/esm/Option.js
|
|
882
882
|
var TypeId3 = /* @__PURE__ */ Symbol.for("effect/Option");
|
|
883
883
|
var none2 = () => none;
|
|
884
884
|
var some2 = some;
|
|
@@ -1042,49 +1042,49 @@ var gen = (f) => {
|
|
|
1042
1042
|
}
|
|
1043
1043
|
};
|
|
1044
1044
|
|
|
1045
|
-
// ../../../node_modules/.pnpm/ts-pattern@5.
|
|
1045
|
+
// ../../../node_modules/.pnpm/ts-pattern@5.1.1/node_modules/ts-pattern/dist/index.js
|
|
1046
1046
|
var t = Symbol.for("@ts-pattern/matcher");
|
|
1047
1047
|
var e = Symbol.for("@ts-pattern/isVariadic");
|
|
1048
1048
|
var n = "@ts-pattern/anonymous-select-key";
|
|
1049
1049
|
var r = (t2) => Boolean(t2 && "object" == typeof t2);
|
|
1050
1050
|
var i = (e2) => e2 && !!e2[t];
|
|
1051
|
-
var
|
|
1051
|
+
var o = (n2, s2, c2) => {
|
|
1052
1052
|
if (i(n2)) {
|
|
1053
|
-
const e2 = n2[t](), { matched: r2, selections: i2 } = e2.match(
|
|
1053
|
+
const e2 = n2[t](), { matched: r2, selections: i2 } = e2.match(s2);
|
|
1054
1054
|
return r2 && i2 && Object.keys(i2).forEach((t2) => c2(t2, i2[t2])), r2;
|
|
1055
1055
|
}
|
|
1056
1056
|
if (r(n2)) {
|
|
1057
|
-
if (!r(
|
|
1057
|
+
if (!r(s2))
|
|
1058
1058
|
return false;
|
|
1059
1059
|
if (Array.isArray(n2)) {
|
|
1060
|
-
if (!Array.isArray(
|
|
1060
|
+
if (!Array.isArray(s2))
|
|
1061
1061
|
return false;
|
|
1062
1062
|
let t2 = [], r2 = [], a = [];
|
|
1063
|
-
for (const
|
|
1064
|
-
const
|
|
1065
|
-
i(
|
|
1063
|
+
for (const o2 of n2.keys()) {
|
|
1064
|
+
const s3 = n2[o2];
|
|
1065
|
+
i(s3) && s3[e] ? a.push(s3) : a.length ? r2.push(s3) : t2.push(s3);
|
|
1066
1066
|
}
|
|
1067
1067
|
if (a.length) {
|
|
1068
1068
|
if (a.length > 1)
|
|
1069
1069
|
throw new Error("Pattern error: Using `...P.array(...)` several times in a single pattern is not allowed.");
|
|
1070
|
-
if (
|
|
1070
|
+
if (s2.length < t2.length + r2.length)
|
|
1071
1071
|
return false;
|
|
1072
|
-
const e2 =
|
|
1073
|
-
return t2.every((t3, n4) =>
|
|
1072
|
+
const e2 = s2.slice(0, t2.length), n3 = 0 === r2.length ? [] : s2.slice(-r2.length), i2 = s2.slice(t2.length, 0 === r2.length ? Infinity : -r2.length);
|
|
1073
|
+
return t2.every((t3, n4) => o(t3, e2[n4], c2)) && r2.every((t3, e3) => o(t3, n3[e3], c2)) && (0 === a.length || o(a[0], i2, c2));
|
|
1074
1074
|
}
|
|
1075
|
-
return n2.length ===
|
|
1075
|
+
return n2.length === s2.length && n2.every((t3, e2) => o(t3, s2[e2], c2));
|
|
1076
1076
|
}
|
|
1077
1077
|
return Object.keys(n2).every((e2) => {
|
|
1078
1078
|
const r2 = n2[e2];
|
|
1079
|
-
return (e2 in
|
|
1079
|
+
return (e2 in s2 || i(a = r2) && "optional" === a[t]().matcherType) && o(r2, s2[e2], c2);
|
|
1080
1080
|
var a;
|
|
1081
1081
|
});
|
|
1082
1082
|
}
|
|
1083
|
-
return Object.is(
|
|
1083
|
+
return Object.is(s2, n2);
|
|
1084
1084
|
};
|
|
1085
|
-
var
|
|
1086
|
-
var n2,
|
|
1087
|
-
return r(e2) ? i(e2) ? null != (n2 = null == (
|
|
1085
|
+
var s = (e2) => {
|
|
1086
|
+
var n2, o2, a;
|
|
1087
|
+
return r(e2) ? i(e2) ? null != (n2 = null == (o2 = (a = e2[t]()).getSelectionKeys) ? void 0 : o2.call(a)) ? n2 : [] : Array.isArray(e2) ? c(e2, s) : c(Object.values(e2), s) : [];
|
|
1088
1088
|
};
|
|
1089
1089
|
var c = (t2, e2) => t2.reduce((t3, n2) => t3.concat(e2(n2)), []);
|
|
1090
1090
|
function u(t2) {
|
|
@@ -1096,8 +1096,8 @@ function l(e2) {
|
|
|
1096
1096
|
const r2 = (t3, e3) => {
|
|
1097
1097
|
n2[t3] = e3;
|
|
1098
1098
|
};
|
|
1099
|
-
return void 0 === t2 ? (
|
|
1100
|
-
}, getSelectionKeys: () =>
|
|
1099
|
+
return void 0 === t2 ? (s(e2).forEach((t3) => r2(t3, void 0)), { matched: true, selections: n2 }) : { matched: o(e2, t2, r2), selections: n2 };
|
|
1100
|
+
}, getSelectionKeys: () => s(e2), matcherType: "optional" }) });
|
|
1101
1101
|
}
|
|
1102
1102
|
function m(...e2) {
|
|
1103
1103
|
return u({ [t]: () => ({ match: (t2) => {
|
|
@@ -1105,8 +1105,8 @@ function m(...e2) {
|
|
|
1105
1105
|
const r2 = (t3, e3) => {
|
|
1106
1106
|
n2[t3] = e3;
|
|
1107
1107
|
};
|
|
1108
|
-
return { matched: e2.every((e3) =>
|
|
1109
|
-
}, getSelectionKeys: () => c(e2,
|
|
1108
|
+
return { matched: e2.every((e3) => o(e3, t2, r2)), selections: n2 };
|
|
1109
|
+
}, getSelectionKeys: () => c(e2, s), matcherType: "and" }) });
|
|
1110
1110
|
}
|
|
1111
1111
|
function d(...e2) {
|
|
1112
1112
|
return u({ [t]: () => ({ match: (t2) => {
|
|
@@ -1114,8 +1114,8 @@ function d(...e2) {
|
|
|
1114
1114
|
const r2 = (t3, e3) => {
|
|
1115
1115
|
n2[t3] = e3;
|
|
1116
1116
|
};
|
|
1117
|
-
return c(e2,
|
|
1118
|
-
}, getSelectionKeys: () => c(e2,
|
|
1117
|
+
return c(e2, s).forEach((t3) => r2(t3, void 0)), { matched: e2.some((e3) => o(e3, t2, r2)), selections: n2 };
|
|
1118
|
+
}, getSelectionKeys: () => c(e2, s), matcherType: "or" }) });
|
|
1119
1119
|
}
|
|
1120
1120
|
function y(e2) {
|
|
1121
1121
|
return { [t]: () => ({ match: (t2) => ({ matched: Boolean(e2(t2)) }) }) };
|
|
@@ -1124,10 +1124,10 @@ function p(...e2) {
|
|
|
1124
1124
|
const r2 = "string" == typeof e2[0] ? e2[0] : void 0, i2 = 2 === e2.length ? e2[1] : "string" == typeof e2[0] ? void 0 : e2[0];
|
|
1125
1125
|
return u({ [t]: () => ({ match: (t2) => {
|
|
1126
1126
|
let e3 = { [null != r2 ? r2 : n]: t2 };
|
|
1127
|
-
return { matched: void 0 === i2 ||
|
|
1127
|
+
return { matched: void 0 === i2 || o(i2, t2, (t3, n2) => {
|
|
1128
1128
|
e3[t3] = n2;
|
|
1129
1129
|
}), selections: e3 };
|
|
1130
|
-
}, getSelectionKeys: () => [null != r2 ? r2 : n].concat(void 0 === i2 ? [] :
|
|
1130
|
+
}, getSelectionKeys: () => [null != r2 ? r2 : n].concat(void 0 === i2 ? [] : s(i2)) }) });
|
|
1131
1131
|
}
|
|
1132
1132
|
function v(t2) {
|
|
1133
1133
|
return "number" == typeof t2;
|
|
@@ -1168,11 +1168,14 @@ u(y(function(t2) {
|
|
|
1168
1168
|
u(y(function(t2) {
|
|
1169
1169
|
return null == t2;
|
|
1170
1170
|
}));
|
|
1171
|
+
u(y(function(t2) {
|
|
1172
|
+
return null != t2;
|
|
1173
|
+
}));
|
|
1171
1174
|
var W = { matched: false, value: void 0 };
|
|
1172
|
-
function
|
|
1173
|
-
return new
|
|
1175
|
+
function $(t2) {
|
|
1176
|
+
return new z(t2, W);
|
|
1174
1177
|
}
|
|
1175
|
-
var
|
|
1178
|
+
var z = class _z {
|
|
1176
1179
|
constructor(t2, e2) {
|
|
1177
1180
|
this.input = void 0, this.state = void 0, this.input = t2, this.state = e2;
|
|
1178
1181
|
}
|
|
@@ -1182,17 +1185,17 @@ var $ = class _$ {
|
|
|
1182
1185
|
const e2 = t2[t2.length - 1], r2 = [t2[0]];
|
|
1183
1186
|
let i2;
|
|
1184
1187
|
3 === t2.length && "function" == typeof t2[1] ? i2 = t2[1] : t2.length > 2 && r2.push(...t2.slice(1, t2.length - 1));
|
|
1185
|
-
let
|
|
1188
|
+
let s2 = false, c2 = {};
|
|
1186
1189
|
const a = (t3, e3) => {
|
|
1187
|
-
|
|
1188
|
-
}, u2 = !r2.some((t3) =>
|
|
1189
|
-
return new
|
|
1190
|
+
s2 = true, c2[t3] = e3;
|
|
1191
|
+
}, u2 = !r2.some((t3) => o(t3, this.input, a)) || i2 && !Boolean(i2(this.input)) ? W : { matched: true, value: e2(s2 ? n in c2 ? c2[n] : c2 : this.input, this.input) };
|
|
1192
|
+
return new _z(this.input, u2);
|
|
1190
1193
|
}
|
|
1191
1194
|
when(t2, e2) {
|
|
1192
1195
|
if (this.state.matched)
|
|
1193
1196
|
return this;
|
|
1194
1197
|
const n2 = Boolean(t2(this.input));
|
|
1195
|
-
return new
|
|
1198
|
+
return new _z(this.input, n2 ? { matched: true, value: e2(this.input, this.input) } : W);
|
|
1196
1199
|
}
|
|
1197
1200
|
otherwise(t2) {
|
|
1198
1201
|
return this.state.matched ? this.state.value : t2(this.input);
|
|
@@ -1219,19 +1222,18 @@ var $ = class _$ {
|
|
|
1219
1222
|
// src/rules/ensure-use-callback-has-non-empty-deps.ts
|
|
1220
1223
|
var RULE_NAME2 = "ensure-use-callback-has-non-empty-deps";
|
|
1221
1224
|
var ensure_use_callback_has_non_empty_deps_default = createRule({
|
|
1222
|
-
name: RULE_NAME2,
|
|
1223
1225
|
meta: {
|
|
1224
1226
|
type: "problem",
|
|
1225
1227
|
docs: {
|
|
1226
1228
|
description: "enforce 'useCallback' has non-empty dependencies array",
|
|
1227
1229
|
requiresTypeChecking: false
|
|
1228
1230
|
},
|
|
1229
|
-
schema: [],
|
|
1230
1231
|
messages: {
|
|
1231
1232
|
ENSURE_USE_CALLBACK_HAS_NON_EMPTY_DEPS: "useCallback should have a non-empty dependencies array"
|
|
1232
|
-
}
|
|
1233
|
+
},
|
|
1234
|
+
schema: []
|
|
1233
1235
|
},
|
|
1234
|
-
|
|
1236
|
+
name: RULE_NAME2,
|
|
1235
1237
|
create(context) {
|
|
1236
1238
|
const alias = shared.parseSchema(shared.ESLintSettingsSchema, context.settings).reactOptions?.additionalHooks?.useCallback ?? [];
|
|
1237
1239
|
const pragma = jsx.getPragmaFromContext(context);
|
|
@@ -1243,7 +1245,7 @@ var ensure_use_callback_has_non_empty_deps_default = createRule({
|
|
|
1243
1245
|
if (!core.isUseCallbackCall(node, context, pragma) && !alias.some(Function_exports.flip(core.isReactHookCallWithNameLoose)(node))) {
|
|
1244
1246
|
return;
|
|
1245
1247
|
}
|
|
1246
|
-
const [
|
|
1248
|
+
const [_2, deps] = node.arguments;
|
|
1247
1249
|
if (!deps) {
|
|
1248
1250
|
context.report({
|
|
1249
1251
|
messageId: "ENSURE_USE_CALLBACK_HAS_NON_EMPTY_DEPS",
|
|
@@ -1252,7 +1254,7 @@ var ensure_use_callback_has_non_empty_deps_default = createRule({
|
|
|
1252
1254
|
return;
|
|
1253
1255
|
}
|
|
1254
1256
|
const maybeDescriptor = Function_exports.pipe(
|
|
1255
|
-
|
|
1257
|
+
$(deps).with({ type: ast.NodeType.ArrayExpression }, Option_exports.some).with({ type: ast.NodeType.Identifier }, (n2) => {
|
|
1256
1258
|
return Function_exports.pipe(
|
|
1257
1259
|
_var.findVariable(n2.name, initialScope),
|
|
1258
1260
|
Option_exports.flatMap(_var.getVariableInit(0)),
|
|
@@ -1261,30 +1263,30 @@ var ensure_use_callback_has_non_empty_deps_default = createRule({
|
|
|
1261
1263
|
}).otherwise(Option_exports.none),
|
|
1262
1264
|
Option_exports.filter((x2) => x2.elements.length === 0),
|
|
1263
1265
|
Option_exports.map(() => ({
|
|
1264
|
-
|
|
1265
|
-
|
|
1266
|
+
messageId: "ENSURE_USE_CALLBACK_HAS_NON_EMPTY_DEPS",
|
|
1267
|
+
node
|
|
1266
1268
|
}))
|
|
1267
1269
|
);
|
|
1268
1270
|
Option_exports.map(maybeDescriptor, context.report);
|
|
1269
1271
|
}
|
|
1270
1272
|
};
|
|
1271
|
-
}
|
|
1273
|
+
},
|
|
1274
|
+
defaultOptions: []
|
|
1272
1275
|
});
|
|
1273
1276
|
var RULE_NAME3 = "ensure-use-memo-has-non-empty-deps";
|
|
1274
1277
|
var ensure_use_memo_has_non_empty_deps_default = createRule({
|
|
1275
|
-
name: RULE_NAME3,
|
|
1276
1278
|
meta: {
|
|
1277
1279
|
type: "problem",
|
|
1278
1280
|
docs: {
|
|
1279
1281
|
description: "enforce 'useMemo' has non-empty dependencies array",
|
|
1280
1282
|
requiresTypeChecking: false
|
|
1281
1283
|
},
|
|
1282
|
-
schema: [],
|
|
1283
1284
|
messages: {
|
|
1284
1285
|
ENSURE_USE_MEMO_HAS_NON_EMPTY_DEPS: "useMemo should have a non-empty dependencies array"
|
|
1285
|
-
}
|
|
1286
|
+
},
|
|
1287
|
+
schema: []
|
|
1286
1288
|
},
|
|
1287
|
-
|
|
1289
|
+
name: RULE_NAME3,
|
|
1288
1290
|
create(context) {
|
|
1289
1291
|
const alias = shared.parseSchema(shared.ESLintSettingsSchema, context.settings).reactOptions?.additionalHooks?.useMemo ?? [];
|
|
1290
1292
|
const pragma = jsx.getPragmaFromContext(context);
|
|
@@ -1295,7 +1297,7 @@ var ensure_use_memo_has_non_empty_deps_default = createRule({
|
|
|
1295
1297
|
return;
|
|
1296
1298
|
if (!core.isUseMemoCall(node, context, pragma) && !alias.some(Function_exports.flip(core.isReactHookCallWithNameLoose)(node)))
|
|
1297
1299
|
return;
|
|
1298
|
-
const [
|
|
1300
|
+
const [_2, deps] = node.arguments;
|
|
1299
1301
|
if (!deps) {
|
|
1300
1302
|
context.report({
|
|
1301
1303
|
messageId: "ENSURE_USE_MEMO_HAS_NON_EMPTY_DEPS",
|
|
@@ -1304,7 +1306,7 @@ var ensure_use_memo_has_non_empty_deps_default = createRule({
|
|
|
1304
1306
|
return;
|
|
1305
1307
|
}
|
|
1306
1308
|
const maybeDescriptor = Function_exports.pipe(
|
|
1307
|
-
|
|
1309
|
+
$(deps).with({ type: ast.NodeType.ArrayExpression }, Option_exports.some).with({ type: ast.NodeType.Identifier }, (n2) => {
|
|
1308
1310
|
return Function_exports.pipe(
|
|
1309
1311
|
_var.findVariable(n2.name, initialScope),
|
|
1310
1312
|
Option_exports.flatMap(_var.getVariableInit(0)),
|
|
@@ -1313,31 +1315,31 @@ var ensure_use_memo_has_non_empty_deps_default = createRule({
|
|
|
1313
1315
|
}).otherwise(Option_exports.none),
|
|
1314
1316
|
Option_exports.filter((x2) => x2.elements.length === 0),
|
|
1315
1317
|
Option_exports.map(() => ({
|
|
1316
|
-
|
|
1317
|
-
|
|
1318
|
+
messageId: "ENSURE_USE_MEMO_HAS_NON_EMPTY_DEPS",
|
|
1319
|
+
node
|
|
1318
1320
|
}))
|
|
1319
1321
|
);
|
|
1320
1322
|
Option_exports.map(maybeDescriptor, context.report);
|
|
1321
1323
|
}
|
|
1322
1324
|
};
|
|
1323
|
-
}
|
|
1325
|
+
},
|
|
1326
|
+
defaultOptions: []
|
|
1324
1327
|
});
|
|
1325
1328
|
var RULE_NAME4 = "prefer-use-state-lazy-initialization";
|
|
1326
1329
|
var ALLOW_LIST = Object.freeze(["Boolean", "String", "Number"]);
|
|
1327
1330
|
var prefer_use_state_lazy_initialization_default = createRule({
|
|
1328
|
-
name: RULE_NAME4,
|
|
1329
1331
|
meta: {
|
|
1330
1332
|
type: "problem",
|
|
1331
1333
|
docs: {
|
|
1332
1334
|
description: "disallow function calls in 'useState' that aren't wrapped in an initializer function",
|
|
1333
1335
|
requiresTypeChecking: false
|
|
1334
1336
|
},
|
|
1335
|
-
schema: [],
|
|
1336
1337
|
messages: {
|
|
1337
1338
|
PREFER_USE_STATE_LAZY_INITIALIZATION: "To prevent re-computation, consider using lazy initial state for useState calls that involve function calls. Ex: 'useState(() => getValue())'"
|
|
1338
|
-
}
|
|
1339
|
+
},
|
|
1340
|
+
schema: []
|
|
1339
1341
|
},
|
|
1340
|
-
|
|
1342
|
+
name: RULE_NAME4,
|
|
1341
1343
|
create(context) {
|
|
1342
1344
|
const alias = shared.parseSchema(shared.ESLintSettingsSchema, context.settings).reactOptions?.additionalHooks?.useState ?? [];
|
|
1343
1345
|
const pragma = jsx.getPragmaFromContext(context);
|
|
@@ -1357,12 +1359,13 @@ var prefer_use_state_lazy_initialization_default = createRule({
|
|
|
1357
1359
|
if (!hasFunctionCall)
|
|
1358
1360
|
return;
|
|
1359
1361
|
context.report({
|
|
1360
|
-
|
|
1361
|
-
|
|
1362
|
+
messageId: "PREFER_USE_STATE_LAZY_INITIALIZATION",
|
|
1363
|
+
node: useStateInput
|
|
1362
1364
|
});
|
|
1363
1365
|
}
|
|
1364
1366
|
};
|
|
1365
|
-
}
|
|
1367
|
+
},
|
|
1368
|
+
defaultOptions: []
|
|
1366
1369
|
});
|
|
1367
1370
|
|
|
1368
1371
|
// src/index.ts
|
package/dist/index.mjs
CHANGED
|
@@ -13,25 +13,24 @@ 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.8-beta.6";
|
|
17
17
|
var createRule = createRuleForPlugin("hooks-extra");
|
|
18
18
|
|
|
19
19
|
// src/rules/ensure-custom-hooks-using-other-hooks.ts
|
|
20
20
|
var RULE_NAME = "ensure-custom-hooks-using-other-hooks";
|
|
21
21
|
var ensure_custom_hooks_using_other_hooks_default = createRule({
|
|
22
|
-
name: RULE_NAME,
|
|
23
22
|
meta: {
|
|
24
23
|
type: "problem",
|
|
25
24
|
docs: {
|
|
26
25
|
description: "enforce custom hooks using other hooks",
|
|
27
26
|
requiresTypeChecking: false
|
|
28
27
|
},
|
|
29
|
-
schema: [],
|
|
30
28
|
messages: {
|
|
31
29
|
ENSURE_CUSTOM_HOOKS_USING_OTHER_HOOKS: "Custom hooks {{name}} should use other hooks"
|
|
32
|
-
}
|
|
30
|
+
},
|
|
31
|
+
schema: []
|
|
33
32
|
},
|
|
34
|
-
|
|
33
|
+
name: RULE_NAME,
|
|
35
34
|
create(context) {
|
|
36
35
|
const { ctx, listeners } = useHookCollector();
|
|
37
36
|
return {
|
|
@@ -51,10 +50,11 @@ var ensure_custom_hooks_using_other_hooks_default = createRule({
|
|
|
51
50
|
}
|
|
52
51
|
}
|
|
53
52
|
};
|
|
54
|
-
}
|
|
53
|
+
},
|
|
54
|
+
defaultOptions: []
|
|
55
55
|
});
|
|
56
56
|
|
|
57
|
-
// ../../../node_modules/.pnpm/effect@2.4.
|
|
57
|
+
// ../../../node_modules/.pnpm/effect@2.4.18/node_modules/effect/dist/esm/Function.js
|
|
58
58
|
var Function_exports = {};
|
|
59
59
|
__export(Function_exports, {
|
|
60
60
|
SK: () => SK,
|
|
@@ -153,7 +153,7 @@ var constUndefined = /* @__PURE__ */ constant(void 0);
|
|
|
153
153
|
var constVoid = constUndefined;
|
|
154
154
|
var flip = (f) => (...b2) => (...a) => f(...a)(...b2);
|
|
155
155
|
var compose = /* @__PURE__ */ dual(2, (ab, bc) => (a) => bc(ab(a)));
|
|
156
|
-
var absurd = (
|
|
156
|
+
var absurd = (_2) => {
|
|
157
157
|
throw new Error("Called `absurd` function which should be uncallable");
|
|
158
158
|
};
|
|
159
159
|
var tupled = (f) => (a) => f(...a);
|
|
@@ -227,13 +227,13 @@ function flow(ab, bc, cd, de, ef, fg, gh, hi, ij) {
|
|
|
227
227
|
return;
|
|
228
228
|
}
|
|
229
229
|
var hole = /* @__PURE__ */ unsafeCoerce(absurd);
|
|
230
|
-
var SK = (
|
|
230
|
+
var SK = (_2, b2) => b2;
|
|
231
231
|
|
|
232
|
-
// ../../../node_modules/.pnpm/effect@2.4.
|
|
233
|
-
var moduleVersion = "2.4.
|
|
232
|
+
// ../../../node_modules/.pnpm/effect@2.4.18/node_modules/effect/dist/esm/internal/version.js
|
|
233
|
+
var moduleVersion = "2.4.18";
|
|
234
234
|
var getCurrentVersion = () => moduleVersion;
|
|
235
235
|
|
|
236
|
-
// ../../../node_modules/.pnpm/effect@2.4.
|
|
236
|
+
// ../../../node_modules/.pnpm/effect@2.4.18/node_modules/effect/dist/esm/GlobalValue.js
|
|
237
237
|
var globalStoreId = /* @__PURE__ */ Symbol.for(`effect/GlobalValue/globalStoreId/${/* @__PURE__ */ getCurrentVersion()}`);
|
|
238
238
|
if (!(globalStoreId in globalThis)) {
|
|
239
239
|
globalThis[globalStoreId] = /* @__PURE__ */ new Map();
|
|
@@ -246,14 +246,14 @@ var globalValue = (id, compute) => {
|
|
|
246
246
|
return globalStore.get(id);
|
|
247
247
|
};
|
|
248
248
|
|
|
249
|
-
// ../../../node_modules/.pnpm/effect@2.4.
|
|
249
|
+
// ../../../node_modules/.pnpm/effect@2.4.18/node_modules/effect/dist/esm/Predicate.js
|
|
250
250
|
var isFunction2 = isFunction;
|
|
251
251
|
var isRecordOrArray = (input) => typeof input === "object" && input !== null;
|
|
252
252
|
var isObject = (input) => isRecordOrArray(input) || isFunction2(input);
|
|
253
253
|
var hasProperty = /* @__PURE__ */ dual(2, (self, property) => isObject(self) && property in self);
|
|
254
254
|
var isNullable = (input) => input === null || input === void 0;
|
|
255
255
|
|
|
256
|
-
// ../../../node_modules/.pnpm/effect@2.4.
|
|
256
|
+
// ../../../node_modules/.pnpm/effect@2.4.18/node_modules/effect/dist/esm/Utils.js
|
|
257
257
|
var GenKindTypeId = /* @__PURE__ */ Symbol.for("effect/Gen/GenKind");
|
|
258
258
|
var GenKindImpl = class {
|
|
259
259
|
value;
|
|
@@ -270,19 +270,19 @@ var GenKindImpl = class {
|
|
|
270
270
|
* @since 2.0.0
|
|
271
271
|
*/
|
|
272
272
|
get _R() {
|
|
273
|
-
return (
|
|
273
|
+
return (_2) => _2;
|
|
274
274
|
}
|
|
275
275
|
/**
|
|
276
276
|
* @since 2.0.0
|
|
277
277
|
*/
|
|
278
278
|
get _O() {
|
|
279
|
-
return (
|
|
279
|
+
return (_2) => _2;
|
|
280
280
|
}
|
|
281
281
|
/**
|
|
282
282
|
* @since 2.0.0
|
|
283
283
|
*/
|
|
284
284
|
get _E() {
|
|
285
|
-
return (
|
|
285
|
+
return (_2) => _2;
|
|
286
286
|
}
|
|
287
287
|
/**
|
|
288
288
|
* @since 2.0.0
|
|
@@ -473,7 +473,7 @@ function add64(out, aHi, aLo, bHi, bLo) {
|
|
|
473
473
|
out[1] = lo;
|
|
474
474
|
}
|
|
475
475
|
|
|
476
|
-
// ../../../node_modules/.pnpm/effect@2.4.
|
|
476
|
+
// ../../../node_modules/.pnpm/effect@2.4.18/node_modules/effect/dist/esm/Hash.js
|
|
477
477
|
var randomHashCache = /* @__PURE__ */ globalValue(/* @__PURE__ */ Symbol.for("effect/Hash/randomHashCache"), () => /* @__PURE__ */ new WeakMap());
|
|
478
478
|
var pcgr = /* @__PURE__ */ globalValue(/* @__PURE__ */ Symbol.for("effect/Hash/pcgr"), () => new PCGRandom());
|
|
479
479
|
var symbol = /* @__PURE__ */ Symbol.for("effect/Hash");
|
|
@@ -559,7 +559,7 @@ var cached = function() {
|
|
|
559
559
|
return hash2;
|
|
560
560
|
};
|
|
561
561
|
|
|
562
|
-
// ../../../node_modules/.pnpm/effect@2.4.
|
|
562
|
+
// ../../../node_modules/.pnpm/effect@2.4.18/node_modules/effect/dist/esm/Equal.js
|
|
563
563
|
var symbol2 = /* @__PURE__ */ Symbol.for("effect/Equal");
|
|
564
564
|
function equals() {
|
|
565
565
|
if (arguments.length === 1) {
|
|
@@ -585,10 +585,10 @@ function compareBoth(self, that) {
|
|
|
585
585
|
var isEqual = (u2) => hasProperty(u2, symbol2);
|
|
586
586
|
var equivalence = () => equals;
|
|
587
587
|
|
|
588
|
-
// ../../../node_modules/.pnpm/effect@2.4.
|
|
588
|
+
// ../../../node_modules/.pnpm/effect@2.4.18/node_modules/effect/dist/esm/Equivalence.js
|
|
589
589
|
var make = (isEquivalent) => (self, that) => self === that || isEquivalent(self, that);
|
|
590
590
|
|
|
591
|
-
// ../../../node_modules/.pnpm/effect@2.4.
|
|
591
|
+
// ../../../node_modules/.pnpm/effect@2.4.18/node_modules/effect/dist/esm/Inspectable.js
|
|
592
592
|
var NodeInspectSymbol = /* @__PURE__ */ Symbol.for("nodejs.util.inspect.custom");
|
|
593
593
|
var toJSON = (x2) => {
|
|
594
594
|
if (hasProperty(x2, "toJSON") && isFunction2(x2["toJSON"]) && x2["toJSON"].length === 0) {
|
|
@@ -600,7 +600,7 @@ var toJSON = (x2) => {
|
|
|
600
600
|
};
|
|
601
601
|
var format = (x2) => JSON.stringify(x2, null, 2);
|
|
602
602
|
|
|
603
|
-
// ../../../node_modules/.pnpm/effect@2.4.
|
|
603
|
+
// ../../../node_modules/.pnpm/effect@2.4.18/node_modules/effect/dist/esm/Option.js
|
|
604
604
|
var Option_exports = {};
|
|
605
605
|
__export(Option_exports, {
|
|
606
606
|
Do: () => Do,
|
|
@@ -662,7 +662,7 @@ __export(Option_exports, {
|
|
|
662
662
|
zipWith: () => zipWith
|
|
663
663
|
});
|
|
664
664
|
|
|
665
|
-
// ../../../node_modules/.pnpm/effect@2.4.
|
|
665
|
+
// ../../../node_modules/.pnpm/effect@2.4.18/node_modules/effect/dist/esm/Pipeable.js
|
|
666
666
|
var pipeArguments = (self, args) => {
|
|
667
667
|
switch (args.length) {
|
|
668
668
|
case 1:
|
|
@@ -693,47 +693,47 @@ var pipeArguments = (self, args) => {
|
|
|
693
693
|
}
|
|
694
694
|
};
|
|
695
695
|
|
|
696
|
-
// ../../../node_modules/.pnpm/effect@2.4.
|
|
696
|
+
// ../../../node_modules/.pnpm/effect@2.4.18/node_modules/effect/dist/esm/internal/effectable.js
|
|
697
697
|
var EffectTypeId = /* @__PURE__ */ Symbol.for("effect/Effect");
|
|
698
698
|
var StreamTypeId = /* @__PURE__ */ Symbol.for("effect/Stream");
|
|
699
699
|
var SinkTypeId = /* @__PURE__ */ Symbol.for("effect/Sink");
|
|
700
700
|
var ChannelTypeId = /* @__PURE__ */ Symbol.for("effect/Channel");
|
|
701
701
|
var effectVariance = {
|
|
702
702
|
/* c8 ignore next */
|
|
703
|
-
_R: (
|
|
703
|
+
_R: (_2) => _2,
|
|
704
704
|
/* c8 ignore next */
|
|
705
|
-
_E: (
|
|
705
|
+
_E: (_2) => _2,
|
|
706
706
|
/* c8 ignore next */
|
|
707
|
-
_A: (
|
|
707
|
+
_A: (_2) => _2,
|
|
708
708
|
_V: /* @__PURE__ */ getCurrentVersion()
|
|
709
709
|
};
|
|
710
710
|
var sinkVariance = {
|
|
711
711
|
/* c8 ignore next */
|
|
712
|
-
_A: (
|
|
712
|
+
_A: (_2) => _2,
|
|
713
713
|
/* c8 ignore next */
|
|
714
|
-
_In: (
|
|
714
|
+
_In: (_2) => _2,
|
|
715
715
|
/* c8 ignore next */
|
|
716
|
-
_L: (
|
|
716
|
+
_L: (_2) => _2,
|
|
717
717
|
/* c8 ignore next */
|
|
718
|
-
_E: (
|
|
718
|
+
_E: (_2) => _2,
|
|
719
719
|
/* c8 ignore next */
|
|
720
|
-
_R: (
|
|
720
|
+
_R: (_2) => _2
|
|
721
721
|
};
|
|
722
722
|
var channelVariance = {
|
|
723
723
|
/* c8 ignore next */
|
|
724
|
-
_Env: (
|
|
724
|
+
_Env: (_2) => _2,
|
|
725
725
|
/* c8 ignore next */
|
|
726
|
-
_InErr: (
|
|
726
|
+
_InErr: (_2) => _2,
|
|
727
727
|
/* c8 ignore next */
|
|
728
|
-
_InElem: (
|
|
728
|
+
_InElem: (_2) => _2,
|
|
729
729
|
/* c8 ignore next */
|
|
730
|
-
_InDone: (
|
|
730
|
+
_InDone: (_2) => _2,
|
|
731
731
|
/* c8 ignore next */
|
|
732
|
-
_OutErr: (
|
|
732
|
+
_OutErr: (_2) => _2,
|
|
733
733
|
/* c8 ignore next */
|
|
734
|
-
_OutElem: (
|
|
734
|
+
_OutElem: (_2) => _2,
|
|
735
735
|
/* c8 ignore next */
|
|
736
|
-
_OutDone: (
|
|
736
|
+
_OutDone: (_2) => _2
|
|
737
737
|
};
|
|
738
738
|
var EffectPrototype = {
|
|
739
739
|
[EffectTypeId]: effectVariance,
|
|
@@ -751,12 +751,12 @@ var EffectPrototype = {
|
|
|
751
751
|
}
|
|
752
752
|
};
|
|
753
753
|
|
|
754
|
-
// ../../../node_modules/.pnpm/effect@2.4.
|
|
754
|
+
// ../../../node_modules/.pnpm/effect@2.4.18/node_modules/effect/dist/esm/internal/option.js
|
|
755
755
|
var TypeId = /* @__PURE__ */ Symbol.for("effect/Option");
|
|
756
756
|
var CommonProto = {
|
|
757
757
|
...EffectPrototype,
|
|
758
758
|
[TypeId]: {
|
|
759
|
-
_A: (
|
|
759
|
+
_A: (_2) => _2
|
|
760
760
|
},
|
|
761
761
|
[NodeInspectSymbol]() {
|
|
762
762
|
return this.toJSON();
|
|
@@ -809,12 +809,12 @@ var some = (value) => {
|
|
|
809
809
|
return a;
|
|
810
810
|
};
|
|
811
811
|
|
|
812
|
-
// ../../../node_modules/.pnpm/effect@2.4.
|
|
812
|
+
// ../../../node_modules/.pnpm/effect@2.4.18/node_modules/effect/dist/esm/internal/either.js
|
|
813
813
|
var TypeId2 = /* @__PURE__ */ Symbol.for("effect/Either");
|
|
814
814
|
var CommonProto2 = {
|
|
815
815
|
...EffectPrototype,
|
|
816
816
|
[TypeId2]: {
|
|
817
|
-
_R: (
|
|
817
|
+
_R: (_2) => _2
|
|
818
818
|
},
|
|
819
819
|
[NodeInspectSymbol]() {
|
|
820
820
|
return this.toJSON();
|
|
@@ -873,10 +873,10 @@ var right = (right2) => {
|
|
|
873
873
|
var getLeft = (self) => isRight(self) ? none : some(self.left);
|
|
874
874
|
var getRight = (self) => isLeft(self) ? none : some(self.right);
|
|
875
875
|
|
|
876
|
-
// ../../../node_modules/.pnpm/effect@2.4.
|
|
876
|
+
// ../../../node_modules/.pnpm/effect@2.4.18/node_modules/effect/dist/esm/Order.js
|
|
877
877
|
var make2 = (compare) => (self, that) => self === that ? 0 : compare(self, that);
|
|
878
878
|
|
|
879
|
-
// ../../../node_modules/.pnpm/effect@2.4.
|
|
879
|
+
// ../../../node_modules/.pnpm/effect@2.4.18/node_modules/effect/dist/esm/Option.js
|
|
880
880
|
var TypeId3 = /* @__PURE__ */ Symbol.for("effect/Option");
|
|
881
881
|
var none2 = () => none;
|
|
882
882
|
var some2 = some;
|
|
@@ -1040,49 +1040,49 @@ var gen = (f) => {
|
|
|
1040
1040
|
}
|
|
1041
1041
|
};
|
|
1042
1042
|
|
|
1043
|
-
// ../../../node_modules/.pnpm/ts-pattern@5.
|
|
1043
|
+
// ../../../node_modules/.pnpm/ts-pattern@5.1.1/node_modules/ts-pattern/dist/index.js
|
|
1044
1044
|
var t = Symbol.for("@ts-pattern/matcher");
|
|
1045
1045
|
var e = Symbol.for("@ts-pattern/isVariadic");
|
|
1046
1046
|
var n = "@ts-pattern/anonymous-select-key";
|
|
1047
1047
|
var r = (t2) => Boolean(t2 && "object" == typeof t2);
|
|
1048
1048
|
var i = (e2) => e2 && !!e2[t];
|
|
1049
|
-
var
|
|
1049
|
+
var o = (n2, s2, c2) => {
|
|
1050
1050
|
if (i(n2)) {
|
|
1051
|
-
const e2 = n2[t](), { matched: r2, selections: i2 } = e2.match(
|
|
1051
|
+
const e2 = n2[t](), { matched: r2, selections: i2 } = e2.match(s2);
|
|
1052
1052
|
return r2 && i2 && Object.keys(i2).forEach((t2) => c2(t2, i2[t2])), r2;
|
|
1053
1053
|
}
|
|
1054
1054
|
if (r(n2)) {
|
|
1055
|
-
if (!r(
|
|
1055
|
+
if (!r(s2))
|
|
1056
1056
|
return false;
|
|
1057
1057
|
if (Array.isArray(n2)) {
|
|
1058
|
-
if (!Array.isArray(
|
|
1058
|
+
if (!Array.isArray(s2))
|
|
1059
1059
|
return false;
|
|
1060
1060
|
let t2 = [], r2 = [], a = [];
|
|
1061
|
-
for (const
|
|
1062
|
-
const
|
|
1063
|
-
i(
|
|
1061
|
+
for (const o2 of n2.keys()) {
|
|
1062
|
+
const s3 = n2[o2];
|
|
1063
|
+
i(s3) && s3[e] ? a.push(s3) : a.length ? r2.push(s3) : t2.push(s3);
|
|
1064
1064
|
}
|
|
1065
1065
|
if (a.length) {
|
|
1066
1066
|
if (a.length > 1)
|
|
1067
1067
|
throw new Error("Pattern error: Using `...P.array(...)` several times in a single pattern is not allowed.");
|
|
1068
|
-
if (
|
|
1068
|
+
if (s2.length < t2.length + r2.length)
|
|
1069
1069
|
return false;
|
|
1070
|
-
const e2 =
|
|
1071
|
-
return t2.every((t3, n4) =>
|
|
1070
|
+
const e2 = s2.slice(0, t2.length), n3 = 0 === r2.length ? [] : s2.slice(-r2.length), i2 = s2.slice(t2.length, 0 === r2.length ? Infinity : -r2.length);
|
|
1071
|
+
return t2.every((t3, n4) => o(t3, e2[n4], c2)) && r2.every((t3, e3) => o(t3, n3[e3], c2)) && (0 === a.length || o(a[0], i2, c2));
|
|
1072
1072
|
}
|
|
1073
|
-
return n2.length ===
|
|
1073
|
+
return n2.length === s2.length && n2.every((t3, e2) => o(t3, s2[e2], c2));
|
|
1074
1074
|
}
|
|
1075
1075
|
return Object.keys(n2).every((e2) => {
|
|
1076
1076
|
const r2 = n2[e2];
|
|
1077
|
-
return (e2 in
|
|
1077
|
+
return (e2 in s2 || i(a = r2) && "optional" === a[t]().matcherType) && o(r2, s2[e2], c2);
|
|
1078
1078
|
var a;
|
|
1079
1079
|
});
|
|
1080
1080
|
}
|
|
1081
|
-
return Object.is(
|
|
1081
|
+
return Object.is(s2, n2);
|
|
1082
1082
|
};
|
|
1083
|
-
var
|
|
1084
|
-
var n2,
|
|
1085
|
-
return r(e2) ? i(e2) ? null != (n2 = null == (
|
|
1083
|
+
var s = (e2) => {
|
|
1084
|
+
var n2, o2, a;
|
|
1085
|
+
return r(e2) ? i(e2) ? null != (n2 = null == (o2 = (a = e2[t]()).getSelectionKeys) ? void 0 : o2.call(a)) ? n2 : [] : Array.isArray(e2) ? c(e2, s) : c(Object.values(e2), s) : [];
|
|
1086
1086
|
};
|
|
1087
1087
|
var c = (t2, e2) => t2.reduce((t3, n2) => t3.concat(e2(n2)), []);
|
|
1088
1088
|
function u(t2) {
|
|
@@ -1094,8 +1094,8 @@ function l(e2) {
|
|
|
1094
1094
|
const r2 = (t3, e3) => {
|
|
1095
1095
|
n2[t3] = e3;
|
|
1096
1096
|
};
|
|
1097
|
-
return void 0 === t2 ? (
|
|
1098
|
-
}, getSelectionKeys: () =>
|
|
1097
|
+
return void 0 === t2 ? (s(e2).forEach((t3) => r2(t3, void 0)), { matched: true, selections: n2 }) : { matched: o(e2, t2, r2), selections: n2 };
|
|
1098
|
+
}, getSelectionKeys: () => s(e2), matcherType: "optional" }) });
|
|
1099
1099
|
}
|
|
1100
1100
|
function m(...e2) {
|
|
1101
1101
|
return u({ [t]: () => ({ match: (t2) => {
|
|
@@ -1103,8 +1103,8 @@ function m(...e2) {
|
|
|
1103
1103
|
const r2 = (t3, e3) => {
|
|
1104
1104
|
n2[t3] = e3;
|
|
1105
1105
|
};
|
|
1106
|
-
return { matched: e2.every((e3) =>
|
|
1107
|
-
}, getSelectionKeys: () => c(e2,
|
|
1106
|
+
return { matched: e2.every((e3) => o(e3, t2, r2)), selections: n2 };
|
|
1107
|
+
}, getSelectionKeys: () => c(e2, s), matcherType: "and" }) });
|
|
1108
1108
|
}
|
|
1109
1109
|
function d(...e2) {
|
|
1110
1110
|
return u({ [t]: () => ({ match: (t2) => {
|
|
@@ -1112,8 +1112,8 @@ function d(...e2) {
|
|
|
1112
1112
|
const r2 = (t3, e3) => {
|
|
1113
1113
|
n2[t3] = e3;
|
|
1114
1114
|
};
|
|
1115
|
-
return c(e2,
|
|
1116
|
-
}, getSelectionKeys: () => c(e2,
|
|
1115
|
+
return c(e2, s).forEach((t3) => r2(t3, void 0)), { matched: e2.some((e3) => o(e3, t2, r2)), selections: n2 };
|
|
1116
|
+
}, getSelectionKeys: () => c(e2, s), matcherType: "or" }) });
|
|
1117
1117
|
}
|
|
1118
1118
|
function y(e2) {
|
|
1119
1119
|
return { [t]: () => ({ match: (t2) => ({ matched: Boolean(e2(t2)) }) }) };
|
|
@@ -1122,10 +1122,10 @@ function p(...e2) {
|
|
|
1122
1122
|
const r2 = "string" == typeof e2[0] ? e2[0] : void 0, i2 = 2 === e2.length ? e2[1] : "string" == typeof e2[0] ? void 0 : e2[0];
|
|
1123
1123
|
return u({ [t]: () => ({ match: (t2) => {
|
|
1124
1124
|
let e3 = { [null != r2 ? r2 : n]: t2 };
|
|
1125
|
-
return { matched: void 0 === i2 ||
|
|
1125
|
+
return { matched: void 0 === i2 || o(i2, t2, (t3, n2) => {
|
|
1126
1126
|
e3[t3] = n2;
|
|
1127
1127
|
}), selections: e3 };
|
|
1128
|
-
}, getSelectionKeys: () => [null != r2 ? r2 : n].concat(void 0 === i2 ? [] :
|
|
1128
|
+
}, getSelectionKeys: () => [null != r2 ? r2 : n].concat(void 0 === i2 ? [] : s(i2)) }) });
|
|
1129
1129
|
}
|
|
1130
1130
|
function v(t2) {
|
|
1131
1131
|
return "number" == typeof t2;
|
|
@@ -1166,11 +1166,14 @@ u(y(function(t2) {
|
|
|
1166
1166
|
u(y(function(t2) {
|
|
1167
1167
|
return null == t2;
|
|
1168
1168
|
}));
|
|
1169
|
+
u(y(function(t2) {
|
|
1170
|
+
return null != t2;
|
|
1171
|
+
}));
|
|
1169
1172
|
var W = { matched: false, value: void 0 };
|
|
1170
|
-
function
|
|
1171
|
-
return new
|
|
1173
|
+
function $(t2) {
|
|
1174
|
+
return new z(t2, W);
|
|
1172
1175
|
}
|
|
1173
|
-
var
|
|
1176
|
+
var z = class _z {
|
|
1174
1177
|
constructor(t2, e2) {
|
|
1175
1178
|
this.input = void 0, this.state = void 0, this.input = t2, this.state = e2;
|
|
1176
1179
|
}
|
|
@@ -1180,17 +1183,17 @@ var $ = class _$ {
|
|
|
1180
1183
|
const e2 = t2[t2.length - 1], r2 = [t2[0]];
|
|
1181
1184
|
let i2;
|
|
1182
1185
|
3 === t2.length && "function" == typeof t2[1] ? i2 = t2[1] : t2.length > 2 && r2.push(...t2.slice(1, t2.length - 1));
|
|
1183
|
-
let
|
|
1186
|
+
let s2 = false, c2 = {};
|
|
1184
1187
|
const a = (t3, e3) => {
|
|
1185
|
-
|
|
1186
|
-
}, u2 = !r2.some((t3) =>
|
|
1187
|
-
return new
|
|
1188
|
+
s2 = true, c2[t3] = e3;
|
|
1189
|
+
}, u2 = !r2.some((t3) => o(t3, this.input, a)) || i2 && !Boolean(i2(this.input)) ? W : { matched: true, value: e2(s2 ? n in c2 ? c2[n] : c2 : this.input, this.input) };
|
|
1190
|
+
return new _z(this.input, u2);
|
|
1188
1191
|
}
|
|
1189
1192
|
when(t2, e2) {
|
|
1190
1193
|
if (this.state.matched)
|
|
1191
1194
|
return this;
|
|
1192
1195
|
const n2 = Boolean(t2(this.input));
|
|
1193
|
-
return new
|
|
1196
|
+
return new _z(this.input, n2 ? { matched: true, value: e2(this.input, this.input) } : W);
|
|
1194
1197
|
}
|
|
1195
1198
|
otherwise(t2) {
|
|
1196
1199
|
return this.state.matched ? this.state.value : t2(this.input);
|
|
@@ -1217,19 +1220,18 @@ var $ = class _$ {
|
|
|
1217
1220
|
// src/rules/ensure-use-callback-has-non-empty-deps.ts
|
|
1218
1221
|
var RULE_NAME2 = "ensure-use-callback-has-non-empty-deps";
|
|
1219
1222
|
var ensure_use_callback_has_non_empty_deps_default = createRule({
|
|
1220
|
-
name: RULE_NAME2,
|
|
1221
1223
|
meta: {
|
|
1222
1224
|
type: "problem",
|
|
1223
1225
|
docs: {
|
|
1224
1226
|
description: "enforce 'useCallback' has non-empty dependencies array",
|
|
1225
1227
|
requiresTypeChecking: false
|
|
1226
1228
|
},
|
|
1227
|
-
schema: [],
|
|
1228
1229
|
messages: {
|
|
1229
1230
|
ENSURE_USE_CALLBACK_HAS_NON_EMPTY_DEPS: "useCallback should have a non-empty dependencies array"
|
|
1230
|
-
}
|
|
1231
|
+
},
|
|
1232
|
+
schema: []
|
|
1231
1233
|
},
|
|
1232
|
-
|
|
1234
|
+
name: RULE_NAME2,
|
|
1233
1235
|
create(context) {
|
|
1234
1236
|
const alias = parseSchema(ESLintSettingsSchema, context.settings).reactOptions?.additionalHooks?.useCallback ?? [];
|
|
1235
1237
|
const pragma = getPragmaFromContext(context);
|
|
@@ -1241,7 +1243,7 @@ var ensure_use_callback_has_non_empty_deps_default = createRule({
|
|
|
1241
1243
|
if (!isUseCallbackCall(node, context, pragma) && !alias.some(Function_exports.flip(isReactHookCallWithNameLoose)(node))) {
|
|
1242
1244
|
return;
|
|
1243
1245
|
}
|
|
1244
|
-
const [
|
|
1246
|
+
const [_2, deps] = node.arguments;
|
|
1245
1247
|
if (!deps) {
|
|
1246
1248
|
context.report({
|
|
1247
1249
|
messageId: "ENSURE_USE_CALLBACK_HAS_NON_EMPTY_DEPS",
|
|
@@ -1250,7 +1252,7 @@ var ensure_use_callback_has_non_empty_deps_default = createRule({
|
|
|
1250
1252
|
return;
|
|
1251
1253
|
}
|
|
1252
1254
|
const maybeDescriptor = Function_exports.pipe(
|
|
1253
|
-
|
|
1255
|
+
$(deps).with({ type: NodeType.ArrayExpression }, Option_exports.some).with({ type: NodeType.Identifier }, (n2) => {
|
|
1254
1256
|
return Function_exports.pipe(
|
|
1255
1257
|
findVariable(n2.name, initialScope),
|
|
1256
1258
|
Option_exports.flatMap(getVariableInit(0)),
|
|
@@ -1259,30 +1261,30 @@ var ensure_use_callback_has_non_empty_deps_default = createRule({
|
|
|
1259
1261
|
}).otherwise(Option_exports.none),
|
|
1260
1262
|
Option_exports.filter((x2) => x2.elements.length === 0),
|
|
1261
1263
|
Option_exports.map(() => ({
|
|
1262
|
-
|
|
1263
|
-
|
|
1264
|
+
messageId: "ENSURE_USE_CALLBACK_HAS_NON_EMPTY_DEPS",
|
|
1265
|
+
node
|
|
1264
1266
|
}))
|
|
1265
1267
|
);
|
|
1266
1268
|
Option_exports.map(maybeDescriptor, context.report);
|
|
1267
1269
|
}
|
|
1268
1270
|
};
|
|
1269
|
-
}
|
|
1271
|
+
},
|
|
1272
|
+
defaultOptions: []
|
|
1270
1273
|
});
|
|
1271
1274
|
var RULE_NAME3 = "ensure-use-memo-has-non-empty-deps";
|
|
1272
1275
|
var ensure_use_memo_has_non_empty_deps_default = createRule({
|
|
1273
|
-
name: RULE_NAME3,
|
|
1274
1276
|
meta: {
|
|
1275
1277
|
type: "problem",
|
|
1276
1278
|
docs: {
|
|
1277
1279
|
description: "enforce 'useMemo' has non-empty dependencies array",
|
|
1278
1280
|
requiresTypeChecking: false
|
|
1279
1281
|
},
|
|
1280
|
-
schema: [],
|
|
1281
1282
|
messages: {
|
|
1282
1283
|
ENSURE_USE_MEMO_HAS_NON_EMPTY_DEPS: "useMemo should have a non-empty dependencies array"
|
|
1283
|
-
}
|
|
1284
|
+
},
|
|
1285
|
+
schema: []
|
|
1284
1286
|
},
|
|
1285
|
-
|
|
1287
|
+
name: RULE_NAME3,
|
|
1286
1288
|
create(context) {
|
|
1287
1289
|
const alias = parseSchema(ESLintSettingsSchema, context.settings).reactOptions?.additionalHooks?.useMemo ?? [];
|
|
1288
1290
|
const pragma = getPragmaFromContext(context);
|
|
@@ -1293,7 +1295,7 @@ var ensure_use_memo_has_non_empty_deps_default = createRule({
|
|
|
1293
1295
|
return;
|
|
1294
1296
|
if (!isUseMemoCall(node, context, pragma) && !alias.some(Function_exports.flip(isReactHookCallWithNameLoose)(node)))
|
|
1295
1297
|
return;
|
|
1296
|
-
const [
|
|
1298
|
+
const [_2, deps] = node.arguments;
|
|
1297
1299
|
if (!deps) {
|
|
1298
1300
|
context.report({
|
|
1299
1301
|
messageId: "ENSURE_USE_MEMO_HAS_NON_EMPTY_DEPS",
|
|
@@ -1302,7 +1304,7 @@ var ensure_use_memo_has_non_empty_deps_default = createRule({
|
|
|
1302
1304
|
return;
|
|
1303
1305
|
}
|
|
1304
1306
|
const maybeDescriptor = Function_exports.pipe(
|
|
1305
|
-
|
|
1307
|
+
$(deps).with({ type: NodeType.ArrayExpression }, Option_exports.some).with({ type: NodeType.Identifier }, (n2) => {
|
|
1306
1308
|
return Function_exports.pipe(
|
|
1307
1309
|
findVariable(n2.name, initialScope),
|
|
1308
1310
|
Option_exports.flatMap(getVariableInit(0)),
|
|
@@ -1311,31 +1313,31 @@ var ensure_use_memo_has_non_empty_deps_default = createRule({
|
|
|
1311
1313
|
}).otherwise(Option_exports.none),
|
|
1312
1314
|
Option_exports.filter((x2) => x2.elements.length === 0),
|
|
1313
1315
|
Option_exports.map(() => ({
|
|
1314
|
-
|
|
1315
|
-
|
|
1316
|
+
messageId: "ENSURE_USE_MEMO_HAS_NON_EMPTY_DEPS",
|
|
1317
|
+
node
|
|
1316
1318
|
}))
|
|
1317
1319
|
);
|
|
1318
1320
|
Option_exports.map(maybeDescriptor, context.report);
|
|
1319
1321
|
}
|
|
1320
1322
|
};
|
|
1321
|
-
}
|
|
1323
|
+
},
|
|
1324
|
+
defaultOptions: []
|
|
1322
1325
|
});
|
|
1323
1326
|
var RULE_NAME4 = "prefer-use-state-lazy-initialization";
|
|
1324
1327
|
var ALLOW_LIST = Object.freeze(["Boolean", "String", "Number"]);
|
|
1325
1328
|
var prefer_use_state_lazy_initialization_default = createRule({
|
|
1326
|
-
name: RULE_NAME4,
|
|
1327
1329
|
meta: {
|
|
1328
1330
|
type: "problem",
|
|
1329
1331
|
docs: {
|
|
1330
1332
|
description: "disallow function calls in 'useState' that aren't wrapped in an initializer function",
|
|
1331
1333
|
requiresTypeChecking: false
|
|
1332
1334
|
},
|
|
1333
|
-
schema: [],
|
|
1334
1335
|
messages: {
|
|
1335
1336
|
PREFER_USE_STATE_LAZY_INITIALIZATION: "To prevent re-computation, consider using lazy initial state for useState calls that involve function calls. Ex: 'useState(() => getValue())'"
|
|
1336
|
-
}
|
|
1337
|
+
},
|
|
1338
|
+
schema: []
|
|
1337
1339
|
},
|
|
1338
|
-
|
|
1340
|
+
name: RULE_NAME4,
|
|
1339
1341
|
create(context) {
|
|
1340
1342
|
const alias = parseSchema(ESLintSettingsSchema, context.settings).reactOptions?.additionalHooks?.useState ?? [];
|
|
1341
1343
|
const pragma = getPragmaFromContext(context);
|
|
@@ -1355,12 +1357,13 @@ var prefer_use_state_lazy_initialization_default = createRule({
|
|
|
1355
1357
|
if (!hasFunctionCall)
|
|
1356
1358
|
return;
|
|
1357
1359
|
context.report({
|
|
1358
|
-
|
|
1359
|
-
|
|
1360
|
+
messageId: "PREFER_USE_STATE_LAZY_INITIALIZATION",
|
|
1361
|
+
node: useStateInput
|
|
1360
1362
|
});
|
|
1361
1363
|
}
|
|
1362
1364
|
};
|
|
1363
|
-
}
|
|
1365
|
+
},
|
|
1366
|
+
defaultOptions: []
|
|
1364
1367
|
});
|
|
1365
1368
|
|
|
1366
1369
|
// src/index.ts
|
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.8-beta.6",
|
|
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,25 +35,26 @@
|
|
|
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.6.0",
|
|
39
|
+
"@typescript-eslint/scope-manager": "7.6.0",
|
|
40
|
+
"@typescript-eslint/type-utils": "7.6.0",
|
|
41
|
+
"@typescript-eslint/types": "7.6.0",
|
|
42
|
+
"@typescript-eslint/utils": "7.6.0",
|
|
43
43
|
"string-ts": "2.1.0",
|
|
44
|
-
"@eslint-react/
|
|
45
|
-
"@eslint-react/
|
|
46
|
-
"@eslint-react/
|
|
47
|
-
"@eslint-react/shared": "1.5.
|
|
48
|
-
"@eslint-react/
|
|
49
|
-
"@eslint-react/var": "1.5.
|
|
50
|
-
"@eslint-react/
|
|
44
|
+
"@eslint-react/jsx": "1.5.8-beta.6",
|
|
45
|
+
"@eslint-react/tools": "1.5.8-beta.6",
|
|
46
|
+
"@eslint-react/core": "1.5.8-beta.6",
|
|
47
|
+
"@eslint-react/shared": "1.5.8-beta.6",
|
|
48
|
+
"@eslint-react/types": "1.5.8-beta.6",
|
|
49
|
+
"@eslint-react/var": "1.5.8-beta.6",
|
|
50
|
+
"@eslint-react/ast": "1.5.8-beta.6"
|
|
51
51
|
},
|
|
52
52
|
"devDependencies": {
|
|
53
|
-
"effect": "2.4.
|
|
53
|
+
"effect": "2.4.18"
|
|
54
54
|
},
|
|
55
55
|
"peerDependencies": {
|
|
56
|
-
"eslint": ">=
|
|
56
|
+
"@typescript-eslint/parser": ">=7.5.0",
|
|
57
|
+
"eslint": ">=9.0.0",
|
|
57
58
|
"typescript": ">=5.3.3"
|
|
58
59
|
},
|
|
59
60
|
"engines": {
|