@eslint-react/var 1.30.1-next.0 → 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 CHANGED
@@ -1,6 +1,6 @@
1
1
  MIT License
2
2
 
3
- Copyright (c) 2024 Eva1ent
3
+ Copyright (c) 2025 Eva1ent
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  of this software and associated documentation files (the "Software"), to deal
package/dist/index.d.mts CHANGED
@@ -13,7 +13,7 @@ declare function getChidScopes(scope: Scope): readonly Scope[];
13
13
 
14
14
  declare function getVariableDeclaratorId(node: TSESTree.Node | _, prev?: TSESTree.Node): TSESTree.BindingName | TSESTree.Expression | _;
15
15
 
16
- declare function getVariableNode(variable: Variable | _, at: number): _ | TSESTree.ClassDeclaration | TSESTree.ClassDeclarationWithName | TSESTree.ClassDeclarationWithOptionalName | TSESTree.Expression | TSESTree.FunctionDeclaration | TSESTree.FunctionDeclarationWithName | TSESTree.FunctionDeclarationWithOptionalName;
16
+ declare function getVariableInitNode(variable: Variable | _, at: number): _ | TSESTree.ClassDeclaration | TSESTree.ClassDeclarationWithName | TSESTree.ClassDeclarationWithOptionalName | TSESTree.Expression | TSESTree.FunctionDeclaration | TSESTree.FunctionDeclarationWithName | TSESTree.FunctionDeclarationWithOptionalName;
17
17
 
18
18
  /**
19
19
  * Get all variables from the given scope up to the global scope
@@ -101,4 +101,4 @@ declare const ValueConstructionHint: {
101
101
  */
102
102
  declare function getValueConstruction(node: TSESTree.Node | _, initialScope: Scope, hint?: bigint): ValueConstruction | _;
103
103
 
104
- export { type LazyValue, type ValueConstruction, ValueConstructionHint, findPropertyInProperties, findVariable, getChidScopes, getValueConstruction, getVariableDeclaratorId, getVariableNode, getVariables, isNodeValueEqual, toStaticValue };
104
+ export { type LazyValue, type ValueConstruction, ValueConstructionHint, findPropertyInProperties, findVariable, getChidScopes, getValueConstruction, getVariableDeclaratorId, getVariableInitNode, getVariables, isNodeValueEqual, toStaticValue };
package/dist/index.d.ts CHANGED
@@ -13,7 +13,7 @@ declare function getChidScopes(scope: Scope): readonly Scope[];
13
13
 
14
14
  declare function getVariableDeclaratorId(node: TSESTree.Node | _, prev?: TSESTree.Node): TSESTree.BindingName | TSESTree.Expression | _;
15
15
 
16
- declare function getVariableNode(variable: Variable | _, at: number): _ | TSESTree.ClassDeclaration | TSESTree.ClassDeclarationWithName | TSESTree.ClassDeclarationWithOptionalName | TSESTree.Expression | TSESTree.FunctionDeclaration | TSESTree.FunctionDeclarationWithName | TSESTree.FunctionDeclarationWithOptionalName;
16
+ declare function getVariableInitNode(variable: Variable | _, at: number): _ | TSESTree.ClassDeclaration | TSESTree.ClassDeclarationWithName | TSESTree.ClassDeclarationWithOptionalName | TSESTree.Expression | TSESTree.FunctionDeclaration | TSESTree.FunctionDeclarationWithName | TSESTree.FunctionDeclarationWithOptionalName;
17
17
 
18
18
  /**
19
19
  * Get all variables from the given scope up to the global scope
@@ -101,4 +101,4 @@ declare const ValueConstructionHint: {
101
101
  */
102
102
  declare function getValueConstruction(node: TSESTree.Node | _, initialScope: Scope, hint?: bigint): ValueConstruction | _;
103
103
 
104
- export { type LazyValue, type ValueConstruction, ValueConstructionHint, findPropertyInProperties, findVariable, getChidScopes, getValueConstruction, getVariableDeclaratorId, getVariableNode, getVariables, isNodeValueEqual, toStaticValue };
104
+ export { type LazyValue, type ValueConstruction, ValueConstructionHint, findPropertyInProperties, findVariable, getChidScopes, getValueConstruction, getVariableDeclaratorId, getVariableInitNode, getVariables, isNodeValueEqual, toStaticValue };
package/dist/index.js CHANGED
@@ -32,7 +32,7 @@ var findVariable2 = eff.dual(2, (nameOrNode, initialScope) => {
32
32
  if (nameOrNode == null) return eff._;
33
33
  return ASTUtils__namespace.findVariable(initialScope, nameOrNode) ?? eff._;
34
34
  });
