@eslint-react/ast 1.37.4-next.0 → 1.38.0-beta.10

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
@@ -1,8 +1,10 @@
1
1
  import { _ } from '@eslint-react/eff';
2
- import { TSESTree, AST_NODE_TYPES as AST_NODE_TYPES$1 } from '@typescript-eslint/types';
2
+ import { TSESTree } from '@typescript-eslint/types';
3
3
  import { TSESTree as TSESTree$1 } from '@typescript-eslint/utils';
4
4
  import { AST_NODE_TYPES } from '@typescript-eslint/typescript-estree';
5
5
 
6
+ declare const ITERATOR_FUNCTION_INDEX_PARAM_POSITION: Map<string, number>;
7
+
6
8
  /**
7
9
  * Find the parent node that satisfies the test function
8
10
  * @param node The AST node
@@ -198,10 +200,10 @@ declare function getPropertyName(node: TSESTree.Node): string | _;
198
200
 
199
201
  declare function getTopLevelIdentifier(node: TSESTree.Node): TSESTree.Identifier | _;
200
202
 
201
- declare const is: <NodeType extends AST_NODE_TYPES$1>(nodeType: NodeType) => (node: TSESTree$1.Node | null | undefined) => node is Extract<TSESTree$1.Node, {
203
+ declare const is: <NodeType extends TSESTree$1.AST_NODE_TYPES>(nodeType: NodeType) => (node: TSESTree$1.Node | null | undefined) => node is Extract<TSESTree$1.Node, {
202
204
  type: NodeType;
203
205
  }>;
204
- declare const isOneOf: <NodeTypes extends readonly AST_NODE_TYPES$1[]>(nodeTypes: NodeTypes) => (node: TSESTree$1.Node | null | undefined) => node is Extract<TSESTree$1.Node, {
206
+ declare const isOneOf: <NodeTypes extends readonly TSESTree$1.AST_NODE_TYPES[]>(nodeTypes: NodeTypes) => (node: TSESTree$1.Node | null | undefined) => node is Extract<TSESTree$1.Node, {
205
207
  type: NodeTypes[number];
206
208
  }>;
207
209
  declare const isFunction: (node: TSESTree$1.Node | null | undefined) => node is TSESTree$1.ArrowFunctionExpression | TSESTree$1.FunctionDeclarationWithName | TSESTree$1.FunctionDeclarationWithOptionalName | TSESTree$1.FunctionExpression;
@@ -224,6 +226,8 @@ declare const isLeftHandSideExpressionType: (node: TSESTree$1.Node | null | unde
224
226
  declare const isTypeExpression: (node: TSESTree$1.Node | null | undefined) => node is TSESTree$1.TSAsExpression | TSESTree$1.TSInstantiationExpression | TSESTree$1.TSNonNullExpression | TSESTree$1.TSSatisfiesExpression | TSESTree$1.TSTypeAssertion;
225
227
  declare const isTypeAssertionExpression: (node: TSESTree$1.Node | null | undefined) => node is TSESTree$1.TSAsExpression | TSESTree$1.TSNonNullExpression | TSESTree$1.TSSatisfiesExpression | TSESTree$1.TSTypeAssertion;
226
228
 
229
+ declare function isArrayMapCallLoose(node: TSESTree.Node): node is TSESTree.CallExpression;
230
+
227
231
  declare function isEmptyFunction(node: TSESTreeFunction): boolean;
228
232
 
229
233
  declare function isKindOfLiteral(node: TSESTree.Node, kind: "boolean"): node is TSESTree.BooleanLiteral;
@@ -232,8 +236,6 @@ declare function isKindOfLiteral(node: TSESTree.Node, kind: "number"): node is T
232
236
  declare function isKindOfLiteral(node: TSESTree.Node, kind: "regexp"): node is TSESTree.RegExpLiteral;
233
237
  declare function isKindOfLiteral(node: TSESTree.Node, kind: "string"): node is TSESTree.StringLiteral;
234
238
 
235
- declare function isMapCallLoose(node: TSESTree.Node): node is TSESTree.CallExpression;
236
-
237
239
  /**
238
240
  * Check if a node is multiline
239
241
  * @param node The AST node to check
@@ -271,4 +273,4 @@ declare function toReadableNodeName(node: TSESTree.Node, getText: (node: TSESTre
271
273
  declare function toReadableNodeType(node: TSESTree.Node): "property" | "RegExp literal" | "string literal" | "number literal" | "bigint literal" | "boolean literal" | "symbol literal" | "undefined literal" | "object literal" | "function literal" | "null literal" | "identifier" | "member expression" | "JSX attribute" | "JSX element" | "JSX fragment" | "JSX identifier" | "JSX text" | "JSX closing element" | "JSX closing fragment" | "JSX empty expression" | "JSX expression container" | "JSX member expression" | "JSX namespaced name" | "JSX opening element" | "JSX opening fragment" | "JSX spread attribute" | "JSX spread child" | "decorator" | "program" | "super" | "accessor property" | "array expression" | "array pattern" | "function expression" | "arrow function expression" | "assignment expression" | "assignment pattern" | "await expression" | "binary expression" | "block statement" | "break statement" | "call expression" | "catch clause" | "chain expression" | "class body" | "class declaration" | "class expression" | "conditional expression" | "continue statement" | "debugger statement" | "while statement" | "do while statement" | "empty statement" | "export all declaration" | "export default declaration" | "export named declaration" | "export specifier" | "expression statement" | "for in statement" | "for of statement" | "for statement" | "function declaration" | "if statement" | "import attribute" | "import declaration" | "import default specifier" | "import expression" | "import namespace specifier" | "import specifier" | "labeled statement" | "logical expression" | "meta property" | "method definition" | "new expression" | "object expression" | "object pattern" | "private identifier" | "property definition" | "rest element" | "return statement" | "sequence expression" | "spread element" | "static block" | "switch case" | "switch statement" | "tagged template expression" | "template element" | "template literal" | "this expression" | "throw statement" | "try statement" | "unary expression" | "update expression" | "variable declaration" | "variable declarator" | "with statement" | "yield expression" | "ts abstract accessor property" | "ts abstract keyword" | "ts abstract method definition" | "ts abstract property definition" | "ts any keyword" | "ts array type" | "ts as expression" | "ts async keyword" | "ts big int keyword" | "ts boolean keyword" | "ts call signature declaration" | "ts class implements" | "ts conditional type" | "ts constructor type" | "ts construct signature declaration" | "ts declare function" | "ts declare keyword" | "ts empty body function expression" | "ts enum body" | "ts enum declaration" | "ts enum member" | "ts export assignment" | "ts export keyword" | "ts external module reference" | "ts function type" | "ts import equals declaration" | "ts import type" | "ts indexed access type" | "ts index signature" | "ts infer type" | "ts instantiation expression" | "ts interface body" | "ts interface declaration" | "ts interface heritage" | "ts intersection type" | "ts intrinsic keyword" | "ts literal type" | "ts mapped type" | "ts method signature" | "ts module block" | "ts module declaration" | "ts named tuple member" | "ts namespace export declaration" | "ts never keyword" | "ts non null expression" | "ts null keyword" | "ts number keyword" | "ts object keyword" | "ts optional type" | "ts parameter property" | "ts private keyword" | "ts property signature" | "ts protected keyword" | "ts public keyword" | "ts qualified name" | "ts readonly keyword" | "ts rest type" | "ts satisfies expression" | "ts static keyword" | "ts string keyword" | "ts symbol keyword" | "ts template literal type" | "ts this type" | "ts tuple type" | "ts type alias declaration" | "ts type annotation" | "ts type assertion" | "ts type literal" | "ts type operator" | "ts type parameter" | "ts type parameter declaration" | "ts type parameter instantiation" | "ts type predicate" | "ts type query" | "ts type reference" | "ts undefined keyword" | "ts union type" | "ts unknown keyword" | "ts void keyword";
272
274
  type ReadableNodeType = ReturnType<typeof toReadableNodeType>;
273
275
 
274
- export { type FunctionInitPath, type ReadableNodeType, type TSESTreeArrayTupleType, type TSESTreeClass, type TSESTreeDestructuringPattern, type TSESTreeFunction, type TSESTreeFunctionType, type TSESTreeJSX, type TSESTreeLoop, type TSESTreeMethodOrProperty, type TSESTreeProperty, type TSESTreeTypeAssertionExpression, type TSESTreeTypeDeclaration, type TSESTreeTypeExpression, findParentNode, getClassIdentifier, getEcmaExpression, getFunctionIdentifier, getFunctionInitPath, getLiteralValueType, getNestedCallExpressions, getNestedExpressionsOfType, getNestedIdentifiers, getNestedNewExpressions, getNestedReturnStatements, getPropertyName, getTopLevelIdentifier, hasCallInFunctionInitPath, is, isArrayTupleType, isClass, isConditional, isControlFlow, isDestructuringPattern, isEmptyFunction, isFunction, isFunctionType, isJSX, isJSXElement, isJSXFragment, isJSXTagNameExpression, isKindOfLiteral, isLeftHandSideExpression, isLeftHandSideExpressionType, isLoop, isMapCallLoose, isMethodOrProperty, isMultiLine, isNodeEqual, isOneOf, isProperty, isThisExpression, isTypeAssertionExpression, isTypeDeclaration, isTypeExpression, toReadableNodeName, toReadableNodeType };
276
+ export { type FunctionInitPath, ITERATOR_FUNCTION_INDEX_PARAM_POSITION, type ReadableNodeType, type TSESTreeArrayTupleType, type TSESTreeClass, type TSESTreeDestructuringPattern, type TSESTreeFunction, type TSESTreeFunctionType, type TSESTreeJSX, type TSESTreeLoop, type TSESTreeMethodOrProperty, type TSESTreeProperty, type TSESTreeTypeAssertionExpression, type TSESTreeTypeDeclaration, type TSESTreeTypeExpression, findParentNode, getClassIdentifier, getEcmaExpression, getFunctionIdentifier, getFunctionInitPath, getLiteralValueType, getNestedCallExpressions, getNestedExpressionsOfType, getNestedIdentifiers, getNestedNewExpressions, getNestedReturnStatements, getPropertyName, getTopLevelIdentifier, hasCallInFunctionInitPath, is, isArrayMapCallLoose, isArrayTupleType, isClass, isConditional, isControlFlow, isDestructuringPattern, isEmptyFunction, isFunction, isFunctionType, isJSX, isJSXElement, isJSXFragment, isJSXTagNameExpression, isKindOfLiteral, isLeftHandSideExpression, isLeftHandSideExpressionType, isLoop, isMethodOrProperty, isMultiLine, isNodeEqual, isOneOf, isProperty, isThisExpression, isTypeAssertionExpression, isTypeDeclaration, isTypeExpression, toReadableNodeName, toReadableNodeType };
package/dist/index.d.ts CHANGED
@@ -1,8 +1,10 @@
1
1
  import { _ } from '@eslint-react/eff';
2
- import { TSESTree, AST_NODE_TYPES as AST_NODE_TYPES$1 } from '@typescript-eslint/types';
2
+ import { TSESTree } from '@typescript-eslint/types';
3
3
  import { TSESTree as TSESTree$1 } from '@typescript-eslint/utils';
4
4
  import { AST_NODE_TYPES } from '@typescript-eslint/typescript-estree';
5
5
 
6
+ declare const ITERATOR_FUNCTION_INDEX_PARAM_POSITION: Map<string, number>;
7
+
6
8
  /**
7
9
  * Find the parent node that satisfies the test function
8
10
  * @param node The AST node
@@ -198,10 +200,10 @@ declare function getPropertyName(node: TSESTree.Node): string | _;
198
200
 
199
201
  declare function getTopLevelIdentifier(node: TSESTree.Node): TSESTree.Identifier | _;
200
202
 
201
- declare const is: <NodeType extends AST_NODE_TYPES$1>(nodeType: NodeType) => (node: TSESTree$1.Node | null | undefined) => node is Extract<TSESTree$1.Node, {
203
+ declare const is: <NodeType extends TSESTree$1.AST_NODE_TYPES>(nodeType: NodeType) => (node: TSESTree$1.Node | null | undefined) => node is Extract<TSESTree$1.Node, {
202
204
  type: NodeType;
203
205
  }>;
204
- declare const isOneOf: <NodeTypes extends readonly AST_NODE_TYPES$1[]>(nodeTypes: NodeTypes) => (node: TSESTree$1.Node | null | undefined) => node is Extract<TSESTree$1.Node, {
206
+ declare const isOneOf: <NodeTypes extends readonly TSESTree$1.AST_NODE_TYPES[]>(nodeTypes: NodeTypes) => (node: TSESTree$1.Node | null | undefined) => node is Extract<TSESTree$1.Node, {
205
207
  type: NodeTypes[number];
206
208
  }>;
207
209
  declare const isFunction: (node: TSESTree$1.Node | null | undefined) => node is TSESTree$1.ArrowFunctionExpression | TSESTree$1.FunctionDeclarationWithName | TSESTree$1.FunctionDeclarationWithOptionalName | TSESTree$1.FunctionExpression;
@@ -224,6 +226,8 @@ declare const isLeftHandSideExpressionType: (node: TSESTree$1.Node | null | unde
224
226
  declare const isTypeExpression: (node: TSESTree$1.Node | null | undefined) => node is TSESTree$1.TSAsExpression | TSESTree$1.TSInstantiationExpression | TSESTree$1.TSNonNullExpression | TSESTree$1.TSSatisfiesExpression | TSESTree$1.TSTypeAssertion;
225
227
  declare const isTypeAssertionExpression: (node: TSESTree$1.Node | null | undefined) => node is TSESTree$1.TSAsExpression | TSESTree$1.TSNonNullExpression | TSESTree$1.TSSatisfiesExpression | TSESTree$1.TSTypeAssertion;
226
228
 
229
+ declare function isArrayMapCallLoose(node: TSESTree.Node): node is TSESTree.CallExpression;
230
+
227
231
  declare function isEmptyFunction(node: TSESTreeFunction): boolean;
228
232
 
229
233
  declare function isKindOfLiteral(node: TSESTree.Node, kind: "boolean"): node is TSESTree.BooleanLiteral;
@@ -232,8 +236,6 @@ declare function isKindOfLiteral(node: TSESTree.Node, kind: "number"): node is T
232
236
  declare function isKindOfLiteral(node: TSESTree.Node, kind: "regexp"): node is TSESTree.RegExpLiteral;
233
237
  declare function isKindOfLiteral(node: TSESTree.Node, kind: "string"): node is TSESTree.StringLiteral;
234
238
 
235
- declare function isMapCallLoose(node: TSESTree.Node): node is TSESTree.CallExpression;
236
-
237
239
  /**
238
240
  * Check if a node is multiline
239
241
  * @param node The AST node to check
@@ -271,4 +273,4 @@ declare function toReadableNodeName(node: TSESTree.Node, getText: (node: TSESTre
271
273
  declare function toReadableNodeType(node: TSESTree.Node): "property" | "RegExp literal" | "string literal" | "number literal" | "bigint literal" | "boolean literal" | "symbol literal" | "undefined literal" | "object literal" | "function literal" | "null literal" | "identifier" | "member expression" | "JSX attribute" | "JSX element" | "JSX fragment" | "JSX identifier" | "JSX text" | "JSX closing element" | "JSX closing fragment" | "JSX empty expression" | "JSX expression container" | "JSX member expression" | "JSX namespaced name" | "JSX opening element" | "JSX opening fragment" | "JSX spread attribute" | "JSX spread child" | "decorator" | "program" | "super" | "accessor property" | "array expression" | "array pattern" | "function expression" | "arrow function expression" | "assignment expression" | "assignment pattern" | "await expression" | "binary expression" | "block statement" | "break statement" | "call expression" | "catch clause" | "chain expression" | "class body" | "class declaration" | "class expression" | "conditional expression" | "continue statement" | "debugger statement" | "while statement" | "do while statement" | "empty statement" | "export all declaration" | "export default declaration" | "export named declaration" | "export specifier" | "expression statement" | "for in statement" | "for of statement" | "for statement" | "function declaration" | "if statement" | "import attribute" | "import declaration" | "import default specifier" | "import expression" | "import namespace specifier" | "import specifier" | "labeled statement" | "logical expression" | "meta property" | "method definition" | "new expression" | "object expression" | "object pattern" | "private identifier" | "property definition" | "rest element" | "return statement" | "sequence expression" | "spread element" | "static block" | "switch case" | "switch statement" | "tagged template expression" | "template element" | "template literal" | "this expression" | "throw statement" | "try statement" | "unary expression" | "update expression" | "variable declaration" | "variable declarator" | "with statement" | "yield expression" | "ts abstract accessor property" | "ts abstract keyword" | "ts abstract method definition" | "ts abstract property definition" | "ts any keyword" | "ts array type" | "ts as expression" | "ts async keyword" | "ts big int keyword" | "ts boolean keyword" | "ts call signature declaration" | "ts class implements" | "ts conditional type" | "ts constructor type" | "ts construct signature declaration" | "ts declare function" | "ts declare keyword" | "ts empty body function expression" | "ts enum body" | "ts enum declaration" | "ts enum member" | "ts export assignment" | "ts export keyword" | "ts external module reference" | "ts function type" | "ts import equals declaration" | "ts import type" | "ts indexed access type" | "ts index signature" | "ts infer type" | "ts instantiation expression" | "ts interface body" | "ts interface declaration" | "ts interface heritage" | "ts intersection type" | "ts intrinsic keyword" | "ts literal type" | "ts mapped type" | "ts method signature" | "ts module block" | "ts module declaration" | "ts named tuple member" | "ts namespace export declaration" | "ts never keyword" | "ts non null expression" | "ts null keyword" | "ts number keyword" | "ts object keyword" | "ts optional type" | "ts parameter property" | "ts private keyword" | "ts property signature" | "ts protected keyword" | "ts public keyword" | "ts qualified name" | "ts readonly keyword" | "ts rest type" | "ts satisfies expression" | "ts static keyword" | "ts string keyword" | "ts symbol keyword" | "ts template literal type" | "ts this type" | "ts tuple type" | "ts type alias declaration" | "ts type annotation" | "ts type assertion" | "ts type literal" | "ts type operator" | "ts type parameter" | "ts type parameter declaration" | "ts type parameter instantiation" | "ts type predicate" | "ts type query" | "ts type reference" | "ts undefined keyword" | "ts union type" | "ts unknown keyword" | "ts void keyword";
272
274
  type ReadableNodeType = ReturnType<typeof toReadableNodeType>;
273
275
 
274
- export { type FunctionInitPath, type ReadableNodeType, type TSESTreeArrayTupleType, type TSESTreeClass, type TSESTreeDestructuringPattern, type TSESTreeFunction, type TSESTreeFunctionType, type TSESTreeJSX, type TSESTreeLoop, type TSESTreeMethodOrProperty, type TSESTreeProperty, type TSESTreeTypeAssertionExpression, type TSESTreeTypeDeclaration, type TSESTreeTypeExpression, findParentNode, getClassIdentifier, getEcmaExpression, getFunctionIdentifier, getFunctionInitPath, getLiteralValueType, getNestedCallExpressions, getNestedExpressionsOfType, getNestedIdentifiers, getNestedNewExpressions, getNestedReturnStatements, getPropertyName, getTopLevelIdentifier, hasCallInFunctionInitPath, is, isArrayTupleType, isClass, isConditional, isControlFlow, isDestructuringPattern, isEmptyFunction, isFunction, isFunctionType, isJSX, isJSXElement, isJSXFragment, isJSXTagNameExpression, isKindOfLiteral, isLeftHandSideExpression, isLeftHandSideExpressionType, isLoop, isMapCallLoose, isMethodOrProperty, isMultiLine, isNodeEqual, isOneOf, isProperty, isThisExpression, isTypeAssertionExpression, isTypeDeclaration, isTypeExpression, toReadableNodeName, toReadableNodeType };
276
+ export { type FunctionInitPath, ITERATOR_FUNCTION_INDEX_PARAM_POSITION, type ReadableNodeType, type TSESTreeArrayTupleType, type TSESTreeClass, type TSESTreeDestructuringPattern, type TSESTreeFunction, type TSESTreeFunctionType, type TSESTreeJSX, type TSESTreeLoop, type TSESTreeMethodOrProperty, type TSESTreeProperty, type TSESTreeTypeAssertionExpression, type TSESTreeTypeDeclaration, type TSESTreeTypeExpression, findParentNode, getClassIdentifier, getEcmaExpression, getFunctionIdentifier, getFunctionInitPath, getLiteralValueType, getNestedCallExpressions, getNestedExpressionsOfType, getNestedIdentifiers, getNestedNewExpressions, getNestedReturnStatements, getPropertyName, getTopLevelIdentifier, hasCallInFunctionInitPath, is, isArrayMapCallLoose, isArrayTupleType, isClass, isConditional, isControlFlow, isDestructuringPattern, isEmptyFunction, isFunction, isFunctionType, isJSX, isJSXElement, isJSXFragment, isJSXTagNameExpression, isKindOfLiteral, isLeftHandSideExpression, isLeftHandSideExpressionType, isLoop, isMethodOrProperty, isMultiLine, isNodeEqual, isOneOf, isProperty, isThisExpression, isTypeAssertionExpression, isTypeDeclaration, isTypeExpression, toReadableNodeName, toReadableNodeType };
package/dist/index.js CHANGED
@@ -6,7 +6,21 @@ var utils = require('@typescript-eslint/utils');
6
6
  var typescriptEstree = require('@typescript-eslint/typescript-estree');
7
7
  var stringTs = require('string-ts');
8
8
 
9
- // src/find-parent-node.ts
9
+ // src/constants.ts
10
+ var ITERATOR_FUNCTION_INDEX_PARAM_POSITION = /* @__PURE__ */ new Map([
11
+ ["every", 1],
12
+ ["filter", 1],
13
+ ["find", 1],
14
+ ["findIndex", 1],
15
+ ["findLast", 1],
16
+ ["findLastIndex", 1],
17
+ ["flatMap", 1],
18
+ ["forEach", 1],
19
+ ["map", 1],
20
+ ["reduce", 2],
21
+ ["reduceRight", 2],
22
+ ["some", 1]
23
+ ]);
10
24
  function findParentNode(node, test) {
11
25
  if (node == null) return eff._;
12
26
  let parent = node.parent;
@@ -442,6 +456,13 @@ function getTopLevelIdentifier(node) {
442
456
  return eff._;
443
457
  }
444
458
  }
