@eslint-react/var 5.2.3-next.2 → 5.2.4-beta.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.
Files changed (2) hide show
  1. package/dist/index.js +8 -8
  2. package/package.json +4 -4
package/dist/index.js CHANGED
@@ -337,8 +337,8 @@ const thisBlockTypes = [
337
337
  * @returns `true` if node value equal
338
338
  */
339
339
  function isValueEqual(context, a, b) {
340
- a = Check.isTypeExpression(a) ? Extract.unwrapped(a) : a;
341
- b = Check.isTypeExpression(b) ? Extract.unwrapped(b) : b;
340
+ a = Check.isTypeExpression(a) ? Extract.unwrap(a) : a;
341
+ b = Check.isTypeExpression(b) ? Extract.unwrap(b) : b;
342
342
  const [aScope, bScope] = [context.sourceCode.getScope(a), context.sourceCode.getScope(b)];
343
343
  switch (true) {
344
344
  case a === b: return true;
@@ -357,11 +357,11 @@ function isValueEqual(context, a, b) {
357
357
  const bDefParentParent = bDef?.parent?.parent;
358
358
  switch (true) {
359
359
  case aDefNodeParent?.type === AST_NODE_TYPES.CallExpression && bDefNodeParent?.type === AST_NODE_TYPES.CallExpression && Check.isFunction(aDefNode) && Check.isFunction(bDefNode): {
360
- if (!Compare.areEqual(aDefNodeParent.callee, bDefNodeParent.callee)) return false;
360
+ if (!Compare.isEqual(aDefNodeParent.callee, bDefNodeParent.callee)) return false;
361
361
  const aParams = aDefNode.params;
362
362
  const bParams = bDefNode.params;
363
- const aPos = aParams.findIndex((x) => Compare.areEqual(x, a));
364
- const bPos = bParams.findIndex((x) => Compare.areEqual(x, b));
363
+ const aPos = aParams.findIndex((x) => Compare.isEqual(x, a));
364
+ const bPos = bParams.findIndex((x) => Compare.isEqual(x, b));
365
365
  return aPos !== -1 && bPos !== -1 && aPos === bPos;
366
366
  }
367
367
  case aDefParentParent?.type === AST_NODE_TYPES.ForOfStatement && bDefParentParent?.type === AST_NODE_TYPES.ForOfStatement: {
@@ -370,14 +370,14 @@ function isValueEqual(context, a, b) {
370
370
  if (aLeft.type !== bLeft.type) return false;
371
371
  const aRight = aDefParentParent.right;
372
372
  const bRight = bDefParentParent.right;
373
- if (!Compare.areEqual(aRight, bRight)) return false;
373
+ if (!Compare.isEqual(aRight, bRight)) return false;
374
374
  if (aDefParentParent === bDefParentParent) return aVar != null && bVar != null && aVar === bVar;
375
375
  return true;
376
376
  }
377
377
  default: return aVar != null && bVar != null && aVar === bVar;
378
378
  }
379
379
  }
380
- case a.type === AST_NODE_TYPES.MemberExpression && b.type === AST_NODE_TYPES.MemberExpression: return (a.computed && b.computed ? isValueEqual(context, a.property, b.property) : Compare.areEqual(a.property, b.property)) && isValueEqual(context, a.object, b.object);
380
+ case a.type === AST_NODE_TYPES.MemberExpression && b.type === AST_NODE_TYPES.MemberExpression: return (a.computed && b.computed ? isValueEqual(context, a.property, b.property) : Compare.isEqual(a.property, b.property)) && isValueEqual(context, a.object, b.object);
381
381
  case a.type === AST_NODE_TYPES.ThisExpression && b.type === AST_NODE_TYPES.ThisExpression:
382
382
  if (aScope.block === bScope.block) return true;
383
383
  return Traverse.findParent(a, isOneOf(thisBlockTypes)) === Traverse.findParent(b, isOneOf(thisBlockTypes));
@@ -401,7 +401,7 @@ function isValueEqual(context, a, b) {
401
401
  * @internal
402
402
  */
403
403
  function isAssignmentTargetEqual(context, a, b) {
404
- return Compare.areEqual(a, b) || isValueEqual(context, a, b);
404
+ return Compare.isEqual(a, b) || isValueEqual(context, a, b);
405
405
  }
406
406
 
407
407
  //#endregion
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@eslint-react/var",
3
- "version": "5.2.3-next.2",
3
+ "version": "5.2.4-beta.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": {
@@ -34,9 +34,9 @@
34
34
  "@typescript-eslint/types": "^8.58.2",
35
35
  "@typescript-eslint/utils": "^8.58.2",
36
36
  "ts-pattern": "^5.9.0",
37
- "@eslint-react/shared": "5.2.3-next.2",
38
- "@eslint-react/ast": "5.2.3-next.2",
39
- "@eslint-react/eslint": "5.2.3-next.2"
37
+ "@eslint-react/ast": "5.2.4-beta.0",
38
+ "@eslint-react/eslint": "5.2.4-beta.0",
39
+ "@eslint-react/shared": "5.2.4-beta.0"
40
40
  },
41
41
  "devDependencies": {
42
42
  "@typescript-eslint/typescript-estree": "^8.58.2",