@eslint-react/ast 2.0.0-next.4 → 2.0.0-next.5

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.ts CHANGED
@@ -147,6 +147,7 @@ declare function getFunctionInitPath(node: TSESTreeFunction): FunctionInitPath |
147
147
  declare function hasCallInFunctionInitPath(callName: string, initPath: FunctionInitPath): boolean;
148
148
 
149
149
  declare function isEmptyFunction(node: TSESTreeFunction): boolean;
150
+ declare function isImmediatelyInvokedFunction(node: TSESTreeFunction): boolean;
150
151
 
151
152
  /**
152
153
  * Find the parent node that satisfies the test function
@@ -272,6 +273,8 @@ declare function isProcessEnvNodeEnvCompare(node: TSESTree.Node | null | _, oper
272
273
 
273
274
  declare function getPropertyName(node: TSESTree.Node): string | _;
274
275
 
276
+ declare function isThenCall(node: TSESTree.CallExpression): boolean;
277
+
275
278
  declare function toDelimiterCaseType(node: TSESTree.Node, delimiter?: string): "RegExp literal" | Lowercase<string> | `JSX ${Lowercase<string>}`;
276
279
  /**
277
280
  * Returns human readable node name for given AST node
@@ -281,4 +284,4 @@ declare function toDelimiterCaseType(node: TSESTree.Node, delimiter?: string): "
281
284
  */
282
285
  declare function toString(node: TSESTree.Node, getText: (node: TSESTree.Node) => string): string;
283
286
 
