@eslint-react/ast 1.23.2-next.6 → 1.23.3-beta.2

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
@@ -2381,14 +2381,14 @@ declare function isEmptyFunction(node: TSESTreeFunction): boolean;
2381
2381
  * @param node The node to check.
2382
2382
  * @returns `true` if the node is a function expression or arrow function expression of a class method, `false` otherwise.
2383
2383
  */
2384
- declare const isFunctionOfClassMethod: (node: TSESTree.Node) => boolean;
2384
+ declare function isFunctionOfClassMethod(node: TSESTree.Node): node is TSESTree.ArrowFunctionExpression | TSESTree.FunctionExpression;
2385
2385
 
2386
2386
  /**
2387
2387
  * Checks if the given node is a function expression or arrow function expression of a class property.
2388
2388
  * @param node The node to check.
2389
2389
  * @returns `true` if the node is a function expression or arrow function expression of a class property, `false` otherwise.
2390
2390
  */
2391
- declare const isFunctionOfClassProperty: (node: TSESTree.Node) => boolean;
2391
+ declare function isFunctionOfClassProperty(node: TSESTree.Node): node is TSESTree.ArrowFunctionExpression | TSESTree.FunctionExpression;
2392
2392
 
2393
2393
  declare function isFunctionOfImmediatelyInvoked(node: TSESTreeFunction): boolean;
2394
2394
 
@@ -2397,7 +2397,7 @@ declare function isFunctionOfImmediatelyInvoked(node: TSESTreeFunction): boolean
2397
2397
  * @param node The node to check.
2398
2398
  * @returns `true` if the node is a function expression or arrow function expression of a object method, `false` otherwise.
2399
2399
  */
2400
- declare const isFunctionOfObjectMethod: (node: TSESTree.Node) => boolean;
2400
+ declare function isFunctionOfObjectMethod(node: TSESTree.Node): boolean;
2401
2401
 
2402
2402
  declare function isKeyLiteralLike(node: TSESTree.MemberExpression | TSESTree.MethodDefinition | TSESTree.Property | TSESTree.PropertyDefinition, property: TSESTree.Node): boolean;
2403
2403
 
package/dist/index.d.ts CHANGED
@@ -2381,14 +2381,14 @@ declare function isEmptyFunction(node: TSESTreeFunction): boolean;
2381
2381
  * @param node The node to check.
2382
2382
  * @returns `true` if the node is a function expression or arrow function expression of a class method, `false` otherwise.
2383
2383
  */
2384
- declare const isFunctionOfClassMethod: (node: TSESTree.Node) => boolean;
2384
+ declare function isFunctionOfClassMethod(node: TSESTree.Node): node is TSESTree.ArrowFunctionExpression | TSESTree.FunctionExpression;
2385
2385
 
2386
2386
  /**
2387
2387
  * Checks if the given node is a function expression or arrow function expression of a class property.
2388
2388
  * @param node The node to check.
2389
2389
  * @returns `true` if the node is a function expression or arrow function expression of a class property, `false` otherwise.
2390
2390
  */
2391
- declare const isFunctionOfClassProperty: (node: TSESTree.Node) => boolean;
2391
+ declare function isFunctionOfClassProperty(node: TSESTree.Node): node is TSESTree.ArrowFunctionExpression | TSESTree.FunctionExpression;
2392
2392
 
2393
2393
  declare function isFunctionOfImmediatelyInvoked(node: TSESTreeFunction): boolean;
2394
2394
 
@@ -2397,7 +2397,7 @@ declare function isFunctionOfImmediatelyInvoked(node: TSESTreeFunction): boolean
2397
2397
  * @param node The node to check.
2398
2398
  * @returns `true` if the node is a function expression or arrow function expression of a object method, `false` otherwise.
2399
2399
  */
2400
- declare const isFunctionOfObjectMethod: (node: TSESTree.Node) => boolean;
2400
+ declare function isFunctionOfObjectMethod(node: TSESTree.Node): boolean;
2401
2401
 
2402
2402
  declare function isKeyLiteralLike(node: TSESTree.MemberExpression | TSESTree.MethodDefinition | TSESTree.Property | TSESTree.PropertyDefinition, property: TSESTree.Node): boolean;
