eslint-plugin-react-hooks-extra 1.5.8-beta.1 → 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.js +45 -45
- package/dist/index.mjs +45 -45
- package/package.json +16 -15
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.8-beta.
|
|
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,
|
|
@@ -231,11 +231,11 @@ 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@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;
|
|
@@ -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,7 +695,7 @@ 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");
|
|
@@ -753,7 +753,7 @@ 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,
|
|
@@ -811,7 +811,7 @@ 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,
|
|
@@ -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,7 +1042,7 @@ var gen = (f) => {
|
|
|
1042
1042
|
}
|
|
1043
1043
|
};
|
|
1044
1044
|
|
|
1045
|
-
// ../../../node_modules/.pnpm/ts-pattern@5.1.
|
|
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";
|
|
@@ -1222,19 +1222,18 @@ var z = class _z {
|
|
|
1222
1222
|
// src/rules/ensure-use-callback-has-non-empty-deps.ts
|
|
1223
1223
|
var RULE_NAME2 = "ensure-use-callback-has-non-empty-deps";
|
|
1224
1224
|
var ensure_use_callback_has_non_empty_deps_default = createRule({
|
|
1225
|
-
name: RULE_NAME2,
|
|
1226
1225
|
meta: {
|
|
1227
1226
|
type: "problem",
|
|
1228
1227
|
docs: {
|
|
1229
1228
|
description: "enforce 'useCallback' has non-empty dependencies array",
|
|
1230
1229
|
requiresTypeChecking: false
|
|
1231
1230
|
},
|
|
1232
|
-
schema: [],
|
|
1233
1231
|
messages: {
|
|
1234
1232
|
ENSURE_USE_CALLBACK_HAS_NON_EMPTY_DEPS: "useCallback should have a non-empty dependencies array"
|
|
1235
|
-
}
|
|
1233
|
+
},
|
|
1234
|
+
schema: []
|
|
1236
1235
|
},
|
|
1237
|
-
|
|
1236
|
+
name: RULE_NAME2,
|
|
1238
1237
|
create(context) {
|
|
1239
1238
|
const alias = shared.parseSchema(shared.ESLintSettingsSchema, context.settings).reactOptions?.additionalHooks?.useCallback ?? [];
|
|
1240
1239
|
const pragma = jsx.getPragmaFromContext(context);
|
|
@@ -1264,30 +1263,30 @@ var ensure_use_callback_has_non_empty_deps_default = createRule({
|
|
|
1264
1263
|
}).otherwise(Option_exports.none),
|
|
1265
1264
|
Option_exports.filter((x2) => x2.elements.length === 0),
|
|
1266
1265
|
Option_exports.map(() => ({
|
|
1267
|
-
|
|
1268
|
-
|
|
1266
|
+
messageId: "ENSURE_USE_CALLBACK_HAS_NON_EMPTY_DEPS",
|
|
1267
|
+
node
|
|
1269
1268
|
}))
|
|
1270
1269
|
);
|
|
1271
1270
|
Option_exports.map(maybeDescriptor, context.report);
|
|
1272
1271
|
}
|
|
1273
1272
|
};
|
|
1274
|
-
}
|
|
1273
|
+
},
|
|
1274
|
+
defaultOptions: []
|
|
1275
1275
|
});
|
|
1276
1276
|
var RULE_NAME3 = "ensure-use-memo-has-non-empty-deps";
|
|
1277
1277
|
var ensure_use_memo_has_non_empty_deps_default = createRule({
|
|
1278
|
-
name: RULE_NAME3,
|
|
1279
1278
|
meta: {
|
|
1280
1279
|
type: "problem",
|
|
1281
1280
|
docs: {
|
|
1282
1281
|
description: "enforce 'useMemo' has non-empty dependencies array",
|
|
1283
1282
|
requiresTypeChecking: false
|
|
1284
1283
|
},
|
|
1285
|
-
schema: [],
|
|
1286
1284
|
messages: {
|
|
1287
1285
|
ENSURE_USE_MEMO_HAS_NON_EMPTY_DEPS: "useMemo should have a non-empty dependencies array"
|
|
1288
|
-
}
|
|
1286
|
+
},
|
|
1287
|
+
schema: []
|
|
1289
1288
|
},
|
|
1290
|
-
|
|
1289
|
+
name: RULE_NAME3,
|
|
1291
1290
|
create(context) {
|
|
1292
1291
|
const alias = shared.parseSchema(shared.ESLintSettingsSchema, context.settings).reactOptions?.additionalHooks?.useMemo ?? [];
|
|
1293
1292
|
const pragma = jsx.getPragmaFromContext(context);
|
|
@@ -1316,31 +1315,31 @@ var ensure_use_memo_has_non_empty_deps_default = createRule({
|
|
|
1316
1315
|
}).otherwise(Option_exports.none),
|
|
1317
1316
|
Option_exports.filter((x2) => x2.elements.length === 0),
|
|
1318
1317
|
Option_exports.map(() => ({
|
|
1319
|
-
|
|
1320
|
-
|
|
1318
|
+
messageId: "ENSURE_USE_MEMO_HAS_NON_EMPTY_DEPS",
|
|
1319
|
+
node
|
|
1321
1320
|
}))
|
|
1322
1321
|
);
|
|
1323
1322
|
Option_exports.map(maybeDescriptor, context.report);
|
|
1324
1323
|
}
|
|
1325
1324
|
};
|
|
1326
|
-
}
|
|
1325
|
+
},
|
|
1326
|
+
defaultOptions: []
|
|
1327
1327
|
});
|
|
1328
1328
|
var RULE_NAME4 = "prefer-use-state-lazy-initialization";
|
|
1329
1329
|
var ALLOW_LIST = Object.freeze(["Boolean", "String", "Number"]);
|
|
1330
1330
|
var prefer_use_state_lazy_initialization_default = createRule({
|
|
1331
|
-
name: RULE_NAME4,
|
|
1332
1331
|
meta: {
|
|
1333
1332
|
type: "problem",
|
|
1334
1333
|
docs: {
|
|
1335
1334
|
description: "disallow function calls in 'useState' that aren't wrapped in an initializer function",
|
|
1336
1335
|
requiresTypeChecking: false
|
|
1337
1336
|
},
|
|
1338
|
-
schema: [],
|
|
1339
1337
|
messages: {
|
|
1340
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())'"
|
|
1341
|
-
}
|
|
1339
|
+
},
|
|
1340
|
+
schema: []
|
|
1342
1341
|
},
|
|
1343
|
-
|
|
1342
|
+
name: RULE_NAME4,
|
|
1344
1343
|
create(context) {
|
|
1345
1344
|
const alias = shared.parseSchema(shared.ESLintSettingsSchema, context.settings).reactOptions?.additionalHooks?.useState ?? [];
|
|
1346
1345
|
const pragma = jsx.getPragmaFromContext(context);
|
|
@@ -1360,12 +1359,13 @@ var prefer_use_state_lazy_initialization_default = createRule({
|
|
|
1360
1359
|
if (!hasFunctionCall)
|
|
1361
1360
|
return;
|
|
1362
1361
|
context.report({
|
|
1363
|
-
|
|
1364
|
-
|
|
1362
|
+
messageId: "PREFER_USE_STATE_LAZY_INITIALIZATION",
|
|
1363
|
+
node: useStateInput
|
|
1365
1364
|
});
|
|
1366
1365
|
}
|
|
1367
1366
|
};
|
|
1368
|
-
}
|
|
1367
|
+
},
|
|
1368
|
+
defaultOptions: []
|
|
1369
1369
|
});
|
|
1370
1370
|
|
|
1371
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.8-beta.
|
|
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,
|
|
@@ -229,11 +229,11 @@ 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@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;
|
|
@@ -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,7 +693,7 @@ 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");
|
|
@@ -751,7 +751,7 @@ 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,
|
|
@@ -809,7 +809,7 @@ 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,
|
|
@@ -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,7 +1040,7 @@ var gen = (f) => {
|
|
|
1040
1040
|
}
|
|
1041
1041
|
};
|
|
1042
1042
|
|
|
1043
|
-
// ../../../node_modules/.pnpm/ts-pattern@5.1.
|
|
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";
|
|
@@ -1220,19 +1220,18 @@ var z = class _z {
|
|
|
1220
1220
|
// src/rules/ensure-use-callback-has-non-empty-deps.ts
|
|
1221
1221
|
var RULE_NAME2 = "ensure-use-callback-has-non-empty-deps";
|
|
1222
1222
|
var ensure_use_callback_has_non_empty_deps_default = createRule({
|
|
1223
|
-
name: RULE_NAME2,
|
|
1224
1223
|
meta: {
|
|
1225
1224
|
type: "problem",
|
|
1226
1225
|
docs: {
|
|
1227
1226
|
description: "enforce 'useCallback' has non-empty dependencies array",
|
|
1228
1227
|
requiresTypeChecking: false
|
|
1229
1228
|
},
|
|
1230
|
-
schema: [],
|
|
1231
1229
|
messages: {
|
|
1232
1230
|
ENSURE_USE_CALLBACK_HAS_NON_EMPTY_DEPS: "useCallback should have a non-empty dependencies array"
|
|
1233
|
-
}
|
|
1231
|
+
},
|
|
1232
|
+
schema: []
|
|
1234
1233
|
},
|
|
1235
|
-
|
|
1234
|
+
name: RULE_NAME2,
|
|
1236
1235
|
create(context) {
|
|
1237
1236
|
const alias = parseSchema(ESLintSettingsSchema, context.settings).reactOptions?.additionalHooks?.useCallback ?? [];
|
|
1238
1237
|
const pragma = getPragmaFromContext(context);
|
|
@@ -1262,30 +1261,30 @@ var ensure_use_callback_has_non_empty_deps_default = createRule({
|
|
|
1262
1261
|
}).otherwise(Option_exports.none),
|
|
1263
1262
|
Option_exports.filter((x2) => x2.elements.length === 0),
|
|
1264
1263
|
Option_exports.map(() => ({
|
|
1265
|
-
|
|
1266
|
-
|
|
1264
|
+
messageId: "ENSURE_USE_CALLBACK_HAS_NON_EMPTY_DEPS",
|
|
1265
|
+
node
|
|
1267
1266
|
}))
|
|
1268
1267
|
);
|
|
1269
1268
|
Option_exports.map(maybeDescriptor, context.report);
|
|
1270
1269
|
}
|
|
1271
1270
|
};
|
|
1272
|
-
}
|
|
1271
|
+
},
|
|
1272
|
+
defaultOptions: []
|
|
1273
1273
|
});
|
|
1274
1274
|
var RULE_NAME3 = "ensure-use-memo-has-non-empty-deps";
|
|
1275
1275
|
var ensure_use_memo_has_non_empty_deps_default = createRule({
|
|
1276
|
-
name: RULE_NAME3,
|
|
1277
1276
|
meta: {
|
|
1278
1277
|
type: "problem",
|
|
1279
1278
|
docs: {
|
|
1280
1279
|
description: "enforce 'useMemo' has non-empty dependencies array",
|
|
1281
1280
|
requiresTypeChecking: false
|
|
1282
1281
|
},
|
|
1283
|
-
schema: [],
|
|
1284
1282
|
messages: {
|
|
1285
1283
|
ENSURE_USE_MEMO_HAS_NON_EMPTY_DEPS: "useMemo should have a non-empty dependencies array"
|
|
1286
|
-
}
|
|
1284
|
+
},
|
|
1285
|
+
schema: []
|
|
1287
1286
|
},
|
|
1288
|
-
|
|
1287
|
+
name: RULE_NAME3,
|
|
1289
1288
|
create(context) {
|
|
1290
1289
|
const alias = parseSchema(ESLintSettingsSchema, context.settings).reactOptions?.additionalHooks?.useMemo ?? [];
|
|
1291
1290
|
const pragma = getPragmaFromContext(context);
|
|
@@ -1314,31 +1313,31 @@ var ensure_use_memo_has_non_empty_deps_default = createRule({
|
|
|
1314
1313
|
}).otherwise(Option_exports.none),
|
|
1315
1314
|
Option_exports.filter((x2) => x2.elements.length === 0),
|
|
1316
1315
|
Option_exports.map(() => ({
|
|
1317
|
-
|
|
1318
|
-
|
|
1316
|
+
messageId: "ENSURE_USE_MEMO_HAS_NON_EMPTY_DEPS",
|
|
1317
|
+
node
|
|
1319
1318
|
}))
|
|
1320
1319
|
);
|
|
1321
1320
|
Option_exports.map(maybeDescriptor, context.report);
|
|
1322
1321
|
}
|
|
1323
1322
|
};
|
|
1324
|
-
}
|
|
1323
|
+
},
|
|
1324
|
+
defaultOptions: []
|
|
1325
1325
|
});
|
|
1326
1326
|
var RULE_NAME4 = "prefer-use-state-lazy-initialization";
|
|
1327
1327
|
var ALLOW_LIST = Object.freeze(["Boolean", "String", "Number"]);
|
|
1328
1328
|
var prefer_use_state_lazy_initialization_default = createRule({
|
|
1329
|
-
name: RULE_NAME4,
|
|
1330
1329
|
meta: {
|
|
1331
1330
|
type: "problem",
|
|
1332
1331
|
docs: {
|
|
1333
1332
|
description: "disallow function calls in 'useState' that aren't wrapped in an initializer function",
|
|
1334
1333
|
requiresTypeChecking: false
|
|
1335
1334
|
},
|
|
1336
|
-
schema: [],
|
|
1337
1335
|
messages: {
|
|
1338
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())'"
|
|
1339
|
-
}
|
|
1337
|
+
},
|
|
1338
|
+
schema: []
|
|
1340
1339
|
},
|
|
1341
|
-
|
|
1340
|
+
name: RULE_NAME4,
|
|
1342
1341
|
create(context) {
|
|
1343
1342
|
const alias = parseSchema(ESLintSettingsSchema, context.settings).reactOptions?.additionalHooks?.useState ?? [];
|
|
1344
1343
|
const pragma = getPragmaFromContext(context);
|
|
@@ -1358,12 +1357,13 @@ var prefer_use_state_lazy_initialization_default = createRule({
|
|
|
1358
1357
|
if (!hasFunctionCall)
|
|
1359
1358
|
return;
|
|
1360
1359
|
context.report({
|
|
1361
|
-
|
|
1362
|
-
|
|
1360
|
+
messageId: "PREFER_USE_STATE_LAZY_INITIALIZATION",
|
|
1361
|
+
node: useStateInput
|
|
1363
1362
|
});
|
|
1364
1363
|
}
|
|
1365
1364
|
};
|
|
1366
|
-
}
|
|
1365
|
+
},
|
|
1366
|
+
defaultOptions: []
|
|
1367
1367
|
});
|
|
1368
1368
|
|
|
1369
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.8-beta.
|
|
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.8-beta.
|
|
48
|
-
"@eslint-react/
|
|
49
|
-
"@eslint-react/
|
|
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": {
|