459
+ function isArrayMapCallLoose(node) {
460
+ if (node.type !== types.AST_NODE_TYPES.CallExpression) return false;
461
+ if (node.callee.type !== types.AST_NODE_TYPES.MemberExpression) return false;
462
+ if (node.callee.property.type !== types.AST_NODE_TYPES.Identifier) return false;
463
+ const { name } = node.callee.property;
464
+ return name === "map" || name.endsWith("Map");
465
+ }
445
466
  function isEmptyFunction(node) {
446
467
  return node.body.type === types.AST_NODE_TYPES.BlockStatement && node.body.body.length === 0;
447
468
  }
@@ -460,13 +481,6 @@ function isKindOfLiteral(node, kind) {
460
481
  return typeof node.value === "string";
461
482
  }
462
483
  }
463
- function isMapCallLoose(node) {
464
- if (node.type !== types.AST_NODE_TYPES.CallExpression) return false;
465
- if (node.callee.type !== types.AST_NODE_TYPES.MemberExpression) return false;
466
- if (node.callee.property.type !== types.AST_NODE_TYPES.Identifier) return false;
467
- const { name } = node.callee.property;
468
- return name === "map" || name.endsWith("Map");
469
- }
470
484
 
471
485
  // src/is-multi-line.ts
472
486
  function isMultiLine(node) {
@@ -562,6 +576,7 @@ function toReadableNodeType(node) {
562
576
  return stringTs.toLowerCase(stringTs.delimiterCase(node.type, " "));
563
577
  }
564
578
 
579
+ exports.ITERATOR_FUNCTION_INDEX_PARAM_POSITION = ITERATOR_FUNCTION_INDEX_PARAM_POSITION;
565
580
  exports.findParentNode = findParentNode;
566
581
  exports.getClassIdentifier = getClassIdentifier;
567
582
  exports.getEcmaExpression = getEcmaExpression;
@@ -577,6 +592,7 @@ exports.getPropertyName = getPropertyName;
577
592
  exports.getTopLevelIdentifier = getTopLevelIdentifier;
578
593
  exports.hasCallInFunctionInitPath = hasCallInFunctionInitPath;
579
594
  exports.is = is;
595
+ exports.isArrayMapCallLoose = isArrayMapCallLoose;
580
596
  exports.isArrayTupleType = isArrayTupleType;
581
597
  exports.isClass = isClass;
582
598
  exports.isConditional = isConditional;
@@ -593,7 +609,6 @@ exports.isKindOfLiteral = isKindOfLiteral;
593
609
  exports.isLeftHandSideExpression = isLeftHandSideExpression;
594
610
  exports.isLeftHandSideExpressionType = isLeftHandSideExpressionType;
595
611
  exports.isLoop = isLoop;
596
- exports.isMapCallLoose = isMapCallLoose;
597
612
  exports.isMethodOrProperty = isMethodOrProperty;
598
613
  exports.isMultiLine = isMultiLine;
599
614
  exports.isNodeEqual = isNodeEqual;
package/dist/index.mjs CHANGED
@@ -4,7 +4,21 @@ import { ASTUtils } from '@typescript-eslint/utils';
4
4
  import { AST_NODE_TYPES as AST_NODE_TYPES$1, simpleTraverse } from '@typescript-eslint/typescript-estree';
5
5
  import { toLowerCase, delimiterCase, replace } from 'string-ts';
6
6
 
7
- // src/find-parent-node.ts
7
+ // src/constants.ts
8
+ var ITERATOR_FUNCTION_INDEX_PARAM_POSITION = /* @__PURE__ */ new Map([
9
+ ["every", 1],
10
+ ["filter", 1],
11
+ ["find", 1],
12
+ ["findIndex", 1],
13
+ ["findLast", 1],
14
+ ["findLastIndex", 1],
15
+ ["flatMap", 1],
16
+ ["forEach", 1],
17
+ ["map", 1],
18
+ ["reduce", 2],
19
+ ["reduceRight", 2],
20
+ ["some", 1]
21
+ ]);
8
22
  function findParentNode(node, test) {
9
23
  if (node == null) return _;
10
24
  let parent = node.parent;
@@ -440,6 +454,13 @@ function getTopLevelIdentifier(node) {
440
454
  return _;
441
455
  }
442
456
  }
457
+ function isArrayMapCallLoose(node) {
458
+ if (node.type !== AST_NODE_TYPES.CallExpression) return false;
459
+ if (node.callee.type !== AST_NODE_TYPES.MemberExpression) return false;
460
+ if (node.callee.property.type !== AST_NODE_TYPES.Identifier) return false;
461
+ const { name } = node.callee.property;
462
+ return name === "map" || name.endsWith("Map");
463
+ }
443
464
  function isEmptyFunction(node) {
444
465
  return node.body.type === AST_NODE_TYPES.BlockStatement && node.body.body.length === 0;
445
466
  }
@@ -458,13 +479,6 @@ function isKindOfLiteral(node, kind) {
458
479
  return typeof node.value === "string";
459
480
  }
460
481
  }
