@eslint-react/ast 2.6.4-next.0 → 2.6.5-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 +3 -2
- package/dist/index.js +5 -5
- package/package.json +2 -2
package/dist/index.d.ts
CHANGED
|
@@ -100,7 +100,8 @@ declare const getNestedCallExpressions: (node: TSESTree.Node) => TSESTree.CallEx
|
|
|
100
100
|
* where JS gives anonymous function expressions names. We roughly detect the
|
|
101
101
|
* same AST nodes with some exceptions to better fit our use case.
|
|
102
102
|
*/
|
|
103
|
-
declare function getFunctionId(node: TSESTree.Expression | TSESTreeFunction): TSESTree.Identifier |
|
|
103
|
+
declare function getFunctionId(node: TSESTree.Expression | TSESTreeFunction): TSESTree.ArrayExpression | TSESTree.ArrayPattern | TSESTree.ArrowFunctionExpression | TSESTree.AssignmentExpression | TSESTree.AwaitExpression | TSESTree.PrivateInExpression | TSESTree.SymmetricBinaryExpression | TSESTree.CallExpression | TSESTree.ChainExpression | TSESTree.ClassExpression | TSESTree.ConditionalExpression | TSESTree.FunctionExpression | TSESTree.Identifier | TSESTree.ImportExpression | TSESTree.JSXElement | TSESTree.JSXFragment | TSESTree.BigIntLiteral | TSESTree.BooleanLiteral | TSESTree.NullLiteral | TSESTree.NumberLiteral | TSESTree.RegExpLiteral | TSESTree.StringLiteral | TSESTree.LogicalExpression | TSESTree.MemberExpressionComputedName | TSESTree.MemberExpressionNonComputedName | TSESTree.MetaProperty | TSESTree.NewExpression | TSESTree.ObjectExpression | TSESTree.ObjectPattern | TSESTree.PrivateIdentifier | TSESTree.SequenceExpression | TSESTree.Super | TSESTree.TaggedTemplateExpression | TSESTree.TemplateLiteral | TSESTree.ThisExpression | TSESTree.TSAsExpression | TSESTree.TSInstantiationExpression | TSESTree.TSNonNullExpression | TSESTree.TSSatisfiesExpression | TSESTree.TSTypeAssertion | TSESTree.UnaryExpressionBitwiseNot | TSESTree.UnaryExpressionDelete | TSESTree.UnaryExpressionMinus | TSESTree.UnaryExpressionNot | TSESTree.UnaryExpressionPlus | TSESTree.UnaryExpressionTypeof | TSESTree.UnaryExpressionVoid | TSESTree.UpdateExpression | TSESTree.YieldExpression | undefined;
|
|
104
|
+
type FunctionID = ReturnType<typeof getFunctionId>;
|
|
104
105
|
//#endregion
|
|
105
106
|
//#region src/function-init-path.d.ts
|
|
106
107
|
/**
|
|
@@ -261,4 +262,4 @@ declare function isViMock(node: TSESTree.Node | null | unit): node is TSESTree.M
|
|
|
261
262
|
*/
|
|
262
263
|
declare function isViMockCallback(node: TSESTree.Node | null | unit): boolean;
|
|
263
264
|
//#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, 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, 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
|
@@ -374,11 +374,11 @@ const getNestedCallExpressions = getNestedExpressionsOfType(AST_NODE_TYPES.CallE
|
|
|
374
374
|
function getFunctionId(node) {
|
|
375
375
|
switch (true) {
|
|
376
376
|
case "id" in node && node.id != null: return node.id;
|
|
377
|
-
case node.parent.type === AST_NODE_TYPES.VariableDeclarator && node.parent.init === node
|
|
378
|
-
case node.parent.type === AST_NODE_TYPES.AssignmentExpression && node.parent.right === node && node.parent.operator === "="
|
|
379
|
-
case node.parent.type === AST_NODE_TYPES.Property && node.parent.value === node && !node.parent.computed
|
|
380
|
-
case isMethodOrProperty(node.parent) && node.parent.value === node
|
|
381
|
-
case node.parent.type === AST_NODE_TYPES.AssignmentPattern && node.parent.right === node
|
|
377
|
+
case node.parent.type === AST_NODE_TYPES.VariableDeclarator && node.parent.init === node: return node.parent.id;
|
|
378
|
+
case node.parent.type === AST_NODE_TYPES.AssignmentExpression && node.parent.right === node && node.parent.operator === "=": return node.parent.left;
|
|
379
|
+
case node.parent.type === AST_NODE_TYPES.Property && node.parent.value === node && !node.parent.computed: return node.parent.key;
|
|
380
|
+
case isMethodOrProperty(node.parent) && node.parent.value === node: return node.parent.key;
|
|
381
|
+
case node.parent.type === AST_NODE_TYPES.AssignmentPattern && node.parent.right === node: return node.parent.left;
|
|
382
382
|
case isTypeAssertionExpression(node.parent): return getFunctionId(node.parent);
|
|
383
383
|
}
|
|
384
384
|
return unit;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@eslint-react/ast",
|
|
3
|
-
"version": "2.6.
|
|
3
|
+
"version": "2.6.5-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.5-beta.0"
|
|
38
38
|
},
|
|
39
39
|
"devDependencies": {
|
|
40
40
|
"tsdown": "^0.20.0-beta.3",
|