@eslint-react/ast 2.6.2 → 2.6.3-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.
- package/dist/index.d.ts +4 -4
- package/dist/index.js +11 -15
- package/package.json +2 -2
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.d.ts
|
|
6
|
-
declare
|
|
7
|
-
declare
|
|
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;
|
|
8
8
|
//#endregion
|
|
9
9
|
//#region src/types.d.ts
|
|
10
10
|
type TSESTreeFunction = TSESTree$1.ArrowFunctionExpression | TSESTree$1.FunctionDeclaration | TSESTree$1.FunctionExpression;
|
|
@@ -261,4 +261,4 @@ declare function isViMock(node: TSESTree.Node | null | unit): node is TSESTree.M
|
|
|
261
261
|
*/
|
|
262
262
|
declare function isViMockCallback(node: TSESTree.Node | null | unit): boolean;
|
|
263
263
|
//#endregion
|
|
264
|
-
export { DisplayNameAssignmentExpression, 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,
|
|
264
|
+
export { DisplayNameAssignmentExpression, 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 };
|
package/dist/index.js
CHANGED
|
@@ -4,21 +4,17 @@ 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.ts
|
|
8
|
-
function
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
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");
|
|
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
|
+
};
|
|
21
15
|
}
|
|
16
|
+
const isArrayMapCallLoose = isMethodCall("map", (name) => name.endsWith("Map"));
|
|
17
|
+
const isArrayFromCallLoose = isMethodCall("from", (name) => name.startsWith("from"));
|
|
22
18
|
|
|
23
19
|
//#endregion
|
|
24
20
|
//#region src/class-id.ts
|
|
@@ -616,4 +612,4 @@ function isViMockCallback(node) {
|
|
|
616
612
|
}
|
|
617
613
|
|
|
618
614
|
//#endregion
|
|
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,
|
|
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 };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@eslint-react/ast",
|
|
3
|
-
"version": "2.6.
|
|
3
|
+
"version": "2.6.3-beta.0",
|
|
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.6.
|
|
37
|
+
"@eslint-react/eff": "2.6.3-beta.0"
|
|
38
38
|
},
|
|
39
39
|
"devDependencies": {
|
|
40
40
|
"tsdown": "^0.20.0-beta.3",
|