eslint-plugin-react-hooks-extra 1.5.7 → 1.5.8-beta.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.mts +5 -5
- package/dist/index.d.ts +5 -5
- package/dist/index.js +63 -60
- package/dist/index.mjs +63 -60
- package/package.json +13 -13
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,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.8-beta.1";
|
|
19
19
|
var createRule = shared.createRuleForPlugin("hooks-extra");
|
|
20
20
|
|
|
21
21
|
// src/rules/ensure-custom-hooks-using-other-hooks.ts
|
|
@@ -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,7 +229,7 @@ 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
234
|
// ../../../node_modules/.pnpm/effect@2.4.15/node_modules/effect/dist/esm/internal/version.js
|
|
235
235
|
var moduleVersion = "2.4.15";
|
|
@@ -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
|
|
@@ -702,40 +702,40 @@ 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,
|
|
@@ -758,7 +758,7 @@ 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();
|
|
@@ -816,7 +816,7 @@ 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();
|
|
@@ -1042,49 +1042,49 @@ var gen = (f) => {
|
|
|
1042
1042
|
}
|
|
1043
1043
|
};
|
|
1044
1044
|
|
|
1045
|
-
// ../../../node_modules/.pnpm/ts-pattern@5.0
|
|
1045
|
+
// ../../../node_modules/.pnpm/ts-pattern@5.1.0/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);
|
|
@@ -1243,7 +1246,7 @@ var ensure_use_callback_has_non_empty_deps_default = createRule({
|
|
|
1243
1246
|
if (!core.isUseCallbackCall(node, context, pragma) && !alias.some(Function_exports.flip(core.isReactHookCallWithNameLoose)(node))) {
|
|
1244
1247
|
return;
|
|
1245
1248
|
}
|
|
1246
|
-
const [
|
|
1249
|
+
const [_2, deps] = node.arguments;
|
|
1247
1250
|
if (!deps) {
|
|
1248
1251
|
context.report({
|
|
1249
1252
|
messageId: "ENSURE_USE_CALLBACK_HAS_NON_EMPTY_DEPS",
|
|
@@ -1252,7 +1255,7 @@ var ensure_use_callback_has_non_empty_deps_default = createRule({
|
|
|
1252
1255
|
return;
|
|
1253
1256
|
}
|
|
1254
1257
|
const maybeDescriptor = Function_exports.pipe(
|
|
1255
|
-
|
|
1258
|
+
$(deps).with({ type: ast.NodeType.ArrayExpression }, Option_exports.some).with({ type: ast.NodeType.Identifier }, (n2) => {
|
|
1256
1259
|
return Function_exports.pipe(
|
|
1257
1260
|
_var.findVariable(n2.name, initialScope),
|
|
1258
1261
|
Option_exports.flatMap(_var.getVariableInit(0)),
|
|
@@ -1295,7 +1298,7 @@ var ensure_use_memo_has_non_empty_deps_default = createRule({
|
|
|
1295
1298
|
return;
|
|
1296
1299
|
if (!core.isUseMemoCall(node, context, pragma) && !alias.some(Function_exports.flip(core.isReactHookCallWithNameLoose)(node)))
|
|
1297
1300
|
return;
|
|
1298
|
-
const [
|
|
1301
|
+
const [_2, deps] = node.arguments;
|
|
1299
1302
|
if (!deps) {
|
|
1300
1303
|
context.report({
|
|
1301
1304
|
messageId: "ENSURE_USE_MEMO_HAS_NON_EMPTY_DEPS",
|
|
@@ -1304,7 +1307,7 @@ var ensure_use_memo_has_non_empty_deps_default = createRule({
|
|
|
1304
1307
|
return;
|
|
1305
1308
|
}
|
|
1306
1309
|
const maybeDescriptor = Function_exports.pipe(
|
|
1307
|
-
|
|
1310
|
+
$(deps).with({ type: ast.NodeType.ArrayExpression }, Option_exports.some).with({ type: ast.NodeType.Identifier }, (n2) => {
|
|
1308
1311
|
return Function_exports.pipe(
|
|
1309
1312
|
_var.findVariable(n2.name, initialScope),
|
|
1310
1313
|
Option_exports.flatMap(_var.getVariableInit(0)),
|
package/dist/index.mjs
CHANGED
|
@@ -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.8-beta.1";
|
|
17
17
|
var createRule = createRuleForPlugin("hooks-extra");
|
|
18
18
|
|
|
19
19
|
// src/rules/ensure-custom-hooks-using-other-hooks.ts
|
|
@@ -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,7 +227,7 @@ 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
232
|
// ../../../node_modules/.pnpm/effect@2.4.15/node_modules/effect/dist/esm/internal/version.js
|
|
233
233
|
var moduleVersion = "2.4.15";
|
|
@@ -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
|
|
@@ -700,40 +700,40 @@ 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,
|
|
@@ -756,7 +756,7 @@ 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();
|
|
@@ -814,7 +814,7 @@ 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();
|
|
@@ -1040,49 +1040,49 @@ var gen = (f) => {
|
|
|
1040
1040
|
}
|
|
1041
1041
|
};
|
|
1042
1042
|
|
|
1043
|
-
// ../../../node_modules/.pnpm/ts-pattern@5.0
|
|
1043
|
+
// ../../../node_modules/.pnpm/ts-pattern@5.1.0/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);
|
|
@@ -1241,7 +1244,7 @@ var ensure_use_callback_has_non_empty_deps_default = createRule({
|
|
|
1241
1244
|
if (!isUseCallbackCall(node, context, pragma) && !alias.some(Function_exports.flip(isReactHookCallWithNameLoose)(node))) {
|
|
1242
1245
|
return;
|
|
1243
1246
|
}
|
|
1244
|
-
const [
|
|
1247
|
+
const [_2, deps] = node.arguments;
|
|
1245
1248
|
if (!deps) {
|
|
1246
1249
|
context.report({
|
|
1247
1250
|
messageId: "ENSURE_USE_CALLBACK_HAS_NON_EMPTY_DEPS",
|
|
@@ -1250,7 +1253,7 @@ var ensure_use_callback_has_non_empty_deps_default = createRule({
|
|
|
1250
1253
|
return;
|
|
1251
1254
|
}
|
|
1252
1255
|
const maybeDescriptor = Function_exports.pipe(
|
|
1253
|
-
|
|
1256
|
+
$(deps).with({ type: NodeType.ArrayExpression }, Option_exports.some).with({ type: NodeType.Identifier }, (n2) => {
|
|
1254
1257
|
return Function_exports.pipe(
|
|
1255
1258
|
findVariable(n2.name, initialScope),
|
|
1256
1259
|
Option_exports.flatMap(getVariableInit(0)),
|
|
@@ -1293,7 +1296,7 @@ var ensure_use_memo_has_non_empty_deps_default = createRule({
|
|
|
1293
1296
|
return;
|
|
1294
1297
|
if (!isUseMemoCall(node, context, pragma) && !alias.some(Function_exports.flip(isReactHookCallWithNameLoose)(node)))
|
|
1295
1298
|
return;
|
|
1296
|
-
const [
|
|
1299
|
+
const [_2, deps] = node.arguments;
|
|
1297
1300
|
if (!deps) {
|
|
1298
1301
|
context.report({
|
|
1299
1302
|
messageId: "ENSURE_USE_MEMO_HAS_NON_EMPTY_DEPS",
|
|
@@ -1302,7 +1305,7 @@ var ensure_use_memo_has_non_empty_deps_default = createRule({
|
|
|
1302
1305
|
return;
|
|
1303
1306
|
}
|
|
1304
1307
|
const maybeDescriptor = Function_exports.pipe(
|
|
1305
|
-
|
|
1308
|
+
$(deps).with({ type: NodeType.ArrayExpression }, Option_exports.some).with({ type: NodeType.Identifier }, (n2) => {
|
|
1306
1309
|
return Function_exports.pipe(
|
|
1307
1310
|
findVariable(n2.name, initialScope),
|
|
1308
1311
|
Option_exports.flatMap(getVariableInit(0)),
|
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.1",
|
|
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,19 +35,19 @@
|
|
|
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.5.0",
|
|
39
|
+
"@typescript-eslint/scope-manager": "7.5.0",
|
|
40
|
+
"@typescript-eslint/type-utils": "7.5.0",
|
|
41
|
+
"@typescript-eslint/types": "7.5.0",
|
|
42
|
+
"@typescript-eslint/utils": "7.5.0",
|
|
43
43
|
"string-ts": "2.1.0",
|
|
44
|
-
"@eslint-react/ast": "1.5.
|
|
45
|
-
"@eslint-react/core": "1.5.
|
|
46
|
-
"@eslint-react/jsx": "1.5.
|
|
47
|
-
"@eslint-react/shared": "1.5.
|
|
48
|
-
"@eslint-react/tools": "1.5.
|
|
49
|
-
"@eslint-react/
|
|
50
|
-
"@eslint-react/
|
|
44
|
+
"@eslint-react/ast": "1.5.8-beta.1",
|
|
45
|
+
"@eslint-react/core": "1.5.8-beta.1",
|
|
46
|
+
"@eslint-react/jsx": "1.5.8-beta.1",
|
|
47
|
+
"@eslint-react/shared": "1.5.8-beta.1",
|
|
48
|
+
"@eslint-react/tools": "1.5.8-beta.1",
|
|
49
|
+
"@eslint-react/types": "1.5.8-beta.1",
|
|
50
|
+
"@eslint-react/var": "1.5.8-beta.1"
|
|
51
51
|
},
|
|
52
52
|
"devDependencies": {
|
|
53
53
|
"effect": "2.4.15"
|