forked from fdzcxy212206413/gsl_grs
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
1 line
15 KiB
1 line
15 KiB
{"version":3,"file":"ast-guards.js","sourceRoot":"","sources":["../../src/eslint-bulk-suppressions/ast-guards.ts"],"names":[],"mappings":";AAAA,4FAA4F;AAC5F,2DAA2D;;;AAI3D,SAAgB,iBAAiB,CAAC,IAAmB;IACnD,OAAO,IAAI,CAAC,IAAI,KAAK,iBAAiB,CAAC;AACzC,CAAC;AAFD,8CAEC;AAED,SAAgB,yBAAyB,CAAC,IAAmB;IAC3D,OAAO,IAAI,CAAC,IAAI,KAAK,yBAAyB,CAAC;AACjD,CAAC;AAFD,8DAEC;AAED,yBAAyB;AACzB,SAAgB,mBAAmB,CAAC,IAAmB;IACrD,OAAO,IAAI,CAAC,IAAI,KAAK,mBAAmB,CAAC;AAC3C,CAAC;AAFD,kDAEC;AAED,SAAgB,kBAAkB,CAAC,IAAmB;IACpD,OAAO,IAAI,CAAC,IAAI,KAAK,kBAAkB,CAAC;AAC1C,CAAC;AAFD,gDAEC;AAED,SAAgB,iBAAiB,CAAC,IAAmB;IACnD,OAAO,IAAI,CAAC,IAAI,KAAK,iBAAiB,CAAC;AACzC,CAAC;AAFD,8CAEC;AAED,SAAgB,0BAA0B,CAAC,IAAmB;IAC5D,OAAO,IAAI,CAAC,IAAI,KAAK,0BAA0B,CAAC;AAClD,CAAC;AAFD,gEAEC;AAED,SAAgB,YAAY,CAAC,IAAmB;IAC9C,OAAO,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,YAAY,CAAC,CAAC;AAC1C,CAAC;AAFD,oCAEC;AAED,SAAgB,qBAAqB,CAAC,IAAmB;IACvD,OAAO,IAAI,CAAC,IAAI,KAAK,qBAAqB,CAAC;AAC7C,CAAC;AAFD,sDAEC;AAED,SAAgB,oBAAoB,CAAC,IAAmB;IACtD,OAAO,IAAI,CAAC,IAAI,KAAK,oBAAoB,CAAC;AAC5C,CAAC;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;AAfD,wCAeC","sourcesContent":["// Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license.\n// See LICENSE in the project root for license information.\n\nimport type { TSESTree } from '@typescript-eslint/types';\n\nexport function isArrayExpression(node: TSESTree.Node): node is TSESTree.ArrayExpression {\n return node.type === 'ArrayExpression';\n}\n\nexport function isArrowFunctionExpression(node: TSESTree.Node): node is TSESTree.ArrowFunctionExpression {\n return node.type === 'ArrowFunctionExpression';\n}\n\n/** default parameters */\nexport function isAssignmentPattern(node: TSESTree.Node): node is TSESTree.AssignmentPattern {\n return node.type === 'AssignmentPattern';\n}\n\nexport function isClassDeclaration(node: TSESTree.Node): node is TSESTree.ClassDeclaration {\n return node.type === 'ClassDeclaration';\n}\n\nexport function isClassExpression(node: TSESTree.Node): node is TSESTree.ClassExpression {\n return node.type === 'ClassExpression';\n}\n\nexport function isExportDefaultDeclaration(node: TSESTree.Node): node is TSESTree.ExportDefaultDeclaration {\n return node.type === 'ExportDefaultDeclaration';\n}\n\nexport function isExpression(node: TSESTree.Node): node is TSESTree.Expression {\n return node.type.includes('Expression');\n}\n\nexport function isFunctionDeclaration(node: TSESTree.Node): node is TSESTree.FunctionDeclaration {\n return node.type === 'FunctionDeclaration';\n}\n\nexport function isFunctionExpression(node: TSESTree.Node): node is TSESTree.FunctionExpression {\n return node.type === 'FunctionExpression';\n}\n\nexport function isIdentifier(node: TSESTree.Node): node is TSESTree.Identifier {\n return node.type === 'Identifier';\n}\n\nexport function isLiteral(node: TSESTree.Node): node is TSESTree.Literal {\n return node.type === 'Literal';\n}\n\nexport function isMethodDefinition(node: TSESTree.Node): node is TSESTree.MethodDefinition {\n return node.type === 'MethodDefinition';\n}\n\nexport function isObjectExpression(node: TSESTree.Node): node is TSESTree.ObjectExpression {\n return node.type === 'ObjectExpression';\n}\n\nexport function isPrivateIdentifier(node: TSESTree.Node): node is TSESTree.PrivateIdentifier {\n return node.type === 'PrivateIdentifier';\n}\n\nexport function isProperty(node: TSESTree.Node): node is TSESTree.Property {\n return node.type === 'Property';\n}\n\nexport function isPropertyDefinition(node: TSESTree.Node): node is TSESTree.PropertyDefinition {\n return node.type === 'PropertyDefinition';\n}\n\nexport function isTSEnumDeclaration(node: TSESTree.Node): node is TSESTree.TSEnumDeclaration {\n return node.type === 'TSEnumDeclaration';\n}\n\nexport function isTSInterfaceDeclaration(node: TSESTree.Node): node is TSESTree.TSInterfaceDeclaration {\n return node.type === 'TSInterfaceDeclaration';\n}\n\nexport function isTSModuleDeclaration(node: TSESTree.Node): node is TSESTree.TSModuleDeclaration {\n return node.type === 'TSModuleDeclaration';\n}\n\nexport function isTSQualifiedName(node: TSESTree.Node): node is TSESTree.TSQualifiedName {\n return node.type === 'TSQualifiedName';\n}\n\nexport function isTSTypeAliasDeclaration(node: TSESTree.Node): node is TSESTree.TSTypeAliasDeclaration {\n return node.type === 'TSTypeAliasDeclaration';\n}\n\nexport function isVariableDeclarator(node: TSESTree.Node): node is TSESTree.VariableDeclarator {\n return node.type === 'VariableDeclarator';\n}\n\n// Compound Type Guards for @typescript-eslint/types ast-spec compound types\nexport function isClassDeclarationWithName(node: TSESTree.Node): node is TSESTree.ClassDeclarationWithName {\n return isClassDeclaration(node) && node.id !== null;\n}\n\nexport function isClassPropertyNameNonComputed(\n node: TSESTree.Node\n): node is TSESTree.ClassPropertyNameNonComputed {\n return isPrivateIdentifier(node) || isPropertyNameNonComputed(node);\n}\n\nexport function isFunctionDeclarationWithName(\n node: TSESTree.Node\n): node is TSESTree.FunctionDeclarationWithName {\n return isFunctionDeclaration(node) && node.id !== null;\n}\n\nexport function isNumberLiteral(node: TSESTree.Node): node is TSESTree.NumberLiteral {\n return isLiteral(node) && typeof node.value === 'number';\n}\n\nexport function isPropertyNameNonComputed(node: TSESTree.Node): node is TSESTree.PropertyNameNonComputed {\n return isIdentifier(node) || isNumberLiteral(node) || isStringLiteral(node);\n}\n\nexport function isStringLiteral(node: TSESTree.Node): node is TSESTree.StringLiteral {\n return isLiteral(node) && typeof node.value === 'string';\n}\n\n// Custom compound types\nexport interface IClassExpressionWithName extends TSESTree.ClassExpression {\n id: TSESTree.Identifier;\n}\n\nexport function isClassExpressionWithName(node: TSESTree.Node): node is IClassExpressionWithName {\n return isClassExpression(node) && node.id !== null;\n}\nexport interface IFunctionExpressionWithName extends TSESTree.FunctionExpression {\n id: TSESTree.Identifier;\n}\n\nexport function isFunctionExpressionWithName(node: TSESTree.Node): node is IFunctionExpressionWithName {\n return isFunctionExpression(node) && node.id !== null;\n}\n\nexport type NormalAnonymousExpression =\n | TSESTree.ArrowFunctionExpression\n | TSESTree.ClassExpression\n | TSESTree.FunctionExpression\n | TSESTree.ObjectExpression;\n\nexport function isNormalAnonymousExpression(node: TSESTree.Node): node is NormalAnonymousExpression {\n const ANONYMOUS_EXPRESSION_GUARDS: ((node: TSESTree.Node) => boolean)[] = [\n isArrowFunctionExpression,\n isClassExpression,\n isFunctionExpression,\n isObjectExpression\n ];\n return ANONYMOUS_EXPRESSION_GUARDS.some((guard) => guard(node));\n}\n\nexport interface INormalAssignmentPattern extends TSESTree.AssignmentPattern {\n left: TSESTree.Identifier;\n}\n\nexport function isNormalAssignmentPattern(node: TSESTree.Node): node is INormalAssignmentPattern {\n return isAssignmentPattern(node) && isIdentifier(node.left);\n}\n\nexport interface INormalClassPropertyDefinition extends TSESTree.PropertyDefinitionNonComputedName {\n key: TSESTree.PrivateIdentifier | TSESTree.Identifier;\n value: TSESTree.Expression;\n}\n\nexport function isNormalClassPropertyDefinition(node: TSESTree.Node): node is INormalClassPropertyDefinition {\n return (\n isPropertyDefinition(node) &&\n (isIdentifier(node.key) || isPrivateIdentifier(node.key)) &&\n node.value !== null\n );\n}\n\nexport interface INormalMethodDefinition extends TSESTree.MethodDefinitionNonComputedName {\n key: TSESTree.PrivateIdentifier | TSESTree.Identifier;\n}\n\nexport function isNormalMethodDefinition(node: TSESTree.Node): node is INormalMethodDefinition {\n return isMethodDefinition(node) && (isIdentifier(node.key) || isPrivateIdentifier(node.key));\n}\n\nexport interface INormalObjectProperty extends TSESTree.PropertyNonComputedName {\n key: TSESTree.Identifier;\n}\n\nexport function isNormalObjectProperty(node: TSESTree.Node): node is INormalObjectProperty {\n return isProperty(node) && (isIdentifier(node.key) || isPrivateIdentifier(node.key));\n}\n\nexport interface INormalVariableDeclarator extends TSESTree.VariableDeclarator {\n id: TSESTree.Identifier;\n init: TSESTree.Expression;\n}\n\nexport function isNormalVariableDeclarator(node: TSESTree.Node): node is INormalVariableDeclarator {\n return isVariableDeclarator(node) && isIdentifier(node.id) && node.init !== null;\n}\n\nexport interface INormalAssignmentPatternWithAnonymousExpressionAssigned extends INormalAssignmentPattern {\n right: NormalAnonymousExpression;\n}\n\nexport function isNormalAssignmentPatternWithAnonymousExpressionAssigned(\n node: TSESTree.Node\n): node is INormalAssignmentPatternWithAnonymousExpressionAssigned {\n return isNormalAssignmentPattern(node) && isNormalAnonymousExpression(node.right);\n}\n\nexport interface INormalVariableDeclaratorWithAnonymousExpressionAssigned extends INormalVariableDeclarator {\n init: NormalAnonymousExpression;\n}\n\nexport function isNormalVariableDeclaratorWithAnonymousExpressionAssigned(\n node: TSESTree.Node\n): node is INormalVariableDeclaratorWithAnonymousExpressionAssigned {\n return isNormalVariableDeclarator(node) && isNormalAnonymousExpression(node.init);\n}\n\nexport interface INormalObjectPropertyWithAnonymousExpressionAssigned extends INormalObjectProperty {\n value: NormalAnonymousExpression;\n}\n\nexport function isNormalObjectPropertyWithAnonymousExpressionAssigned(\n node: TSESTree.Node\n): node is INormalObjectPropertyWithAnonymousExpressionAssigned {\n return isNormalObjectProperty(node) && isNormalAnonymousExpression(node.value);\n}\n\nexport interface INormalClassPropertyDefinitionWithAnonymousExpressionAssigned\n extends INormalClassPropertyDefinition {\n value: NormalAnonymousExpression;\n}\n\nexport function isNormalClassPropertyDefinitionWithAnonymousExpressionAssigned(\n node: TSESTree.Node\n): node is INormalClassPropertyDefinitionWithAnonymousExpressionAssigned {\n return isNormalClassPropertyDefinition(node) && isNormalAnonymousExpression(node.value);\n}\n\nexport type NodeWithName =\n | TSESTree.ClassDeclarationWithName\n | TSESTree.FunctionDeclarationWithName\n | IClassExpressionWithName\n | IFunctionExpressionWithName\n | INormalVariableDeclaratorWithAnonymousExpressionAssigned\n | INormalObjectPropertyWithAnonymousExpressionAssigned\n | INormalClassPropertyDefinitionWithAnonymousExpressionAssigned\n | INormalAssignmentPatternWithAnonymousExpressionAssigned\n | INormalMethodDefinition\n | TSESTree.TSEnumDeclaration\n | TSESTree.TSInterfaceDeclaration\n | TSESTree.TSTypeAliasDeclaration;\n\nexport function isNodeWithName(node: TSESTree.Node): node is NodeWithName {\n return (\n isClassDeclarationWithName(node) ||\n isFunctionDeclarationWithName(node) ||\n isClassExpressionWithName(node) ||\n isFunctionExpressionWithName(node) ||\n isNormalVariableDeclaratorWithAnonymousExpressionAssigned(node) ||\n isNormalObjectPropertyWithAnonymousExpressionAssigned(node) ||\n isNormalClassPropertyDefinitionWithAnonymousExpressionAssigned(node) ||\n isNormalAssignmentPatternWithAnonymousExpressionAssigned(node) ||\n isNormalMethodDefinition(node) ||\n isTSEnumDeclaration(node) ||\n isTSInterfaceDeclaration(node) ||\n isTSTypeAliasDeclaration(node)\n );\n}\n"]} |