@eslint-react/var 1.24.0-next.8 → 1.24.0

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/dist/index.d.mts CHANGED
@@ -43,7 +43,7 @@ declare function isNodeValueEqual(a: TSESTree.Node, b: TSESTree.Node, initialSco
43
43
  bScope: Scope
44
44
  ]): boolean;
45
45
 
46
- type StaticValue = {
46
+ type LazyValue = {
47
47
  kind: "lazy";
48
48
  node: TSESTree.Node;
49
49
  initialScope: Scope | _;
@@ -57,7 +57,7 @@ type StaticValue = {
57
57
  value: unknown;
58
58
  initialScope: Scope | _;
59
59
  };
60
- declare function toResolved(sv: StaticValue): {
60
+ declare function toStaticValue(lazyValue: LazyValue): {
61
61
  readonly kind: "none";
62
62
  readonly node: TSESTree.Node;
63
63
  readonly initialScope: Scope | undefined;
@@ -110,4 +110,4 @@ declare const ValueConstructionHint: {
110
110
  */
111
111
  declare function getValueConstruction(node: TSESTree.Node | _, initialScope: Scope, hint?: bigint): ValueConstruction | _;
112
112
 
113
- export { type StaticValue, type ValueConstruction, ValueConstructionHint, findPropertyInProperties, findVariable, getChidScopes, getValueConstruction, getVariableDeclaratorId, getVariableNode, getVariables, isInitializedFromSource, isNodeValueEqual, toResolved };
113
+ export { type LazyValue, type ValueConstruction, ValueConstructionHint, findPropertyInProperties, findVariable, getChidScopes, getValueConstruction, getVariableDeclaratorId, getVariableNode, getVariables, isInitializedFromSource, isNodeValueEqual, toStaticValue };
package/dist/index.d.ts CHANGED
@@ -43,7 +43,7 @@ declare function isNodeValueEqual(a: TSESTree.Node, b: TSESTree.Node, initialSco
43
43
  bScope: Scope
44
44
  ]): boolean;
45
45
 
46
- type StaticValue = {
46
+ type LazyValue = {
47
47
  kind: "lazy";
48
48
  node: TSESTree.Node;
49
49
  initialScope: Scope | _;
@@ -57,7 +57,7 @@ type StaticValue = {
57
57
  value: unknown;
58
58
  initialScope: Scope | _;
59
59
  };
60
- declare function toResolved(sv: StaticValue): {
60
+ declare function toStaticValue(lazyValue: LazyValue): {
61
61
  readonly kind: "none";
62
62
  readonly node: TSESTree.Node;
63
63
  readonly initialScope: Scope | undefined;
@@ -110,4 +110,4 @@ declare const ValueConstructionHint: {
110
110
  */
111
111
  declare function getValueConstruction(node: TSESTree.Node | _, initialScope: Scope, hint?: bigint): ValueConstruction | _;
112
112
 
113
- export { type StaticValue, type ValueConstruction, ValueConstructionHint, findPropertyInProperties, findVariable, getChidScopes, getValueConstruction, getVariableDeclaratorId, getVariableNode, getVariables, isInitializedFromSource, isNodeValueEqual, toResolved };
113
+ export { type LazyValue, type ValueConstruction, ValueConstructionHint, findPropertyInProperties, findVariable, getChidScopes, getValueConstruction, getVariableDeclaratorId, getVariableNode, getVariables, isInitializedFromSource, isNodeValueEqual, toStaticValue };
package/dist/index.js CHANGED
@@ -153,13 +153,13 @@ function getRequireExpressionArguments(node) {
153
153
  }
154
154
  return eff._;
155
155
  }
156
- function toResolved(sv) {
157
- const { kind, node, initialScope } = sv;
156
+ function toStaticValue(lazyValue) {
157
+ const { kind, node, initialScope } = lazyValue;
158
158
  if (kind !== "lazy") {
159
- return sv;
159
+ return lazyValue;
160
160
  }
161
- const resolvedValue = initialScope == null ? ASTUtils.getStaticValue(node) : ASTUtils.getStaticValue(node, initialScope);
162
- return resolvedValue == null ? { kind: "none", node, initialScope } : { kind: "some", node, initialScope, value: resolvedValue.value };
161
+ const staticValue = initialScope == null ? ASTUtils.getStaticValue(node) : ASTUtils.getStaticValue(node, initialScope);
162
+ return staticValue == null ? { kind: "none", node, initialScope } : { kind: "some", node, initialScope, value: staticValue.value };
163
163
  }
164
164
 
165
165
  // src/is-node-value-equal.ts
@@ -230,8 +230,8 @@ function isNodeValueEqual(a, b, initialScopes) {
230
230
  return aFunction === bFunction;
231
231
  }
232
232
  default: {
233
- const aStatic = toResolved({ kind: "lazy", node: a, initialScope: aScope });
234
- const bStatic = toResolved({ kind: "lazy", node: b, initialScope: bScope });
233
+ const aStatic = toStaticValue({ kind: "lazy", node: a, initialScope: aScope });
234
+ const bStatic = toStaticValue({ kind: "lazy", node: b, initialScope: bScope });
235
235
  return aStatic.kind !== "none" && bStatic.kind !== "none" && aStatic.value === bStatic.value;
236
236
  }
237
237
  }
@@ -321,4 +321,4 @@ exports.getVariableNode = getVariableNode;
321
321
  exports.getVariables = getVariables;
322
322
  exports.isInitializedFromSource = isInitializedFromSource;
323
323
  exports.isNodeValueEqual = isNodeValueEqual;
324
- exports.toResolved = toResolved;
324
+ exports.toStaticValue = toStaticValue;
package/dist/index.mjs CHANGED
@@ -131,13 +131,13 @@ function getRequireExpressionArguments(node) {
131
131
  }
132
132
  return _;
133
133
  }
134
- function toResolved(sv) {
135
- const { kind, node, initialScope } = sv;
134
+ function toStaticValue(lazyValue) {
135
+ const { kind, node, initialScope } = lazyValue;
136
136
  if (kind !== "lazy") {
137
- return sv;
137
+ return lazyValue;
138
138
  }
139
- const resolvedValue = initialScope == null ? getStaticValue(node) : getStaticValue(node, initialScope);
140
- return resolvedValue == null ? { kind: "none", node, initialScope } : { kind: "some", node, initialScope, value: resolvedValue.value };
139
+ const staticValue = initialScope == null ? getStaticValue(node) : getStaticValue(node, initialScope);
140
+ return staticValue == null ? { kind: "none", node, initialScope } : { kind: "some", node, initialScope, value: staticValue.value };
141
141
  }
142
142
 
143
143
  // src/is-node-value-equal.ts
@@ -208,8 +208,8 @@ function isNodeValueEqual(a, b, initialScopes) {
208
208
  return aFunction === bFunction;
209
209
  }
210
210
  default: {
211
- const aStatic = toResolved({ kind: "lazy", node: a, initialScope: aScope });
212
- const bStatic = toResolved({ kind: "lazy", node: b, initialScope: bScope });
211
+ const aStatic = toStaticValue({ kind: "lazy", node: a, initialScope: aScope });
212
+ const bStatic = toStaticValue({ kind: "lazy", node: b, initialScope: bScope });
213
213
  return aStatic.kind !== "none" && bStatic.kind !== "none" && aStatic.value === bStatic.value;
214
214
  }
215
215
  }
@@ -289,4 +289,4 @@ function getValueConstruction(node, initialScope, hint = ValueConstructionHint.N
289
289
  }
290
290
  }
291
291
 
292
- export { ValueConstructionHint, findPropertyInProperties, findVariable2 as findVariable, getChidScopes, getValueConstruction, getVariableDeclaratorId, getVariableNode, getVariables, isInitializedFromSource, isNodeValueEqual, toResolved };
292
+ export { ValueConstructionHint, findPropertyInProperties, findVariable2 as findVariable, getChidScopes, getValueConstruction, getVariableDeclaratorId, getVariableNode, getVariables, isInitializedFromSource, isNodeValueEqual, toStaticValue };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@eslint-react/var",
3
- "version": "1.24.0-next.8",
3
+ "version": "1.24.0",
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": {
@@ -37,9 +37,9 @@
37
37
  "@typescript-eslint/types": "^8.20.0",
38
38
  "@typescript-eslint/utils": "^8.20.0",
39
39
  "string-ts": "^2.2.0",
40
- "ts-pattern": "^5.6.0",
41
- "@eslint-react/ast": "1.24.0-next.8",
42
- "@eslint-react/eff": "1.24.0-next.8"
40
+ "ts-pattern": "^5.6.1",
41
+ "@eslint-react/ast": "1.24.0",
42
+ "@eslint-react/eff": "1.24.0"
43
43
  },
44
44
  "devDependencies": {
45
45
  "tsup": "^8.3.5",