Latest Threat Research:SANDWORM_MODE: Shai-Hulud-Style npm Worm Hijacks CI Workflows and Poisons AI Toolchains.Details
Socket
Book a DemoInstallSign in
Socket

@eslint-react/var

Package Overview
Dependencies
Maintainers
1
Versions
2295
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
3.0.0-beta.53
to
3.0.0-beta.54
+5
-14
dist/index.d.ts

@@ -55,10 +55,7 @@ import { unit } from "@eslint-react/eff";

//#endregion
//#region src/scope.d.ts
//#region src/binding-kind.d.ts
type BindingKind = "var" | "let" | "const" | "module" | "hoisted" | "param" | "local" | "unknown";
//#endregion
//#region src/helper.d.ts
/**
* Get all variables from the given scope up to the global scope
* @param initialScope The scope to start from
* @returns All variables from the given scope up to the global scope
*/
declare function getVariables(initialScope: Scope): Variable[];
/**
* Find a variable by name or identifier node in the scope chain

@@ -76,8 +73,2 @@ * @param initialScope The scope to start searching from

};
/**
* Get all child scopes recursively from a given scope
* @param scope The scope to get child scopes from
* @returns Array of all child scopes including the input scope
*/
declare function getChildScopes(scope: Scope): readonly Scope[];
//#endregion

@@ -144,2 +135,2 @@ //#region src/value-equality.d.ts

//#endregion
export { AssignmentTarget, ObjectType, findEnclosingAssignmentTarget, findImportSource, findProperty, findVariable, getChildScopes, getObjectType, getVariableInitializer, getVariableInitializerLoose, getVariables, isAssignmentTargetEqual, isValueEqual };
export { AssignmentTarget, BindingKind, ObjectType, findEnclosingAssignmentTarget, findImportSource, findProperty, findVariable, getObjectType, getVariableInitializer, getVariableInitializerLoose, isAssignmentTargetEqual, isValueEqual };

@@ -6,3 +6,3 @@ import * as ast from "@eslint-react/ast";

import { getStaticValue } from "@typescript-eslint/utils/ast-utils";
import { DefinitionType, ScopeType } from "@typescript-eslint/scope-manager";
import { DefinitionType } from "@typescript-eslint/scope-manager";
import { P, match } from "ts-pattern";

@@ -44,18 +44,4 @@

//#endregion
//#region src/scope.ts
//#region src/helper.ts
/**
* Get all variables from the given scope up to the global scope
* @param initialScope The scope to start from
* @returns All variables from the given scope up to the global scope
*/
function getVariables(initialScope) {
let scope = initialScope;
const variables = [...scope.variables];
while (scope.type !== ScopeType.global) {
scope = scope.upper;
variables.push(...scope.variables);
}
return variables.reverse();
}
/**
* Find a variable by name or identifier node in the scope chain

@@ -73,12 +59,2 @@ * @param initialScope The scope to start searching from

});
/**
* Get all child scopes recursively from a given scope
* @param scope The scope to get child scopes from
* @returns Array of all child scopes including the input scope
*/
function getChildScopes(scope) {
const scopes = [scope];
for (const childScope of scope.childScopes) scopes.push(...getChildScopes(childScope));
return scopes;
}

@@ -111,6 +87,6 @@ //#endregion

const bVar = findVariable(b, bScope);
const aVarNode = getVariableInitializerLoose(aVar, 0);
const bVarNode = getVariableInitializerLoose(bVar, 0);
const aVarNodeParent = aVarNode?.parent;
const bVarNodeParent = bVarNode?.parent;
const aVarInit = getVariableInitializerLoose(aVar, 0);
const bVarInit = getVariableInitializerLoose(bVar, 0);
const aVarInitParent = aVarInit?.parent;
const bVarInitParent = bVarInit?.parent;
const aDef = aVar?.defs.at(0);

@@ -121,6 +97,6 @@ const bDef = bVar?.defs.at(0);

switch (true) {
case aVarNodeParent?.type === AST_NODE_TYPES.CallExpression && bVarNodeParent?.type === AST_NODE_TYPES.CallExpression && ast.isFunction(aVarNode) && ast.isFunction(bVarNode): {
if (!ast.isNodeEqual(aVarNodeParent.callee, bVarNodeParent.callee)) return false;
const aParams = aVarNode.params;
const bParams = bVarNode.params;
case aVarInitParent?.type === AST_NODE_TYPES.CallExpression && bVarInitParent?.type === AST_NODE_TYPES.CallExpression && ast.isFunction(aVarInit) && ast.isFunction(bVarInit): {
if (!ast.isNodeEqual(aVarInitParent.callee, bVarInitParent.callee)) return false;
const aParams = aVarInit.params;
const bParams = bVarInit.params;
const aPos = aParams.findIndex((x) => ast.isNodeEqual(x, a));

@@ -330,2 +306,2 @@ const bPos = bParams.findIndex((x) => ast.isNodeEqual(x, b));

//#endregion
export { findEnclosingAssignmentTarget, findImportSource, findProperty, findVariable, getChildScopes, getObjectType, getVariableInitializer, getVariableInitializerLoose, getVariables, isAssignmentTargetEqual, isValueEqual };
export { findEnclosingAssignmentTarget, findImportSource, findProperty, findVariable, getObjectType, getVariableInitializer, getVariableInitializerLoose, isAssignmentTargetEqual, isValueEqual };
{
"name": "@eslint-react/var",
"version": "3.0.0-beta.53",
"version": "3.0.0-beta.54",
"description": "ESLint React's TSESTree AST utility module for static analysis of variables.",

@@ -37,8 +37,8 @@ "homepage": "https://github.com/Rel1cx/eslint-react",

"ts-pattern": "^5.9.0",
"@eslint-react/ast": "3.0.0-beta.53",
"@eslint-react/shared": "3.0.0-beta.53",
"@eslint-react/eff": "3.0.0-beta.53"
"@eslint-react/ast": "3.0.0-beta.54",
"@eslint-react/shared": "3.0.0-beta.54",
"@eslint-react/eff": "3.0.0-beta.54"
},
"devDependencies": {
"tsdown": "^0.20.3",
"tsdown": "^0.21.0-beta.1",
"@local/configs": "0.0.0"

@@ -45,0 +45,0 @@ },