@eslint-react/ast 2.7.0-next.0 → 2.7.0-next.1

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
@@ -2,9 +2,9 @@ import { AST_NODE_TYPES, TSESTree } from "@typescript-eslint/types";
2
2
  import { unit } from "@eslint-react/eff";
3
3
  import { TSESTree as TSESTree$1 } from "@typescript-eslint/utils";
4
4
 
5
- //#region src/array-method-call.d.ts
6
- declare const isArrayMapCallLoose: (node: TSESTree.Node) => node is TSESTree.CallExpression;
7
- declare const isArrayFromCallLoose: (node: TSESTree.Node) => node is TSESTree.CallExpression;
5
+ //#region src/array-method.d.ts
6
+ declare function isArrayFromCall(node: TSESTree.Node, loose?: boolean): node is TSESTree.CallExpression;
7
+ declare function isArrayMapCall(node: TSESTree.Node, loose?: boolean): node is TSESTree.CallExpression;
8
8
  //#endregion
9
9
  //#region src/types.d.ts
10
10
  type TSESTreeFunction = TSESTree$1.ArrowFunctionExpression | TSESTree$1.FunctionDeclaration | TSESTree$1.FunctionExpression;
@@ -262,4 +262,4 @@ declare function isViMock(node: TSESTree.Node | null | unit): node is TSESTree.M
262
262
  */
263
263
  declare function isViMockCallback(node: TSESTree.Node | null | unit): boolean;
264
264
  //#endregion
265
- export { DisplayNameAssignmentExpression, FunctionID, FunctionInitPath, ImplicitReturnArrowFunctionExpression, ObjectDestructuringVariableDeclarator, SEL_DISPLAY_NAME_ASSIGNMENT_EXPRESSION, SEL_IMPLICIT_RETURN_ARROW_FUNCTION_EXPRESSION, SEL_OBJECT_DESTRUCTURING_VARIABLE_DECLARATOR, TSESTreeArrayTupleType, TSESTreeClass, TSESTreeDestructuringPattern, TSESTreeFunction, TSESTreeFunctionType, TSESTreeJSX, TSESTreeJSXAttributeLike, TSESTreeLoop, TSESTreeMethodOrProperty, TSESTreeProperty, TSESTreeTypeAssertionExpression, TSESTreeTypeDeclaration, TSESTreeTypeExpression, findParentNode, getClassId, getFunctionId, getFunctionInitPath, getNestedCallExpressions, getNestedExpressionsOfType, getNestedIdentifiers, getNestedNewExpressions, getNestedReturnStatements, getPropertyName, getUnderlyingExpression, hasCallInFunctionInitPath, is, isArrayFromCallLoose, isArrayMapCallLoose, isClass, isConditional, isControlFlow, isFunction, isFunctionEmpty, isFunctionImmediatelyInvoked, isFunctionType, isJSX, isJSXElement, isJSXFragment, isJSXTagNameExpression, isLineBreak, isLiteral, isLoop, isMethodOrProperty, isMultiLine, isNodeEqual, isOneOf, isProcessEnvNodeEnv, isProcessEnvNodeEnvCompare, isProperty, isThisExpressionLoose, isTypeAssertionExpression, isTypeExpression, isViMock, isViMockCallback, toDelimiterFormat, toStringFormat };
265
+ export { DisplayNameAssignmentExpression, FunctionID, FunctionInitPath, ImplicitReturnArrowFunctionExpression, ObjectDestructuringVariableDeclarator, SEL_DISPLAY_NAME_ASSIGNMENT_EXPRESSION, SEL_IMPLICIT_RETURN_ARROW_FUNCTION_EXPRESSION, SEL_OBJECT_DESTRUCTURING_VARIABLE_DECLARATOR, TSESTreeArrayTupleType, TSESTreeClass, TSESTreeDestructuringPattern, TSESTreeFunction, TSESTreeFunctionType, TSESTreeJSX, TSESTreeJSXAttributeLike, TSESTreeLoop, TSESTreeMethodOrProperty, TSESTreeProperty, TSESTreeTypeAssertionExpression, TSESTreeTypeDeclaration, TSESTreeTypeExpression, findParentNode, getClassId, getFunctionId, getFunctionInitPath, getNestedCallExpressions, getNestedExpressionsOfType, getNestedIdentifiers, getNestedNewExpressions, getNestedReturnStatements, getPropertyName, getUnderlyingExpression, hasCallInFunctionInitPath, is, isArrayFromCall, isArrayMapCall, isClass, isConditional, isControlFlow, isFunction, isFunctionEmpty, isFunctionImmediatelyInvoked, isFunctionType, isJSX, isJSXElement, isJSXFragment, isJSXTagNameExpression, isLineBreak, isLiteral, isLoop, isMethodOrProperty, isMultiLine, isNodeEqual, isOneOf, isProcessEnvNodeEnv, isProcessEnvNodeEnvCompare, isProperty, isThisExpressionLoose, isTypeAssertionExpression, isTypeExpression, isViMock, isViMockCallback, toDelimiterFormat, toStringFormat };
package/dist/index.js CHANGED
@@ -4,17 +4,21 @@ import { ASTUtils } from "@typescript-eslint/utils";
4
4
  import { simpleTraverse } from "@typescript-eslint/typescript-estree";