284
- export { type FunctionInitPath, 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, getArrayMethodCallbackIndexParamPosition, getClassId, getFunctionId, getFunctionInitPath, getJSExpression, getNestedCallExpressions, getNestedExpressionsOfType, getNestedIdentifiers, getNestedNewExpressions, getNestedReturnStatements, getPropertyName, hasCallInFunctionInitPath, is, isArrayFromCall, isArrayMapCall, isArrayTupleType, isClass, isConditional, isControlFlow, isDestructuringPattern, isEmptyFunction, isFunction, isFunctionType, isJSX, isJSXElement, isJSXFragment, isJSXTagNameExpression, isLeftHandSideExpression, isLeftHandSideExpressionType, isLineBreak, isLiteral, isLoop, isMethodOrProperty, isMultiLine, isNodeEqual, isOneOf, isProcessEnvNodeEnv, isProcessEnvNodeEnvCompare, isProperty, isThisExpression, isTypeAssertionExpression, isTypeDeclaration, isTypeExpression, toDelimiterCaseType, toString };
287
+ export { type FunctionInitPath, 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, getArrayMethodCallbackIndexParamPosition, getClassId, getFunctionId, getFunctionInitPath, getJSExpression, getNestedCallExpressions, getNestedExpressionsOfType, getNestedIdentifiers, getNestedNewExpressions, getNestedReturnStatements, getPropertyName, hasCallInFunctionInitPath, is, isArrayFromCall, isArrayMapCall, isArrayTupleType, isClass, isConditional, isControlFlow, isDestructuringPattern, isEmptyFunction, isFunction, isFunctionType, isImmediatelyInvokedFunction, isJSX, isJSXElement, isJSXFragment, isJSXTagNameExpression, isLeftHandSideExpression, isLeftHandSideExpressionType, isLineBreak, isLiteral, isLoop, isMethodOrProperty, isMultiLine, isNodeEqual, isOneOf, isProcessEnvNodeEnv, isProcessEnvNodeEnvCompare, isProperty, isThenCall, isThisExpression, isTypeAssertionExpression, isTypeDeclaration, isTypeExpression, toDelimiterCaseType, toString };
package/dist/index.js CHANGED
@@ -271,6 +271,9 @@ function hasCallInFunctionInitPath(callName, initPath) {
271
271
  function isEmptyFunction(node) {
272
272
  return node.body.type === AST_NODE_TYPES.BlockStatement && node.body.body.length === 0;
273
273
  }
274
+ function isImmediatelyInvokedFunction(node) {
275
+ return node.type !== AST_NODE_TYPES.FunctionDeclaration && node.parent.type === AST_NODE_TYPES.CallExpression && node.parent.callee === node;
276
+ }
274
277
  function findParentNode(node, test) {
275
278
  if (node == null) return _;
276
279
  let parent = node.parent;
@@ -550,6 +553,9 @@ function getPropertyName(node) {
550
553
  }
551
554
  return _;
552
555
  }
556
+ function isThenCall(node) {
557
+ return node.callee.type === AST_NODE_TYPES.MemberExpression && node.callee.property.type === AST_NODE_TYPES.Identifier && node.callee.property.name === "then";
558
+ }
553
559
  function getLiteralValueType(input) {
554
560
  if (input === null) return "null";
555
561
  return typeof input;
@@ -586,4 +592,4 @@ function toString(node, getText) {
586
592
  }
587
593
  }
588
594
 
589
- export { findParentNode, getArrayMethodCallbackIndexParamPosition, getClassId, getFunctionId, getFunctionInitPath, getJSExpression, getNestedCallExpressions, getNestedExpressionsOfType, getNestedIdentifiers, getNestedNewExpressions, getNestedReturnStatements, getPropertyName, hasCallInFunctionInitPath, is, isArrayFromCall, isArrayMapCall, isArrayTupleType, isClass, isConditional, isControlFlow, isDestructuringPattern, isEmptyFunction, isFunction, isFunctionType, isJSX, isJSXElement, isJSXFragment, isJSXTagNameExpression, isLeftHandSideExpression, isLeftHandSideExpressionType, isLineBreak, isLiteral, isLoop, isMethodOrProperty, isMultiLine, isNodeEqual, isOneOf, isProcessEnvNodeEnv, isProcessEnvNodeEnvCompare, isProperty, isThisExpression, isTypeAssertionExpression, isTypeDeclaration, isTypeExpression, toDelimiterCaseType, toString };
595
+ export { findParentNode, getArrayMethodCallbackIndexParamPosition, getClassId, getFunctionId, getFunctionInitPath, getJSExpression, getNestedCallExpressions, getNestedExpressionsOfType, getNestedIdentifiers, getNestedNewExpressions, getNestedReturnStatements, getPropertyName, hasCallInFunctionInitPath, is, isArrayFromCall, isArrayMapCall, isArrayTupleType, isClass, isConditional, isControlFlow, isDestructuringPattern, isEmptyFunction, isFunction, isFunctionType, isImmediatelyInvokedFunction, isJSX, isJSXElement, isJSXFragment, isJSXTagNameExpression, isLeftHandSideExpression, isLeftHandSideExpressionType, isLineBreak, isLiteral, isLoop, isMethodOrProperty, isMultiLine, isNodeEqual, isOneOf, isProcessEnvNodeEnv, isProcessEnvNodeEnvCompare, isProperty, isThenCall, isThisExpression, isTypeAssertionExpression, isTypeDeclaration, isTypeExpression, toDelimiterCaseType, toString };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@eslint-react/ast",
3
- "version": "2.0.0-next.4",
3
+ "version": "2.0.0-next.5",
4
4
  "description": "ESLint React's TSESTree AST utility module.",
5
5
  "homepage": "https://github.com/Rel1cx/eslint-react",
6
6
  "bugs": {
@@ -27,12 +27,12 @@
27
27
  "./package.json"
28
28
  ],
29
29
  "dependencies": {
30
- "@typescript-eslint/types": "^8.30.1",
31
- "@typescript-eslint/typescript-estree": "^8.30.1",
32
- "@typescript-eslint/utils": "^8.30.1",
30
+ "@typescript-eslint/types": "^8.31.0",
31
+ "@typescript-eslint/typescript-estree": "^8.31.0",
32
+ "@typescript-eslint/utils": "^8.31.0",
33
33
  "string-ts": "^2.2.1",
34
34
  "ts-pattern": "^5.7.0",
35
- "@eslint-react/eff": "2.0.0-next.4"
35
+ "@eslint-react/eff": "2.0.0-next.5"
36
36
  },
37
37
  "devDependencies": {
38
38
  "tsup": "^8.4.0",