🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more
Socket
DemoInstallSign in
Socket

eslint-plugin-react-hooks-extra

Package Overview
Dependencies
Maintainers
1
Versions
1311
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

eslint-plugin-react-hooks-extra - npm Package Compare versions

Comparing version

to
1.50.1-beta.7

22

dist/index.js

@@ -55,3 +55,3 @@ 'use strict';

var name2 = "eslint-plugin-react-hooks-extra";
var version = "1.50.1-beta.3";
var version = "1.50.1-beta.7";
var createRule = utils.ESLintUtils.RuleCreator(shared.getDocsUrl("hooks-extra"));

@@ -79,5 +79,2 @@ function isFromHookCall(context, name3, settings, predicate = eff.constTrue) {

}
function isFunctionOfImmediatelyInvoked(node) {
return node.type !== types.AST_NODE_TYPES.FunctionDeclaration && node.parent.type === types.AST_NODE_TYPES.CallExpression && node.parent.callee === node;
}
function isSetFunctionCall(context, settings) {

@@ -200,3 +197,14 @@ const isIdFromUseStateCall = isFromUseStateCall(context, settings);

function getFunctionKind(node) {
return tsPattern.match(node).when(isFunctionOfUseEffectSetup, () => "setup").when(isFunctionOfImmediatelyInvoked, () => "immediate").otherwise(() => "other");
const parent = AST__namespace.findParentNode(node, eff.not(AST__namespace.isTypeExpression)) ?? node.parent;
switch (true) {
case node.async:
case (parent.type === types.AST_NODE_TYPES.CallExpression && isThenCall(parent)):
return "deferred";
case (node.type !== types.AST_NODE_TYPES.FunctionDeclaration && parent.type === types.AST_NODE_TYPES.CallExpression && parent.callee === node):
return "immediate";
case isFunctionOfUseEffectSetup(node):
return "setup";
default:
return "other";
}
}

@@ -226,2 +234,6 @@ return {

switch (true) {
case pEntry.kind === "deferred":
case pEntry.node.async: {
break;
}
case pEntry.node === setupFunction:

@@ -228,0 +240,0 @@ case (pEntry.kind === "immediate" && AST__namespace.findParentNode(pEntry.node, AST__namespace.isFunction) === setupFunction): {

{
"name": "eslint-plugin-react-hooks-extra",
"version": "1.50.1-beta.3",
"version": "1.50.1-beta.7",
"description": "ESLint React's ESLint plugin for React Hooks related rules.",

@@ -47,14 +47,14 @@ "keywords": [

"dependencies": {
"@typescript-eslint/scope-manager": "^8.33.0",
"@typescript-eslint/type-utils": "^8.33.0",
"@typescript-eslint/types": "^8.33.0",
"@typescript-eslint/utils": "^8.33.0",
"@typescript-eslint/scope-manager": "^8.33.1",
"@typescript-eslint/type-utils": "^8.33.1",
"@typescript-eslint/types": "^8.33.1",
"@typescript-eslint/utils": "^8.33.1",
"string-ts": "^2.2.1",
"ts-pattern": "^5.7.1",
"@eslint-react/ast": "1.50.1-beta.3",
"@eslint-react/core": "1.50.1-beta.3",
"@eslint-react/kit": "1.50.1-beta.3",
"@eslint-react/shared": "1.50.1-beta.3",
"@eslint-react/var": "1.50.1-beta.3",
"@eslint-react/eff": "1.50.1-beta.3"
"@eslint-react/ast": "1.50.1-beta.7",
"@eslint-react/eff": "1.50.1-beta.7",
"@eslint-react/core": "1.50.1-beta.7",
"@eslint-react/kit": "1.50.1-beta.7",
"@eslint-react/shared": "1.50.1-beta.7",
"@eslint-react/var": "1.50.1-beta.7"
},

@@ -61,0 +61,0 @@ "devDependencies": {

Sorry, the diff of this file is not supported yet