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

@eslint-react/var

Package Overview
Dependencies
Maintainers
1
Versions
1398
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@eslint-react/var - npm Package Compare versions

Comparing version

to
1.52.3-beta.2

20

dist/index.d.ts
import { Scope, Variable } from '@typescript-eslint/scope-manager';
import { TSESTree } from '@typescript-eslint/types';
import { _ } from '@eslint-react/eff';
import { unit } from '@eslint-react/eff';

@@ -12,6 +12,6 @@ /**

declare const findVariable: {
(initialScope: Scope): (nameOrNode: string | TSESTree.Identifier | _) => Variable | _;
(nameOrNode: string | TSESTree.Identifier | _, initialScope: Scope): Variable | _;
(initialScope: Scope): (nameOrNode: string | TSESTree.Identifier | unit) => Variable | unit;
(nameOrNode: string | TSESTree.Identifier | unit, initialScope: Scope): Variable | unit;
};
declare function findPropertyInProperties(name: string, properties: (TSESTree.Property | TSESTree.RestElement | TSESTree.SpreadElement)[], initialScope: Scope, seen?: Set<string>): (typeof properties)[number] | _;
declare function findPropertyInProperties(name: string, properties: (TSESTree.Property | TSESTree.RestElement | TSESTree.SpreadElement)[], initialScope: Scope, seen?: Set<string>): (typeof properties)[number] | unit;

@@ -57,7 +57,7 @@ declare const ConstructionDetectionHint: {

*/
declare function getConstruction(node: TSESTree.Node | _, initialScope: Scope, hint?: bigint): Construction | _;
declare function getConstruction(node: TSESTree.Node | unit, initialScope: Scope, hint?: bigint): Construction | unit;
declare function getVariableDeclaratorId(node: TSESTree.Node | _, prev?: TSESTree.Node): TSESTree.BindingName | TSESTree.Expression | _;
declare function getVariableDeclaratorId(node: TSESTree.Node | unit, prev?: TSESTree.Node): TSESTree.BindingName | TSESTree.Expression | unit;
declare function getVariableInitNode(variable: Variable | _, at: number): _ | TSESTree.ClassDeclaration | TSESTree.ClassDeclarationWithName | TSESTree.ClassDeclarationWithOptionalName | TSESTree.Expression | TSESTree.FunctionDeclaration | TSESTree.FunctionDeclarationWithName | TSESTree.FunctionDeclarationWithOptionalName;
declare function getVariableInitNode(variable: Variable | unit, at: number): unit | TSESTree.ClassDeclaration | TSESTree.ClassDeclarationWithName | TSESTree.ClassDeclarationWithOptionalName | TSESTree.Expression | TSESTree.FunctionDeclaration | TSESTree.FunctionDeclarationWithName | TSESTree.FunctionDeclarationWithOptionalName;

@@ -69,7 +69,7 @@ declare function getChidScopes(scope: Scope): readonly Scope[];

node: TSESTree.Node;
initialScope: Scope | _;
initialScope: Scope | unit;
} | {
kind: "none";
node: TSESTree.Node;
initialScope: Scope | _;
initialScope: Scope | unit;
} | {

@@ -79,3 +79,3 @@ kind: "some";

value: unknown;
initialScope: Scope | _;
initialScope: Scope | unit;
};

