@eslint-react/ast 4.0.2-beta.6 → 4.0.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 +21 -1
- package/dist/index.js +27 -1
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -506,6 +506,13 @@ declare function isProcessEnvNodeEnvCompare(node: TSESTree.Node | null, operator
|
|
|
506
506
|
* @internal
|
|
507
507
|
*/
|
|
508
508
|
declare function isViMock(node: TSESTree.Node | null): node is TSESTree.MemberExpression;
|
|
509
|
+
/**
|
|
510
|
+
* Check if the given node is a `jest.mock`.
|
|
511
|
+
* @param node The node to check
|
|
512
|
+
* @returns `true` if the node is a `jest.mock`, otherwise `false`.
|
|
513
|
+
* @internal
|
|
514
|
+
*/
|
|
515
|
+
declare function isJestMock(node: TSESTree.Node | null): node is TSESTree.MemberExpression;
|
|
509
516
|
/**
|
|
510
517
|
* Check if the given node is a `vi.mock` callback.
|
|
511
518
|
* @param node The node to check
|
|
@@ -513,6 +520,19 @@ declare function isViMock(node: TSESTree.Node | null): node is TSESTree.MemberEx
|
|
|
513
520
|
* @internal
|
|
514
521
|
*/
|
|
515
522
|
declare function isViMockCallback(node: TSESTree.Node | null): boolean;
|
|
523
|
+
/**
|
|
524
|
+
* Check if the given node is a `jest.mock` callback.
|
|
525
|
+
* @param node The node to check
|
|
526
|
+
* @returns `true` if the node is a `jest.mock` callback, otherwise `false`.
|
|
527
|
+
* @internal
|
|
528
|
+
*/
|
|
529
|
+
declare function isJestMockCallback(node: TSESTree.Node | null): boolean;
|
|
530
|
+
/**
|
|
531
|
+
* Check if the given node is a `vi.mock` or `jest.mock` callback.
|
|
532
|
+
* @param node The node to check
|
|
533
|
+
* @returns `true` if the node is a test mock callback, otherwise `false`.
|
|
534
|
+
*/
|
|
535
|
+
declare function isTestMockCallback(node: TSESTree.Node | null): boolean;
|
|
516
536
|
//#endregion
|
|
517
537
|
//#region src/property-name.d.ts
|
|
518
538
|
/**
|
|
@@ -534,4 +554,4 @@ declare function getPropertyName(node: TSESTree.Node): string | null;
|
|
|
534
554
|
*/
|
|
535
555
|
declare function findProperty(properties: TSESTree.ObjectLiteralElement[], name: string): TSESTree.Property | null;
|
|
536
556
|
//#endregion
|
|
537
|
-
export { DirectiveKind, DisplayNameAssignmentExpression, FunctionID, FunctionInitPath, ImplicitReturnArrowFunctionExpression, ObjectDestructuringVariableDeclarator, SEL_DISPLAY_NAME_ASSIGNMENT_EXPRESSION, SEL_IMPLICIT_RETURN_ARROW_FUNCTION_EXPRESSION, SEL_OBJECT_DESTRUCTURING_VARIABLE_DECLARATOR, TSESTreeArrayTupleType, TSESTreeClass, TSESTreeDestructuringPattern, TSESTreeDirective, TSESTreeDirectiveLike, TSESTreeFunction, TSESTreeFunctionType, TSESTreeJSX, TSESTreeJSXAttributeLike, TSESTreeJSXElementLike, TSESTreeLoop, TSESTreeMethodOrProperty, TSESTreeProperty, TSESTreeTypeAssertionExpression, TSESTreeTypeDeclaration, TSESTreeTypeExpression, findParent, findProperty, getClassId, getFileDirectives, getFullyQualifiedName, getFunctionDirectives, getFunctionId, getFunctionInitPath, getHumanReadableKind, getNestedCallExpressions, getNestedExpressionsOfType, getNestedIdentifiers, getNestedNewExpressions, getNestedReturnStatements, getPropertyName, getRootIdentifier, getUnderlyingExpression, hasCallInFunctionInitPath, is, isClass, isConditional, isControlFlow, isDirective, isDirectiveInFile, isDirectiveInFunction, isDirectiveKind, isDirectiveLike, isDirectiveName, isFunction, isFunctionEmpty, isFunctionImmediatelyInvoked, isFunctionType, isIdentifier, isIdentifierName, isJSX, isJSXElement, isJSXElementLike, isJSXFragment, isJSXTagNameExpression, isLineBreak, isLiteral, isLoop, isMethodOrProperty, isMultiLine, isNodeEqual, isOneOf, isProcessEnvNodeEnv, isProcessEnvNodeEnvCompare, isProperty, isThisExpressionLoose, isTypeAssertionExpression, isTypeExpression, isViMock, isViMockCallback };
|
|
557
|
+
export { DirectiveKind, DisplayNameAssignmentExpression, FunctionID, FunctionInitPath, ImplicitReturnArrowFunctionExpression, ObjectDestructuringVariableDeclarator, SEL_DISPLAY_NAME_ASSIGNMENT_EXPRESSION, SEL_IMPLICIT_RETURN_ARROW_FUNCTION_EXPRESSION, SEL_OBJECT_DESTRUCTURING_VARIABLE_DECLARATOR, TSESTreeArrayTupleType, TSESTreeClass, TSESTreeDestructuringPattern, TSESTreeDirective, TSESTreeDirectiveLike, TSESTreeFunction, TSESTreeFunctionType, TSESTreeJSX, TSESTreeJSXAttributeLike, TSESTreeJSXElementLike, TSESTreeLoop, TSESTreeMethodOrProperty, TSESTreeProperty, TSESTreeTypeAssertionExpression, TSESTreeTypeDeclaration, TSESTreeTypeExpression, findParent, findProperty, getClassId, getFileDirectives, getFullyQualifiedName, getFunctionDirectives, getFunctionId, getFunctionInitPath, getHumanReadableKind, getNestedCallExpressions, getNestedExpressionsOfType, getNestedIdentifiers, getNestedNewExpressions, getNestedReturnStatements, getPropertyName, getRootIdentifier, getUnderlyingExpression, hasCallInFunctionInitPath, is, isClass, isConditional, isControlFlow, isDirective, isDirectiveInFile, isDirectiveInFunction, isDirectiveKind, isDirectiveLike, isDirectiveName, isFunction, isFunctionEmpty, isFunctionImmediatelyInvoked, isFunctionType, isIdentifier, isIdentifierName, isJSX, isJSXElement, isJSXElementLike, isJSXFragment, isJSXTagNameExpression, isJestMock, isJestMockCallback, isLineBreak, isLiteral, isLoop, isMethodOrProperty, isMultiLine, isNodeEqual, isOneOf, isProcessEnvNodeEnv, isProcessEnvNodeEnvCompare, isProperty, isTestMockCallback, isThisExpressionLoose, isTypeAssertionExpression, isTypeExpression, isViMock, isViMockCallback };
|
package/dist/index.js
CHANGED
|
@@ -933,6 +933,15 @@ function isViMock(node) {
|
|
|
933
933
|
return node != null && node.type === AST_NODE_TYPES.MemberExpression && node.object.type === AST_NODE_TYPES.Identifier && node.object.name === "vi" && node.property.type === AST_NODE_TYPES.Identifier && node.property.name === "mock";
|
|
934
934
|
}
|
|
935
935
|
/**
|
|
936
|
+
* Check if the given node is a `jest.mock`.
|
|
937
|
+
* @param node The node to check
|
|
938
|
+
* @returns `true` if the node is a `jest.mock`, otherwise `false`.
|
|
939
|
+
* @internal
|
|
940
|
+
*/
|
|
941
|
+
function isJestMock(node) {
|
|
942
|
+
return node != null && node.type === AST_NODE_TYPES.MemberExpression && node.object.type === AST_NODE_TYPES.Identifier && node.object.name === "jest" && node.property.type === AST_NODE_TYPES.Identifier && node.property.name === "mock";
|
|
943
|
+
}
|
|
944
|
+
/**
|
|
936
945
|
* Check if the given node is a `vi.mock` callback.
|
|
937
946
|
* @param node The node to check
|
|
938
947
|
* @returns `true` if the node is a `vi.mock` callback, otherwise `false`.
|
|
@@ -941,6 +950,23 @@ function isViMock(node) {
|
|
|
941
950
|
function isViMockCallback(node) {
|
|
942
951
|
return node != null && isFunction(node) && node.parent.type === AST_NODE_TYPES.CallExpression && isViMock(node.parent.callee) && node.parent.arguments[1] === node;
|
|
943
952
|
}
|
|
953
|
+
/**
|
|
954
|
+
* Check if the given node is a `jest.mock` callback.
|
|
955
|
+
* @param node The node to check
|
|
956
|
+
* @returns `true` if the node is a `jest.mock` callback, otherwise `false`.
|
|
957
|
+
* @internal
|
|
958
|
+
*/
|
|
959
|
+
function isJestMockCallback(node) {
|
|
960
|
+
return node != null && isFunction(node) && node.parent.type === AST_NODE_TYPES.CallExpression && isJestMock(node.parent.callee) && node.parent.arguments[1] === node;
|
|
961
|
+
}
|
|
962
|
+
/**
|
|
963
|
+
* Check if the given node is a `vi.mock` or `jest.mock` callback.
|
|
964
|
+
* @param node The node to check
|
|
965
|
+
* @returns `true` if the node is a test mock callback, otherwise `false`.
|
|
966
|
+
*/
|
|
967
|
+
function isTestMockCallback(node) {
|
|
968
|
+
return isViMockCallback(node) || isJestMockCallback(node);
|
|
969
|
+
}
|
|
944
970
|
|
|
945
971
|
//#endregion
|
|
946
972
|
//#region src/property-name.ts
|
|
@@ -980,4 +1006,4 @@ function findProperty(properties, name) {
|
|
|
980
1006
|
}
|
|
981
1007
|
|
|
982
1008
|
//#endregion
|
|
983
|
-
export { SEL_DISPLAY_NAME_ASSIGNMENT_EXPRESSION, SEL_IMPLICIT_RETURN_ARROW_FUNCTION_EXPRESSION, SEL_OBJECT_DESTRUCTURING_VARIABLE_DECLARATOR, findParent, findProperty, getClassId, getFileDirectives, getFullyQualifiedName, getFunctionDirectives, getFunctionId, getFunctionInitPath, getHumanReadableKind, getNestedCallExpressions, getNestedExpressionsOfType, getNestedIdentifiers, getNestedNewExpressions, getNestedReturnStatements, getPropertyName, getRootIdentifier, getUnderlyingExpression, hasCallInFunctionInitPath, is, isClass, isConditional, isControlFlow, isDirective, isDirectiveInFile, isDirectiveInFunction, isDirectiveKind, isDirectiveLike, isDirectiveName, isFunction, isFunctionEmpty, isFunctionImmediatelyInvoked, isFunctionType, isIdentifier, isIdentifierName, isJSX, isJSXElement, isJSXElementLike, isJSXFragment, isJSXTagNameExpression, isLineBreak, isLiteral, isLoop, isMethodOrProperty, isMultiLine, isNodeEqual, isOneOf, isProcessEnvNodeEnv, isProcessEnvNodeEnvCompare, isProperty, isThisExpressionLoose, isTypeAssertionExpression, isTypeExpression, isViMock, isViMockCallback };
|
|
1009
|
+
export { SEL_DISPLAY_NAME_ASSIGNMENT_EXPRESSION, SEL_IMPLICIT_RETURN_ARROW_FUNCTION_EXPRESSION, SEL_OBJECT_DESTRUCTURING_VARIABLE_DECLARATOR, findParent, findProperty, getClassId, getFileDirectives, getFullyQualifiedName, getFunctionDirectives, getFunctionId, getFunctionInitPath, getHumanReadableKind, getNestedCallExpressions, getNestedExpressionsOfType, getNestedIdentifiers, getNestedNewExpressions, getNestedReturnStatements, getPropertyName, getRootIdentifier, getUnderlyingExpression, hasCallInFunctionInitPath, is, isClass, isConditional, isControlFlow, isDirective, isDirectiveInFile, isDirectiveInFunction, isDirectiveKind, isDirectiveLike, isDirectiveName, isFunction, isFunctionEmpty, isFunctionImmediatelyInvoked, isFunctionType, isIdentifier, isIdentifierName, isJSX, isJSXElement, isJSXElementLike, isJSXFragment, isJSXTagNameExpression, isJestMock, isJestMockCallback, isLineBreak, isLiteral, isLoop, isMethodOrProperty, isMultiLine, isNodeEqual, isOneOf, isProcessEnvNodeEnv, isProcessEnvNodeEnvCompare, isProperty, isTestMockCallback, isThisExpressionLoose, isTypeAssertionExpression, isTypeExpression, isViMock, isViMockCallback };
|