eslint-plugin-react-hooks-extra 1.30.1-next.1 → 1.30.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/LICENSE +1 -1
- package/dist/index.js +7 -7
- package/dist/index.mjs +7 -7
- package/package.json +7 -7
package/LICENSE
CHANGED
package/dist/index.js
CHANGED
|
@@ -50,13 +50,13 @@ var rules = {
|
|
|
50
50
|
|
|
51
51
|
// package.json
|
|
52
52
|
var name2 = "eslint-plugin-react-hooks-extra";
|
|
53
|
-
var version = "1.30.1
|
|
53
|
+
var version = "1.30.1";
|
|
54
54
|
var createRule = shared.createRuleForPlugin("hooks-extra");
|
|
55
55
|
function isFromHookCall(context, name3, settings, predicate = eff.constTrue) {
|
|
56
56
|
const hookAlias = settings.additionalHooks[name3] ?? [];
|
|
57
57
|
return (topLevelId) => {
|
|
58
58
|
const variable = VAR4__namespace.findVariable(topLevelId, context.sourceCode.getScope(topLevelId));
|
|
59
|
-
const variableNode = VAR4__namespace.
|
|
59
|
+
const variableNode = VAR4__namespace.getVariableInitNode(variable, 0);
|
|
60
60
|
if (variableNode == null) return false;
|
|
61
61
|
if (variableNode.type !== types.AST_NODE_TYPES.CallExpression) return false;
|
|
62
62
|
if (!core.isReactHookCallWithNameAlias(context, name3, hookAlias)(variableNode)) return false;
|
|
@@ -272,7 +272,7 @@ function useNoDirectSetStateInUseEffect(context, options) {
|
|
|
272
272
|
},
|
|
273
273
|
"Program:exit"() {
|
|
274
274
|
const getSetStateCalls = (id, initialScope) => {
|
|
275
|
-
const node = VAR4__namespace.
|
|
275
|
+
const node = VAR4__namespace.getVariableInitNode(VAR4__namespace.findVariable(id, initialScope), 0);
|
|
276
276
|
switch (node?.type) {
|
|
277
277
|
case types.AST_NODE_TYPES.ArrowFunctionExpression:
|
|
278
278
|
case types.AST_NODE_TYPES.FunctionDeclaration:
|
|
@@ -413,7 +413,7 @@ var no_unnecessary_use_callback_default = createRule({
|
|
|
413
413
|
}
|
|
414
414
|
const hasEmptyDeps = tsPattern.match(arg1).with({ type: types.AST_NODE_TYPES.ArrayExpression }, (n) => n.elements.length === 0).with({ type: types.AST_NODE_TYPES.Identifier }, (n) => {
|
|
415
415
|
const variable = VAR4__namespace.findVariable(n.name, initialScope);
|
|
416
|
-
const variableNode = VAR4__namespace.
|
|
416
|
+
const variableNode = VAR4__namespace.getVariableInitNode(variable, 0);
|
|
417
417
|
if (variableNode?.type !== types.AST_NODE_TYPES.ArrayExpression) {
|
|
418
418
|
return false;
|
|
419
419
|
}
|
|
@@ -429,7 +429,7 @@ var no_unnecessary_use_callback_default = createRule({
|
|
|
429
429
|
return n;
|
|
430
430
|
}).with({ type: types.AST_NODE_TYPES.FunctionExpression }, eff.identity).with({ type: types.AST_NODE_TYPES.Identifier }, (n) => {
|
|
431
431
|
const variable = VAR4__namespace.findVariable(n.name, initialScope);
|
|
432
|
-
const variableNode = VAR4__namespace.
|
|
432
|
+
const variableNode = VAR4__namespace.getVariableInitNode(variable, 0);
|
|
433
433
|
if (variableNode?.type !== types.AST_NODE_TYPES.ArrowFunctionExpression && variableNode?.type !== types.AST_NODE_TYPES.FunctionExpression) {
|
|
434
434
|
return eff._;
|
|
435
435
|
}
|
|
@@ -496,7 +496,7 @@ var no_unnecessary_use_memo_default = createRule({
|
|
|
496
496
|
}
|
|
497
497
|
const hasEmptyDeps = tsPattern.match(arg1).with({ type: types.AST_NODE_TYPES.ArrayExpression }, (n) => n.elements.length === 0).with({ type: types.AST_NODE_TYPES.Identifier }, (n) => {
|
|
498
498
|
const variable = VAR4__namespace.findVariable(n.name, initialScope);
|
|
499
|
-
const variableNode = VAR4__namespace.
|
|
499
|
+
const variableNode = VAR4__namespace.getVariableInitNode(variable, 0);
|
|
500
500
|
if (variableNode?.type !== types.AST_NODE_TYPES.ArrayExpression) {
|
|
501
501
|
return false;
|
|
502
502
|
}
|
|
@@ -512,7 +512,7 @@ var no_unnecessary_use_memo_default = createRule({
|
|
|
512
512
|
return n;
|
|
513
513
|
}).with({ type: types.AST_NODE_TYPES.FunctionExpression }, eff.identity).with({ type: types.AST_NODE_TYPES.Identifier }, (n) => {
|
|
514
514
|
const variable = VAR4__namespace.findVariable(n.name, initialScope);
|
|
515
|
-
const variableNode = VAR4__namespace.
|
|
515
|
+
const variableNode = VAR4__namespace.getVariableInitNode(variable, 0);
|
|
516
516
|
if (variableNode?.type !== types.AST_NODE_TYPES.ArrowFunctionExpression && variableNode?.type !== types.AST_NODE_TYPES.FunctionExpression) {
|
|
517
517
|
return eff._;
|
|
518
518
|
}
|
package/dist/index.mjs
CHANGED
|
@@ -27,13 +27,13 @@ var rules = {
|
|
|
27
27
|
|
|
28
28
|
// package.json
|
|
29
29
|
var name2 = "eslint-plugin-react-hooks-extra";
|
|
30
|
-
var version = "1.30.1
|
|
30
|
+
var version = "1.30.1";
|
|
31
31
|
var createRule = createRuleForPlugin("hooks-extra");
|
|
32
32
|
function isFromHookCall(context, name3, settings, predicate = constTrue) {
|
|
33
33
|
const hookAlias = settings.additionalHooks[name3] ?? [];
|
|
34
34
|
return (topLevelId) => {
|
|
35
35
|
const variable = VAR4.findVariable(topLevelId, context.sourceCode.getScope(topLevelId));
|
|
36
|
-
const variableNode = VAR4.
|
|
36
|
+
const variableNode = VAR4.getVariableInitNode(variable, 0);
|
|
37
37
|
if (variableNode == null) return false;
|
|
38
38
|
if (variableNode.type !== AST_NODE_TYPES.CallExpression) return false;
|
|
39
39
|
if (!isReactHookCallWithNameAlias(context, name3, hookAlias)(variableNode)) return false;
|
|
@@ -249,7 +249,7 @@ function useNoDirectSetStateInUseEffect(context, options) {
|
|
|
249
249
|
},
|
|
250
250
|
"Program:exit"() {
|
|
251
251
|
const getSetStateCalls = (id, initialScope) => {
|
|
252
|
-
const node = VAR4.
|
|
252
|
+
const node = VAR4.getVariableInitNode(VAR4.findVariable(id, initialScope), 0);
|
|
253
253
|
switch (node?.type) {
|
|
254
254
|
case AST_NODE_TYPES.ArrowFunctionExpression:
|
|
255
255
|
case AST_NODE_TYPES.FunctionDeclaration:
|
|
@@ -390,7 +390,7 @@ var no_unnecessary_use_callback_default = createRule({
|
|
|
390
390
|
}
|
|
391
391
|
const hasEmptyDeps = match(arg1).with({ type: AST_NODE_TYPES.ArrayExpression }, (n) => n.elements.length === 0).with({ type: AST_NODE_TYPES.Identifier }, (n) => {
|
|
392
392
|
const variable = VAR4.findVariable(n.name, initialScope);
|
|
393
|
-
const variableNode = VAR4.
|
|
393
|
+
const variableNode = VAR4.getVariableInitNode(variable, 0);
|
|
394
394
|
if (variableNode?.type !== AST_NODE_TYPES.ArrayExpression) {
|
|
395
395
|
return false;
|
|
396
396
|
}
|
|
@@ -406,7 +406,7 @@ var no_unnecessary_use_callback_default = createRule({
|
|
|
406
406
|
return n;
|
|
407
407
|
}).with({ type: AST_NODE_TYPES.FunctionExpression }, identity).with({ type: AST_NODE_TYPES.Identifier }, (n) => {
|
|
408
408
|
const variable = VAR4.findVariable(n.name, initialScope);
|
|
409
|
-
const variableNode = VAR4.
|
|
409
|
+
const variableNode = VAR4.getVariableInitNode(variable, 0);
|
|
410
410
|
if (variableNode?.type !== AST_NODE_TYPES.ArrowFunctionExpression && variableNode?.type !== AST_NODE_TYPES.FunctionExpression) {
|
|
411
411
|
return _;
|
|
412
412
|
}
|
|
@@ -473,7 +473,7 @@ var no_unnecessary_use_memo_default = createRule({
|
|
|
473
473
|
}
|
|
474
474
|
const hasEmptyDeps = match(arg1).with({ type: AST_NODE_TYPES.ArrayExpression }, (n) => n.elements.length === 0).with({ type: AST_NODE_TYPES.Identifier }, (n) => {
|
|
475
475
|
const variable = VAR4.findVariable(n.name, initialScope);
|
|
476
|
-
const variableNode = VAR4.
|
|
476
|
+
const variableNode = VAR4.getVariableInitNode(variable, 0);
|
|
477
477
|
if (variableNode?.type !== AST_NODE_TYPES.ArrayExpression) {
|
|
478
478
|
return false;
|
|
479
479
|
}
|
|
@@ -489,7 +489,7 @@ var no_unnecessary_use_memo_default = createRule({
|
|
|
489
489
|
return n;
|
|
490
490
|
}).with({ type: AST_NODE_TYPES.FunctionExpression }, identity).with({ type: AST_NODE_TYPES.Identifier }, (n) => {
|
|
491
491
|
const variable = VAR4.findVariable(n.name, initialScope);
|
|
492
|
-
const variableNode = VAR4.
|
|
492
|
+
const variableNode = VAR4.getVariableInitNode(variable, 0);
|
|
493
493
|
if (variableNode?.type !== AST_NODE_TYPES.ArrowFunctionExpression && variableNode?.type !== AST_NODE_TYPES.FunctionExpression) {
|
|
494
494
|
return _;
|
|
495
495
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "eslint-plugin-react-hooks-extra",
|
|
3
|
-
"version": "1.30.1
|
|
3
|
+
"version": "1.30.1",
|
|
4
4
|
"description": "ESLint React's ESLint plugin for React Hooks related rules.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"react",
|
|
@@ -50,12 +50,12 @@
|
|
|
50
50
|
"@typescript-eslint/utils": "^8.26.0",
|
|
51
51
|
"string-ts": "^2.2.1",
|
|
52
52
|
"ts-pattern": "^5.6.2",
|
|
53
|
-
"@eslint-react/ast": "1.30.1
|
|
54
|
-
"@eslint-react/core": "1.30.1
|
|
55
|
-
"@eslint-react/eff": "1.30.1
|
|
56
|
-
"@eslint-react/jsx": "1.30.1
|
|
57
|
-
"@eslint-react/shared": "1.30.1
|
|
58
|
-
"@eslint-react/var": "1.30.1
|
|
53
|
+
"@eslint-react/ast": "1.30.1",
|
|
54
|
+
"@eslint-react/core": "1.30.1",
|
|
55
|
+
"@eslint-react/eff": "1.30.1",
|
|
56
|
+
"@eslint-react/jsx": "1.30.1",
|
|
57
|
+
"@eslint-react/shared": "1.30.1",
|
|
58
|
+
"@eslint-react/var": "1.30.1"
|
|
59
59
|
},
|
|
60
60
|
"devDependencies": {
|
|
61
61
|
"@types/react": "^19.0.10",
|