461
- function isMapCallLoose(node) {
462
- if (node.type !== AST_NODE_TYPES.CallExpression) return false;
463
- if (node.callee.type !== AST_NODE_TYPES.MemberExpression) return false;
464
- if (node.callee.property.type !== AST_NODE_TYPES.Identifier) return false;
465
- const { name } = node.callee.property;
466
- return name === "map" || name.endsWith("Map");
467
- }
468
482
 
469
483
  // src/is-multi-line.ts
470
484
  function isMultiLine(node) {
@@ -560,4 +574,4 @@ function toReadableNodeType(node) {
560
574
  return toLowerCase(delimiterCase(node.type, " "));
561
575
  }
562
576
 
563
- export { findParentNode, getClassIdentifier, getEcmaExpression, getFunctionIdentifier, getFunctionInitPath, getLiteralValueType, getNestedCallExpressions, getNestedExpressionsOfType, getNestedIdentifiers, getNestedNewExpressions, getNestedReturnStatements, getPropertyName, getTopLevelIdentifier, hasCallInFunctionInitPath, is, isArrayTupleType, isClass, isConditional, isControlFlow, isDestructuringPattern, isEmptyFunction, isFunction, isFunctionType, isJSX, isJSXElement, isJSXFragment, isJSXTagNameExpression, isKindOfLiteral, isLeftHandSideExpression, isLeftHandSideExpressionType, isLoop, isMapCallLoose, isMethodOrProperty, isMultiLine, isNodeEqual, isOneOf, isProperty, isThisExpression, isTypeAssertionExpression, isTypeDeclaration, isTypeExpression, toReadableNodeName, toReadableNodeType };
577
+ export { ITERATOR_FUNCTION_INDEX_PARAM_POSITION, findParentNode, getClassIdentifier, getEcmaExpression, getFunctionIdentifier, getFunctionInitPath, getLiteralValueType, getNestedCallExpressions, getNestedExpressionsOfType, getNestedIdentifiers, getNestedNewExpressions, getNestedReturnStatements, getPropertyName, getTopLevelIdentifier, hasCallInFunctionInitPath, is, isArrayMapCallLoose, isArrayTupleType, isClass, isConditional, isControlFlow, isDestructuringPattern, isEmptyFunction, isFunction, isFunctionType, isJSX, isJSXElement, isJSXFragment, isJSXTagNameExpression, isKindOfLiteral, isLeftHandSideExpression, isLeftHandSideExpressionType, isLoop, isMethodOrProperty, isMultiLine, isNodeEqual, isOneOf, isProperty, isThisExpression, isTypeAssertionExpression, isTypeDeclaration, isTypeExpression, toReadableNodeName, toReadableNodeType };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@eslint-react/ast",
3
- "version": "1.37.4-next.0",
3
+ "version": "1.38.0-beta.10",
4
4
  "description": "ESLint React's TSESTree AST utility module.",
5
5
  "homepage": "https://github.com/Rel1cx/eslint-react",
6
6
  "bugs": {
@@ -40,7 +40,7 @@
40
40
  "@typescript-eslint/utils": "^8.27.0",
41
41
  "string-ts": "^2.2.1",
42
42
  "ts-pattern": "^5.6.2",
43
- "@eslint-react/eff": "1.37.4-next.0"
43
+ "@eslint-react/eff": "1.38.0-beta.10"
44
44
  },
45
45
  "devDependencies": {
46
46
  "tsup": "^8.4.0",