2403
2403
 
package/dist/index.js CHANGED
@@ -41,7 +41,9 @@ function findParentNodeStop(node, stopNode, predicate) {
41
41
  }
42
42
  function getFunctionInitPath(node) {
43
43
  const { parent } = node;
44
- if (node.type === types.AST_NODE_TYPES.FunctionDeclaration) return eff.O.some([node]);
44
+ if (node.type === types.AST_NODE_TYPES.FunctionDeclaration) {
45
+ return eff.O.some([node]);
46
+ }
45
47
  if (parent.type === types.AST_NODE_TYPES.VariableDeclarator) {
46
48
  return eff.O.some([
47
49
  parent.parent,
@@ -101,8 +103,12 @@ function hasCallInFunctionInitPath(callName) {
101
103
  eff.O.exists((nodes) => {
102
104
  return nodes.some(
103
105
  (n) => {
104
- if (n.type !== types.AST_NODE_TYPES.CallExpression) return false;
105
- if (n.callee.type === types.AST_NODE_TYPES.Identifier) return n.callee.name === callName;
106
+ if (n.type !== types.AST_NODE_TYPES.CallExpression) {
107
+ return false;
108
+ }
109
+ if (n.callee.type === types.AST_NODE_TYPES.Identifier) {
110
+ return n.callee.name === callName;
111
+ }
106
112
  return "property" in n.callee && "name" in n.callee.property && n.callee.property.name === callName;
107
113
  }
108
114
  );
@@ -111,7 +117,9 @@ function hasCallInFunctionInitPath(callName) {
111
117
  };
112
118
  }
113
119
  function getClassIdentifier(node) {
114
- if (node.id) return eff.O.fromNullable(node.id);
120
+ if (node.id) {
121
+ return eff.O.fromNullable(node.id);
122
+ }
115
123
  if (node.parent.type === types.AST_NODE_TYPES.VariableDeclarator && node.parent.id.type === types.AST_NODE_TYPES.Identifier) {
116
124
  return eff.O.fromNullable(node.parent.id);
117
125
  }
@@ -286,7 +294,9 @@ function getFunctionIdentifier(node) {
286
294
  return eff.O.none();
287
295
  }
288
296
  function getIdentifiersFromBinaryExpression(side) {
289
- if (side.type === types.AST_NODE_TYPES.Identifier) return [side];
297
+ if (side.type === types.AST_NODE_TYPES.Identifier) {
298
+ return [side];
299
+ }
290
300
  if (side.type === types.AST_NODE_TYPES.BinaryExpression) {
291
301
  return [
292
302
  ...getIdentifiersFromBinaryExpression(side.left),
@@ -453,9 +463,13 @@ function getNestedReturnStatements(node) {
453
463
  const functionNode = isFunction(node) ? node : eff.O.getOrNull(findParentNodeGuard(node, isFunction));
454
464
  typescriptEstree.simpleTraverse(node, {
455
465
  enter(node2) {
456
- if (node2.type !== types.AST_NODE_TYPES.ReturnStatement) return;
466
+ if (node2.type !== types.AST_NODE_TYPES.ReturnStatement) {
467
+ return;
468
+ }
457
469
  const parentFunction = eff.O.getOrNull(findParentNodeGuard(node2, isFunction));
458
- if (parentFunction !== functionNode) return;
470
+ if (parentFunction !== functionNode) {
471
+ return;
472
+ }
459
473
  returnStatements.push(node2);
460
474
  }
461
475
  });
@@ -474,43 +488,31 @@ function getTopLevelIdentifier(node) {
474
488
  function isEmptyFunction(node) {
475
489
  return node.body.type === types.AST_NODE_TYPES.BlockStatement && node.body.body.length === 0;
476
490
  }
477
- var isFunctionOfClassMethod = tsPattern.isMatching({
478
- type: tsPattern.P.union([types.AST_NODE_TYPES.FunctionExpression, types.AST_NODE_TYPES.ArrowFunctionExpression]),
479
- parent: {
480
- type: types.AST_NODE_TYPES.MethodDefinition,
481
- parent: {
482
- type: types.AST_NODE_TYPES.ClassBody
483
- }
484
- }
485
- });
486
- var isFunctionOfClassProperty = tsPattern.isMatching({
487
- type: tsPattern.P.union([types.AST_NODE_TYPES.FunctionExpression, types.AST_NODE_TYPES.ArrowFunctionExpression]),
488
- parent: {
489
- type: types.AST_NODE_TYPES.Property,
490
- parent: {
491
- type: types.AST_NODE_TYPES.ClassBody
492
- }
493
- }
494
- });
491
+ function isFunctionOfClassMethod(node) {
492
+ return (node.type === types.AST_NODE_TYPES.FunctionExpression || node.type === types.AST_NODE_TYPES.ArrowFunctionExpression) && node.parent.type === types.AST_NODE_TYPES.MethodDefinition;
493
+ }
494
+ function isFunctionOfClassProperty(node) {
495
+ return (node.type === types.AST_NODE_TYPES.FunctionExpression || node.type === types.AST_NODE_TYPES.ArrowFunctionExpression) && node.parent.type === types.AST_NODE_TYPES.Property;
496
+ }
495
497
  function isFunctionOfImmediatelyInvoked(node) {
496
498
  return node.type !== types.AST_NODE_TYPES.FunctionDeclaration && node.parent.type === types.AST_NODE_TYPES.CallExpression && node.parent.callee === node;
497
499
  }
498
- var isFunctionOfObjectMethod = tsPattern.isMatching({
499
- type: tsPattern.P.union([types.AST_NODE_TYPES.FunctionExpression, types.AST_NODE_TYPES.ArrowFunctionExpression]),
500
- parent: {
501
- type: types.AST_NODE_TYPES.Property,
502
- parent: {
503
- type: types.AST_NODE_TYPES.ObjectExpression
504
- }
505
- }
506
- });
500
+ function isFunctionOfObjectMethod(node) {
501
+ return (node.type === types.AST_NODE_TYPES.FunctionExpression || node.type === types.AST_NODE_TYPES.ArrowFunctionExpression) && node.parent.type === types.AST_NODE_TYPES.Property && node.parent.parent.type === types.AST_NODE_TYPES.ObjectExpression;
502
+ }
507
503
  function isKeyLiteralLike(node, property) {
508
504
  return tsPattern.match(property).with({ type: types.AST_NODE_TYPES.Literal }, eff.F.constTrue).with({ type: types.AST_NODE_TYPES.TemplateLiteral, expressions: [] }, eff.F.constTrue).with({ type: types.AST_NODE_TYPES.Identifier }, () => !node.computed).otherwise(eff.F.constFalse);
509
505
  }
510
506
  function isMapCallLoose(node) {
511
- if (node.type !== types.AST_NODE_TYPES.CallExpression) return false;
512
- if (node.callee.type !== types.AST_NODE_TYPES.MemberExpression) return false;
513
- if (node.callee.property.type !== types.AST_NODE_TYPES.Identifier) return false;
507
+ if (node.type !== types.AST_NODE_TYPES.CallExpression) {
508
+ return false;
509
+ }
510
+ if (node.callee.type !== types.AST_NODE_TYPES.MemberExpression) {
511
+ return false;
512
+ }
513
+ if (node.callee.property.type !== types.AST_NODE_TYPES.Identifier) {
514
+ return false;
515
+ }
514
516
  const { name } = node.callee.property;
515
517
  return name === "map" || name.endsWith("Map");
516
518
  }
@@ -530,9 +532,15 @@ var isNodeEqual = eff.F.dual(2, (a, b) => {
530
532
  case (a.type === types.AST_NODE_TYPES.TemplateElement && b.type === types.AST_NODE_TYPES.TemplateElement):
531
533
  return a.value.raw === b.value.raw;
532
534
  case (a.type === types.AST_NODE_TYPES.TemplateLiteral && b.type === types.AST_NODE_TYPES.TemplateLiteral):
533
- if (a.quasis.length !== b.quasis.length || a.expressions.length !== b.expressions.length) return false;
534
- if (!types$1.zip(a.quasis, b.quasis).every(([a2, b2]) => isNodeEqual(a2, b2))) return false;
535
- if (!types$1.zip(a.expressions, b.expressions).every(([a2, b2]) => isNodeEqual(a2, b2))) return false;
535
+ if (a.quasis.length !== b.quasis.length || a.expressions.length !== b.expressions.length) {
536
+ return false;
537
+ }
538
+ if (!types$1.zip(a.quasis, b.quasis).every(([a2, b2]) => isNodeEqual(a2, b2))) {
539
+ return false;
540
+ }
541
+ if (!types$1.zip(a.expressions, b.expressions).every(([a2, b2]) => isNodeEqual(a2, b2))) {
542
+ return false;
543
+ }
536
544
  return true;
537
545
  case (a.type === types.AST_NODE_TYPES.Identifier && b.type === types.AST_NODE_TYPES.Identifier):
538
546
  return a.name === b.name;
@@ -541,8 +549,12 @@ var isNodeEqual = eff.F.dual(2, (a, b) => {
541
549
  case (a.type === types.AST_NODE_TYPES.MemberExpression && b.type === types.AST_NODE_TYPES.MemberExpression):
542
550
  return isNodeEqual(a.property, b.property) && isNodeEqual(a.object, b.object);
543
551
  case (a.type === types.AST_NODE_TYPES.JSXAttribute && b.type === types.AST_NODE_TYPES.JSXAttribute): {
544
- if (a.name.name !== b.name.name) return false;
545
- if (a.value === null || b.value === null) return a.value === b.value;
552
+ if (a.name.name !== b.name.name) {
553
+ return false;
554
+ }
555
+ if (a.value === null || b.value === null) {
556
+ return a.value === b.value;
557
+ }
546
558
  return isNodeEqual(a.value, b.value);
547
559
  }
548
560
  case (a.type === types.AST_NODE_TYPES.ThisExpression && b.type === types.AST_NODE_TYPES.ThisExpression):
@@ -587,16 +599,22 @@ function toReadableNodeName(node, getText) {
587
599
  }
588
600
  function toReadableNodeType(node) {
589
601
  if (node.type === types.AST_NODE_TYPES.Literal) {
590
- if ("regex" in node) return "RegExp literal";
602
+ if ("regex" in node) {
603
+ return "RegExp literal";
604
+ }
591
605
  return `${getLiteralValueType(node.value)} literal`;
592
606
  }
593
- if (isJSX(node)) return `JSX ${stringTs.toLowerCase(stringTs.delimiterCase(stringTs.replace(node.type, "JSX", ""), " "))}`;
607
+ if (isJSX(node)) {
608
+ return `JSX ${stringTs.toLowerCase(stringTs.delimiterCase(stringTs.replace(node.type, "JSX", ""), " "))}`;
609
+ }
594
610
  return stringTs.toLowerCase(stringTs.delimiterCase(node.type, " "));
595
611
  }
596
612
 
597
613
  // src/unwrap-type-expression.ts
598
614
  function unwrapTypeExpression(node) {
599
- if (isTypeExpression(node)) return unwrapTypeExpression(node.expression);
615
+ if (isTypeExpression(node)) {
616
+ return unwrapTypeExpression(node.expression);
617
+ }
600
618
  return node;
601
619
  }
602
620
 
package/dist/index.mjs CHANGED
@@ -1,7 +1,7 @@
1
1
  import { F, O, or, isString } from '@eslint-react/eff';
2
2
  import { AST_NODE_TYPES } from '@typescript-eslint/types';
3
3
  import { ASTUtils } from '@typescript-eslint/utils';
4
- import { isMatching, P, match } from 'ts-pattern';
4
+ import { match, P } from 'ts-pattern';
5
5
  import { AST_NODE_TYPES as AST_NODE_TYPES$1, simpleTraverse } from '@typescript-eslint/typescript-estree';
6
6
  import { zip } from '@eslint-react/types';
7
7
  import { toLowerCase, delimiterCase, replace } from 'string-ts';
@@ -39,7 +39,9 @@ function findParentNodeStop(node, stopNode, predicate) {
39
39
  }
40
40
  function getFunctionInitPath(node) {
41
41
  const { parent } = node;
42
- if (node.type === AST_NODE_TYPES.FunctionDeclaration) return O.some([node]);
42
+ if (node.type === AST_NODE_TYPES.FunctionDeclaration) {
43
+ return O.some([node]);
44
+ }
43
45
  if (parent.type === AST_NODE_TYPES.VariableDeclarator) {
44
46
  return O.some([
45
47
  parent.parent,
@@ -99,8 +101,12 @@ function hasCallInFunctionInitPath(callName) {
99
101
  O.exists((nodes) => {
100
102
  return nodes.some(
101
103
  (n) => {
102
- if (n.type !== AST_NODE_TYPES.CallExpression) return false;
103
- if (n.callee.type === AST_NODE_TYPES.Identifier) return n.callee.name === callName;
104
+ if (n.type !== AST_NODE_TYPES.CallExpression) {
105
+ return false;
106
+ }
107
+ if (n.callee.type === AST_NODE_TYPES.Identifier) {
108
+ return n.callee.name === callName;
109
+ }
104
110
  return "property" in n.callee && "name" in n.callee.property && n.callee.property.name === callName;
105
111
  }
106
112
  );
@@ -109,7 +115,9 @@ function hasCallInFunctionInitPath(callName) {
109
115
  };
110
116
  }
111
117
  function getClassIdentifier(node) {
112
- if (node.id) return O.fromNullable(node.id);
118
+ if (node.id) {
119
+ return O.fromNullable(node.id);
120
+ }
113
121
  if (node.parent.type === AST_NODE_TYPES.VariableDeclarator && node.parent.id.type === AST_NODE_TYPES.Identifier) {
114
122
  return O.fromNullable(node.parent.id);
115
123
  }
@@ -284,7 +292,9 @@ function getFunctionIdentifier(node) {
284
292
  return O.none();
285
293
  }
286
294
  function getIdentifiersFromBinaryExpression(side) {
287
- if (side.type === AST_NODE_TYPES.Identifier) return [side];
295
+ if (side.type === AST_NODE_TYPES.Identifier) {
296
+ return [side];
297
+ }
288
298
  if (side.type === AST_NODE_TYPES.BinaryExpression) {
289
299
  return [
290
300
  ...getIdentifiersFromBinaryExpression(side.left),
@@ -451,9 +461,13 @@ function getNestedReturnStatements(node) {
451
461
  const functionNode = isFunction(node) ? node : O.getOrNull(findParentNodeGuard(node, isFunction));
452
462
  simpleTraverse(node, {
453
463
  enter(node2) {
454
- if (node2.type !== AST_NODE_TYPES.ReturnStatement) return;
464
+ if (node2.type !== AST_NODE_TYPES.ReturnStatement) {
465
+ return;
466
+ }
455
467
  const parentFunction = O.getOrNull(findParentNodeGuard(node2, isFunction));
456
- if (parentFunction !== functionNode) return;
468
+ if (parentFunction !== functionNode) {
469
+ return;
470
+ }
457
471
  returnStatements.push(node2);
458
472
  }
459
473
  });
@@ -472,43 +486,31 @@ function getTopLevelIdentifier(node) {
472
486
  function isEmptyFunction(node) {
473
487
  return node.body.type === AST_NODE_TYPES.BlockStatement && node.body.body.length === 0;
474
488
  }
475
- var isFunctionOfClassMethod = isMatching({
476
- type: P.union([AST_NODE_TYPES.FunctionExpression, AST_NODE_TYPES.ArrowFunctionExpression]),
477
- parent: {
478
- type: AST_NODE_TYPES.MethodDefinition,
479
- parent: {
480
- type: AST_NODE_TYPES.ClassBody
481
- }
482
- }
483
- });
484
- var isFunctionOfClassProperty = isMatching({
485
- type: P.union([AST_NODE_TYPES.FunctionExpression, AST_NODE_TYPES.ArrowFunctionExpression]),
486
- parent: {
487
- type: AST_NODE_TYPES.Property,
488
- parent: {
489
- type: AST_NODE_TYPES.ClassBody
490
- }
491
- }
492
- });
489
+ function isFunctionOfClassMethod(node) {
490
+ return (node.type === AST_NODE_TYPES.FunctionExpression || node.type === AST_NODE_TYPES.ArrowFunctionExpression) && node.parent.type === AST_NODE_TYPES.MethodDefinition;
491
+ }
492
+ function isFunctionOfClassProperty(node) {
493
+ return (node.type === AST_NODE_TYPES.FunctionExpression || node.type === AST_NODE_TYPES.ArrowFunctionExpression) && node.parent.type === AST_NODE_TYPES.Property;
494
+ }
493
495
  function isFunctionOfImmediatelyInvoked(node) {
494
496
  return node.type !== AST_NODE_TYPES.FunctionDeclaration && node.parent.type === AST_NODE_TYPES.CallExpression && node.parent.callee === node;
495
497
  }
496
- var isFunctionOfObjectMethod = isMatching({
497
- type: P.union([AST_NODE_TYPES.FunctionExpression, AST_NODE_TYPES.ArrowFunctionExpression]),
498
- parent: {
499
- type: AST_NODE_TYPES.Property,
500
- parent: {
501
- type: AST_NODE_TYPES.ObjectExpression
502
- }
503
- }
504
- });
498
+ function isFunctionOfObjectMethod(node) {
499
+ return (node.type === AST_NODE_TYPES.FunctionExpression || node.type === AST_NODE_TYPES.ArrowFunctionExpression) && node.parent.type === AST_NODE_TYPES.Property && node.parent.parent.type === AST_NODE_TYPES.ObjectExpression;
500
+ }
505
501
  function isKeyLiteralLike(node, property) {
506
502
  return match(property).with({ type: AST_NODE_TYPES.Literal }, F.constTrue).with({ type: AST_NODE_TYPES.TemplateLiteral, expressions: [] }, F.constTrue).with({ type: AST_NODE_TYPES.Identifier }, () => !node.computed).otherwise(F.constFalse);
507
503
  }
508
504
  function isMapCallLoose(node) {
509
- if (node.type !== AST_NODE_TYPES.CallExpression) return false;
510
- if (node.callee.type !== AST_NODE_TYPES.MemberExpression) return false;
511
- if (node.callee.property.type !== AST_NODE_TYPES.Identifier) return false;
505
+ if (node.type !== AST_NODE_TYPES.CallExpression) {
506
+ return false;
507
+ }
508
+ if (node.callee.type !== AST_NODE_TYPES.MemberExpression) {
509
+ return false;
510
+ }
511
+ if (node.callee.property.type !== AST_NODE_TYPES.Identifier) {
512
+ return false;
513
+ }
512
514
  const { name } = node.callee.property;
513
515
  return name === "map" || name.endsWith("Map");
514
516
  }
@@ -528,9 +530,15 @@ var isNodeEqual = F.dual(2, (a, b) => {
528
530
  case (a.type === AST_NODE_TYPES.TemplateElement && b.type === AST_NODE_TYPES.TemplateElement):
529
531
  return a.value.raw === b.value.raw;
530
532
  case (a.type === AST_NODE_TYPES.TemplateLiteral && b.type === AST_NODE_TYPES.TemplateLiteral):
531
- if (a.quasis.length !== b.quasis.length || a.expressions.length !== b.expressions.length) return false;
532
- if (!zip(a.quasis, b.quasis).every(([a2, b2]) => isNodeEqual(a2, b2))) return false;
533
- if (!zip(a.expressions, b.expressions).every(([a2, b2]) => isNodeEqual(a2, b2))) return false;
533
+ if (a.quasis.length !== b.quasis.length || a.expressions.length !== b.expressions.length) {
534
+ return false;
535
+ }
536
+ if (!zip(a.quasis, b.quasis).every(([a2, b2]) => isNodeEqual(a2, b2))) {
537
+ return false;
538
+ }
539
+ if (!zip(a.expressions, b.expressions).every(([a2, b2]) => isNodeEqual(a2, b2))) {
540
+ return false;
541
+ }
534
542
  return true;
535
543
  case (a.type === AST_NODE_TYPES.Identifier && b.type === AST_NODE_TYPES.Identifier):
536
544
  return a.name === b.name;
@@ -539,8 +547,12 @@ var isNodeEqual = F.dual(2, (a, b) => {
539
547
  case (a.type === AST_NODE_TYPES.MemberExpression && b.type === AST_NODE_TYPES.MemberExpression):
540
548
  return isNodeEqual(a.property, b.property) && isNodeEqual(a.object, b.object);
541
549
  case (a.type === AST_NODE_TYPES.JSXAttribute && b.type === AST_NODE_TYPES.JSXAttribute): {
542
- if (a.name.name !== b.name.name) return false;
543
- if (a.value === null || b.value === null) return a.value === b.value;
550
+ if (a.name.name !== b.name.name) {
551
+ return false;
552
+ }
553
+ if (a.value === null || b.value === null) {
554
+ return a.value === b.value;
555
+ }
544
556
  return isNodeEqual(a.value, b.value);
545
557
  }
546
558
  case (a.type === AST_NODE_TYPES.ThisExpression && b.type === AST_NODE_TYPES.ThisExpression):
@@ -585,16 +597,22 @@ function toReadableNodeName(node, getText) {
585
597
  }
586
598
  function toReadableNodeType(node) {
587
599
  if (node.type === AST_NODE_TYPES.Literal) {
588
- if ("regex" in node) return "RegExp literal";
600
+ if ("regex" in node) {
601
+ return "RegExp literal";
602
+ }
589
603
  return `${getLiteralValueType(node.value)} literal`;
590
604
  }
591
- if (isJSX(node)) return `JSX ${toLowerCase(delimiterCase(replace(node.type, "JSX", ""), " "))}`;
605
+ if (isJSX(node)) {
606
+ return `JSX ${toLowerCase(delimiterCase(replace(node.type, "JSX", ""), " "))}`;
607
+ }
592
608
  return toLowerCase(delimiterCase(node.type, " "));
593
609
  }
594
610
 
595
611
  // src/unwrap-type-expression.ts
596
612
  function unwrapTypeExpression(node) {
597
- if (isTypeExpression(node)) return unwrapTypeExpression(node.expression);
613
+ if (isTypeExpression(node)) {
614
+ return unwrapTypeExpression(node.expression);
615
+ }
598
616
  return node;
599
617
  }
600
618
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@eslint-react/ast",
3
- "version": "1.23.2-next.6",
3
+ "version": "1.23.3-beta.2",
4
4
  "description": "ESLint React's TSESTree AST utility module.",
5
5
  "homepage": "https://github.com/rEl1cx/eslint-react",
6
6
  "bugs": {
@@ -13,6 +13,7 @@
13
13
  },
14
14
  "license": "MIT",
15
15
  "author": "Eva1ent<rel1cx@proton.me>",
16
+ "sideEffects": false,
16
17
  "exports": {
17
18
  ".": {
18
19
  "import": {
@@ -27,6 +28,7 @@
27
28
  "./package.json": "./package.json"
28
29
  },
29
30
  "main": "dist/index.js",
31
+ "module": "dist/index.mjs",
30
32
  "types": "dist/index.d.ts",
31
33
  "files": [
32
34
  "dist",
@@ -38,8 +40,8 @@
38
40
  "@typescript-eslint/utils": "^8.19.1",
39
41
  "string-ts": "^2.2.0",
40
42
  "ts-pattern": "^5.6.0",
41
- "@eslint-react/eff": "1.23.2-next.6",
42
- "@eslint-react/types": "1.23.2-next.6"
43
+ "@eslint-react/eff": "1.23.3-beta.2",
44
+ "@eslint-react/types": "1.23.3-beta.2"
43
45
  },
44
46
  "devDependencies": {
45
47
  "tsup": "^8.3.5",
@@ -49,8 +51,6 @@
49
51
  "bun": ">=1.0.15",
50
52
  "node": ">=18.18.0"
51
53
  },
52
- "sideEffects": false,
53
- "module": "dist/index.mjs",
54
54
  "scripts": {
55
55
  "build": "tsup",
56
56
  "lint:publish": "publint",