35
- function getVariableNode(variable, at) {
35
+ function getVariableInitNode(variable, at) {
36
36
  if (variable == null) return eff._;
37
37
  const def = variable.defs.at(at);
38
38
  if (def == null) return eff._;
@@ -59,7 +59,7 @@ function findPropertyInProperties(name, properties, initialScope, seen = /* @__P
59
59
  case types.AST_NODE_TYPES.Identifier: {
60
60
  if (seen.has(prop.argument.name)) return false;
61
61
  const variable = findVariable2(prop.argument.name, initialScope);
62
- const variableNode = getVariableNode(variable, 0);
62
+ const variableNode = getVariableInitNode(variable, 0);
63
63
  if (variableNode?.type === types.AST_NODE_TYPES.ObjectExpression) {
64
64
  seen.add(prop.argument.name);
65
65
  return findPropertyInProperties(
@@ -148,8 +148,8 @@ function isNodeValueEqual(a, b, initialScopes) {
148
148
  case (a.type === types.AST_NODE_TYPES.Identifier && b.type === types.AST_NODE_TYPES.Identifier): {
149
149
  const aVar = findVariable2(a, aScope);
150
150
  const bVar = findVariable2(b, bScope);
151
- const aVarNode = getVariableNodeLoose(aVar, 0);
152
- const bVarNode = getVariableNodeLoose(bVar, 0);
151
+ const aVarNode = getVariableInitNodeLoose(aVar, 0);
152
+ const bVarNode = getVariableInitNodeLoose(bVar, 0);
153
153
  const aVarNodeParent = aVarNode?.parent;
154
154
  const bVarNodeParent = bVarNode?.parent;
155
155
  const aDef = aVar?.defs.at(0);
@@ -200,9 +200,9 @@ function isNodeValueEqual(a, b, initialScopes) {
200
200
  }
201
201
  }
202
202
  }
203
- function getVariableNodeLoose(variable, at) {
203
+ function getVariableInitNodeLoose(variable, at) {
204
204
  if (variable == null) return eff._;
205
- const node = getVariableNode(variable, at);
205
+ const node = getVariableInitNode(variable, at);
206
206
  if (node != null) return node;
207
207
  const def = variable.defs.at(at);
208
208
  if (def?.type === scopeManager.DefinitionType.Parameter && AST__namespace.isFunction(def.node)) return def.node;
@@ -265,7 +265,7 @@ function getValueConstruction(node, initialScope, hint = ValueConstructionHint.N
265
265
  return eff._;
266
266
  }
267
267
  const variable = initialScope.set.get(node.name);
268
- const variableNode = getVariableNode(variable, -1);
268
+ const variableNode = getVariableInitNode(variable, -1);
269
269
  return getValueConstruction(variableNode, initialScope, hint);
270
270
  }
271
271
  case types.AST_NODE_TYPES.Literal: {
@@ -289,7 +289,7 @@ exports.findVariable = findVariable2;
289
289
  exports.getChidScopes = getChidScopes;
290
290
  exports.getValueConstruction = getValueConstruction;
291
291
  exports.getVariableDeclaratorId = getVariableDeclaratorId;
292
- exports.getVariableNode = getVariableNode;
292
+ exports.getVariableInitNode = getVariableInitNode;
293
293
  exports.getVariables = getVariables;
294
294
  exports.isNodeValueEqual = isNodeValueEqual;
295
295
  exports.toStaticValue = toStaticValue;
package/dist/index.mjs CHANGED
@@ -10,7 +10,7 @@ var findVariable2 = dual(2, (nameOrNode, initialScope) => {
10
10
  if (nameOrNode == null) return _;
11
11
  return ASTUtils.findVariable(initialScope, nameOrNode) ?? _;
12
12
  });
13
- function getVariableNode(variable, at) {
13
+ function getVariableInitNode(variable, at) {
14
14
  if (variable == null) return _;
15
15
  const def = variable.defs.at(at);
16
16
  if (def == null) return _;
@@ -37,7 +37,7 @@ function findPropertyInProperties(name, properties, initialScope, seen = /* @__P
37
37
  case AST_NODE_TYPES.Identifier: {
38
38
  if (seen.has(prop.argument.name)) return false;
39
39
  const variable = findVariable2(prop.argument.name, initialScope);
40
- const variableNode = getVariableNode(variable, 0);
40
+ const variableNode = getVariableInitNode(variable, 0);
41
41
  if (variableNode?.type === AST_NODE_TYPES.ObjectExpression) {
42
42
  seen.add(prop.argument.name);
43
43
  return findPropertyInProperties(
@@ -126,8 +126,8 @@ function isNodeValueEqual(a, b, initialScopes) {
126
126
  case (a.type === AST_NODE_TYPES.Identifier && b.type === AST_NODE_TYPES.Identifier): {
127
127
  const aVar = findVariable2(a, aScope);
128
128
  const bVar = findVariable2(b, bScope);
129
- const aVarNode = getVariableNodeLoose(aVar, 0);
130
- const bVarNode = getVariableNodeLoose(bVar, 0);
129
+ const aVarNode = getVariableInitNodeLoose(aVar, 0);
130
+ const bVarNode = getVariableInitNodeLoose(bVar, 0);
131
131
  const aVarNodeParent = aVarNode?.parent;
132
132
  const bVarNodeParent = bVarNode?.parent;
133
133
  const aDef = aVar?.defs.at(0);
@@ -178,9 +178,9 @@ function isNodeValueEqual(a, b, initialScopes) {
178
178
  }
179
179
  }
180
180
  }
181
- function getVariableNodeLoose(variable, at) {
181
+ function getVariableInitNodeLoose(variable, at) {
182
182
  if (variable == null) return _;
183
- const node = getVariableNode(variable, at);
183
+ const node = getVariableInitNode(variable, at);
184
184
  if (node != null) return node;
185
185
  const def = variable.defs.at(at);
186
186
  if (def?.type === DefinitionType.Parameter && AST.isFunction(def.node)) return def.node;
@@ -243,7 +243,7 @@ function getValueConstruction(node, initialScope, hint = ValueConstructionHint.N
243
243
  return _;
244
244
  }
245
245
  const variable = initialScope.set.get(node.name);
246
- const variableNode = getVariableNode(variable, -1);
246
+ const variableNode = getVariableInitNode(variable, -1);
247
247
  return getValueConstruction(variableNode, initialScope, hint);
248
248
  }
249
249
  case AST_NODE_TYPES.Literal: {
@@ -261,4 +261,4 @@ function getValueConstruction(node, initialScope, hint = ValueConstructionHint.N
261
261
  }
262
262
  }
263
263
 
264
- export { ValueConstructionHint, findPropertyInProperties, findVariable2 as findVariable, getChidScopes, getValueConstruction, getVariableDeclaratorId, getVariableNode, getVariables, isNodeValueEqual, toStaticValue };
264
+ export { ValueConstructionHint, findPropertyInProperties, findVariable2 as findVariable, getChidScopes, getValueConstruction, getVariableDeclaratorId, getVariableInitNode, getVariables, isNodeValueEqual, toStaticValue };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@eslint-react/var",
3
- "version": "1.30.1-next.0",
3
+ "version": "1.30.1",
4
4
  "description": "ESLint React's TSESTree AST utility module for static analysis of variables.",
5
5
  "homepage": "https://github.com/Rel1cx/eslint-react",
6
6
  "bugs": {
@@ -35,13 +35,13 @@
35
35
  "./package.json"
36
36
  ],
37
37
  "dependencies": {
38
- "@typescript-eslint/scope-manager": "^8.25.0",
39
- "@typescript-eslint/types": "^8.25.0",
40
- "@typescript-eslint/utils": "^8.25.0",
38
+ "@typescript-eslint/scope-manager": "^8.26.0",
39
+ "@typescript-eslint/types": "^8.26.0",
40
+ "@typescript-eslint/utils": "^8.26.0",
41
41
  "string-ts": "^2.2.1",
42
42
  "ts-pattern": "^5.6.2",
43
- "@eslint-react/eff": "1.30.1-next.0",
44
- "@eslint-react/ast": "1.30.1-next.0"
43
+ "@eslint-react/ast": "1.30.1",
44
+ "@eslint-react/eff": "1.30.1"
45
45
  },
46
46
  "devDependencies": {
47
47
  "tsup": "^8.4.0",