@eslint-react/var 1.23.2-beta.2 → 1.23.2-beta.6

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.js CHANGED
@@ -95,9 +95,9 @@ function getVariables(initialScope) {
95
95
  return variables.reverse();
96
96
  }
97
97
  function isInitializedFromSource(name, source, initialScope) {
98
- const maybeLatestDef = eff.O.flatMapNullable(findVariable2(name, initialScope), (v) => v.defs.at(-1));
99
- if (eff.O.isNone(maybeLatestDef)) return false;
100
- const { node, parent } = maybeLatestDef.value;
98
+ const latestDef = eff.O.flatMapNullable(findVariable2(name, initialScope), (v) => v.defs.at(-1));
99
+ if (eff.O.isNone(latestDef)) return false;
100
+ const { node, parent } = latestDef.value;
101
101
  if (node.type === types.AST_NODE_TYPES.VariableDeclarator && node.init) {
102
102
  const { init } = node;
103
103
  if (init.type === types.AST_NODE_TYPES.MemberExpression && init.object.type === types.AST_NODE_TYPES.Identifier) {
@@ -189,7 +189,7 @@ function isNodeValueEqual(a, b, initialScopes) {
189
189
  );
190
190
  }
191
191
  default: {
192
- return eff.O.isSome(aVar) && eff.O.isSome(bVar) && eff.Equal.equals(aVar, bVar);
192
+ return eff.O.isSome(aVar) && eff.O.isSome(bVar) && aVar.value === bVar.value;
193
193
  }
194
194
  }
195
195
  }
@@ -200,8 +200,8 @@ function isNodeValueEqual(a, b, initialScopes) {
200
200
  if (aScope.block === bScope.block) return true;
201
201
  return eff.F.pipe(
202
202
  eff.O.Do,
203
- eff.O.bind("aFunction", () => AST3__namespace.traverseUp(a, AST3__namespace.isOneOf(thisBlockTypes))),
204
- eff.O.bind("bFunction", () => AST3__namespace.traverseUp(b, AST3__namespace.isOneOf(thisBlockTypes))),
203
+ eff.O.bind("aFunction", () => AST3__namespace.findParentNode(a, AST3__namespace.isOneOf(thisBlockTypes))),
204
+ eff.O.bind("bFunction", () => AST3__namespace.findParentNode(b, AST3__namespace.isOneOf(thisBlockTypes))),
205
205
  eff.O.exists(({ aFunction, bFunction }) => aFunction === bFunction)
206
206
  );
207
207
  }
package/dist/index.mjs CHANGED
@@ -1,4 +1,4 @@
1
- import { F, O, Equal, isObject, isString } from '@eslint-react/eff';
1
+ import { F, O, isObject, isString } from '@eslint-react/eff';
2
2
  import * as ASTUtils from '@typescript-eslint/utils/ast-utils';
3
3
  import { AST_NODE_TYPES } from '@typescript-eslint/types';
4
4
  import * as AST3 from '@eslint-react/ast';
@@ -72,9 +72,9 @@ function getVariables(initialScope) {
72
72
  return variables.reverse();
73
73
  }
74
74
  function isInitializedFromSource(name, source, initialScope) {
75
- const maybeLatestDef = O.flatMapNullable(findVariable2(name, initialScope), (v) => v.defs.at(-1));
76
- if (O.isNone(maybeLatestDef)) return false;
77
- const { node, parent } = maybeLatestDef.value;
75
+ const latestDef = O.flatMapNullable(findVariable2(name, initialScope), (v) => v.defs.at(-1));
76
+ if (O.isNone(latestDef)) return false;
77
+ const { node, parent } = latestDef.value;
78
78
  if (node.type === AST_NODE_TYPES.VariableDeclarator && node.init) {
79
79
  const { init } = node;
80
80
  if (init.type === AST_NODE_TYPES.MemberExpression && init.object.type === AST_NODE_TYPES.Identifier) {
@@ -166,7 +166,7 @@ function isNodeValueEqual(a, b, initialScopes) {
166
166
  );
167
167
  }
168
168
  default: {
169
- return O.isSome(aVar) && O.isSome(bVar) && Equal.equals(aVar, bVar);
169
+ return O.isSome(aVar) && O.isSome(bVar) && aVar.value === bVar.value;
170
170
  }
171
171
  }
172
172
  }
@@ -177,8 +177,8 @@ function isNodeValueEqual(a, b, initialScopes) {
177
177
  if (aScope.block === bScope.block) return true;
178
178
  return F.pipe(
179
179
  O.Do,
180
- O.bind("aFunction", () => AST3.traverseUp(a, AST3.isOneOf(thisBlockTypes))),
181
- O.bind("bFunction", () => AST3.traverseUp(b, AST3.isOneOf(thisBlockTypes))),
180
+ O.bind("aFunction", () => AST3.findParentNode(a, AST3.isOneOf(thisBlockTypes))),
181
+ O.bind("bFunction", () => AST3.findParentNode(b, AST3.isOneOf(thisBlockTypes))),
182
182
  O.exists(({ aFunction, bFunction }) => aFunction === bFunction)
183
183
  );
184
184
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@eslint-react/var",
3
- "version": "1.23.2-beta.2",
3
+ "version": "1.23.2-beta.6",
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": {
@@ -33,14 +33,14 @@
33
33
  "./package.json"
34
34
  ],
35
35
  "dependencies": {
36
- "@typescript-eslint/scope-manager": "^8.19.0",
37
- "@typescript-eslint/types": "^8.19.0",
38
- "@typescript-eslint/utils": "^8.19.0",
36
+ "@typescript-eslint/scope-manager": "^8.19.1",
37
+ "@typescript-eslint/types": "^8.19.1",
38
+ "@typescript-eslint/utils": "^8.19.1",
39
39
  "string-ts": "^2.2.0",
40
40
  "ts-pattern": "^5.6.0",
41
- "@eslint-react/ast": "1.23.2-beta.2",
42
- "@eslint-react/types": "1.23.2-beta.2",
43
- "@eslint-react/eff": "1.23.2-beta.2"
41
+ "@eslint-react/ast": "1.23.2-beta.6",
42
+ "@eslint-react/eff": "1.23.2-beta.6",
43
+ "@eslint-react/types": "1.23.2-beta.6"
44
44
  },
45
45
  "devDependencies": {
46
46
  "tsup": "^8.3.5",