@@ -82,0 +82,0 @@ declare function toStaticValue(lazyValue: LazyValue): {

@@ -32,5 +32,5 @@ 'use strict';

function getVariableInitNode(variable, at) {
if (variable == null) return eff._;
if (variable == null) return eff.unit;
const def = variable.defs.at(at);
if (def == null) return eff._;
if (def == null) return eff.unit;
switch (true) {

@@ -44,3 +44,3 @@ case (def.type === scopeManager.DefinitionType.FunctionName && def.node.type === types.AST_NODE_TYPES.FunctionDeclaration):

default:
return eff._;
return eff.unit;
}

@@ -60,4 +60,4 @@ }

var findVariable2 = eff.dual(2, (nameOrNode, initialScope) => {
if (nameOrNode == null) return eff._;
return ASTUtils__namespace.findVariable(initialScope, nameOrNode) ?? eff._;
if (nameOrNode == null) return eff.unit;
return ASTUtils__namespace.findVariable(initialScope, nameOrNode) ?? eff.unit;
});

@@ -106,3 +106,3 @@ function findPropertyInProperties(name, properties, initialScope, seen = /* @__PURE__ */ new Set()) {

function getConstruction(node, initialScope, hint = ConstructionDetectionHint.None) {
if (node == null) return eff._;
if (node == null) return eff.unit;
switch (node.type) {

@@ -127,6 +127,6 @@ case types.AST_NODE_TYPES.JSXElement:

}
return eff._;
return eff.unit;
}
case types.AST_NODE_TYPES.MemberExpression: {
if (!("object" in node)) return eff._;
if (!("object" in node)) return eff.unit;
return getConstruction(node.object, initialScope, hint);

@@ -136,3 +136,3 @@ }

case types.AST_NODE_TYPES.AssignmentPattern: {
if (!("right" in node)) return eff._;
if (!("right" in node)) return eff.unit;
return getConstruction(node.right, initialScope, hint);

@@ -142,3 +142,3 @@ }

const lvc = getConstruction(node.left, initialScope, hint);
if (lvc == null) return eff._;
if (lvc == null) return eff.unit;
return getConstruction(node.right, initialScope, hint);

@@ -148,3 +148,3 @@ }

const cvc = getConstruction(node.consequent, initialScope, hint);
if (cvc == null) return eff._;
if (cvc == null) return eff.unit;
return getConstruction(node.alternate, initialScope, hint);

@@ -154,3 +154,3 @@ }

if (!("name" in node) || typeof node.name !== "string") {
return eff._;
return eff.unit;
}

@@ -165,7 +165,7 @@ const variable = initialScope.set.get(node.name);

}
return eff._;
return eff.unit;
}
default: {
if (!("expression" in node) || typeof node.expression !== "object") {
return eff._;
return eff.unit;
}

@@ -177,3 +177,3 @@ return getConstruction(node.expression, initialScope, hint);

function getVariableDeclaratorId(node, prev) {
if (node == null) return eff._;
if (node == null) return eff.unit;
switch (true) {

@@ -185,3 +185,3 @@ case (node.type === types.AST_NODE_TYPES.VariableDeclarator && node.init === prev):

case (node.type === types.AST_NODE_TYPES.BlockStatement || node.type === types.AST_NODE_TYPES.Program || node.parent === node):
return eff._;
return eff.unit;
default:

@@ -282,3 +282,3 @@ return getVariableDeclaratorId(node.parent, node);

function getVariableInitNodeLoose(variable, at) {
if (variable == null) return eff._;
if (variable == null) return eff.unit;
const node = getVariableInitNode(variable, at);

@@ -288,3 +288,3 @@ if (node != null) return node;

if (def?.type === scopeManager.DefinitionType.Parameter && AST__namespace.isFunction(def.node)) return def.node;
return eff._;
return eff.unit;
}

@@ -291,0 +291,0 @@

{
"name": "@eslint-react/var",
"version": "1.52.3-beta.1",
"version": "1.52.3-beta.2",
"description": "ESLint React's TSESTree AST utility module for static analysis of variables.",

@@ -43,4 +43,4 @@ "homepage": "https://github.com/Rel1cx/eslint-react",

"ts-pattern": "^5.7.1",
"@eslint-react/ast": "1.52.3-beta.1",
"@eslint-react/eff": "1.52.3-beta.1"
"@eslint-react/ast": "1.52.3-beta.2",
"@eslint-react/eff": "1.52.3-beta.2"
},

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

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet