eslint-plugin-react-hooks-extra 1.24.0-next.9 → 1.24.0
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 +9 -9
- package/dist/index.mjs +9 -9
- package/package.json +8 -8
package/dist/index.js
CHANGED
|
@@ -31,10 +31,10 @@ 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.24.0
|
|
34
|
+
var version = "1.24.0";
|
|
35
35
|
var createRule = shared.createRuleForPlugin("hooks-extra");
|
|
36
36
|
function isFromHookCall(name2, context, settings, predicate = eff.returnTrue) {
|
|
37
|
-
const hookAlias = settings.additionalHooks
|
|
37
|
+
const hookAlias = settings.additionalHooks[name2] ?? [];
|
|
38
38
|
return (topLevelId) => {
|
|
39
39
|
const variable = VAR5__namespace.findVariable(topLevelId, context.sourceCode.getScope(topLevelId));
|
|
40
40
|
const variableNode = VAR5__namespace.getVariableNode(variable, 0);
|
|
@@ -74,7 +74,7 @@ function isSetFunctionCall(context, settings) {
|
|
|
74
74
|
return false;
|
|
75
75
|
}
|
|
76
76
|
const indexScope = context.sourceCode.getScope(node);
|
|
77
|
-
const indexValue = VAR5__namespace.
|
|
77
|
+
const indexValue = VAR5__namespace.toStaticValue({
|
|
78
78
|
kind: "lazy",
|
|
79
79
|
node: index,
|
|
80
80
|
initialScope: indexScope
|
|
@@ -94,7 +94,7 @@ function isSetFunctionCall(context, settings) {
|
|
|
94
94
|
}
|
|
95
95
|
const property = node.callee.property;
|
|
96
96
|
const propertyScope = context.sourceCode.getScope(node);
|
|
97
|
-
const propertyValue = VAR5__namespace.
|
|
97
|
+
const propertyValue = VAR5__namespace.toStaticValue({
|
|
98
98
|
kind: "lazy",
|
|
99
99
|
node: property,
|
|
100
100
|
initialScope: propertyScope
|
|
@@ -153,7 +153,7 @@ var no_direct_set_state_in_use_effect_default = createRule({
|
|
|
153
153
|
return {};
|
|
154
154
|
}
|
|
155
155
|
const settings = shared.getSettingsFromContext(context);
|
|
156
|
-
const additionalHooks = settings.additionalHooks
|
|
156
|
+
const additionalHooks = settings.additionalHooks;
|
|
157
157
|
const isUseEffectLikeCall = core.isReactHookCallWithNameAlias("useEffect", context, additionalHooks.useEffect ?? []);
|
|
158
158
|
const isUseStateCall2 = core.isReactHookCallWithNameAlias("useState", context, additionalHooks.useState ?? []);
|
|
159
159
|
const isUseMemoCall2 = core.isReactHookCallWithNameAlias("useMemo", context, additionalHooks.useMemo ?? []);
|
|
@@ -348,7 +348,7 @@ var no_direct_set_state_in_use_layout_effect_default = createRule({
|
|
|
348
348
|
return {};
|
|
349
349
|
}
|
|
350
350
|
const settings = shared.getSettingsFromContext(context);
|
|
351
|
-
const additionalHooks = settings.additionalHooks
|
|
351
|
+
const additionalHooks = settings.additionalHooks;
|
|
352
352
|
const isUseLayoutEffectLikeCall = core.isReactHookCallWithNameAlias(
|
|
353
353
|
"useLayoutEffect",
|
|
354
354
|
context,
|
|
@@ -546,7 +546,7 @@ var no_unnecessary_use_callback_default = createRule({
|
|
|
546
546
|
if (!context.sourceCode.text.includes("use")) {
|
|
547
547
|
return {};
|
|
548
548
|
}
|
|
549
|
-
const alias = shared.getSettingsFromContext(context).additionalHooks
|
|
549
|
+
const alias = shared.getSettingsFromContext(context).additionalHooks.useCallback ?? [];
|
|
550
550
|
return {
|
|
551
551
|
CallExpression(node) {
|
|
552
552
|
if (!core.isReactHookCall(node)) {
|
|
@@ -625,7 +625,7 @@ var no_unnecessary_use_memo_default = createRule({
|
|
|
625
625
|
if (!context.sourceCode.text.includes("use")) {
|
|
626
626
|
return {};
|
|
627
627
|
}
|
|
628
|
-
const alias = shared.getSettingsFromContext(context).additionalHooks
|
|
628
|
+
const alias = shared.getSettingsFromContext(context).additionalHooks.useMemo ?? [];
|
|
629
629
|
return {
|
|
630
630
|
CallExpression(node) {
|
|
631
631
|
if (!core.isReactHookCall(node)) {
|
|
@@ -758,7 +758,7 @@ var prefer_use_state_lazy_initialization_default = createRule({
|
|
|
758
758
|
if (!context.sourceCode.text.includes("use")) {
|
|
759
759
|
return {};
|
|
760
760
|
}
|
|
761
|
-
const alias = shared.getSettingsFromContext(context).additionalHooks
|
|
761
|
+
const alias = shared.getSettingsFromContext(context).additionalHooks.useState ?? [];
|
|
762
762
|
return {
|
|
763
763
|
CallExpression(node) {
|
|
764
764
|
if (!core.isReactHookCall(node)) {
|
package/dist/index.mjs
CHANGED
|
@@ -8,10 +8,10 @@ import { match } from 'ts-pattern';
|
|
|
8
8
|
|
|
9
9
|
// package.json
|
|
10
10
|
var name = "eslint-plugin-react-hooks-extra";
|
|
11
|
-
var version = "1.24.0
|
|
11
|
+
var version = "1.24.0";
|
|
12
12
|
var createRule = createRuleForPlugin("hooks-extra");
|
|
13
13
|
function isFromHookCall(name2, context, settings, predicate = returnTrue) {
|
|
14
|
-
const hookAlias = settings.additionalHooks
|
|
14
|
+
const hookAlias = settings.additionalHooks[name2] ?? [];
|
|
15
15
|
return (topLevelId) => {
|
|
16
16
|
const variable = VAR5.findVariable(topLevelId, context.sourceCode.getScope(topLevelId));
|
|
17
17
|
const variableNode = VAR5.getVariableNode(variable, 0);
|
|
@@ -51,7 +51,7 @@ function isSetFunctionCall(context, settings) {
|
|
|
51
51
|
return false;
|
|
52
52
|
}
|
|
53
53
|
const indexScope = context.sourceCode.getScope(node);
|
|
54
|
-
const indexValue = VAR5.
|
|
54
|
+
const indexValue = VAR5.toStaticValue({
|
|
55
55
|
kind: "lazy",
|
|
56
56
|
node: index,
|
|
57
57
|
initialScope: indexScope
|
|
@@ -71,7 +71,7 @@ function isSetFunctionCall(context, settings) {
|
|
|
71
71
|
}
|
|
72
72
|
const property = node.callee.property;
|
|
73
73
|
const propertyScope = context.sourceCode.getScope(node);
|
|
74
|
-
const propertyValue = VAR5.
|
|
74
|
+
const propertyValue = VAR5.toStaticValue({
|
|
75
75
|
kind: "lazy",
|
|
76
76
|
node: property,
|
|
77
77
|
initialScope: propertyScope
|
|
@@ -130,7 +130,7 @@ var no_direct_set_state_in_use_effect_default = createRule({
|
|
|
130
130
|
return {};
|
|
131
131
|
}
|
|
132
132
|
const settings = getSettingsFromContext(context);
|
|
133
|
-
const additionalHooks = settings.additionalHooks
|
|
133
|
+
const additionalHooks = settings.additionalHooks;
|
|
134
134
|
const isUseEffectLikeCall = isReactHookCallWithNameAlias("useEffect", context, additionalHooks.useEffect ?? []);
|
|
135
135
|
const isUseStateCall2 = isReactHookCallWithNameAlias("useState", context, additionalHooks.useState ?? []);
|
|
136
136
|
const isUseMemoCall2 = isReactHookCallWithNameAlias("useMemo", context, additionalHooks.useMemo ?? []);
|
|
@@ -325,7 +325,7 @@ var no_direct_set_state_in_use_layout_effect_default = createRule({
|
|
|
325
325
|
return {};
|
|
326
326
|
}
|
|
327
327
|
const settings = getSettingsFromContext(context);
|
|
328
|
-
const additionalHooks = settings.additionalHooks
|
|
328
|
+
const additionalHooks = settings.additionalHooks;
|
|
329
329
|
const isUseLayoutEffectLikeCall = isReactHookCallWithNameAlias(
|
|
330
330
|
"useLayoutEffect",
|
|
331
331
|
context,
|
|
@@ -523,7 +523,7 @@ var no_unnecessary_use_callback_default = createRule({
|
|
|
523
523
|
if (!context.sourceCode.text.includes("use")) {
|
|
524
524
|
return {};
|
|
525
525
|
}
|
|
526
|
-
const alias = getSettingsFromContext(context).additionalHooks
|
|
526
|
+
const alias = getSettingsFromContext(context).additionalHooks.useCallback ?? [];
|
|
527
527
|
return {
|
|
528
528
|
CallExpression(node) {
|
|
529
529
|
if (!isReactHookCall(node)) {
|
|
@@ -602,7 +602,7 @@ var no_unnecessary_use_memo_default = createRule({
|
|
|
602
602
|
if (!context.sourceCode.text.includes("use")) {
|
|
603
603
|
return {};
|
|
604
604
|
}
|
|
605
|
-
const alias = getSettingsFromContext(context).additionalHooks
|
|
605
|
+
const alias = getSettingsFromContext(context).additionalHooks.useMemo ?? [];
|
|
606
606
|
return {
|
|
607
607
|
CallExpression(node) {
|
|
608
608
|
if (!isReactHookCall(node)) {
|
|
@@ -735,7 +735,7 @@ var prefer_use_state_lazy_initialization_default = createRule({
|
|
|
735
735
|
if (!context.sourceCode.text.includes("use")) {
|
|
736
736
|
return {};
|
|
737
737
|
}
|
|
738
|
-
const alias = getSettingsFromContext(context).additionalHooks
|
|
738
|
+
const alias = getSettingsFromContext(context).additionalHooks.useState ?? [];
|
|
739
739
|
return {
|
|
740
740
|
CallExpression(node) {
|
|
741
741
|
if (!isReactHookCall(node)) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "eslint-plugin-react-hooks-extra",
|
|
3
|
-
"version": "1.24.0
|
|
3
|
+
"version": "1.24.0",
|
|
4
4
|
"description": "ESLint React's ESLint plugin for React Hooks related rules.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"react",
|
|
@@ -47,13 +47,13 @@
|
|
|
47
47
|
"@typescript-eslint/types": "^8.20.0",
|
|
48
48
|
"@typescript-eslint/utils": "^8.20.0",
|
|
49
49
|
"string-ts": "^2.2.0",
|
|
50
|
-
"ts-pattern": "^5.6.
|
|
51
|
-
"@eslint-react/ast": "1.24.0
|
|
52
|
-
"@eslint-react/core": "1.24.0
|
|
53
|
-
"@eslint-react/
|
|
54
|
-
"@eslint-react/
|
|
55
|
-
"@eslint-react/
|
|
56
|
-
"@eslint-react/
|
|
50
|
+
"ts-pattern": "^5.6.1",
|
|
51
|
+
"@eslint-react/ast": "1.24.0",
|
|
52
|
+
"@eslint-react/core": "1.24.0",
|
|
53
|
+
"@eslint-react/jsx": "1.24.0",
|
|
54
|
+
"@eslint-react/var": "1.24.0",
|
|
55
|
+
"@eslint-react/eff": "1.24.0",
|
|
56
|
+
"@eslint-react/shared": "1.24.0"
|
|
57
57
|
},
|
|
58
58
|
"devDependencies": {
|
|
59
59
|
"@types/react": "^19.0.7",
|