eslint-plugin-react-hooks-extra 1.23.3-next.5 → 1.23.3-next.7
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 +8 -14
- package/dist/index.mjs +9 -15
- package/package.json +8 -8
package/dist/index.js
CHANGED
|
@@ -31,7 +31,7 @@ var VAR5__namespace = /*#__PURE__*/_interopNamespace(VAR5);
|
|
|
31
31
|
|
|
32
32
|
// package.json
|
|
33
33
|
var name = "eslint-plugin-react-hooks-extra";
|
|
34
|
-
var version = "1.23.3-next.
|
|
34
|
+
var version = "1.23.3-next.7";
|
|
35
35
|
var createRule = shared.createRuleForPlugin("hooks-extra");
|
|
36
36
|
function isFromHookCall(name2, context, settings, predicate = eff.F.constTrue) {
|
|
37
37
|
const hookAlias = settings.additionalHooks?.[name2] ?? [];
|
|
@@ -67,15 +67,9 @@ function isSetFunctionCall(context, settings) {
|
|
|
67
67
|
if (!("name" in callee.object)) {
|
|
68
68
|
return false;
|
|
69
69
|
}
|
|
70
|
-
const isAt =
|
|
71
|
-
type: types.AST_NODE_TYPES.MemberExpression,
|
|
72
|
-
property: {
|
|
73
|
-
type: types.AST_NODE_TYPES.Identifier,
|
|
74
|
-
name: "at"
|
|
75
|
-
}
|
|
76
|
-
}, callee);
|
|
70
|
+
const isAt = callee.property.type === types.AST_NODE_TYPES.Identifier && callee.property.name === "at";
|
|
77
71
|
const [index] = node.callee.arguments;
|
|
78
|
-
if (!isAt ||
|
|
72
|
+
if (!isAt || index == null) {
|
|
79
73
|
return false;
|
|
80
74
|
}
|
|
81
75
|
const initialScope = context.sourceCode.getScope(node);
|
|
@@ -199,7 +193,7 @@ var no_direct_set_state_in_use_effect_default = createRule({
|
|
|
199
193
|
return;
|
|
200
194
|
}
|
|
201
195
|
tsPattern.match(getCallKind(node)).with("setState", () => {
|
|
202
|
-
if (
|
|
196
|
+
if (pEntry == null) {
|
|
203
197
|
return;
|
|
204
198
|
}
|
|
205
199
|
switch (true) {
|
|
@@ -416,7 +410,7 @@ var no_direct_set_state_in_use_layout_effect_default = createRule({
|
|
|
416
410
|
return;
|
|
417
411
|
}
|
|
418
412
|
tsPattern.match(getCallKind(node)).with("setState", () => {
|
|
419
|
-
if (
|
|
413
|
+
if (pEntry == null) {
|
|
420
414
|
return;
|
|
421
415
|
}
|
|
422
416
|
switch (true) {
|
|
@@ -592,7 +586,7 @@ var no_unnecessary_use_callback_default = createRule({
|
|
|
592
586
|
return;
|
|
593
587
|
}
|
|
594
588
|
const [arg0, arg1] = node.arguments;
|
|
595
|
-
if (
|
|
589
|
+
if (arg0 == null || arg1 == null) {
|
|
596
590
|
return;
|
|
597
591
|
}
|
|
598
592
|
const hasEmptyDeps = eff.F.pipe(
|
|
@@ -673,7 +667,7 @@ var no_unnecessary_use_memo_default = createRule({
|
|
|
673
667
|
return;
|
|
674
668
|
}
|
|
675
669
|
const [arg0, arg1] = node.arguments;
|
|
676
|
-
if (
|
|
670
|
+
if (arg0 == null || arg1 == null) {
|
|
677
671
|
return;
|
|
678
672
|
}
|
|
679
673
|
const hasCallInArg0 = eff.F.pipe(
|
|
@@ -806,7 +800,7 @@ var prefer_use_state_lazy_initialization_default = createRule({
|
|
|
806
800
|
return;
|
|
807
801
|
}
|
|
808
802
|
const [useStateInput] = node.arguments;
|
|
809
|
-
if (
|
|
803
|
+
if (useStateInput == null) {
|
|
810
804
|
return;
|
|
811
805
|
}
|
|
812
806
|
const nestedCallExpressions = AST2__namespace.getNestedCallExpressions(useStateInput);
|
package/dist/index.mjs
CHANGED
|
@@ -4,11 +4,11 @@ import { O, F } from '@eslint-react/eff';
|
|
|
4
4
|
import { createRuleForPlugin, getSettingsFromContext } from '@eslint-react/shared';
|
|
5
5
|
import * as VAR5 from '@eslint-react/var';
|
|
6
6
|
import { AST_NODE_TYPES } from '@typescript-eslint/types';
|
|
7
|
-
import { match
|
|
7
|
+
import { match } from 'ts-pattern';
|
|
8
8
|
|
|
9
9
|
// package.json
|
|
10
10
|
var name = "eslint-plugin-react-hooks-extra";
|
|
11
|
-
var version = "1.23.3-next.
|
|
11
|
+
var version = "1.23.3-next.7";
|
|
12
12
|
var createRule = createRuleForPlugin("hooks-extra");
|
|
13
13
|
function isFromHookCall(name2, context, settings, predicate = F.constTrue) {
|
|
14
14
|
const hookAlias = settings.additionalHooks?.[name2] ?? [];
|
|
@@ -44,15 +44,9 @@ function isSetFunctionCall(context, settings) {
|
|
|
44
44
|
if (!("name" in callee.object)) {
|
|
45
45
|
return false;
|
|
46
46
|
}
|
|
47
|
-
const isAt =
|
|
48
|
-
type: AST_NODE_TYPES.MemberExpression,
|
|
49
|
-
property: {
|
|
50
|
-
type: AST_NODE_TYPES.Identifier,
|
|
51
|
-
name: "at"
|
|
52
|
-
}
|
|
53
|
-
}, callee);
|
|
47
|
+
const isAt = callee.property.type === AST_NODE_TYPES.Identifier && callee.property.name === "at";
|
|
54
48
|
const [index] = node.callee.arguments;
|
|
55
|
-
if (!isAt ||
|
|
49
|
+
if (!isAt || index == null) {
|
|
56
50
|
return false;
|
|
57
51
|
}
|
|
58
52
|
const initialScope = context.sourceCode.getScope(node);
|
|
@@ -176,7 +170,7 @@ var no_direct_set_state_in_use_effect_default = createRule({
|
|
|
176
170
|
return;
|
|
177
171
|
}
|
|
178
172
|
match(getCallKind(node)).with("setState", () => {
|
|
179
|
-
if (
|
|
173
|
+
if (pEntry == null) {
|
|
180
174
|
return;
|
|
181
175
|
}
|
|
182
176
|
switch (true) {
|
|
@@ -393,7 +387,7 @@ var no_direct_set_state_in_use_layout_effect_default = createRule({
|
|
|
393
387
|
return;
|
|
394
388
|
}
|
|
395
389
|
match(getCallKind(node)).with("setState", () => {
|
|
396
|
-
if (
|
|
390
|
+
if (pEntry == null) {
|
|
397
391
|
return;
|
|
398
392
|
}
|
|
399
393
|
switch (true) {
|
|
@@ -569,7 +563,7 @@ var no_unnecessary_use_callback_default = createRule({
|
|
|
569
563
|
return;
|
|
570
564
|
}
|
|
571
565
|
const [arg0, arg1] = node.arguments;
|
|
572
|
-
if (
|
|
566
|
+
if (arg0 == null || arg1 == null) {
|
|
573
567
|
return;
|
|
574
568
|
}
|
|
575
569
|
const hasEmptyDeps = F.pipe(
|
|
@@ -650,7 +644,7 @@ var no_unnecessary_use_memo_default = createRule({
|
|
|
650
644
|
return;
|
|
651
645
|
}
|
|
652
646
|
const [arg0, arg1] = node.arguments;
|
|
653
|
-
if (
|
|
647
|
+
if (arg0 == null || arg1 == null) {
|
|
654
648
|
return;
|
|
655
649
|
}
|
|
656
650
|
const hasCallInArg0 = F.pipe(
|
|
@@ -783,7 +777,7 @@ var prefer_use_state_lazy_initialization_default = createRule({
|
|
|
783
777
|
return;
|
|
784
778
|
}
|
|
785
779
|
const [useStateInput] = node.arguments;
|
|
786
|
-
if (
|
|
780
|
+
if (useStateInput == null) {
|
|
787
781
|
return;
|
|
788
782
|
}
|
|
789
783
|
const nestedCallExpressions = AST2.getNestedCallExpressions(useStateInput);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "eslint-plugin-react-hooks-extra",
|
|
3
|
-
"version": "1.23.3-next.
|
|
3
|
+
"version": "1.23.3-next.7",
|
|
4
4
|
"description": "ESLint React's ESLint plugin for React Hooks related rules.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"react",
|
|
@@ -48,13 +48,13 @@
|
|
|
48
48
|
"@typescript-eslint/utils": "^8.19.1",
|
|
49
49
|
"string-ts": "^2.2.0",
|
|
50
50
|
"ts-pattern": "^5.6.0",
|
|
51
|
-
"@eslint-react/
|
|
52
|
-
"@eslint-react/
|
|
53
|
-
"@eslint-react/
|
|
54
|
-
"@eslint-react/
|
|
55
|
-
"@eslint-react/shared": "1.23.3-next.
|
|
56
|
-
"@eslint-react/
|
|
57
|
-
"@eslint-react/
|
|
51
|
+
"@eslint-react/core": "1.23.3-next.7",
|
|
52
|
+
"@eslint-react/ast": "1.23.3-next.7",
|
|
53
|
+
"@eslint-react/eff": "1.23.3-next.7",
|
|
54
|
+
"@eslint-react/jsx": "1.23.3-next.7",
|
|
55
|
+
"@eslint-react/shared": "1.23.3-next.7",
|
|
56
|
+
"@eslint-react/types": "1.23.3-next.7",
|
|
57
|
+
"@eslint-react/var": "1.23.3-next.7"
|
|
58
58
|
},
|
|
59
59
|
"devDependencies": {
|
|
60
60
|
"@types/react": "^19.0.4",
|