@vue-vine/eslint-parser 0.1.31 → 0.1.32
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/index.d.mts +88 -30
- package/dist/index.d.ts +88 -30
- package/dist/index.js +32 -12
- package/dist/index.mjs +32 -12
- package/package.json +2 -2
package/dist/index.d.mts
CHANGED
@@ -1,6 +1,8 @@
|
|
1
|
-
import {
|
2
|
-
import { TSESTree } from '@typescript-eslint/types';
|
1
|
+
import { TSESTree as TSESTree$1 } from '@typescript-eslint/types';
|
3
2
|
import { ScopeManager } from 'eslint-scope';
|
3
|
+
import { ParserOptions, parseForESLint as parseForESLint$1 } from '@typescript-eslint/parser';
|
4
|
+
import { TSESTree } from '@typescript-eslint/typescript-estree';
|
5
|
+
import { VisitorKeys } from 'eslint-visitor-keys';
|
4
6
|
|
5
7
|
/**
|
6
8
|
* HTML parse errors.
|
@@ -94,6 +96,65 @@ interface HasLocation {
|
|
94
96
|
end?: number;
|
95
97
|
}
|
96
98
|
|
99
|
+
/**
|
100
|
+
* The type of basic ESLint custom parser.
|
101
|
+
* e.g. espree
|
102
|
+
*/
|
103
|
+
interface BasicParserObject<R = ESLintProgram> {
|
104
|
+
parse: (code: string, options: any) => R;
|
105
|
+
parseForESLint: undefined;
|
106
|
+
}
|
107
|
+
/**
|
108
|
+
* The type of ESLint custom parser enhanced for ESLint.
|
109
|
+
* e.g. @babel/eslint-parser, @typescript-eslint/parser
|
110
|
+
*/
|
111
|
+
interface EnhancedParserObject<R = ESLintExtendedProgram> {
|
112
|
+
parseForESLint: (code: string, options: any) => R;
|
113
|
+
parse: undefined;
|
114
|
+
}
|
115
|
+
/**
|
116
|
+
* The type of ESLint (custom) parsers.
|
117
|
+
*/
|
118
|
+
type ParserObject<R1 = ESLintExtendedProgram, R2 = ESLintProgram> = EnhancedParserObject<R1> | BasicParserObject<R2>;
|
119
|
+
|
120
|
+
declare function prepareTemplate(templateNode: TSESTree.TaggedTemplateExpression): {
|
121
|
+
templatePositionInfo: {
|
122
|
+
templateStartLine: number;
|
123
|
+
templateStartColumn: number;
|
124
|
+
templateStartOffset: number;
|
125
|
+
templateEndOffset: number;
|
126
|
+
templateEndLine: number;
|
127
|
+
templateEndColumn: number;
|
128
|
+
};
|
129
|
+
templateRawContent: string;
|
130
|
+
};
|
131
|
+
|
132
|
+
type PrettierType<T> = {
|
133
|
+
[K in keyof T]: T[K];
|
134
|
+
} & {};
|
135
|
+
type TsESLintParseForESLint = ReturnType<typeof parseForESLint$1>;
|
136
|
+
interface ParseForESLintResult {
|
137
|
+
ast: ESLintProgram;
|
138
|
+
services: TsESLintParseForESLint['services'];
|
139
|
+
scopeManager: TsESLintParseForESLint['scopeManager'];
|
140
|
+
visitorKeys: TsESLintParseForESLint['visitorKeys'];
|
141
|
+
}
|
142
|
+
type VineESLintParserOptions = ParserOptions & {
|
143
|
+
parser?: boolean | string | ParserObject | Record<string, string | ParserObject | undefined>;
|
144
|
+
ecmaFeatures?: ParserOptions['ecmaFeatures'] & {
|
145
|
+
[key: string]: any;
|
146
|
+
};
|
147
|
+
};
|
148
|
+
interface VineTemplateMeta {
|
149
|
+
tokens: Token[];
|
150
|
+
comments: Token[];
|
151
|
+
errors: ParseError[];
|
152
|
+
}
|
153
|
+
type FinalProcessTemplateInfo = ReturnType<typeof prepareTemplate> & {
|
154
|
+
templateRootAST: VTemplateRoot;
|
155
|
+
templateMeta: VineTemplateMeta;
|
156
|
+
};
|
157
|
+
|
97
158
|
/**
|
98
159
|
* Tokens.
|
99
160
|
*/
|
@@ -142,7 +203,7 @@ interface ESLintProgram extends HasLocation, HasParent {
|
|
142
203
|
comments?: Token[];
|
143
204
|
errors?: ParseError[];
|
144
205
|
}
|
145
|
-
type ESLintStatement = ESLintExpressionStatement | ESLintBlockStatement | ESLintEmptyStatement | ESLintDebuggerStatement | ESLintWithStatement | ESLintReturnStatement | ESLintLabeledStatement | ESLintBreakStatement | ESLintContinueStatement | ESLintIfStatement | ESLintSwitchStatement | ESLintThrowStatement | ESLintTryStatement | ESLintWhileStatement | ESLintDoWhileStatement | ESLintForStatement | ESLintForInStatement | ESLintForOfStatement | ESLintDeclaration;
|
206
|
+
type ESLintStatement = ESLintExpressionStatement | ESLintDirective | ESLintBlockStatement | ESLintEmptyStatement | ESLintDebuggerStatement | ESLintWithStatement | ESLintReturnStatement | ESLintLabeledStatement | ESLintBreakStatement | ESLintContinueStatement | ESLintIfStatement | ESLintSwitchStatement | ESLintThrowStatement | ESLintTryStatement | ESLintWhileStatement | ESLintDoWhileStatement | ESLintForStatement | ESLintForInStatement | ESLintForOfStatement | ESLintDeclaration;
|
146
207
|
interface ESLintEmptyStatement extends HasLocation, HasParent {
|
147
208
|
type: 'EmptyStatement';
|
148
209
|
}
|
@@ -154,6 +215,11 @@ interface ESLintExpressionStatement extends HasLocation, HasParent {
|
|
154
215
|
type: 'ExpressionStatement';
|
155
216
|
expression: ESLintExpression;
|
156
217
|
}
|
218
|
+
interface ESLintDirective extends HasLocation, HasParent {
|
219
|
+
type: 'ExpressionStatement';
|
220
|
+
expression: ESLintLiteral;
|
221
|
+
directive: string;
|
222
|
+
}
|
157
223
|
interface ESLintIfStatement extends HasLocation, HasParent {
|
158
224
|
type: 'IfStatement';
|
159
225
|
test: ESLintExpression;
|
@@ -755,41 +821,33 @@ interface VElement extends HasLocation, HasParent {
|
|
755
821
|
*/
|
756
822
|
interface VTemplateRoot extends HasLocation {
|
757
823
|
type: 'VTemplateRoot';
|
758
|
-
parent: TSESTree.Node;
|
824
|
+
parent: TSESTree$1.Node;
|
759
825
|
children: (VElement | VText | VExpressionContainer)[];
|
826
|
+
templateInfo?: PrettierType<Omit<FinalProcessTemplateInfo, 'templateMeta' | 'templateRootAST'>>;
|
760
827
|
}
|
761
828
|
|
829
|
+
declare const KEYS: {
|
830
|
+
readonly [type: string]: readonly string[];
|
831
|
+
};
|
762
832
|
/**
|
763
|
-
*
|
764
|
-
*
|
765
|
-
|
766
|
-
interface BasicParserObject<R = ESLintProgram> {
|
767
|
-
parse: (code: string, options: any) => R;
|
768
|
-
parseForESLint: undefined;
|
769
|
-
}
|
770
|
-
/**
|
771
|
-
* The type of ESLint custom parser enhanced for ESLint.
|
772
|
-
* e.g. @babel/eslint-parser, @typescript-eslint/parser
|
833
|
+
* Get the keys of the given node to traverse it.
|
834
|
+
* @param node The node to get.
|
835
|
+
* @returns The keys to traverse.
|
773
836
|
*/
|
774
|
-
|
775
|
-
|
776
|
-
|
837
|
+
declare function getFallbackKeys(node: Node): string[];
|
838
|
+
interface Visitor {
|
839
|
+
visitorKeys?: VisitorKeys;
|
840
|
+
enterNode: (node: Node, parent: Node | null) => void;
|
841
|
+
leaveNode: (node: Node, parent: Node | null) => void;
|
777
842
|
}
|
778
843
|
/**
|
779
|
-
*
|
844
|
+
* Traverse the given AST tree.
|
845
|
+
* @param node Root node to traverse.
|
846
|
+
* @param visitor Visitor.
|
780
847
|
*/
|
781
|
-
|
782
|
-
|
783
|
-
type VineESLintAST = TSESTree.Program;
|
784
|
-
type ParseForESLintResult = ReturnType<typeof parseForESLint$1>;
|
785
|
-
type VineESLintParserOptions = ParserOptions & {
|
786
|
-
parser?: boolean | string | ParserObject | Record<string, string | ParserObject | undefined>;
|
787
|
-
ecmaFeatures?: ParserOptions['ecmaFeatures'] & {
|
788
|
-
[key: string]: any;
|
789
|
-
};
|
790
|
-
};
|
848
|
+
declare function traverseNodes(node: Node, visitor: Visitor): void;
|
791
849
|
|
792
|
-
declare function parse(code: string, parserOptions: VineESLintParserOptions):
|
850
|
+
declare function parse(code: string, parserOptions: VineESLintParserOptions): ESLintProgram;
|
793
851
|
declare function parseForESLint(code: string, parserOptions: VineESLintParserOptions): ParseForESLintResult;
|
794
852
|
|
795
|
-
export { parse, parseForESLint };
|
853
|
+
export { type ESLintArrayExpression, type ESLintArrayPattern, type ESLintArrowFunctionExpression, type ESLintAssignmentExpression, type ESLintAssignmentPattern, type ESLintAssignmentProperty, type ESLintAwaitExpression, type ESLintBigIntLiteral, type ESLintBinaryExpression, type ESLintBlockStatement, type ESLintBooleanLiteral, type ESLintBreakStatement, type ESLintCallExpression, type ESLintCatchClause, type ESLintChainElement, type ESLintChainExpression, type ESLintClassBody, type ESLintClassDeclaration, type ESLintClassExpression, type ESLintConditionalExpression, type ESLintContinueStatement, type ESLintDebuggerStatement, type ESLintDeclaration, type ESLintDirective, type ESLintDoWhileStatement, type ESLintEmptyStatement, type ESLintExportAllDeclaration, type ESLintExportDefaultDeclaration, type ESLintExportNamedDeclaration, type ESLintExportSpecifier, type ESLintExpression, type ESLintExpressionStatement, type ESLintExtendedProgram, type ESLintForInStatement, type ESLintForOfStatement, type ESLintForStatement, type ESLintFunctionDeclaration, type ESLintFunctionExpression, type ESLintIdentifier, type ESLintIfStatement, type ESLintImportDeclaration, type ESLintImportDefaultSpecifier, type ESLintImportExpression, type ESLintImportNamespaceSpecifier, type ESLintImportSpecifier, type ESLintLabeledStatement, type ESLintLegacyRestProperty, type ESLintLegacySpreadProperty, type ESLintLiteral, type ESLintLogicalExpression, type ESLintMemberExpression, type ESLintMetaProperty, type ESLintMethodDefinition, type ESLintModuleDeclaration, type ESLintModuleSpecifier, type ESLintNewExpression, type ESLintNode, type ESLintNullLiteral, type ESLintNumberLiteral, type ESLintObjectExpression, type ESLintObjectPattern, type ESLintPattern, type ESLintPrivateIdentifier, type ESLintProgram, type ESLintProperty, type ESLintPropertyDefinition, type ESLintRegExpLiteral, type ESLintRestElement, type ESLintReturnStatement, type ESLintSequenceExpression, type ESLintSpreadElement, type ESLintStatement, type ESLintStaticBlock, type ESLintStringLiteral, type ESLintSuper, type ESLintSwitchCase, type ESLintSwitchStatement, type ESLintTaggedTemplateExpression, type ESLintTemplateElement, type ESLintTemplateLiteral, type ESLintThisExpression, type ESLintThrowStatement, type ESLintTryStatement, type ESLintUnaryExpression, type ESLintUpdateExpression, type ESLintVariableDeclaration, type ESLintVariableDeclarator, type ESLintWhileStatement, type ESLintWithStatement, type ESLintYieldExpression, type ErrorCode, type HasConcreteInfo, type HasLocation, type HasParent, KEYS, type Location, type LocationRange, NS, type Namespace, type Node, type Offset, type OffsetRange, ParseError, type Reference, type Token, type VAttribute, type VDirective, type VDirectiveKey, type VElement, type VEndTag, type VExpressionContainer, type VFilter, type VFilterSequenceExpression, type VForExpression, type VIdentifier, type VLiteral, type VNode, type VOnExpression, type VSlotScopeExpression, type VStartTag, type VTemplateRoot, type VText, type Variable, type Visitor, getFallbackKeys, parse, parseForESLint, traverseNodes };
|
package/dist/index.d.ts
CHANGED
@@ -1,6 +1,8 @@
|
|
1
|
-
import {
|
2
|
-
import { TSESTree } from '@typescript-eslint/types';
|
1
|
+
import { TSESTree as TSESTree$1 } from '@typescript-eslint/types';
|
3
2
|
import { ScopeManager } from 'eslint-scope';
|
3
|
+
import { ParserOptions, parseForESLint as parseForESLint$1 } from '@typescript-eslint/parser';
|
4
|
+
import { TSESTree } from '@typescript-eslint/typescript-estree';
|
5
|
+
import { VisitorKeys } from 'eslint-visitor-keys';
|
4
6
|
|
5
7
|
/**
|
6
8
|
* HTML parse errors.
|
@@ -94,6 +96,65 @@ interface HasLocation {
|
|
94
96
|
end?: number;
|
95
97
|
}
|
96
98
|
|
99
|
+
/**
|
100
|
+
* The type of basic ESLint custom parser.
|
101
|
+
* e.g. espree
|
102
|
+
*/
|
103
|
+
interface BasicParserObject<R = ESLintProgram> {
|
104
|
+
parse: (code: string, options: any) => R;
|
105
|
+
parseForESLint: undefined;
|
106
|
+
}
|
107
|
+
/**
|
108
|
+
* The type of ESLint custom parser enhanced for ESLint.
|
109
|
+
* e.g. @babel/eslint-parser, @typescript-eslint/parser
|
110
|
+
*/
|
111
|
+
interface EnhancedParserObject<R = ESLintExtendedProgram> {
|
112
|
+
parseForESLint: (code: string, options: any) => R;
|
113
|
+
parse: undefined;
|
114
|
+
}
|
115
|
+
/**
|
116
|
+
* The type of ESLint (custom) parsers.
|
117
|
+
*/
|
118
|
+
type ParserObject<R1 = ESLintExtendedProgram, R2 = ESLintProgram> = EnhancedParserObject<R1> | BasicParserObject<R2>;
|
119
|
+
|
120
|
+
declare function prepareTemplate(templateNode: TSESTree.TaggedTemplateExpression): {
|
121
|
+
templatePositionInfo: {
|
122
|
+
templateStartLine: number;
|
123
|
+
templateStartColumn: number;
|
124
|
+
templateStartOffset: number;
|
125
|
+
templateEndOffset: number;
|
126
|
+
templateEndLine: number;
|
127
|
+
templateEndColumn: number;
|
128
|
+
};
|
129
|
+
templateRawContent: string;
|
130
|
+
};
|
131
|
+
|
132
|
+
type PrettierType<T> = {
|
133
|
+
[K in keyof T]: T[K];
|
134
|
+
} & {};
|
135
|
+
type TsESLintParseForESLint = ReturnType<typeof parseForESLint$1>;
|
136
|
+
interface ParseForESLintResult {
|
137
|
+
ast: ESLintProgram;
|
138
|
+
services: TsESLintParseForESLint['services'];
|
139
|
+
scopeManager: TsESLintParseForESLint['scopeManager'];
|
140
|
+
visitorKeys: TsESLintParseForESLint['visitorKeys'];
|
141
|
+
}
|
142
|
+
type VineESLintParserOptions = ParserOptions & {
|
143
|
+
parser?: boolean | string | ParserObject | Record<string, string | ParserObject | undefined>;
|
144
|
+
ecmaFeatures?: ParserOptions['ecmaFeatures'] & {
|
145
|
+
[key: string]: any;
|
146
|
+
};
|
147
|
+
};
|
148
|
+
interface VineTemplateMeta {
|
149
|
+
tokens: Token[];
|
150
|
+
comments: Token[];
|
151
|
+
errors: ParseError[];
|
152
|
+
}
|
153
|
+
type FinalProcessTemplateInfo = ReturnType<typeof prepareTemplate> & {
|
154
|
+
templateRootAST: VTemplateRoot;
|
155
|
+
templateMeta: VineTemplateMeta;
|
156
|
+
};
|
157
|
+
|
97
158
|
/**
|
98
159
|
* Tokens.
|
99
160
|
*/
|
@@ -142,7 +203,7 @@ interface ESLintProgram extends HasLocation, HasParent {
|
|
142
203
|
comments?: Token[];
|
143
204
|
errors?: ParseError[];
|
144
205
|
}
|
145
|
-
type ESLintStatement = ESLintExpressionStatement | ESLintBlockStatement | ESLintEmptyStatement | ESLintDebuggerStatement | ESLintWithStatement | ESLintReturnStatement | ESLintLabeledStatement | ESLintBreakStatement | ESLintContinueStatement | ESLintIfStatement | ESLintSwitchStatement | ESLintThrowStatement | ESLintTryStatement | ESLintWhileStatement | ESLintDoWhileStatement | ESLintForStatement | ESLintForInStatement | ESLintForOfStatement | ESLintDeclaration;
|
206
|
+
type ESLintStatement = ESLintExpressionStatement | ESLintDirective | ESLintBlockStatement | ESLintEmptyStatement | ESLintDebuggerStatement | ESLintWithStatement | ESLintReturnStatement | ESLintLabeledStatement | ESLintBreakStatement | ESLintContinueStatement | ESLintIfStatement | ESLintSwitchStatement | ESLintThrowStatement | ESLintTryStatement | ESLintWhileStatement | ESLintDoWhileStatement | ESLintForStatement | ESLintForInStatement | ESLintForOfStatement | ESLintDeclaration;
|
146
207
|
interface ESLintEmptyStatement extends HasLocation, HasParent {
|
147
208
|
type: 'EmptyStatement';
|
148
209
|
}
|
@@ -154,6 +215,11 @@ interface ESLintExpressionStatement extends HasLocation, HasParent {
|
|
154
215
|
type: 'ExpressionStatement';
|
155
216
|
expression: ESLintExpression;
|
156
217
|
}
|
218
|
+
interface ESLintDirective extends HasLocation, HasParent {
|
219
|
+
type: 'ExpressionStatement';
|
220
|
+
expression: ESLintLiteral;
|
221
|
+
directive: string;
|
222
|
+
}
|
157
223
|
interface ESLintIfStatement extends HasLocation, HasParent {
|
158
224
|
type: 'IfStatement';
|
159
225
|
test: ESLintExpression;
|
@@ -755,41 +821,33 @@ interface VElement extends HasLocation, HasParent {
|
|
755
821
|
*/
|
756
822
|
interface VTemplateRoot extends HasLocation {
|
757
823
|
type: 'VTemplateRoot';
|
758
|
-
parent: TSESTree.Node;
|
824
|
+
parent: TSESTree$1.Node;
|
759
825
|
children: (VElement | VText | VExpressionContainer)[];
|
826
|
+
templateInfo?: PrettierType<Omit<FinalProcessTemplateInfo, 'templateMeta' | 'templateRootAST'>>;
|
760
827
|
}
|
761
828
|
|
829
|
+
declare const KEYS: {
|
830
|
+
readonly [type: string]: readonly string[];
|
831
|
+
};
|
762
832
|
/**
|
763
|
-
*
|
764
|
-
*
|
765
|
-
|
766
|
-
interface BasicParserObject<R = ESLintProgram> {
|
767
|
-
parse: (code: string, options: any) => R;
|
768
|
-
parseForESLint: undefined;
|
769
|
-
}
|
770
|
-
/**
|
771
|
-
* The type of ESLint custom parser enhanced for ESLint.
|
772
|
-
* e.g. @babel/eslint-parser, @typescript-eslint/parser
|
833
|
+
* Get the keys of the given node to traverse it.
|
834
|
+
* @param node The node to get.
|
835
|
+
* @returns The keys to traverse.
|
773
836
|
*/
|
774
|
-
|
775
|
-
|
776
|
-
|
837
|
+
declare function getFallbackKeys(node: Node): string[];
|
838
|
+
interface Visitor {
|
839
|
+
visitorKeys?: VisitorKeys;
|
840
|
+
enterNode: (node: Node, parent: Node | null) => void;
|
841
|
+
leaveNode: (node: Node, parent: Node | null) => void;
|
777
842
|
}
|
778
843
|
/**
|
779
|
-
*
|
844
|
+
* Traverse the given AST tree.
|
845
|
+
* @param node Root node to traverse.
|
846
|
+
* @param visitor Visitor.
|
780
847
|
*/
|
781
|
-
|
782
|
-
|
783
|
-
type VineESLintAST = TSESTree.Program;
|
784
|
-
type ParseForESLintResult = ReturnType<typeof parseForESLint$1>;
|
785
|
-
type VineESLintParserOptions = ParserOptions & {
|
786
|
-
parser?: boolean | string | ParserObject | Record<string, string | ParserObject | undefined>;
|
787
|
-
ecmaFeatures?: ParserOptions['ecmaFeatures'] & {
|
788
|
-
[key: string]: any;
|
789
|
-
};
|
790
|
-
};
|
848
|
+
declare function traverseNodes(node: Node, visitor: Visitor): void;
|
791
849
|
|
792
|
-
declare function parse(code: string, parserOptions: VineESLintParserOptions):
|
850
|
+
declare function parse(code: string, parserOptions: VineESLintParserOptions): ESLintProgram;
|
793
851
|
declare function parseForESLint(code: string, parserOptions: VineESLintParserOptions): ParseForESLintResult;
|
794
852
|
|
795
|
-
export { parse, parseForESLint };
|
853
|
+
export { type ESLintArrayExpression, type ESLintArrayPattern, type ESLintArrowFunctionExpression, type ESLintAssignmentExpression, type ESLintAssignmentPattern, type ESLintAssignmentProperty, type ESLintAwaitExpression, type ESLintBigIntLiteral, type ESLintBinaryExpression, type ESLintBlockStatement, type ESLintBooleanLiteral, type ESLintBreakStatement, type ESLintCallExpression, type ESLintCatchClause, type ESLintChainElement, type ESLintChainExpression, type ESLintClassBody, type ESLintClassDeclaration, type ESLintClassExpression, type ESLintConditionalExpression, type ESLintContinueStatement, type ESLintDebuggerStatement, type ESLintDeclaration, type ESLintDirective, type ESLintDoWhileStatement, type ESLintEmptyStatement, type ESLintExportAllDeclaration, type ESLintExportDefaultDeclaration, type ESLintExportNamedDeclaration, type ESLintExportSpecifier, type ESLintExpression, type ESLintExpressionStatement, type ESLintExtendedProgram, type ESLintForInStatement, type ESLintForOfStatement, type ESLintForStatement, type ESLintFunctionDeclaration, type ESLintFunctionExpression, type ESLintIdentifier, type ESLintIfStatement, type ESLintImportDeclaration, type ESLintImportDefaultSpecifier, type ESLintImportExpression, type ESLintImportNamespaceSpecifier, type ESLintImportSpecifier, type ESLintLabeledStatement, type ESLintLegacyRestProperty, type ESLintLegacySpreadProperty, type ESLintLiteral, type ESLintLogicalExpression, type ESLintMemberExpression, type ESLintMetaProperty, type ESLintMethodDefinition, type ESLintModuleDeclaration, type ESLintModuleSpecifier, type ESLintNewExpression, type ESLintNode, type ESLintNullLiteral, type ESLintNumberLiteral, type ESLintObjectExpression, type ESLintObjectPattern, type ESLintPattern, type ESLintPrivateIdentifier, type ESLintProgram, type ESLintProperty, type ESLintPropertyDefinition, type ESLintRegExpLiteral, type ESLintRestElement, type ESLintReturnStatement, type ESLintSequenceExpression, type ESLintSpreadElement, type ESLintStatement, type ESLintStaticBlock, type ESLintStringLiteral, type ESLintSuper, type ESLintSwitchCase, type ESLintSwitchStatement, type ESLintTaggedTemplateExpression, type ESLintTemplateElement, type ESLintTemplateLiteral, type ESLintThisExpression, type ESLintThrowStatement, type ESLintTryStatement, type ESLintUnaryExpression, type ESLintUpdateExpression, type ESLintVariableDeclaration, type ESLintVariableDeclarator, type ESLintWhileStatement, type ESLintWithStatement, type ESLintYieldExpression, type ErrorCode, type HasConcreteInfo, type HasLocation, type HasParent, KEYS, type Location, type LocationRange, NS, type Namespace, type Node, type Offset, type OffsetRange, ParseError, type Reference, type Token, type VAttribute, type VDirective, type VDirectiveKey, type VElement, type VEndTag, type VExpressionContainer, type VFilter, type VFilterSequenceExpression, type VForExpression, type VIdentifier, type VLiteral, type VNode, type VOnExpression, type VSlotScopeExpression, type VStartTag, type VTemplateRoot, type VText, type Variable, type Visitor, getFallbackKeys, parse, parseForESLint, traverseNodes };
|
package/dist/index.js
CHANGED
@@ -3952,16 +3952,18 @@ function extractForVineTemplate(ast) {
|
|
3952
3952
|
if (_optionalChain([parent, 'optionalAccess', _14 => _14.type]) === _typescriptestree.TSESTree.AST_NODE_TYPES.ReturnStatement) {
|
3953
3953
|
parent.argument = null;
|
3954
3954
|
parentOfTemplate = parent;
|
3955
|
-
bindVineTemplateESTree = (vineESTree) => {
|
3955
|
+
bindVineTemplateESTree = ({ templateRootAST: vineESTree, templateMeta: _, ...templateInfo }) => {
|
3956
3956
|
parent.argument = vineESTree;
|
3957
3957
|
vineESTree.parent = parent;
|
3958
|
+
vineESTree.templateInfo = templateInfo;
|
3958
3959
|
};
|
3959
3960
|
} else if (_optionalChain([parent, 'optionalAccess', _15 => _15.type]) === _typescriptestree.TSESTree.AST_NODE_TYPES.ArrowFunctionExpression) {
|
3960
3961
|
parent.body = null;
|
3961
3962
|
parentOfTemplate = parent;
|
3962
|
-
bindVineTemplateESTree = (vineESTree) => {
|
3963
|
+
bindVineTemplateESTree = ({ templateRootAST: vineESTree, templateMeta: _, ...templateInfo }) => {
|
3963
3964
|
parent.body = vineESTree;
|
3964
3965
|
vineESTree.parent = parent;
|
3966
|
+
vineESTree.templateInfo = templateInfo;
|
3965
3967
|
};
|
3966
3968
|
}
|
3967
3969
|
ast.tokens = _optionalChain([ast, 'access', _16 => _16.tokens, 'optionalAccess', _17 => _17.filter, 'call', _18 => _18(
|
@@ -6074,13 +6076,13 @@ var VineTemplateParser = (_class = class {
|
|
6074
6076
|
this[token.type](token);
|
6075
6077
|
} while (token != null);
|
6076
6078
|
this.popElementStackUntil(0);
|
6079
|
+
this.correctMetaTokenPos();
|
6077
6080
|
const templateRoot = this.vTemplateRoot;
|
6078
6081
|
const templateMeta = this.vTemplateMeta;
|
6079
6082
|
for (const proc of this.postProcessForScript) {
|
6080
6083
|
proc(this.baseParserOptions);
|
6081
6084
|
}
|
6082
6085
|
this.postProcessForScript = [];
|
6083
|
-
this.correctMetaTokenPos();
|
6084
6086
|
return [templateRoot, templateMeta];
|
6085
6087
|
}
|
6086
6088
|
}, _class);
|
@@ -10078,21 +10080,30 @@ function getTemplateRootDataList(prepareResult, parserOptions) {
|
|
10078
10080
|
);
|
10079
10081
|
return templateParser.parse();
|
10080
10082
|
}
|
10081
|
-
function finalProcessForTSFileAST(bindVineTemplateESTree,
|
10082
|
-
bindVineTemplateESTree(
|
10083
|
+
function finalProcessForTSFileAST(bindVineTemplateESTree, tsFileAST, templateInfo) {
|
10084
|
+
bindVineTemplateESTree(templateInfo);
|
10083
10085
|
tsFileAST.tokens = [
|
10084
10086
|
..._nullishCoalesce(tsFileAST.tokens, () => ( [])),
|
10085
|
-
...templateMeta.tokens
|
10087
|
+
...templateInfo.templateMeta.tokens
|
10086
10088
|
].sort((a, b) => a.range[0] - b.range[0]);
|
10087
10089
|
}
|
10088
10090
|
function runParse(code, parserOptions) {
|
10089
|
-
const {
|
10091
|
+
const {
|
10092
|
+
ast: tsESLintAST,
|
10093
|
+
scopeManager,
|
10094
|
+
services: tsESLintParserServices,
|
10095
|
+
visitorKeys: tsESLintVisitorKeys
|
10096
|
+
} = typescriptBasicESLintParse(
|
10090
10097
|
code,
|
10091
10098
|
parserOptions
|
10092
10099
|
);
|
10093
|
-
const prepareResults = prepareForTemplateRootAST(
|
10100
|
+
const prepareResults = prepareForTemplateRootAST(tsESLintAST);
|
10094
10101
|
for (const prepareResult of prepareResults) {
|
10095
|
-
const {
|
10102
|
+
const {
|
10103
|
+
bindVineTemplateESTree,
|
10104
|
+
templatePositionInfo,
|
10105
|
+
templateRawContent
|
10106
|
+
} = prepareResult;
|
10096
10107
|
const rootData = getTemplateRootDataList(
|
10097
10108
|
prepareResult,
|
10098
10109
|
{
|
@@ -10106,19 +10117,28 @@ function runParse(code, parserOptions) {
|
|
10106
10117
|
const [templateRootAST, templateMeta] = rootData;
|
10107
10118
|
finalProcessForTSFileAST(
|
10108
10119
|
bindVineTemplateESTree,
|
10109
|
-
|
10110
|
-
|
10111
|
-
|
10120
|
+
tsESLintAST,
|
10121
|
+
{
|
10122
|
+
templateRootAST,
|
10123
|
+
templateMeta,
|
10124
|
+
templatePositionInfo,
|
10125
|
+
templateRawContent
|
10126
|
+
}
|
10112
10127
|
);
|
10113
10128
|
analyzeUsedInTemplateVariables(
|
10114
10129
|
scopeManager,
|
10115
10130
|
templateRootAST
|
10116
10131
|
);
|
10117
10132
|
}
|
10133
|
+
const ast = tsESLintAST;
|
10118
10134
|
const visitorKeys = {
|
10119
10135
|
...tsESLintVisitorKeys,
|
10120
10136
|
...KEYS2
|
10121
10137
|
};
|
10138
|
+
const services = {
|
10139
|
+
...tsESLintParserServices
|
10140
|
+
// Todo: Maybe additional services specific to Vue Vine
|
10141
|
+
};
|
10122
10142
|
return {
|
10123
10143
|
ast,
|
10124
10144
|
services,
|
package/dist/index.mjs
CHANGED
@@ -3952,16 +3952,18 @@ function extractForVineTemplate(ast) {
|
|
3952
3952
|
if (parent?.type === TSESTree.AST_NODE_TYPES.ReturnStatement) {
|
3953
3953
|
parent.argument = null;
|
3954
3954
|
parentOfTemplate = parent;
|
3955
|
-
bindVineTemplateESTree = (vineESTree) => {
|
3955
|
+
bindVineTemplateESTree = ({ templateRootAST: vineESTree, templateMeta: _, ...templateInfo }) => {
|
3956
3956
|
parent.argument = vineESTree;
|
3957
3957
|
vineESTree.parent = parent;
|
3958
|
+
vineESTree.templateInfo = templateInfo;
|
3958
3959
|
};
|
3959
3960
|
} else if (parent?.type === TSESTree.AST_NODE_TYPES.ArrowFunctionExpression) {
|
3960
3961
|
parent.body = null;
|
3961
3962
|
parentOfTemplate = parent;
|
3962
|
-
bindVineTemplateESTree = (vineESTree) => {
|
3963
|
+
bindVineTemplateESTree = ({ templateRootAST: vineESTree, templateMeta: _, ...templateInfo }) => {
|
3963
3964
|
parent.body = vineESTree;
|
3964
3965
|
vineESTree.parent = parent;
|
3966
|
+
vineESTree.templateInfo = templateInfo;
|
3965
3967
|
};
|
3966
3968
|
}
|
3967
3969
|
ast.tokens = ast.tokens?.filter(
|
@@ -6074,13 +6076,13 @@ var VineTemplateParser = class {
|
|
6074
6076
|
this[token.type](token);
|
6075
6077
|
} while (token != null);
|
6076
6078
|
this.popElementStackUntil(0);
|
6079
|
+
this.correctMetaTokenPos();
|
6077
6080
|
const templateRoot = this.vTemplateRoot;
|
6078
6081
|
const templateMeta = this.vTemplateMeta;
|
6079
6082
|
for (const proc of this.postProcessForScript) {
|
6080
6083
|
proc(this.baseParserOptions);
|
6081
6084
|
}
|
6082
6085
|
this.postProcessForScript = [];
|
6083
|
-
this.correctMetaTokenPos();
|
6084
6086
|
return [templateRoot, templateMeta];
|
6085
6087
|
}
|
6086
6088
|
};
|
@@ -10078,21 +10080,30 @@ function getTemplateRootDataList(prepareResult, parserOptions) {
|
|
10078
10080
|
);
|
10079
10081
|
return templateParser.parse();
|
10080
10082
|
}
|
10081
|
-
function finalProcessForTSFileAST(bindVineTemplateESTree,
|
10082
|
-
bindVineTemplateESTree(
|
10083
|
+
function finalProcessForTSFileAST(bindVineTemplateESTree, tsFileAST, templateInfo) {
|
10084
|
+
bindVineTemplateESTree(templateInfo);
|
10083
10085
|
tsFileAST.tokens = [
|
10084
10086
|
...tsFileAST.tokens ?? [],
|
10085
|
-
...templateMeta.tokens
|
10087
|
+
...templateInfo.templateMeta.tokens
|
10086
10088
|
].sort((a, b) => a.range[0] - b.range[0]);
|
10087
10089
|
}
|
10088
10090
|
function runParse(code, parserOptions) {
|
10089
|
-
const {
|
10091
|
+
const {
|
10092
|
+
ast: tsESLintAST,
|
10093
|
+
scopeManager,
|
10094
|
+
services: tsESLintParserServices,
|
10095
|
+
visitorKeys: tsESLintVisitorKeys
|
10096
|
+
} = typescriptBasicESLintParse(
|
10090
10097
|
code,
|
10091
10098
|
parserOptions
|
10092
10099
|
);
|
10093
|
-
const prepareResults = prepareForTemplateRootAST(
|
10100
|
+
const prepareResults = prepareForTemplateRootAST(tsESLintAST);
|
10094
10101
|
for (const prepareResult of prepareResults) {
|
10095
|
-
const {
|
10102
|
+
const {
|
10103
|
+
bindVineTemplateESTree,
|
10104
|
+
templatePositionInfo,
|
10105
|
+
templateRawContent
|
10106
|
+
} = prepareResult;
|
10096
10107
|
const rootData = getTemplateRootDataList(
|
10097
10108
|
prepareResult,
|
10098
10109
|
{
|
@@ -10106,19 +10117,28 @@ function runParse(code, parserOptions) {
|
|
10106
10117
|
const [templateRootAST, templateMeta] = rootData;
|
10107
10118
|
finalProcessForTSFileAST(
|
10108
10119
|
bindVineTemplateESTree,
|
10109
|
-
|
10110
|
-
|
10111
|
-
|
10120
|
+
tsESLintAST,
|
10121
|
+
{
|
10122
|
+
templateRootAST,
|
10123
|
+
templateMeta,
|
10124
|
+
templatePositionInfo,
|
10125
|
+
templateRawContent
|
10126
|
+
}
|
10112
10127
|
);
|
10113
10128
|
analyzeUsedInTemplateVariables(
|
10114
10129
|
scopeManager,
|
10115
10130
|
templateRootAST
|
10116
10131
|
);
|
10117
10132
|
}
|
10133
|
+
const ast = tsESLintAST;
|
10118
10134
|
const visitorKeys = {
|
10119
10135
|
...tsESLintVisitorKeys,
|
10120
10136
|
...KEYS2
|
10121
10137
|
};
|
10138
|
+
const services = {
|
10139
|
+
...tsESLintParserServices
|
10140
|
+
// Todo: Maybe additional services specific to Vue Vine
|
10141
|
+
};
|
10122
10142
|
return {
|
10123
10143
|
ast,
|
10124
10144
|
services,
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@vue-vine/eslint-parser",
|
3
|
-
"version": "0.1.
|
3
|
+
"version": "0.1.32",
|
4
4
|
"description": "ESLint parser for Vue Vine",
|
5
5
|
"author": "ShenQingchuan",
|
6
6
|
"license": "MIT",
|
@@ -27,7 +27,7 @@
|
|
27
27
|
"@typescript-eslint/scope-manager": "^8.11.0",
|
28
28
|
"@typescript-eslint/typescript-estree": "^8.11.0",
|
29
29
|
"debug": "^4.3.4",
|
30
|
-
"eslint-scope": "^
|
30
|
+
"eslint-scope": "^8.2.0",
|
31
31
|
"espree": "^9.6.1",
|
32
32
|
"line-column": "^1.0.2",
|
33
33
|
"semver": "^7.5.4"
|