vue-eslint-parser
Version:
The ESLint custom parser for `.vue` files.
1 lines • 803 kB
Source Map (JSON)
{"version":3,"file":"index.js.map","sources":[".temp/ast/src/ast/errors.ts",".temp/ast/src/ast/nodes.ts",".temp/ast/src/ast/traverse.ts",".temp/common/src/common/lines-and-columns.ts",".temp/common/src/common/location-calculator.ts",".temp/common/src/common/debug.ts",".temp/common/src/common/ast-utils.ts",".temp/common/src/common/parser-object.ts",".temp/common/src/common/parser-options.ts",".temp/common/src/common/create-require.ts",".temp/common/src/common/linter-require.ts",".temp/common/src/common/eslint-scope.ts",".temp/common/src/common/espree.ts",".temp/script/src/script/scope-analyzer.ts",".temp/common/src/common/fix-locations.ts",".temp/script-setup/src/script-setup/parser-options.ts",".temp/script/src/script/generic.ts",".temp/script/src/script/index.ts",".temp/common/src/common/token-utils.ts",".temp/common/src/common/error-utils.ts",".temp/utils/src/utils/utils.ts",".temp/template/src/template/index.ts",".temp/html/util/src/html/util/attribute-names.ts",".temp/html/util/src/html/util/tag-names.ts",".temp/html/src/html/intermediate-tokenizer.ts",".temp/html/src/html/parser.ts",".temp/html/util/src/html/util/alternative-cr.ts",".temp/html/util/src/html/util/entities.ts",".temp/html/util/src/html/util/unicode.ts",".temp/html/src/html/tokenizer.ts",".temp/external/src/external/node-event-generator.ts",".temp/external/token-store/src/external/token-store/utils.ts",".temp/external/token-store/cursors/src/external/token-store/cursors/cursor.ts",".temp/external/token-store/cursors/src/external/token-store/cursors/backward-token-comment-cursor.ts",".temp/external/token-store/cursors/src/external/token-store/cursors/backward-token-cursor.ts",".temp/external/token-store/cursors/src/external/token-store/cursors/decorative-cursor.ts",".temp/external/token-store/cursors/src/external/token-store/cursors/filter-cursor.ts",".temp/external/token-store/cursors/src/external/token-store/cursors/forward-token-comment-cursor.ts",".temp/external/token-store/cursors/src/external/token-store/cursors/forward-token-cursor.ts",".temp/external/token-store/cursors/src/external/token-store/cursors/limit-cursor.ts",".temp/external/token-store/cursors/src/external/token-store/cursors/skip-cursor.ts",".temp/external/token-store/cursors/src/external/token-store/cursors/index.ts",".temp/external/token-store/cursors/src/external/token-store/cursors/padded-token-cursor.ts",".temp/external/token-store/src/external/token-store/index.ts",".temp/sfc/custom-block/src/sfc/custom-block/index.ts",".temp/src/parser-services.ts",".temp/script-setup/src/script-setup/index.ts",".temp/style/src/style/tokenizer.ts",".temp/style/src/style/index.ts",".temp/script-setup/src/script-setup/scope-analyzer.ts",".temp/src/index.ts"],"sourcesContent":["/**\n * @author Toru Nagashima <https://github.com/mysticatea>\n * @copyright 2017 Toru Nagashima. All rights reserved.\n * See LICENSE file in root directory for full license.\n */\nimport type { Location } from \"./locations\"\n\n/**\n * Check whether the given value has acorn style location information.\n * @param x The value to check.\n * @returns `true` if the value has acorn style location information.\n */\nfunction isAcornStyleParseError(\n x: any,\n): x is { message: string; pos: number; loc: Location } {\n return (\n typeof x.message === \"string\" &&\n typeof x.pos === \"number\" &&\n typeof x.loc === \"object\" &&\n x.loc !== null &&\n typeof x.loc.line === \"number\" &&\n typeof x.loc.column === \"number\"\n )\n}\n\n/**\n * Check whether the given value is probably a TSError.\n * @param x The value to check.\n * @returns `true` if the given value is probably a TSError.\n */\nfunction isTSError(\n x: any,\n): x is { message: string; index: number; lineNumber: number; column: number } {\n return (\n !(x instanceof ParseError) &&\n typeof x.message === \"string\" &&\n typeof x.index === \"number\" &&\n typeof x.lineNumber === \"number\" &&\n typeof x.column === \"number\" &&\n x.name === \"TSError\"\n )\n}\n\n/**\n * HTML parse errors.\n */\nexport class ParseError extends SyntaxError {\n public code?: ErrorCode\n public index: number\n public lineNumber: number\n public column: number\n\n /**\n * Create new parser error object.\n * @param code The error code. See also: https://html.spec.whatwg.org/multipage/parsing.html#parse-errors\n * @param offset The offset number of this error.\n * @param line The line number of this error.\n * @param column The column number of this error.\n */\n public static fromCode(\n code: ErrorCode,\n offset: number,\n line: number,\n column: number,\n ): ParseError {\n return new ParseError(code, code, offset, line, column)\n }\n\n /**\n * Normalize the error object.\n * @param x The error object to normalize.\n */\n public static normalize(x: any): ParseError | null {\n if (isTSError(x)) {\n return new ParseError(\n x.message,\n undefined,\n x.index,\n x.lineNumber,\n x.column,\n )\n }\n if (ParseError.isParseError(x)) {\n return x\n }\n if (isAcornStyleParseError(x)) {\n return new ParseError(\n x.message,\n undefined,\n x.pos,\n x.loc.line,\n x.loc.column,\n )\n }\n return null\n }\n\n /**\n * Initialize this ParseError instance.\n * @param message The error message.\n * @param code The error code. See also: https://html.spec.whatwg.org/multipage/parsing.html#parse-errors\n * @param offset The offset number of this error.\n * @param line The line number of this error.\n * @param column The column number of this error.\n */\n public constructor(\n message: string,\n code: ErrorCode | undefined,\n offset: number,\n line: number,\n column: number,\n ) {\n super(message)\n this.code = code\n this.index = offset\n this.lineNumber = line\n this.column = column\n }\n\n /**\n * Type guard for ParseError.\n * @param x The value to check.\n * @returns `true` if the value has `message`, `pos`, `loc` properties.\n */\n public static isParseError(x: any): x is ParseError {\n return (\n x instanceof ParseError ||\n (typeof x.message === \"string\" &&\n typeof x.index === \"number\" &&\n typeof x.lineNumber === \"number\" &&\n typeof x.column === \"number\")\n )\n }\n}\n\n/**\n * The error codes of HTML syntax errors.\n * https://html.spec.whatwg.org/multipage/parsing.html#parse-errors\n */\nexport type ErrorCode =\n | \"abrupt-closing-of-empty-comment\"\n | \"absence-of-digits-in-numeric-character-reference\"\n | \"cdata-in-html-content\"\n | \"character-reference-outside-unicode-range\"\n | \"control-character-in-input-stream\"\n | \"control-character-reference\"\n | \"eof-before-tag-name\"\n | \"eof-in-cdata\"\n | \"eof-in-comment\"\n | \"eof-in-tag\"\n | \"incorrectly-closed-comment\"\n | \"incorrectly-opened-comment\"\n | \"invalid-first-character-of-tag-name\"\n | \"missing-attribute-value\"\n | \"missing-end-tag-name\"\n | \"missing-semicolon-after-character-reference\"\n | \"missing-whitespace-between-attributes\"\n | \"nested-comment\"\n | \"noncharacter-character-reference\"\n | \"noncharacter-in-input-stream\"\n | \"null-character-reference\"\n | \"surrogate-character-reference\"\n | \"surrogate-in-input-stream\"\n | \"unexpected-character-in-attribute-name\"\n | \"unexpected-character-in-unquoted-attribute-value\"\n | \"unexpected-equals-sign-before-attribute-name\"\n | \"unexpected-null-character\"\n | \"unexpected-question-mark-instead-of-tag-name\"\n | \"unexpected-solidus-in-tag\"\n | \"unknown-named-character-reference\"\n | \"end-tag-with-attributes\"\n | \"duplicate-attribute\"\n | \"end-tag-with-trailing-solidus\"\n | \"non-void-html-element-start-tag-with-trailing-solidus\"\n | \"x-invalid-end-tag\"\n | \"x-invalid-namespace\"\n | \"x-missing-interpolation-end\"\n// ---- Use RAWTEXT state for <script> elements instead ----\n// \"eof-in-script-html-comment-like-text\" |\n// ---- Use BOGUS_COMMENT state for DOCTYPEs instead ----\n// \"abrupt-doctype-public-identifier\" |\n// \"abrupt-doctype-system-identifier\" |\n// \"eof-in-doctype\" |\n// \"invalid-character-sequence-after-doctype-name\" |\n// \"missing-doctype-name\" |\n// \"missing-doctype-public-identifier\" |\n// \"missing-doctype-system-identifier\" |\n// \"missing-quote-before-doctype-public-identifier\" |\n// \"missing-quote-before-doctype-system-identifier\" |\n// \"missing-whitespace-after-doctype-public-keyword\" |\n// \"missing-whitespace-after-doctype-system-keyword\" |\n// \"missing-whitespace-before-doctype-name\" |\n// \"missing-whitespace-between-doctype-public-and-system-identifiers\" |\n// \"unexpected-character-after-doctype-system-identifier\" |\n","/**\n * @author Toru Nagashima <https://github.com/mysticatea>\n * @copyright 2017 Toru Nagashima. All rights reserved.\n * See LICENSE file in root directory for full license.\n */\nimport type { ScopeManager } from \"eslint-scope\"\nimport type { ParseError } from \"./errors\"\nimport type { HasLocation } from \"./locations\"\nimport type { Token } from \"./tokens\"\n// eslint-disable-next-line node/no-extraneous-import -- ignore\nimport type { TSESTree } from \"@typescript-eslint/utils\"\n\n//------------------------------------------------------------------------------\n// Common\n//------------------------------------------------------------------------------\n\n/**\n * Objects which have their parent.\n */\nexport interface HasParent {\n parent?: Node | null\n}\n\n/**\n * The union type for all nodes.\n */\nexport type Node =\n | ESLintNode\n | VNode\n | VForExpression\n | VOnExpression\n | VSlotScopeExpression\n | VGenericExpression\n | VFilterSequenceExpression\n | VFilter\n\n//------------------------------------------------------------------------------\n// Script\n//------------------------------------------------------------------------------\n\n/**\n * The union type for ESLint nodes.\n */\nexport type ESLintNode =\n | ESLintIdentifier\n | ESLintLiteral\n | ESLintProgram\n | ESLintSwitchCase\n | ESLintCatchClause\n | ESLintVariableDeclarator\n | ESLintStatement\n | ESLintExpression\n | ESLintProperty\n | ESLintAssignmentProperty\n | ESLintSuper\n | ESLintTemplateElement\n | ESLintSpreadElement\n | ESLintPattern\n | ESLintClassBody\n | ESLintMethodDefinition\n | ESLintPropertyDefinition\n | ESLintStaticBlock\n | ESLintPrivateIdentifier\n | ESLintModuleDeclaration\n | ESLintModuleSpecifier\n | ESLintImportExpression\n | ESLintLegacyRestProperty\n\n/**\n * The parsing result of ESLint custom parsers.\n */\nexport interface ESLintExtendedProgram {\n ast: ESLintProgram\n services?: {}\n visitorKeys?: { [type: string]: string[] }\n scopeManager?: ScopeManager\n}\n\nexport interface ESLintProgram extends HasLocation, HasParent {\n type: \"Program\"\n sourceType: \"script\" | \"module\"\n body: (ESLintStatement | ESLintModuleDeclaration)[]\n templateBody?: VElement & HasConcreteInfo\n tokens?: Token[]\n comments?: Token[]\n errors?: ParseError[]\n}\n\nexport type ESLintStatement =\n | ESLintExpressionStatement\n | ESLintBlockStatement\n | ESLintEmptyStatement\n | ESLintDebuggerStatement\n | ESLintWithStatement\n | ESLintReturnStatement\n | ESLintLabeledStatement\n | ESLintBreakStatement\n | ESLintContinueStatement\n | ESLintIfStatement\n | ESLintSwitchStatement\n | ESLintThrowStatement\n | ESLintTryStatement\n | ESLintWhileStatement\n | ESLintDoWhileStatement\n | ESLintForStatement\n | ESLintForInStatement\n | ESLintForOfStatement\n | ESLintDeclaration\n\nexport interface ESLintEmptyStatement extends HasLocation, HasParent {\n type: \"EmptyStatement\"\n}\n\nexport interface ESLintBlockStatement extends HasLocation, HasParent {\n type: \"BlockStatement\"\n body: ESLintStatement[]\n}\n\nexport interface ESLintExpressionStatement extends HasLocation, HasParent {\n type: \"ExpressionStatement\"\n expression: ESLintExpression\n}\n\nexport interface ESLintIfStatement extends HasLocation, HasParent {\n type: \"IfStatement\"\n test: ESLintExpression\n consequent: ESLintStatement\n alternate: ESLintStatement | null\n}\n\nexport interface ESLintSwitchStatement extends HasLocation, HasParent {\n type: \"SwitchStatement\"\n discriminant: ESLintExpression\n cases: ESLintSwitchCase[]\n}\n\nexport interface ESLintSwitchCase extends HasLocation, HasParent {\n type: \"SwitchCase\"\n test: ESLintExpression | null\n consequent: ESLintStatement[]\n}\n\nexport interface ESLintWhileStatement extends HasLocation, HasParent {\n type: \"WhileStatement\"\n test: ESLintExpression\n body: ESLintStatement\n}\n\nexport interface ESLintDoWhileStatement extends HasLocation, HasParent {\n type: \"DoWhileStatement\"\n body: ESLintStatement\n test: ESLintExpression\n}\n\nexport interface ESLintForStatement extends HasLocation, HasParent {\n type: \"ForStatement\"\n init: ESLintVariableDeclaration | ESLintExpression | null\n test: ESLintExpression | null\n update: ESLintExpression | null\n body: ESLintStatement\n}\n\nexport interface ESLintForInStatement extends HasLocation, HasParent {\n type: \"ForInStatement\"\n left: ESLintVariableDeclaration | ESLintPattern\n right: ESLintExpression\n body: ESLintStatement\n}\n\nexport interface ESLintForOfStatement extends HasLocation, HasParent {\n type: \"ForOfStatement\"\n left: ESLintVariableDeclaration | ESLintPattern\n right: ESLintExpression\n body: ESLintStatement\n await: boolean\n}\n\nexport interface ESLintLabeledStatement extends HasLocation, HasParent {\n type: \"LabeledStatement\"\n label: ESLintIdentifier\n body: ESLintStatement\n}\n\nexport interface ESLintBreakStatement extends HasLocation, HasParent {\n type: \"BreakStatement\"\n label: ESLintIdentifier | null\n}\n\nexport interface ESLintContinueStatement extends HasLocation, HasParent {\n type: \"ContinueStatement\"\n label: ESLintIdentifier | null\n}\n\nexport interface ESLintReturnStatement extends HasLocation, HasParent {\n type: \"ReturnStatement\"\n argument: ESLintExpression | null\n}\n\nexport interface ESLintThrowStatement extends HasLocation, HasParent {\n type: \"ThrowStatement\"\n argument: ESLintExpression\n}\n\nexport interface ESLintTryStatement extends HasLocation, HasParent {\n type: \"TryStatement\"\n block: ESLintBlockStatement\n handler: ESLintCatchClause | null\n finalizer: ESLintBlockStatement | null\n}\n\nexport interface ESLintCatchClause extends HasLocation, HasParent {\n type: \"CatchClause\"\n param: ESLintPattern | null\n body: ESLintBlockStatement\n}\n\nexport interface ESLintWithStatement extends HasLocation, HasParent {\n type: \"WithStatement\"\n object: ESLintExpression\n body: ESLintStatement\n}\n\nexport interface ESLintDebuggerStatement extends HasLocation, HasParent {\n type: \"DebuggerStatement\"\n}\n\nexport type ESLintDeclaration =\n | ESLintFunctionDeclaration\n | ESLintVariableDeclaration\n | ESLintClassDeclaration\n\nexport interface ESLintFunctionDeclaration extends HasLocation, HasParent {\n type: \"FunctionDeclaration\"\n async: boolean\n generator: boolean\n id: ESLintIdentifier | null\n params: ESLintPattern[]\n body: ESLintBlockStatement\n}\n\nexport interface ESLintVariableDeclaration extends HasLocation, HasParent {\n type: \"VariableDeclaration\"\n kind: \"var\" | \"let\" | \"const\"\n declarations: ESLintVariableDeclarator[]\n}\n\nexport interface ESLintVariableDeclarator extends HasLocation, HasParent {\n type: \"VariableDeclarator\"\n id: ESLintPattern\n init: ESLintExpression | null\n}\n\nexport interface ESLintClassDeclaration extends HasLocation, HasParent {\n type: \"ClassDeclaration\"\n id: ESLintIdentifier | null\n superClass: ESLintExpression | null\n body: ESLintClassBody\n}\n\nexport interface ESLintClassBody extends HasLocation, HasParent {\n type: \"ClassBody\"\n body: (\n | ESLintMethodDefinition\n | ESLintPropertyDefinition\n | ESLintStaticBlock\n )[]\n}\n\nexport interface ESLintMethodDefinition extends HasLocation, HasParent {\n type: \"MethodDefinition\"\n kind: \"constructor\" | \"method\" | \"get\" | \"set\"\n computed: boolean\n static: boolean\n key: ESLintExpression | ESLintPrivateIdentifier\n value: ESLintFunctionExpression\n}\nexport interface ESLintPropertyDefinition extends HasLocation, HasParent {\n type: \"PropertyDefinition\"\n computed: boolean\n static: boolean\n key: ESLintExpression | ESLintPrivateIdentifier\n value: ESLintExpression | null\n}\n\nexport interface ESLintStaticBlock\n extends HasLocation,\n HasParent,\n Omit<ESLintBlockStatement, \"type\"> {\n type: \"StaticBlock\"\n body: ESLintStatement[]\n}\n\nexport interface ESLintPrivateIdentifier extends HasLocation, HasParent {\n type: \"PrivateIdentifier\"\n name: string\n}\n\nexport type ESLintModuleDeclaration =\n | ESLintImportDeclaration\n | ESLintExportNamedDeclaration\n | ESLintExportDefaultDeclaration\n | ESLintExportAllDeclaration\n\nexport type ESLintModuleSpecifier =\n | ESLintImportSpecifier\n | ESLintImportDefaultSpecifier\n | ESLintImportNamespaceSpecifier\n | ESLintExportSpecifier\n\nexport interface ESLintImportDeclaration extends HasLocation, HasParent {\n type: \"ImportDeclaration\"\n specifiers: (\n | ESLintImportSpecifier\n | ESLintImportDefaultSpecifier\n | ESLintImportNamespaceSpecifier\n )[]\n source: ESLintLiteral\n}\n\nexport interface ESLintImportSpecifier extends HasLocation, HasParent {\n type: \"ImportSpecifier\"\n imported: ESLintIdentifier | ESLintStringLiteral\n local: ESLintIdentifier\n}\n\nexport interface ESLintImportDefaultSpecifier extends HasLocation, HasParent {\n type: \"ImportDefaultSpecifier\"\n local: ESLintIdentifier\n}\n\nexport interface ESLintImportNamespaceSpecifier extends HasLocation, HasParent {\n type: \"ImportNamespaceSpecifier\"\n local: ESLintIdentifier\n}\n\nexport interface ESLintImportExpression extends HasLocation, HasParent {\n type: \"ImportExpression\"\n source: ESLintExpression\n}\n\nexport interface ESLintExportNamedDeclaration extends HasLocation, HasParent {\n type: \"ExportNamedDeclaration\"\n declaration?: ESLintDeclaration | null\n specifiers: ESLintExportSpecifier[]\n source?: ESLintLiteral | null\n}\n\nexport interface ESLintExportSpecifier extends HasLocation, HasParent {\n type: \"ExportSpecifier\"\n local: ESLintIdentifier | ESLintStringLiteral\n exported: ESLintIdentifier | ESLintStringLiteral\n}\n\nexport interface ESLintExportDefaultDeclaration extends HasLocation, HasParent {\n type: \"ExportDefaultDeclaration\"\n declaration: ESLintDeclaration | ESLintExpression\n}\n\nexport interface ESLintExportAllDeclaration extends HasLocation, HasParent {\n type: \"ExportAllDeclaration\"\n exported: ESLintIdentifier | ESLintStringLiteral | null\n source: ESLintLiteral\n}\n\nexport type ESLintExpression =\n | ESLintThisExpression\n | ESLintArrayExpression\n | ESLintObjectExpression\n | ESLintFunctionExpression\n | ESLintArrowFunctionExpression\n | ESLintYieldExpression\n | ESLintLiteral\n | ESLintUnaryExpression\n | ESLintUpdateExpression\n | ESLintBinaryExpression\n | ESLintAssignmentExpression\n | ESLintLogicalExpression\n | ESLintMemberExpression\n | ESLintConditionalExpression\n | ESLintCallExpression\n | ESLintNewExpression\n | ESLintSequenceExpression\n | ESLintTemplateLiteral\n | ESLintTaggedTemplateExpression\n | ESLintClassExpression\n | ESLintMetaProperty\n | ESLintIdentifier\n | ESLintAwaitExpression\n | ESLintChainExpression\n\nexport interface ESLintIdentifier extends HasLocation, HasParent {\n type: \"Identifier\"\n name: string\n}\ninterface ESLintLiteralBase extends HasLocation, HasParent {\n type: \"Literal\"\n value: string | boolean | null | number | RegExp | bigint\n raw: string\n regex?: {\n pattern: string\n flags: string\n }\n bigint?: string\n}\nexport interface ESLintStringLiteral extends ESLintLiteralBase {\n value: string\n regex?: undefined\n bigint?: undefined\n}\nexport interface ESLintBooleanLiteral extends ESLintLiteralBase {\n value: boolean\n regex?: undefined\n bigint?: undefined\n}\nexport interface ESLintNullLiteral extends ESLintLiteralBase {\n value: null\n regex?: undefined\n bigint?: undefined\n}\nexport interface ESLintNumberLiteral extends ESLintLiteralBase {\n value: number\n regex?: undefined\n bigint?: undefined\n}\nexport interface ESLintRegExpLiteral extends ESLintLiteralBase {\n value: null | RegExp\n regex: {\n pattern: string\n flags: string\n }\n bigint?: undefined\n}\nexport interface ESLintBigIntLiteral extends ESLintLiteralBase {\n value: null | bigint\n regex?: undefined\n bigint: string\n}\nexport type ESLintLiteral =\n | ESLintStringLiteral\n | ESLintBooleanLiteral\n | ESLintNullLiteral\n | ESLintNumberLiteral\n | ESLintRegExpLiteral\n | ESLintBigIntLiteral\n\nexport interface ESLintThisExpression extends HasLocation, HasParent {\n type: \"ThisExpression\"\n}\n\nexport interface ESLintArrayExpression extends HasLocation, HasParent {\n type: \"ArrayExpression\"\n elements: (ESLintExpression | ESLintSpreadElement)[]\n}\n\nexport interface ESLintObjectExpression extends HasLocation, HasParent {\n type: \"ObjectExpression\"\n properties: (\n | ESLintProperty\n | ESLintSpreadElement\n | ESLintLegacySpreadProperty\n )[]\n}\n\nexport interface ESLintProperty extends HasLocation, HasParent {\n type: \"Property\"\n kind: \"init\" | \"get\" | \"set\"\n method: boolean\n shorthand: boolean\n computed: boolean\n key: ESLintExpression\n value: ESLintExpression | ESLintPattern\n}\n\nexport interface ESLintFunctionExpression extends HasLocation, HasParent {\n type: \"FunctionExpression\"\n async: boolean\n generator: boolean\n id: ESLintIdentifier | null\n params: ESLintPattern[]\n body: ESLintBlockStatement\n}\n\nexport interface ESLintArrowFunctionExpression extends HasLocation, HasParent {\n type: \"ArrowFunctionExpression\"\n async: boolean\n generator: boolean\n id: ESLintIdentifier | null\n params: ESLintPattern[]\n body: ESLintBlockStatement | ESLintExpression\n}\n\nexport interface ESLintSequenceExpression extends HasLocation, HasParent {\n type: \"SequenceExpression\"\n expressions: ESLintExpression[]\n}\n\nexport interface ESLintUnaryExpression extends HasLocation, HasParent {\n type: \"UnaryExpression\"\n operator: \"-\" | \"+\" | \"!\" | \"~\" | \"typeof\" | \"void\" | \"delete\"\n prefix: boolean\n argument: ESLintExpression\n}\n\nexport interface ESLintBinaryExpression extends HasLocation, HasParent {\n type: \"BinaryExpression\"\n operator:\n | \"==\"\n | \"!=\"\n | \"===\"\n | \"!==\"\n | \"<\"\n | \"<=\"\n | \">\"\n | \">=\"\n | \"<<\"\n | \">>\"\n | \">>>\"\n | \"+\"\n | \"-\"\n | \"*\"\n | \"/\"\n | \"%\"\n | \"**\"\n | \"|\"\n | \"^\"\n | \"&\"\n | \"in\"\n | \"instanceof\"\n left: ESLintExpression | ESLintPrivateIdentifier\n right: ESLintExpression\n}\n\nexport interface ESLintAssignmentExpression extends HasLocation, HasParent {\n type: \"AssignmentExpression\"\n operator:\n | \"=\"\n | \"+=\"\n | \"-=\"\n | \"*=\"\n | \"/=\"\n | \"%=\"\n | \"**=\"\n | \"<<=\"\n | \">>=\"\n | \">>>=\"\n | \"|=\"\n | \"^=\"\n | \"&=\"\n | \"||=\"\n | \"&&=\"\n | \"??=\"\n left: ESLintPattern\n right: ESLintExpression\n}\n\nexport interface ESLintUpdateExpression extends HasLocation, HasParent {\n type: \"UpdateExpression\"\n operator: \"++\" | \"--\"\n argument: ESLintExpression\n prefix: boolean\n}\n\nexport interface ESLintLogicalExpression extends HasLocation, HasParent {\n type: \"LogicalExpression\"\n operator: \"||\" | \"&&\" | \"??\"\n left: ESLintExpression\n right: ESLintExpression\n}\n\nexport interface ESLintConditionalExpression extends HasLocation, HasParent {\n type: \"ConditionalExpression\"\n test: ESLintExpression\n alternate: ESLintExpression\n consequent: ESLintExpression\n}\n\nexport interface ESLintCallExpression extends HasLocation, HasParent {\n type: \"CallExpression\"\n optional: boolean\n callee: ESLintExpression | ESLintSuper\n arguments: (ESLintExpression | ESLintSpreadElement)[]\n}\n\nexport interface ESLintSuper extends HasLocation, HasParent {\n type: \"Super\"\n}\n\nexport interface ESLintNewExpression extends HasLocation, HasParent {\n type: \"NewExpression\"\n callee: ESLintExpression\n arguments: (ESLintExpression | ESLintSpreadElement)[]\n}\n\nexport interface ESLintMemberExpression extends HasLocation, HasParent {\n type: \"MemberExpression\"\n optional: boolean\n computed: boolean\n object: ESLintExpression | ESLintSuper\n property: ESLintExpression | ESLintPrivateIdentifier\n}\n\nexport interface ESLintYieldExpression extends HasLocation, HasParent {\n type: \"YieldExpression\"\n delegate: boolean\n argument: ESLintExpression | null\n}\n\nexport interface ESLintAwaitExpression extends HasLocation, HasParent {\n type: \"AwaitExpression\"\n argument: ESLintExpression\n}\n\nexport interface ESLintTemplateLiteral extends HasLocation, HasParent {\n type: \"TemplateLiteral\"\n quasis: ESLintTemplateElement[]\n expressions: ESLintExpression[]\n}\n\nexport interface ESLintTaggedTemplateExpression extends HasLocation, HasParent {\n type: \"TaggedTemplateExpression\"\n tag: ESLintExpression\n quasi: ESLintTemplateLiteral\n}\n\nexport interface ESLintTemplateElement extends HasLocation, HasParent {\n type: \"TemplateElement\"\n tail: boolean\n value: {\n cooked: string | null\n raw: string\n }\n}\n\nexport interface ESLintClassExpression extends HasLocation, HasParent {\n type: \"ClassExpression\"\n id: ESLintIdentifier | null\n superClass: ESLintExpression | null\n body: ESLintClassBody\n}\n\nexport interface ESLintMetaProperty extends HasLocation, HasParent {\n type: \"MetaProperty\"\n meta: ESLintIdentifier\n property: ESLintIdentifier\n}\n\nexport type ESLintPattern =\n | ESLintIdentifier\n | ESLintObjectPattern\n | ESLintArrayPattern\n | ESLintRestElement\n | ESLintAssignmentPattern\n | ESLintMemberExpression\n | ESLintLegacyRestProperty\n\nexport interface ESLintObjectPattern extends HasLocation, HasParent {\n type: \"ObjectPattern\"\n properties: (\n | ESLintAssignmentProperty\n | ESLintRestElement\n | ESLintLegacyRestProperty\n )[]\n}\n\nexport interface ESLintAssignmentProperty extends ESLintProperty {\n value: ESLintPattern\n kind: \"init\"\n method: false\n}\n\nexport interface ESLintArrayPattern extends HasLocation, HasParent {\n type: \"ArrayPattern\"\n elements: ESLintPattern[]\n}\n\nexport interface ESLintRestElement extends HasLocation, HasParent {\n type: \"RestElement\"\n argument: ESLintPattern\n}\n\nexport interface ESLintSpreadElement extends HasLocation, HasParent {\n type: \"SpreadElement\"\n argument: ESLintExpression\n}\n\nexport interface ESLintAssignmentPattern extends HasLocation, HasParent {\n type: \"AssignmentPattern\"\n left: ESLintPattern\n right: ESLintExpression\n}\n\nexport type ESLintChainElement = ESLintCallExpression | ESLintMemberExpression\n\nexport interface ESLintChainExpression extends HasLocation, HasParent {\n type: \"ChainExpression\"\n expression: ESLintChainElement\n}\n\n/**\n * Legacy for babel-eslint and espree.\n */\nexport interface ESLintLegacyRestProperty extends HasLocation, HasParent {\n type: \"RestProperty\" | \"ExperimentalRestProperty\"\n argument: ESLintPattern\n}\n\n/**\n * Legacy for babel-eslint and espree.\n */\nexport interface ESLintLegacySpreadProperty extends HasLocation, HasParent {\n type: \"SpreadProperty\" | \"ExperimentalSpreadProperty\"\n argument: ESLintExpression\n}\n\n//------------------------------------------------------------------------------\n// Template\n//------------------------------------------------------------------------------\n\n/**\n * Constants of namespaces.\n * @see https://infra.spec.whatwg.org/#namespaces\n */\nexport const NS = Object.freeze({\n HTML: \"http://www.w3.org/1999/xhtml\" as \"http://www.w3.org/1999/xhtml\",\n MathML: \"http://www.w3.org/1998/Math/MathML\" as \"http://www.w3.org/1998/Math/MathML\",\n SVG: \"http://www.w3.org/2000/svg\" as \"http://www.w3.org/2000/svg\",\n XLink: \"http://www.w3.org/1999/xlink\" as \"http://www.w3.org/1999/xlink\",\n XML: \"http://www.w3.org/XML/1998/namespace\" as \"http://www.w3.org/XML/1998/namespace\",\n XMLNS: \"http://www.w3.org/2000/xmlns/\" as \"http://www.w3.org/2000/xmlns/\",\n})\n\n/**\n * Type of namespaces.\n */\nexport type Namespace =\n | typeof NS.HTML\n | typeof NS.MathML\n | typeof NS.SVG\n | typeof NS.XLink\n | typeof NS.XML\n | typeof NS.XMLNS\n\n/**\n * Type of variable definitions.\n */\nexport interface Variable {\n id: ESLintIdentifier\n kind: \"v-for\" | \"scope\" | \"generic\"\n references: Reference[]\n}\n\n/**\n * Type of variable references.\n */\nexport interface Reference {\n id: ESLintIdentifier\n mode: \"rw\" | \"r\" | \"w\"\n variable: Variable | null\n\n // For typescript-eslint\n isValueReference?: boolean\n isTypeReference?: boolean\n}\n\n/**\n * The node of `v-for` directives.\n */\nexport interface VForExpression extends HasLocation, HasParent {\n type: \"VForExpression\"\n parent: VExpressionContainer\n left: ESLintPattern[]\n right: ESLintExpression\n}\n\n/**\n * The node of `v-on` directives.\n */\nexport interface VOnExpression extends HasLocation, HasParent {\n type: \"VOnExpression\"\n parent: VExpressionContainer\n body: ESLintStatement[]\n}\n\n/**\n * The node of `slot-scope` directives.\n */\nexport interface VSlotScopeExpression extends HasLocation, HasParent {\n type: \"VSlotScopeExpression\"\n parent: VExpressionContainer\n params: ESLintPattern[]\n}\n\n/**\n * The node of `generic` directives.\n */\nexport interface VGenericExpression extends HasLocation, HasParent {\n type: \"VGenericExpression\"\n parent: VExpressionContainer\n params: TSESTree.TSTypeParameterDeclaration[\"params\"]\n rawParams: string[]\n}\n\n/**\n * The node of a filter sequence which is separated by `|`.\n */\nexport interface VFilterSequenceExpression extends HasLocation, HasParent {\n type: \"VFilterSequenceExpression\"\n parent: VExpressionContainer\n expression: ESLintExpression\n filters: VFilter[]\n}\n\n/**\n * The node of a filter sequence which is separated by `|`.\n */\nexport interface VFilter extends HasLocation, HasParent {\n type: \"VFilter\"\n parent: VFilterSequenceExpression\n callee: ESLintIdentifier\n arguments: (ESLintExpression | ESLintSpreadElement)[]\n}\n\n/**\n * The union type of any nodes.\n */\nexport type VNode =\n | VAttribute\n | VDirective\n | VDirectiveKey\n | VDocumentFragment\n | VElement\n | VEndTag\n | VExpressionContainer\n | VIdentifier\n | VLiteral\n | VStartTag\n | VText\n\n/**\n * Text nodes.\n */\nexport interface VText extends HasLocation, HasParent {\n type: \"VText\"\n parent: VDocumentFragment | VElement\n value: string\n}\n\n/**\n * The node of JavaScript expression in text.\n * e.g. `{{ name }}`\n */\nexport interface VExpressionContainer extends HasLocation, HasParent {\n type: \"VExpressionContainer\"\n parent: VDocumentFragment | VElement | VDirective | VDirectiveKey\n expression:\n | ESLintExpression\n | VFilterSequenceExpression\n | VForExpression\n | VOnExpression\n | VSlotScopeExpression\n | VGenericExpression\n | null\n references: Reference[]\n}\n\n/**\n * Attribute name nodes.\n */\nexport interface VIdentifier extends HasLocation, HasParent {\n type: \"VIdentifier\"\n parent: VAttribute | VDirectiveKey\n name: string\n rawName: string\n}\n\n/**\n * Attribute name nodes.\n */\nexport interface VDirectiveKey extends HasLocation, HasParent {\n type: \"VDirectiveKey\"\n parent: VDirective\n name: VIdentifier\n argument: VExpressionContainer | VIdentifier | null\n modifiers: VIdentifier[]\n}\n\n/**\n * Attribute value nodes.\n */\nexport interface VLiteral extends HasLocation, HasParent {\n type: \"VLiteral\"\n parent: VAttribute\n value: string\n}\n\n/**\n * Static attribute nodes.\n */\nexport interface VAttribute extends HasLocation, HasParent {\n type: \"VAttribute\"\n parent: VStartTag\n directive: false\n key: VIdentifier\n value: VLiteral | null\n}\n\n/**\n * Directive nodes.\n */\nexport interface VDirective extends HasLocation, HasParent {\n type: \"VAttribute\"\n parent: VStartTag\n directive: true\n key: VDirectiveKey\n value: VExpressionContainer | null\n}\n\n/**\n * Start tag nodes.\n */\nexport interface VStartTag extends HasLocation, HasParent {\n type: \"VStartTag\"\n parent: VElement\n selfClosing: boolean\n attributes: (VAttribute | VDirective)[]\n}\n\n/**\n * End tag nodes.\n */\nexport interface VEndTag extends HasLocation, HasParent {\n type: \"VEndTag\"\n parent: VElement\n}\n\n/**\n * The property which has concrete information.\n */\nexport interface HasConcreteInfo {\n tokens: Token[]\n comments: Token[]\n errors: ParseError[]\n}\n\n/**\n * Element nodes.\n */\nexport interface VElement extends HasLocation, HasParent {\n type: \"VElement\"\n parent: VDocumentFragment | VElement\n namespace: Namespace\n name: string\n rawName: string\n startTag: VStartTag\n children: (VElement | VText | VExpressionContainer)[]\n endTag: VEndTag | null\n variables: Variable[]\n}\n\n/**\n * Root nodes.\n */\nexport interface VDocumentFragment\n extends HasLocation,\n HasParent,\n HasConcreteInfo {\n type: \"VDocumentFragment\"\n parent: null\n children: (VElement | VText | VExpressionContainer | VStyleElement)[]\n}\n\n/**\n * Style element nodes.\n */\nexport interface VStyleElement extends VElement {\n type: \"VElement\"\n name: \"style\"\n style: true\n children: (VText | VExpressionContainer)[]\n}\n","/**\n * @author Toru Nagashima <https://github.com/mysticatea>\n * @copyright 2017 Toru Nagashima. All rights reserved.\n * See LICENSE file in root directory for full license.\n */\nimport type { VisitorKeys } from \"eslint-visitor-keys\"\nimport * as Evk from \"eslint-visitor-keys\"\nimport type { Node } from \"./nodes\"\n\n//------------------------------------------------------------------------------\n// Helpers\n//------------------------------------------------------------------------------\n\nexport const KEYS = Evk.unionWith({\n VAttribute: [\"key\", \"value\"],\n VDirectiveKey: [\"name\", \"argument\", \"modifiers\"],\n VDocumentFragment: [\"children\"],\n VElement: [\"startTag\", \"children\", \"endTag\"],\n VEndTag: [],\n VExpressionContainer: [\"expression\"],\n VFilter: [\"callee\", \"arguments\"],\n VFilterSequenceExpression: [\"expression\", \"filters\"],\n VForExpression: [\"left\", \"right\"],\n VIdentifier: [],\n VLiteral: [],\n VOnExpression: [\"body\"],\n VSlotScopeExpression: [\"params\"],\n VStartTag: [\"attributes\"],\n VText: [],\n})\n\n/**\n * Check that the given key should be traversed or not.\n * @this {Traversable}\n * @param key The key to check.\n * @returns `true` if the key should be traversed.\n */\nfunction fallbackKeysFilter(this: any, key: string): boolean {\n let value = null\n return (\n key !== \"comments\" &&\n key !== \"leadingComments\" &&\n key !== \"loc\" &&\n key !== \"parent\" &&\n key !== \"range\" &&\n key !== \"tokens\" &&\n key !== \"trailingComments\" &&\n (value = this[key]) !== null &&\n typeof value === \"object\" &&\n (typeof value.type === \"string\" || Array.isArray(value))\n )\n}\n\n/**\n * Get the keys of the given node to traverse it.\n * @param node The node to get.\n * @returns The keys to traverse.\n */\nfunction getFallbackKeys(node: Node): string[] {\n return Object.keys(node).filter(fallbackKeysFilter, node)\n}\n\n/**\n * Check wheather a given value is a node.\n * @param x The value to check.\n * @returns `true` if the value is a node.\n */\nfunction isNode(x: any): x is Node {\n return x !== null && typeof x === \"object\" && typeof x.type === \"string\"\n}\n\n/**\n * Traverse the given node.\n * @param node The node to traverse.\n * @param parent The parent node.\n * @param visitor The node visitor.\n */\nfunction traverse(node: Node, parent: Node | null, visitor: Visitor): void {\n let i = 0\n let j = 0\n\n visitor.enterNode(node, parent)\n\n const keys =\n (visitor.visitorKeys || KEYS)[node.type] || getFallbackKeys(node)\n for (i = 0; i < keys.length; ++i) {\n const child = (node as any)[keys[i]]\n\n if (Array.isArray(child)) {\n for (j = 0; j < child.length; ++j) {\n if (isNode(child[j])) {\n traverse(child[j], node, visitor)\n }\n }\n } else if (isNode(child)) {\n traverse(child, node, visitor)\n }\n }\n\n visitor.leaveNode(node, parent)\n}\n\n//------------------------------------------------------------------------------\n// Exports\n//------------------------------------------------------------------------------\n\nexport interface Visitor {\n visitorKeys?: VisitorKeys\n enterNode(node: Node, parent: Node | null): void\n leaveNode(node: Node, parent: Node | null): void\n}\n\n/**\n * Traverse the given AST tree.\n * @param node Root node to traverse.\n * @param visitor Visitor.\n */\nexport function traverseNodes(node: Node, visitor: Visitor): void {\n traverse(node, null, visitor)\n}\n\nexport { getFallbackKeys }\n","import sortedLastIndex from \"lodash/sortedLastIndex\"\nimport type { Location } from \"../ast\"\nimport type { LocationCalculator } from \"./location-calculator\"\n/**\n * A class for getting lines and columns location.\n */\nexport class LinesAndColumns {\n protected ltOffsets: number[]\n\n /**\n * Initialize.\n * @param ltOffsets The list of the offset of line terminators.\n */\n public constructor(ltOffsets: number[]) {\n this.ltOffsets = ltOffsets\n }\n\n /**\n * Calculate the location of the given index.\n * @param index The index to calculate their location.\n * @returns The location of the index.\n */\n public getLocFromIndex(index: number): Location {\n const line = sortedLastIndex(this.ltOffsets, index) + 1\n const column = index - (line === 1 ? 0 : this.ltOffsets[line - 2])\n return { line, column }\n }\n\n public createOffsetLocationCalculator(offset: number): LocationCalculator {\n return {\n getFixOffset() {\n return offset\n },\n getLocFromIndex: this.getLocFromIndex.bind(this),\n }\n }\n}\n","/**\n * @author Toru Nagashima <https://github.com/mysticatea>\n * @copyright 2017 Toru Nagashima. All rights reserved.\n * See LICENSE file in root directory for full license.\n */\nimport sortedLastIndex from \"lodash/sortedLastIndex\"\nimport type { Location } from \"../ast\"\nimport { LinesAndColumns } from \"./lines-and-columns\"\n\n/**\n * Location calculators.\n */\nexport interface LocationCalculator {\n /**\n * Gets the fix location offset of the given offset with using the base offset of this calculator.\n * @param offset The offset to modify.\n */\n getFixOffset(offset: number, kind: \"start\" | \"end\"): number\n\n /**\n * Calculate the location of the given index.\n * @param index The index to calculate their location.\n * @returns The location of the index.\n */\n getLocFromIndex(index: number): Location\n}\n\n/**\n * Location calculators.\n *\n * HTML tokenizers remove several characters to handle HTML entities and line terminators.\n * Tokens have the processed text as their value, but tokens have offsets and locations in the original text.\n * This calculator calculates the original locations from the processed texts.\n *\n * This calculator will be used for:\n *\n * - Adjusts the locations of script ASTs.\n * - Creates expression containers in postprocess.\n */\nexport class LocationCalculatorForHtml\n extends LinesAndColumns\n implements LocationCalculator\n{\n private gapOffsets: number[]\n private baseOffset: number\n private baseIndexOfGap: number\n private shiftOffset: number\n\n /**\n * Initialize this calculator.\n * @param gapOffsets The list of the offset of removed characters in tokenization phase.\n * @param ltOffsets The list of the offset of line terminators.\n * @param baseOffset The base offset to calculate locations.\n * @param shiftOffset The shift offset to calculate locations.\n */\n public constructor(\n gapOffsets: number[],\n ltOffsets: number[],\n baseOffset?: number,\n shiftOffset = 0,\n ) {\n super(ltOffsets)\n this.gapOffsets = gapOffsets\n this.ltOffsets = ltOffsets\n this.baseOffset = baseOffset || 0\n this.baseIndexOfGap =\n this.baseOffset === 0\n ? 0\n : sortedLastIndex(gapOffsets, this.baseOffset)\n this.shiftOffset = shiftOffset\n }\n\n /**\n * Get sub calculator which have the given base offset.\n * @param offset The base offset of new sub calculator.\n * @returns Sub calculator.\n */\n public getSubCalculatorAfter(offset: number): LocationCalculatorForHtml {\n return new LocationCalculatorForHtml(\n this.gapOffsets,\n this.ltOffsets,\n this.baseOffset + offset,\n this.shiftOffset,\n )\n }\n\n /**\n * Get sub calculator that shifts the given offset.\n * @param offset The shift of new sub calculator.\n * @returns Sub calculator.\n */\n public getSubCalculatorShift(offset: number): LocationCalculatorForHtml {\n return new LocationCalculatorForHtml(\n this.gapOffsets,\n this.ltOffsets,\n this.baseOffset,\n this.shiftOffset + offset,\n )\n }\n\n /**\n * Calculate gap at the given index.\n * @param index The index to calculate gap.\n */\n private _getGap(index: number): number {\n const offsets = this.gapOffsets\n let g0 = sortedLastIndex(offsets, index + this.baseOffset)\n let pos = index + this.baseOffset + g0 - this.baseIndexOfGap\n\n while (g0 < offsets.length && offsets[g0] <= pos) {\n g0 += 1\n pos += 1\n }\n\n return g0 - this.baseIndexOfGap\n }\n\n /**\n * Calculate the location of the given index.\n * @param index The index to calculate their location.\n * @returns The location of the index.\n */\n public getLocation(index: number): Location {\n return this.getLocFromIndex(this.getOffsetWithGap(index))\n }\n\n /**\n * Calculate the offset of the given index.\n * @param index The index to calculate their location.\n * @returns The offset of the index.\n */\n public getOffsetWithGap(index: number): number {\n return index + this.getFixOffset(index)\n }\n\n /**\n * Gets the fix location offset of the given offset with using the base offset of this calculator.\n * @param offset The offset to modify.\n */\n public getFixOffset(offset: number): number {\n const shiftOffset = this.shiftOffset\n const gap = this._getGap(offset + shiftOffset)\n return this.baseOffset + gap + shiftOffset\n }\n}\n","/**\n * @author Toru Nagashima <https://github.com/mysticatea>\n * @copyright 2017 Toru Nagashima. All rights reserved.\n * See LICENSE file in root directory for full license.\n */\nimport debugFactory from \"debug\"\nexport const debug = debugFactory(\"vue-eslint-parser\")\n","import type {\n VAttribute,\n VDirective,\n VDocumentFragment,\n VElement,\n VExpressionContainer,\n VGenericExpression,\n VNode,\n} from \"../ast\"\n\n/**\n * Check whether the node is a `<script>` element.\n * @param node The node to check.\n * @returns `true` if the node is a `<script>` element.\n */\nexport function isScriptElement(node: VNode): node is VElement {\n return node.type === \"VElement\" && node.name === \"script\"\n}\n\n/**\n * Checks whether the given script element is `<script setup>`.\n */\nexport function isScriptSetupElement(script: VElement): boolean {\n return (\n isScriptElement(script) &&\n script.startTag.attributes.some(\n (attr) => !attr.directive && attr.key.name === \"setup\",\n )\n )\n}\n\n/**\n * Check whether the node is a `<template>` element.\n * @param node The node to check.\n * @returns `true` if the node is a `<template>` element.\n */\nexport function isTemplateElement(node: VNode): node is VElement {\n return node.type === \"VElement\" && node.name === \"template\"\n}\n\n/**\n * Check whether the node is a `<style>` element.\n * @param node The node to check.\n * @returns `true` if the node is a `<style>` element.\n */\nexport function isStyleElement(node: VNode): node is VElement {\n return node.type === \"VElement\" && node.name === \"style\"\n}\n\n/**\n * Get the belonging document of the given node.\n * @param leafNode The node to get.\n * @returns The belonging document.\n */\nexport function getOwnerDocument(leafNode: VNode): VDocumentFragment | null {\n let node: VNode | null = leafNode\n while (node != null && node.type !== \"VDocumentFragment\") {\n node = node.parent\n }\n return node\n}\n\n/**\n * Check whether the attribute node is a `lang` attribute.\n * @param attribute The attribute node to check.\n * @returns `true` if the attribute node is a `lang` attribute.\n */\nexport function isLang(\n attribute: VAttribute | VDirective,\n): attribute is VAttribute {\n return attribute.directive === false && attribute.key.name === \"lang\"\n}\n\n/**\n * Get the `lang` attribute value from a given element.\n * @param element The element to get.\n * @param defaultLang The default value of the `lang` attribute.\n * @returns The `lang` attribute value.\n */\nexport function getLang(element: VElement | undefined): string | null {\n const langAttr = element && element.startTag.attributes.find(isLang)\n const lang = langAttr && langAttr.value && langAttr.value.value\n return lang || null\n}\n/**\n * Check whether the given script element has `lang=\"ts\"`.\n * @param element The element to check.\n * @returns The given script element has `lang=\"ts\"`.\n */\nexport function isTSLang(element: VElement | undefined): boolean {\n const lang = getLang(element)\n // See https://github.com/vuejs/core/blob/28e30c819df5e4fc301c98f7be938fa13e8be3bc/packages/compiler-sfc/src/compileScript.ts#L179\n return lang === \"ts\" || lang === \"tsx\"\n}\n\nexport type GenericDirective = VDirective & {\n value: VExpressionContainer & {\n expression: VGenericExpression\n }\n}\n\n/**\n * Find `generic` directive from given `<script>` element\n */\nexport function findGenericDirective(\n element: VElement,\n): GenericDirective | null {\n return (\n element.startTag.attributes.find(\n (attr): attr is GenericDirective =>\n attr.directive &&\n attr.value?.expression?.type === \"VGenericExpression\",\n ) || null\n )\n}\n","import type { ESLintExtendedProgram, ESLintProgram } from \"../ast\"\n\n/**\n * The type of basic ESLint custom parser.\n * e.g. espree\n */\nexport type BasicParserObject<R = ESLintProgram> = {\n parse(code: string, options: any): R\n parseForESLint: undefined\n}\n/**\n * The type of ESLint custom parser enhanced for ESLint.\n * e.g. @babel/eslint-parser, @typescript-eslint/parser\n */\nexport type EnhancedParserObject<R = ESLintExtendedProgram> = {\n parseForESLint(code: string, options: any): R\n parse: undefined\n}\n\n/**\n * The type of ESLint (custom) parsers.\n */\nexport type ParserObject<R1 = ESLintExtendedProgram, R2 = ESLintProgram> =\n | EnhancedParserOb