5
5
  import { delimiterCase, replace, toLowerCase } from "string-ts";
6
6
 
7
- //#region src/array-method-call.ts
8
- function isMethodCall(name, looseMatcher) {
9
- return (node) => {
10
- if (node.type !== AST_NODE_TYPES.CallExpression) return false;
11
- if (node.callee.type !== AST_NODE_TYPES.MemberExpression) return false;
12
- if (node.callee.property.type !== AST_NODE_TYPES.Identifier) return false;
13
- return node.callee.property.name === name || looseMatcher != null && looseMatcher(name);
14
- };
7
+ //#region src/array-method.ts
8
+ function isArrayFromCall(node, loose = true) {
9
+ if (node.type !== AST_NODE_TYPES.CallExpression) return false;
10
+ if (node.callee.type !== AST_NODE_TYPES.MemberExpression) return false;
11
+ if (node.callee.property.type !== AST_NODE_TYPES.Identifier) return false;
12
+ const name = node.callee.property.name;
13
+ return name === "from" || loose && name.startsWith("from");
14
+ }
15
+ function isArrayMapCall(node, loose = true) {
16
+ if (node.type !== AST_NODE_TYPES.CallExpression) return false;
17
+ if (node.callee.type !== AST_NODE_TYPES.MemberExpression) return false;
18
+ if (node.callee.property.type !== AST_NODE_TYPES.Identifier) return false;
19
+ const name = node.callee.property.name;
20
+ return name === "map" || loose && name.endsWith("Map");
15
21
  }
16
- const isArrayMapCallLoose = isMethodCall("map", (name) => name.endsWith("Map"));
17
- const isArrayFromCallLoose = isMethodCall("from", (name) => name.startsWith("from"));
18
22
 
19
23
  //#endregion
20
24
  //#region src/class-id.ts
@@ -612,4 +616,4 @@ function isViMockCallback(node) {
612
616
  }
613
617
 
614
618
  //#endregion
615
- export { SEL_DISPLAY_NAME_ASSIGNMENT_EXPRESSION, SEL_IMPLICIT_RETURN_ARROW_FUNCTION_EXPRESSION, SEL_OBJECT_DESTRUCTURING_VARIABLE_DECLARATOR, findParentNode, getClassId, getFunctionId, getFunctionInitPath, getNestedCallExpressions, getNestedExpressionsOfType, getNestedIdentifiers, getNestedNewExpressions, getNestedReturnStatements, getPropertyName, getUnderlyingExpression, hasCallInFunctionInitPath, is, isArrayFromCallLoose, isArrayMapCallLoose, isClass, isConditional, isControlFlow, isFunction, isFunctionEmpty, isFunctionImmediatelyInvoked, isFunctionType, isJSX, isJSXElement, isJSXFragment, isJSXTagNameExpression, isLineBreak, isLiteral, isLoop, isMethodOrProperty, isMultiLine, isNodeEqual, isOneOf, isProcessEnvNodeEnv, isProcessEnvNodeEnvCompare, isProperty, isThisExpressionLoose, isTypeAssertionExpression, isTypeExpression, isViMock, isViMockCallback, toDelimiterFormat, toStringFormat };
619
+ export { SEL_DISPLAY_NAME_ASSIGNMENT_EXPRESSION, SEL_IMPLICIT_RETURN_ARROW_FUNCTION_EXPRESSION, SEL_OBJECT_DESTRUCTURING_VARIABLE_DECLARATOR, findParentNode, getClassId, getFunctionId, getFunctionInitPath, getNestedCallExpressions, getNestedExpressionsOfType, getNestedIdentifiers, getNestedNewExpressions, getNestedReturnStatements, getPropertyName, getUnderlyingExpression, hasCallInFunctionInitPath, is, isArrayFromCall, isArrayMapCall, isClass, isConditional, isControlFlow, isFunction, isFunctionEmpty, isFunctionImmediatelyInvoked, isFunctionType, isJSX, isJSXElement, isJSXFragment, isJSXTagNameExpression, isLineBreak, isLiteral, isLoop, isMethodOrProperty, isMultiLine, isNodeEqual, isOneOf, isProcessEnvNodeEnv, isProcessEnvNodeEnvCompare, isProperty, isThisExpressionLoose, isTypeAssertionExpression, isTypeExpression, isViMock, isViMockCallback, toDelimiterFormat, toStringFormat };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@eslint-react/ast",
3
- "version": "2.7.0-next.0",
3
+ "version": "2.7.0-next.1",
4
4
  "description": "ESLint React's TSESTree AST utility module.",
5
5
  "homepage": "https://github.com/Rel1cx/eslint-react",
6
6
  "bugs": {
@@ -34,7 +34,7 @@
34
34
  "@typescript-eslint/typescript-estree": "^8.53.0",
35
35
  "@typescript-eslint/utils": "^8.53.0",
36
36
  "string-ts": "^2.3.1",
37
- "@eslint-react/eff": "2.7.0-next.0"
37
+ "@eslint-react/eff": "2.7.0-next.1"
38
38
  },
39
39
  "devDependencies": {
40
40
  "tsdown": "^0.20.0-beta.3",