@vue-vine/eslint-parser 0.2.20 → 1.1.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 +623 -589
- package/dist/index.js +10272 -9913
- package/package.json +7 -8
- package/dist/index.d.mts +0 -858
- package/dist/index.mjs +0 -10171
package/dist/index.d.ts
CHANGED
@@ -1,858 +1,892 @@
|
|
1
|
-
import {
|
2
|
-
import { ScopeManager } from
|
3
|
-
import {
|
4
|
-
import {
|
5
|
-
import {
|
1
|
+
import { ParserOptions, parseForESLint as parseForESLint$1 } from "@typescript-eslint/parser";
|
2
|
+
import { ScopeManager } from "eslint-scope";
|
3
|
+
import { TSESTree } from "@typescript-eslint/typescript-estree";
|
4
|
+
import { ESLint, Linter } from "eslint";
|
5
|
+
import { TSESTree as TSESTree$1 } from "@typescript-eslint/types";
|
6
|
+
import { VisitorKeys } from "eslint-visitor-keys";
|
6
7
|
|
8
|
+
//#region src/ast/errors.d.ts
|
7
9
|
/**
|
8
|
-
|
9
|
-
|
10
|
-
declare class ParseError extends SyntaxError {
|
11
|
-
code?: ErrorCode;
|
12
|
-
index: number;
|
13
|
-
lineNumber: number;
|
14
|
-
column: number;
|
15
|
-
/**
|
16
|
-
* Create new parser error object.
|
17
|
-
* @param code The error code. See also: https://html.spec.whatwg.org/multipage/parsing.html#parse-errors
|
18
|
-
* @param offset The offset number of this error.
|
19
|
-
* @param line The line number of this error.
|
20
|
-
* @param column The column number of this error.
|
21
|
-
*/
|
22
|
-
static fromCode(code: ErrorCode, offset: number, line: number, column: number): ParseError;
|
23
|
-
/**
|
24
|
-
* Normalize the error object.
|
25
|
-
* @param x The error object to normalize.
|
26
|
-
*/
|
27
|
-
static normalize(x: any): ParseError | null;
|
28
|
-
/**
|
29
|
-
* Initialize this ParseError instance.
|
30
|
-
* @param message The error message.
|
31
|
-
* @param code The error code. See also: https://html.spec.whatwg.org/multipage/parsing.html#parse-errors
|
32
|
-
* @param offset The offset number of this error.
|
33
|
-
* @param line The line number of this error.
|
34
|
-
* @param column The column number of this error.
|
35
|
-
*/
|
36
|
-
constructor(message: string, code: ErrorCode | undefined, offset: number, line: number, column: number);
|
37
|
-
/**
|
38
|
-
* Type guard for ParseError.
|
39
|
-
* @param x The value to check.
|
40
|
-
* @returns `true` if the value has `message`, `pos`, `loc` properties.
|
41
|
-
*/
|
42
|
-
static isParseError(x: any): x is ParseError;
|
43
|
-
}
|
44
|
-
/**
|
45
|
-
* The error codes of HTML syntax errors.
|
46
|
-
* https://html.spec.whatwg.org/multipage/parsing.html#parse-errors
|
47
|
-
*/
|
48
|
-
type ErrorCode = 'abrupt-closing-of-empty-comment' | 'absence-of-digits-in-numeric-character-reference' | 'cdata-in-html-content' | 'character-reference-outside-unicode-range' | 'control-character-in-input-stream' | 'control-character-reference' | 'eof-before-tag-name' | 'eof-in-cdata' | 'eof-in-comment' | 'eof-in-tag' | 'incorrectly-closed-comment' | 'incorrectly-opened-comment' | 'invalid-first-character-of-tag-name' | 'missing-attribute-value' | 'missing-end-tag-name' | 'missing-semicolon-after-character-reference' | 'missing-whitespace-between-attributes' | 'nested-comment' | 'noncharacter-character-reference' | 'noncharacter-in-input-stream' | 'null-character-reference' | 'surrogate-character-reference' | 'surrogate-in-input-stream' | 'unexpected-character-in-attribute-name' | 'unexpected-character-in-unquoted-attribute-value' | 'unexpected-equals-sign-before-attribute-name' | 'unexpected-null-character' | 'unexpected-question-mark-instead-of-tag-name' | 'unexpected-solidus-in-tag' | 'unknown-named-character-reference' | 'end-tag-with-attributes' | 'duplicate-attribute' | 'end-tag-with-trailing-solidus' | 'non-void-html-element-start-tag-with-trailing-solidus' | 'x-invalid-end-tag' | 'x-invalid-namespace' | 'x-missing-interpolation-end';
|
49
|
-
|
10
|
+
* HTML parse errors.
|
11
|
+
*/
|
50
12
|
/**
|
51
|
-
|
52
|
-
|
13
|
+
* HTML parse errors.
|
14
|
+
*/
|
15
|
+
declare class ParseError extends SyntaxError {
|
16
|
+
code?: ErrorCode;
|
17
|
+
index: number;
|
18
|
+
lineNumber: number;
|
19
|
+
column: number;
|
20
|
+
/**
|
21
|
+
* Create new parser error object.
|
22
|
+
* @param code The error code. See also: https://html.spec.whatwg.org/multipage/parsing.html#parse-errors
|
23
|
+
* @param offset The offset number of this error.
|
24
|
+
* @param line The line number of this error.
|
25
|
+
* @param column The column number of this error.
|
26
|
+
*/
|
27
|
+
static fromCode(code: ErrorCode, offset: number, line: number, column: number): ParseError;
|
28
|
+
/**
|
29
|
+
* Normalize the error object.
|
30
|
+
* @param x The error object to normalize.
|
31
|
+
*/
|
32
|
+
static normalize(x: any): ParseError | null;
|
33
|
+
/**
|
34
|
+
* Initialize this ParseError instance.
|
35
|
+
* @param message The error message.
|
36
|
+
* @param code The error code. See also: https://html.spec.whatwg.org/multipage/parsing.html#parse-errors
|
37
|
+
* @param offset The offset number of this error.
|
38
|
+
* @param line The line number of this error.
|
39
|
+
* @param column The column number of this error.
|
40
|
+
*/
|
41
|
+
constructor(message: string, code: ErrorCode | undefined, offset: number, line: number, column: number);
|
42
|
+
/**
|
43
|
+
* Type guard for ParseError.
|
44
|
+
* @param x The value to check.
|
45
|
+
* @returns `true` if the value has `message`, `pos`, `loc` properties.
|
46
|
+
*/
|
47
|
+
static isParseError(x: any): x is ParseError;
|
48
|
+
}
|
49
|
+
/**
|
50
|
+
* The error codes of HTML syntax errors.
|
51
|
+
* https://html.spec.whatwg.org/multipage/parsing.html#parse-errors
|
52
|
+
*/
|
53
|
+
type ErrorCode = "abrupt-closing-of-empty-comment" | "absence-of-digits-in-numeric-character-reference" | "cdata-in-html-content" | "character-reference-outside-unicode-range" | "control-character-in-input-stream" | "control-character-reference" | "eof-before-tag-name" | "eof-in-cdata" | "eof-in-comment" | "eof-in-tag" | "incorrectly-closed-comment" | "incorrectly-opened-comment" | "invalid-first-character-of-tag-name" | "missing-attribute-value" | "missing-end-tag-name" | "missing-semicolon-after-character-reference" | "missing-whitespace-between-attributes" | "nested-comment" | "noncharacter-character-reference" | "noncharacter-in-input-stream" | "null-character-reference" | "surrogate-character-reference" | "surrogate-in-input-stream" | "unexpected-character-in-attribute-name" | "unexpected-character-in-unquoted-attribute-value" | "unexpected-equals-sign-before-attribute-name" | "unexpected-null-character" | "unexpected-question-mark-instead-of-tag-name" | "unexpected-solidus-in-tag" | "unknown-named-character-reference" | "end-tag-with-attributes" | "duplicate-attribute" | "end-tag-with-trailing-solidus" | "non-void-html-element-start-tag-with-trailing-solidus" | "x-invalid-end-tag" | "x-invalid-namespace" | "x-missing-interpolation-end"; //#endregion
|
54
|
+
//#region src/ast/locations.d.ts
|
55
|
+
/**
|
56
|
+
* Location information in lines and columns.
|
57
|
+
*/
|
53
58
|
interface Location {
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
}
|
63
|
-
/**
|
64
|
-
|
65
|
-
|
59
|
+
/**
|
60
|
+
* The line number. This is 1-based.
|
61
|
+
*/
|
62
|
+
line: number;
|
63
|
+
/**
|
64
|
+
* The column number. This is 0-based.
|
65
|
+
*/
|
66
|
+
column: number;
|
67
|
+
}
|
68
|
+
/**
|
69
|
+
* Range information in lines and columns.
|
70
|
+
*/
|
66
71
|
interface LocationRange {
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
}
|
76
|
-
/**
|
77
|
-
|
78
|
-
|
79
|
-
|
72
|
+
/**
|
73
|
+
* The start location.
|
74
|
+
*/
|
75
|
+
start: Location;
|
76
|
+
/**
|
77
|
+
* The end location.
|
78
|
+
*/
|
79
|
+
end: Location;
|
80
|
+
}
|
81
|
+
/**
|
82
|
+
* Location information in offsets.
|
83
|
+
* This is 0-based.
|
84
|
+
*/
|
80
85
|
type Offset = number;
|
81
86
|
/**
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
87
|
+
* Range information in offsets.
|
88
|
+
* The 1st element is the start offset.
|
89
|
+
* The 2nd element is the end offset.
|
90
|
+
*
|
91
|
+
* This is 0-based.
|
92
|
+
*/
|
88
93
|
type OffsetRange = [Offset, Offset];
|
89
94
|
/**
|
90
|
-
|
91
|
-
|
95
|
+
* Objects which have their location.
|
96
|
+
*/
|
92
97
|
interface HasLocation {
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
98
|
+
range: OffsetRange;
|
99
|
+
loc: LocationRange;
|
100
|
+
start?: number;
|
101
|
+
end?: number;
|
97
102
|
}
|
98
103
|
|
104
|
+
//#endregion
|
105
|
+
//#region src/ast/tokens.d.ts
|
99
106
|
/**
|
100
|
-
|
101
|
-
|
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
|
-
|
158
|
-
/**
|
159
|
-
* Tokens.
|
160
|
-
*/
|
107
|
+
* Tokens.
|
108
|
+
*/
|
161
109
|
interface Token extends HasLocation {
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
|
166
|
-
|
167
|
-
|
168
|
-
|
169
|
-
|
110
|
+
/**
|
111
|
+
* Token types.
|
112
|
+
*/
|
113
|
+
type: string;
|
114
|
+
/**
|
115
|
+
* Processed values.
|
116
|
+
*/
|
117
|
+
value: string;
|
170
118
|
}
|
171
119
|
|
172
|
-
|
173
|
-
|
174
|
-
|
120
|
+
//#endregion
|
121
|
+
//#region src/ast/nodes.d.ts
|
122
|
+
// ------------------------------------------------------------------------------
|
123
|
+
// Common
|
124
|
+
// ------------------------------------------------------------------------------
|
125
|
+
/**
|
126
|
+
* Objects which have their parent.
|
127
|
+
*/
|
175
128
|
interface HasParent {
|
176
|
-
|
129
|
+
parent?: Node | null;
|
177
130
|
}
|
178
131
|
/**
|
179
|
-
|
180
|
-
|
132
|
+
* The union type for all nodes.
|
133
|
+
*/
|
181
134
|
type Node = ESLintNode | VNode | VForExpression | VOnExpression | VSlotScopeExpression | VFilterSequenceExpression | VFilter;
|
182
135
|
/**
|
183
|
-
|
184
|
-
|
136
|
+
* The union type for all template nodes.
|
137
|
+
*/
|
185
138
|
type VTemplateNode = VNode | VForExpression | VOnExpression | VSlotScopeExpression | VFilterSequenceExpression | VFilter;
|
139
|
+
// ------------------------------------------------------------------------------
|
140
|
+
// Script
|
141
|
+
// ------------------------------------------------------------------------------
|
186
142
|
/**
|
187
|
-
|
188
|
-
|
143
|
+
* The union type for ESLint nodes.
|
144
|
+
*/
|
189
145
|
type ESLintNode = ESLintIdentifier | ESLintLiteral | ESLintProgram | ESLintSwitchCase | ESLintCatchClause | ESLintVariableDeclarator | ESLintStatement | ESLintExpression | ESLintProperty | ESLintAssignmentProperty | ESLintSuper | ESLintTemplateElement | ESLintSpreadElement | ESLintPattern | ESLintClassBody | ESLintMethodDefinition | ESLintPropertyDefinition | ESLintStaticBlock | ESLintPrivateIdentifier | ESLintModuleDeclaration | ESLintModuleSpecifier | ESLintImportExpression | ESLintLegacyRestProperty;
|
190
146
|
/**
|
191
|
-
|
192
|
-
|
147
|
+
* The parsing result of ESLint custom parsers.
|
148
|
+
*/
|
193
149
|
interface ESLintExtendedProgram {
|
194
|
-
|
195
|
-
|
196
|
-
|
197
|
-
|
198
|
-
|
199
|
-
|
150
|
+
ast: ESLintProgram;
|
151
|
+
services?: Record<string, unknown>;
|
152
|
+
visitorKeys?: {
|
153
|
+
[type: string]: string[];
|
154
|
+
};
|
155
|
+
scopeManager?: ScopeManager;
|
200
156
|
}
|
201
157
|
interface ESLintProgram extends HasLocation, HasParent {
|
202
|
-
|
203
|
-
|
204
|
-
|
205
|
-
|
206
|
-
|
207
|
-
|
208
|
-
|
158
|
+
type: "Program";
|
159
|
+
sourceType: "script" | "module";
|
160
|
+
body: (ESLintStatement | ESLintModuleDeclaration)[];
|
161
|
+
templateBody?: VElement & HasConcreteInfo;
|
162
|
+
tokens?: Token[];
|
163
|
+
comments?: Token[];
|
164
|
+
errors?: ParseError[];
|
209
165
|
}
|
210
166
|
type ESLintStatement = ESLintExpressionStatement | ESLintDirective | ESLintBlockStatement | ESLintEmptyStatement | ESLintDebuggerStatement | ESLintWithStatement | ESLintReturnStatement | ESLintLabeledStatement | ESLintBreakStatement | ESLintContinueStatement | ESLintIfStatement | ESLintSwitchStatement | ESLintThrowStatement | ESLintTryStatement | ESLintWhileStatement | ESLintDoWhileStatement | ESLintForStatement | ESLintForInStatement | ESLintForOfStatement | ESLintDeclaration;
|
211
167
|
interface ESLintEmptyStatement extends HasLocation, HasParent {
|
212
|
-
|
168
|
+
type: "EmptyStatement";
|
213
169
|
}
|
214
170
|
interface ESLintBlockStatement extends HasLocation, HasParent {
|
215
|
-
|
216
|
-
|
171
|
+
type: "BlockStatement";
|
172
|
+
body: ESLintStatement[];
|
217
173
|
}
|
218
174
|
interface ESLintExpressionStatement extends HasLocation, HasParent {
|
219
|
-
|
220
|
-
|
175
|
+
type: "ExpressionStatement";
|
176
|
+
expression: ESLintExpression;
|
221
177
|
}
|
222
178
|
interface ESLintDirective extends HasLocation, HasParent {
|
223
|
-
|
224
|
-
|
225
|
-
|
179
|
+
type: "ExpressionStatement";
|
180
|
+
expression: ESLintLiteral;
|
181
|
+
directive: string;
|
226
182
|
}
|
227
183
|
interface ESLintIfStatement extends HasLocation, HasParent {
|
228
|
-
|
229
|
-
|
230
|
-
|
231
|
-
|
184
|
+
type: "IfStatement";
|
185
|
+
test: ESLintExpression;
|
186
|
+
consequent: ESLintStatement;
|
187
|
+
alternate: ESLintStatement | null;
|
232
188
|
}
|
233
189
|
interface ESLintSwitchStatement extends HasLocation, HasParent {
|
234
|
-
|
235
|
-
|
236
|
-
|
190
|
+
type: "SwitchStatement";
|
191
|
+
discriminant: ESLintExpression;
|
192
|
+
cases: ESLintSwitchCase[];
|
237
193
|
}
|
238
194
|
interface ESLintSwitchCase extends HasLocation, HasParent {
|
239
|
-
|
240
|
-
|
241
|
-
|
195
|
+
type: "SwitchCase";
|
196
|
+
test: ESLintExpression | null;
|
197
|
+
consequent: ESLintStatement[];
|
242
198
|
}
|
243
199
|
interface ESLintWhileStatement extends HasLocation, HasParent {
|
244
|
-
|
245
|
-
|
246
|
-
|
200
|
+
type: "WhileStatement";
|
201
|
+
test: ESLintExpression;
|
202
|
+
body: ESLintStatement;
|
247
203
|
}
|
248
204
|
interface ESLintDoWhileStatement extends HasLocation, HasParent {
|
249
|
-
|
250
|
-
|
251
|
-
|
205
|
+
type: "DoWhileStatement";
|
206
|
+
body: ESLintStatement;
|
207
|
+
test: ESLintExpression;
|
252
208
|
}
|
253
209
|
interface ESLintForStatement extends HasLocation, HasParent {
|
254
|
-
|
255
|
-
|
256
|
-
|
257
|
-
|
258
|
-
|
210
|
+
type: "ForStatement";
|
211
|
+
init: ESLintVariableDeclaration | ESLintExpression | null;
|
212
|
+
test: ESLintExpression | null;
|
213
|
+
update: ESLintExpression | null;
|
214
|
+
body: ESLintStatement;
|
259
215
|
}
|
260
216
|
interface ESLintForInStatement extends HasLocation, HasParent {
|
261
|
-
|
262
|
-
|
263
|
-
|
264
|
-
|
217
|
+
type: "ForInStatement";
|
218
|
+
left: ESLintVariableDeclaration | ESLintPattern;
|
219
|
+
right: ESLintExpression;
|
220
|
+
body: ESLintStatement;
|
265
221
|
}
|
266
222
|
interface ESLintForOfStatement extends HasLocation, HasParent {
|
267
|
-
|
268
|
-
|
269
|
-
|
270
|
-
|
271
|
-
|
223
|
+
type: "ForOfStatement";
|
224
|
+
left: ESLintVariableDeclaration | ESLintPattern;
|
225
|
+
right: ESLintExpression;
|
226
|
+
body: ESLintStatement;
|
227
|
+
await: boolean;
|
272
228
|
}
|
273
229
|
interface ESLintLabeledStatement extends HasLocation, HasParent {
|
274
|
-
|
275
|
-
|
276
|
-
|
230
|
+
type: "LabeledStatement";
|
231
|
+
label: ESLintIdentifier;
|
232
|
+
body: ESLintStatement;
|
277
233
|
}
|
278
234
|
interface ESLintBreakStatement extends HasLocation, HasParent {
|
279
|
-
|
280
|
-
|
235
|
+
type: "BreakStatement";
|
236
|
+
label: ESLintIdentifier | null;
|
281
237
|
}
|
282
238
|
interface ESLintContinueStatement extends HasLocation, HasParent {
|
283
|
-
|
284
|
-
|
239
|
+
type: "ContinueStatement";
|
240
|
+
label: ESLintIdentifier | null;
|
285
241
|
}
|
286
242
|
interface ESLintReturnStatement extends HasLocation, HasParent {
|
287
|
-
|
288
|
-
|
243
|
+
type: "ReturnStatement";
|
244
|
+
argument: ESLintExpression | null;
|
289
245
|
}
|
290
246
|
interface ESLintThrowStatement extends HasLocation, HasParent {
|
291
|
-
|
292
|
-
|
247
|
+
type: "ThrowStatement";
|
248
|
+
argument: ESLintExpression;
|
293
249
|
}
|
294
250
|
interface ESLintTryStatement extends HasLocation, HasParent {
|
295
|
-
|
296
|
-
|
297
|
-
|
298
|
-
|
251
|
+
type: "TryStatement";
|
252
|
+
block: ESLintBlockStatement;
|
253
|
+
handler: ESLintCatchClause | null;
|
254
|
+
finalizer: ESLintBlockStatement | null;
|
299
255
|
}
|
300
256
|
interface ESLintCatchClause extends HasLocation, HasParent {
|
301
|
-
|
302
|
-
|
303
|
-
|
257
|
+
type: "CatchClause";
|
258
|
+
param: ESLintPattern | null;
|
259
|
+
body: ESLintBlockStatement;
|
304
260
|
}
|
305
261
|
interface ESLintWithStatement extends HasLocation, HasParent {
|
306
|
-
|
307
|
-
|
308
|
-
|
262
|
+
type: "WithStatement";
|
263
|
+
object: ESLintExpression;
|
264
|
+
body: ESLintStatement;
|
309
265
|
}
|
310
266
|
interface ESLintDebuggerStatement extends HasLocation, HasParent {
|
311
|
-
|
267
|
+
type: "DebuggerStatement";
|
312
268
|
}
|
313
269
|
type ESLintDeclaration = ESLintFunctionDeclaration | ESLintVariableDeclaration | ESLintClassDeclaration;
|
314
270
|
interface ESLintFunctionDeclaration extends HasLocation, HasParent {
|
315
|
-
|
316
|
-
|
317
|
-
|
318
|
-
|
319
|
-
|
320
|
-
|
271
|
+
type: "FunctionDeclaration";
|
272
|
+
async: boolean;
|
273
|
+
generator: boolean;
|
274
|
+
id: ESLintIdentifier | null;
|
275
|
+
params: ESLintPattern[];
|
276
|
+
body: ESLintBlockStatement;
|
321
277
|
}
|
322
278
|
interface ESLintVariableDeclaration extends HasLocation, HasParent {
|
323
|
-
|
324
|
-
|
325
|
-
|
279
|
+
type: "VariableDeclaration";
|
280
|
+
kind: "var" | "let" | "const";
|
281
|
+
declarations: ESLintVariableDeclarator[];
|
326
282
|
}
|
327
283
|
interface ESLintVariableDeclarator extends HasLocation, HasParent {
|
328
|
-
|
329
|
-
|
330
|
-
|
284
|
+
type: "VariableDeclarator";
|
285
|
+
id: ESLintPattern;
|
286
|
+
init: ESLintExpression | null;
|
331
287
|
}
|
332
288
|
interface ESLintClassDeclaration extends HasLocation, HasParent {
|
333
|
-
|
334
|
-
|
335
|
-
|
336
|
-
|
289
|
+
type: "ClassDeclaration";
|
290
|
+
id: ESLintIdentifier | null;
|
291
|
+
superClass: ESLintExpression | null;
|
292
|
+
body: ESLintClassBody;
|
337
293
|
}
|
338
294
|
interface ESLintClassBody extends HasLocation, HasParent {
|
339
|
-
|
340
|
-
|
295
|
+
type: "ClassBody";
|
296
|
+
body: (ESLintMethodDefinition | ESLintPropertyDefinition | ESLintStaticBlock)[];
|
341
297
|
}
|
342
298
|
interface ESLintMethodDefinition extends HasLocation, HasParent {
|
343
|
-
|
344
|
-
|
345
|
-
|
346
|
-
|
347
|
-
|
348
|
-
|
299
|
+
type: "MethodDefinition";
|
300
|
+
kind: "constructor" | "method" | "get" | "set";
|
301
|
+
computed: boolean;
|
302
|
+
static: boolean;
|
303
|
+
key: ESLintExpression | ESLintPrivateIdentifier;
|
304
|
+
value: ESLintFunctionExpression;
|
349
305
|
}
|
350
306
|
interface ESLintPropertyDefinition extends HasLocation, HasParent {
|
351
|
-
|
352
|
-
|
353
|
-
|
354
|
-
|
355
|
-
|
307
|
+
type: "PropertyDefinition";
|
308
|
+
computed: boolean;
|
309
|
+
static: boolean;
|
310
|
+
key: ESLintExpression | ESLintPrivateIdentifier;
|
311
|
+
value: ESLintExpression | null;
|
356
312
|
}
|
357
|
-
interface ESLintStaticBlock extends HasLocation, HasParent, Omit<ESLintBlockStatement,
|
358
|
-
|
359
|
-
|
313
|
+
interface ESLintStaticBlock extends HasLocation, HasParent, Omit<ESLintBlockStatement, "type"> {
|
314
|
+
type: "StaticBlock";
|
315
|
+
body: ESLintStatement[];
|
360
316
|
}
|
361
317
|
interface ESLintPrivateIdentifier extends HasLocation, HasParent {
|
362
|
-
|
363
|
-
|
318
|
+
type: "PrivateIdentifier";
|
319
|
+
name: string;
|
364
320
|
}
|
365
321
|
type ESLintModuleDeclaration = ESLintImportDeclaration | ESLintExportNamedDeclaration | ESLintExportDefaultDeclaration | ESLintExportAllDeclaration;
|
366
322
|
type ESLintModuleSpecifier = ESLintImportSpecifier | ESLintImportDefaultSpecifier | ESLintImportNamespaceSpecifier | ESLintExportSpecifier;
|
367
323
|
interface ESLintImportDeclaration extends HasLocation, HasParent {
|
368
|
-
|
369
|
-
|
370
|
-
|
324
|
+
type: "ImportDeclaration";
|
325
|
+
specifiers: (ESLintImportSpecifier | ESLintImportDefaultSpecifier | ESLintImportNamespaceSpecifier)[];
|
326
|
+
source: ESLintLiteral;
|
371
327
|
}
|
372
328
|
interface ESLintImportSpecifier extends HasLocation, HasParent {
|
373
|
-
|
374
|
-
|
375
|
-
|
329
|
+
type: "ImportSpecifier";
|
330
|
+
imported: ESLintIdentifier | ESLintStringLiteral;
|
331
|
+
local: ESLintIdentifier;
|
376
332
|
}
|
377
333
|
interface ESLintImportDefaultSpecifier extends HasLocation, HasParent {
|
378
|
-
|
379
|
-
|
334
|
+
type: "ImportDefaultSpecifier";
|
335
|
+
local: ESLintIdentifier;
|
380
336
|
}
|
381
337
|
interface ESLintImportNamespaceSpecifier extends HasLocation, HasParent {
|
382
|
-
|
383
|
-
|
338
|
+
type: "ImportNamespaceSpecifier";
|
339
|
+
local: ESLintIdentifier;
|
384
340
|
}
|
385
341
|
interface ESLintImportExpression extends HasLocation, HasParent {
|
386
|
-
|
387
|
-
|
342
|
+
type: "ImportExpression";
|
343
|
+
source: ESLintExpression;
|
388
344
|
}
|
389
345
|
interface ESLintExportNamedDeclaration extends HasLocation, HasParent {
|
390
|
-
|
391
|
-
|
392
|
-
|
393
|
-
|
346
|
+
type: "ExportNamedDeclaration";
|
347
|
+
declaration?: ESLintDeclaration | null;
|
348
|
+
specifiers: ESLintExportSpecifier[];
|
349
|
+
source?: ESLintLiteral | null;
|
394
350
|
}
|
395
351
|
interface ESLintExportSpecifier extends HasLocation, HasParent {
|
396
|
-
|
397
|
-
|
398
|
-
|
352
|
+
type: "ExportSpecifier";
|
353
|
+
local: ESLintIdentifier | ESLintStringLiteral;
|
354
|
+
exported: ESLintIdentifier | ESLintStringLiteral;
|
399
355
|
}
|
400
356
|
interface ESLintExportDefaultDeclaration extends HasLocation, HasParent {
|
401
|
-
|
402
|
-
|
357
|
+
type: "ExportDefaultDeclaration";
|
358
|
+
declaration: ESLintDeclaration | ESLintExpression;
|
403
359
|
}
|
404
360
|
interface ESLintExportAllDeclaration extends HasLocation, HasParent {
|
405
|
-
|
406
|
-
|
407
|
-
|
361
|
+
type: "ExportAllDeclaration";
|
362
|
+
exported: ESLintIdentifier | ESLintStringLiteral | null;
|
363
|
+
source: ESLintLiteral;
|
408
364
|
}
|
409
365
|
type ESLintExpression = ESLintThisExpression | ESLintArrayExpression | ESLintObjectExpression | ESLintFunctionExpression | ESLintArrowFunctionExpression | ESLintYieldExpression | ESLintLiteral | ESLintUnaryExpression | ESLintUpdateExpression | ESLintBinaryExpression | ESLintAssignmentExpression | ESLintLogicalExpression | ESLintMemberExpression | ESLintConditionalExpression | ESLintCallExpression | ESLintNewExpression | ESLintSequenceExpression | ESLintTemplateLiteral | ESLintTaggedTemplateExpression | ESLintClassExpression | ESLintMetaProperty | ESLintIdentifier | ESLintAwaitExpression | ESLintChainExpression;
|
410
366
|
interface ESLintIdentifier extends HasLocation, HasParent {
|
411
|
-
|
412
|
-
|
367
|
+
type: "Identifier";
|
368
|
+
name: string;
|
413
369
|
}
|
414
370
|
interface ESLintLiteralBase extends HasLocation, HasParent {
|
415
|
-
|
416
|
-
|
417
|
-
|
418
|
-
|
419
|
-
|
420
|
-
|
421
|
-
|
422
|
-
|
371
|
+
type: "Literal";
|
372
|
+
value: string | boolean | null | number | RegExp | bigint;
|
373
|
+
raw: string;
|
374
|
+
regex?: {
|
375
|
+
pattern: string;
|
376
|
+
flags: string;
|
377
|
+
};
|
378
|
+
bigint?: string;
|
423
379
|
}
|
424
380
|
interface ESLintStringLiteral extends ESLintLiteralBase {
|
425
|
-
|
426
|
-
|
427
|
-
|
381
|
+
value: string;
|
382
|
+
regex?: undefined;
|
383
|
+
bigint?: undefined;
|
428
384
|
}
|
429
385
|
interface ESLintBooleanLiteral extends ESLintLiteralBase {
|
430
|
-
|
431
|
-
|
432
|
-
|
386
|
+
value: boolean;
|
387
|
+
regex?: undefined;
|
388
|
+
bigint?: undefined;
|
433
389
|
}
|
434
390
|
interface ESLintNullLiteral extends ESLintLiteralBase {
|
435
|
-
|
436
|
-
|
437
|
-
|
391
|
+
value: null;
|
392
|
+
regex?: undefined;
|
393
|
+
bigint?: undefined;
|
438
394
|
}
|
439
395
|
interface ESLintNumberLiteral extends ESLintLiteralBase {
|
440
|
-
|
441
|
-
|
442
|
-
|
396
|
+
value: number;
|
397
|
+
regex?: undefined;
|
398
|
+
bigint?: undefined;
|
443
399
|
}
|
444
400
|
interface ESLintRegExpLiteral extends ESLintLiteralBase {
|
445
|
-
|
446
|
-
|
447
|
-
|
448
|
-
|
449
|
-
|
450
|
-
|
401
|
+
value: null | RegExp;
|
402
|
+
regex: {
|
403
|
+
pattern: string;
|
404
|
+
flags: string;
|
405
|
+
};
|
406
|
+
bigint?: undefined;
|
451
407
|
}
|
452
408
|
interface ESLintBigIntLiteral extends ESLintLiteralBase {
|
453
|
-
|
454
|
-
|
455
|
-
|
409
|
+
value: null | bigint;
|
410
|
+
regex?: undefined;
|
411
|
+
bigint: string;
|
456
412
|
}
|
457
413
|
type ESLintLiteral = ESLintStringLiteral | ESLintBooleanLiteral | ESLintNullLiteral | ESLintNumberLiteral | ESLintRegExpLiteral | ESLintBigIntLiteral;
|
458
414
|
interface ESLintThisExpression extends HasLocation, HasParent {
|
459
|
-
|
415
|
+
type: "ThisExpression";
|
460
416
|
}
|
461
417
|
interface ESLintArrayExpression extends HasLocation, HasParent {
|
462
|
-
|
463
|
-
|
418
|
+
type: "ArrayExpression";
|
419
|
+
elements: (ESLintExpression | ESLintSpreadElement)[];
|
464
420
|
}
|
465
421
|
interface ESLintObjectExpression extends HasLocation, HasParent {
|
466
|
-
|
467
|
-
|
422
|
+
type: "ObjectExpression";
|
423
|
+
properties: (ESLintProperty | ESLintSpreadElement | ESLintLegacySpreadProperty)[];
|
468
424
|
}
|
469
425
|
interface ESLintProperty extends HasLocation, HasParent {
|
470
|
-
|
471
|
-
|
472
|
-
|
473
|
-
|
474
|
-
|
475
|
-
|
476
|
-
|
426
|
+
type: "Property";
|
427
|
+
kind: "init" | "get" | "set";
|
428
|
+
method: boolean;
|
429
|
+
shorthand: boolean;
|
430
|
+
computed: boolean;
|
431
|
+
key: ESLintExpression;
|
432
|
+
value: ESLintExpression | ESLintPattern;
|
477
433
|
}
|
478
434
|
interface ESLintFunctionExpression extends HasLocation, HasParent {
|
479
|
-
|
480
|
-
|
481
|
-
|
482
|
-
|
483
|
-
|
484
|
-
|
435
|
+
type: "FunctionExpression";
|
436
|
+
async: boolean;
|
437
|
+
generator: boolean;
|
438
|
+
id: ESLintIdentifier | null;
|
439
|
+
params: ESLintPattern[];
|
440
|
+
body: ESLintBlockStatement;
|
485
441
|
}
|
486
442
|
interface ESLintArrowFunctionExpression extends HasLocation, HasParent {
|
487
|
-
|
488
|
-
|
489
|
-
|
490
|
-
|
491
|
-
|
492
|
-
|
443
|
+
type: "ArrowFunctionExpression";
|
444
|
+
async: boolean;
|
445
|
+
generator: boolean;
|
446
|
+
id: ESLintIdentifier | null;
|
447
|
+
params: ESLintPattern[];
|
448
|
+
body: ESLintBlockStatement;
|
493
449
|
}
|
494
450
|
interface ESLintSequenceExpression extends HasLocation, HasParent {
|
495
|
-
|
496
|
-
|
451
|
+
type: "SequenceExpression";
|
452
|
+
expressions: ESLintExpression[];
|
497
453
|
}
|
498
454
|
interface ESLintUnaryExpression extends HasLocation, HasParent {
|
499
|
-
|
500
|
-
|
501
|
-
|
502
|
-
|
455
|
+
type: "UnaryExpression";
|
456
|
+
operator: "-" | "+" | "!" | "~" | "typeof" | "void" | "delete";
|
457
|
+
prefix: boolean;
|
458
|
+
argument: ESLintExpression;
|
503
459
|
}
|
504
460
|
interface ESLintBinaryExpression extends HasLocation, HasParent {
|
505
|
-
|
506
|
-
|
507
|
-
|
508
|
-
|
461
|
+
type: "BinaryExpression";
|
462
|
+
operator: "==" | "!=" | "===" | "!==" | "<" | "<=" | ">" | ">=" | "<<" | ">>" | ">>>" | "+" | "-" | "*" | "/" | "%" | "**" | "|" | "^" | "&" | "in" | "instanceof";
|
463
|
+
left: ESLintExpression | ESLintPrivateIdentifier;
|
464
|
+
right: ESLintExpression;
|
509
465
|
}
|
510
466
|
interface ESLintAssignmentExpression extends HasLocation, HasParent {
|
511
|
-
|
512
|
-
|
513
|
-
|
514
|
-
|
467
|
+
type: "AssignmentExpression";
|
468
|
+
operator: "=" | "+=" | "-=" | "*=" | "/=" | "%=" | "**=" | "<<=" | ">>=" | ">>>=" | "|=" | "^=" | "&=" | "||=" | "&&=" | "??=";
|
469
|
+
left: ESLintPattern;
|
470
|
+
right: ESLintExpression;
|
515
471
|
}
|
516
472
|
interface ESLintUpdateExpression extends HasLocation, HasParent {
|
517
|
-
|
518
|
-
|
519
|
-
|
520
|
-
|
473
|
+
type: "UpdateExpression";
|
474
|
+
operator: "++" | "--";
|
475
|
+
argument: ESLintExpression;
|
476
|
+
prefix: boolean;
|
521
477
|
}
|
522
478
|
interface ESLintLogicalExpression extends HasLocation, HasParent {
|
523
|
-
|
524
|
-
|
525
|
-
|
526
|
-
|
479
|
+
type: "LogicalExpression";
|
480
|
+
operator: "||" | "&&" | "??";
|
481
|
+
left: ESLintExpression;
|
482
|
+
right: ESLintExpression;
|
527
483
|
}
|
528
484
|
interface ESLintConditionalExpression extends HasLocation, HasParent {
|
529
|
-
|
530
|
-
|
531
|
-
|
532
|
-
|
485
|
+
type: "ConditionalExpression";
|
486
|
+
test: ESLintExpression;
|
487
|
+
alternate: ESLintExpression;
|
488
|
+
consequent: ESLintExpression;
|
533
489
|
}
|
534
490
|
interface ESLintCallExpression extends HasLocation, HasParent {
|
535
|
-
|
536
|
-
|
537
|
-
|
538
|
-
|
491
|
+
type: "CallExpression";
|
492
|
+
optional: boolean;
|
493
|
+
callee: ESLintExpression | ESLintSuper;
|
494
|
+
arguments: (ESLintExpression | ESLintSpreadElement)[];
|
539
495
|
}
|
540
496
|
interface ESLintSuper extends HasLocation, HasParent {
|
541
|
-
|
497
|
+
type: "Super";
|
542
498
|
}
|
543
499
|
interface ESLintNewExpression extends HasLocation, HasParent {
|
544
|
-
|
545
|
-
|
546
|
-
|
500
|
+
type: "NewExpression";
|
501
|
+
callee: ESLintExpression;
|
502
|
+
arguments: (ESLintExpression | ESLintSpreadElement)[];
|
547
503
|
}
|
548
504
|
interface ESLintMemberExpression extends HasLocation, HasParent {
|
549
|
-
|
550
|
-
|
551
|
-
|
552
|
-
|
553
|
-
|
505
|
+
type: "MemberExpression";
|
506
|
+
optional: boolean;
|
507
|
+
computed: boolean;
|
508
|
+
object: ESLintExpression | ESLintSuper;
|
509
|
+
property: ESLintExpression | ESLintPrivateIdentifier;
|
554
510
|
}
|
555
511
|
interface ESLintYieldExpression extends HasLocation, HasParent {
|
556
|
-
|
557
|
-
|
558
|
-
|
512
|
+
type: "YieldExpression";
|
513
|
+
delegate: boolean;
|
514
|
+
argument: ESLintExpression | null;
|
559
515
|
}
|
560
516
|
interface ESLintAwaitExpression extends HasLocation, HasParent {
|
561
|
-
|
562
|
-
|
517
|
+
type: "AwaitExpression";
|
518
|
+
argument: ESLintExpression;
|
563
519
|
}
|
564
520
|
interface ESLintTemplateLiteral extends HasLocation, HasParent {
|
565
|
-
|
566
|
-
|
567
|
-
|
521
|
+
type: "TemplateLiteral";
|
522
|
+
quasis: ESLintTemplateElement[];
|
523
|
+
expressions: ESLintExpression[];
|
568
524
|
}
|
569
525
|
interface ESLintTaggedTemplateExpression extends HasLocation, HasParent {
|
570
|
-
|
571
|
-
|
572
|
-
|
526
|
+
type: "TaggedTemplateExpression";
|
527
|
+
tag: ESLintExpression;
|
528
|
+
quasi: ESLintTemplateLiteral;
|
573
529
|
}
|
574
530
|
interface ESLintTemplateElement extends HasLocation, HasParent {
|
575
|
-
|
576
|
-
|
577
|
-
|
578
|
-
|
579
|
-
|
580
|
-
|
531
|
+
type: "TemplateElement";
|
532
|
+
tail: boolean;
|
533
|
+
value: {
|
534
|
+
cooked: string | null;
|
535
|
+
raw: string;
|
536
|
+
};
|
581
537
|
}
|
582
538
|
interface ESLintClassExpression extends HasLocation, HasParent {
|
583
|
-
|
584
|
-
|
585
|
-
|
586
|
-
|
539
|
+
type: "ClassExpression";
|
540
|
+
id: ESLintIdentifier | null;
|
541
|
+
superClass: ESLintExpression | null;
|
542
|
+
body: ESLintClassBody;
|
587
543
|
}
|
588
544
|
interface ESLintMetaProperty extends HasLocation, HasParent {
|
589
|
-
|
590
|
-
|
591
|
-
|
545
|
+
type: "MetaProperty";
|
546
|
+
meta: ESLintIdentifier;
|
547
|
+
property: ESLintIdentifier;
|
592
548
|
}
|
593
549
|
type ESLintPattern = ESLintIdentifier | ESLintObjectPattern | ESLintArrayPattern | ESLintRestElement | ESLintAssignmentPattern | ESLintMemberExpression | ESLintLegacyRestProperty;
|
594
550
|
interface ESLintObjectPattern extends HasLocation, HasParent {
|
595
|
-
|
596
|
-
|
551
|
+
type: "ObjectPattern";
|
552
|
+
properties: (ESLintAssignmentProperty | ESLintRestElement | ESLintLegacyRestProperty)[];
|
597
553
|
}
|
598
554
|
interface ESLintAssignmentProperty extends ESLintProperty {
|
599
|
-
|
600
|
-
|
601
|
-
|
555
|
+
value: ESLintPattern;
|
556
|
+
kind: "init";
|
557
|
+
method: false;
|
602
558
|
}
|
603
559
|
interface ESLintArrayPattern extends HasLocation, HasParent {
|
604
|
-
|
605
|
-
|
560
|
+
type: "ArrayPattern";
|
561
|
+
elements: ESLintPattern[];
|
606
562
|
}
|
607
563
|
interface ESLintRestElement extends HasLocation, HasParent {
|
608
|
-
|
609
|
-
|
564
|
+
type: "RestElement";
|
565
|
+
argument: ESLintPattern;
|
610
566
|
}
|
611
567
|
interface ESLintSpreadElement extends HasLocation, HasParent {
|
612
|
-
|
613
|
-
|
568
|
+
type: "SpreadElement";
|
569
|
+
argument: ESLintExpression;
|
614
570
|
}
|
615
571
|
interface ESLintAssignmentPattern extends HasLocation, HasParent {
|
616
|
-
|
617
|
-
|
618
|
-
|
572
|
+
type: "AssignmentPattern";
|
573
|
+
left: ESLintPattern;
|
574
|
+
right: ESLintExpression;
|
619
575
|
}
|
620
576
|
type ESLintChainElement = ESLintCallExpression | ESLintMemberExpression;
|
621
577
|
interface ESLintChainExpression extends HasLocation, HasParent {
|
622
|
-
|
623
|
-
|
578
|
+
type: "ChainExpression";
|
579
|
+
expression: ESLintChainElement;
|
624
580
|
}
|
625
581
|
/**
|
626
|
-
|
627
|
-
|
582
|
+
* Legacy for babel-eslint and espree.
|
583
|
+
*/
|
628
584
|
interface ESLintLegacyRestProperty extends HasLocation, HasParent {
|
629
|
-
|
630
|
-
|
585
|
+
type: "RestProperty" | "ExperimentalRestProperty";
|
586
|
+
argument: ESLintPattern;
|
631
587
|
}
|
632
588
|
/**
|
633
|
-
|
634
|
-
|
589
|
+
* Legacy for babel-eslint and espree.
|
590
|
+
*/
|
635
591
|
interface ESLintLegacySpreadProperty extends HasLocation, HasParent {
|
636
|
-
|
637
|
-
|
592
|
+
type: "SpreadProperty" | "ExperimentalSpreadProperty";
|
593
|
+
argument: ESLintExpression;
|
638
594
|
}
|
595
|
+
// ------------------------------------------------------------------------------
|
596
|
+
// Template
|
597
|
+
// ------------------------------------------------------------------------------
|
639
598
|
/**
|
640
|
-
|
641
|
-
|
642
|
-
|
599
|
+
* Constants of namespaces.
|
600
|
+
* @see https://infra.spec.whatwg.org/#namespaces
|
601
|
+
*/
|
643
602
|
declare const NS: Readonly<{
|
644
|
-
|
645
|
-
|
646
|
-
|
647
|
-
|
648
|
-
|
649
|
-
|
603
|
+
HTML: "http://www.w3.org/1999/xhtml";
|
604
|
+
MathML: "http://www.w3.org/1998/Math/MathML";
|
605
|
+
SVG: "http://www.w3.org/2000/svg";
|
606
|
+
XLink: "http://www.w3.org/1999/xlink";
|
607
|
+
XML: "http://www.w3.org/XML/1998/namespace";
|
608
|
+
XMLNS: "http://www.w3.org/2000/xmlns/";
|
650
609
|
}>;
|
651
610
|
/**
|
652
|
-
|
653
|
-
|
611
|
+
* Type of namespaces.
|
612
|
+
*/
|
654
613
|
type Namespace = typeof NS.HTML | typeof NS.MathML | typeof NS.SVG | typeof NS.XLink | typeof NS.XML | typeof NS.XMLNS;
|
655
614
|
/**
|
656
|
-
|
657
|
-
|
615
|
+
* Type of variable definitions.
|
616
|
+
*/
|
658
617
|
interface Variable {
|
659
|
-
|
660
|
-
|
661
|
-
|
618
|
+
id: ESLintIdentifier;
|
619
|
+
kind: "v-for" | "scope";
|
620
|
+
references: Reference[];
|
662
621
|
}
|
663
622
|
/**
|
664
|
-
|
665
|
-
|
623
|
+
* Type of variable references.
|
624
|
+
*/
|
666
625
|
interface Reference {
|
667
|
-
|
668
|
-
|
669
|
-
|
670
|
-
|
671
|
-
|
626
|
+
id: ESLintIdentifier;
|
627
|
+
mode: "rw" | "r" | "w";
|
628
|
+
variable: Variable | null;
|
629
|
+
// For typescript-eslint
|
630
|
+
isValueReference?: boolean;
|
631
|
+
isTypeReference?: boolean;
|
672
632
|
}
|
673
633
|
/**
|
674
|
-
|
675
|
-
|
634
|
+
* The node of `v-for` directives.
|
635
|
+
*/
|
676
636
|
interface VForExpression extends HasLocation, HasParent {
|
677
|
-
|
678
|
-
|
679
|
-
|
680
|
-
|
637
|
+
type: "VForExpression";
|
638
|
+
parent: VExpressionContainer;
|
639
|
+
left: ESLintPattern[];
|
640
|
+
right: ESLintExpression;
|
681
641
|
}
|
682
642
|
/**
|
683
|
-
|
684
|
-
|
643
|
+
* The node of `v-on` directives.
|
644
|
+
*/
|
685
645
|
interface VOnExpression extends HasLocation, HasParent {
|
686
|
-
|
687
|
-
|
688
|
-
|
646
|
+
type: "VOnExpression";
|
647
|
+
parent: VExpressionContainer;
|
648
|
+
body: ESLintStatement[];
|
689
649
|
}
|
690
650
|
/**
|
691
|
-
|
692
|
-
|
651
|
+
* The node of `slot-scope` directives.
|
652
|
+
*/
|
693
653
|
interface VSlotScopeExpression extends HasLocation, HasParent {
|
694
|
-
|
695
|
-
|
696
|
-
|
654
|
+
type: "VSlotScopeExpression";
|
655
|
+
parent: VExpressionContainer;
|
656
|
+
params: ESLintPattern[];
|
697
657
|
}
|
698
658
|
/**
|
699
|
-
|
700
|
-
|
659
|
+
* The node of a filter sequence which is separated by `|`.
|
660
|
+
*/
|
701
661
|
interface VFilterSequenceExpression extends HasLocation, HasParent {
|
702
|
-
|
703
|
-
|
704
|
-
|
705
|
-
|
662
|
+
type: "VFilterSequenceExpression";
|
663
|
+
parent: VExpressionContainer;
|
664
|
+
expression: ESLintExpression;
|
665
|
+
filters: VFilter[];
|
706
666
|
}
|
707
667
|
/**
|
708
|
-
|
709
|
-
|
668
|
+
* The node of a filter sequence which is separated by `|`.
|
669
|
+
*/
|
710
670
|
interface VFilter extends HasLocation, HasParent {
|
711
|
-
|
712
|
-
|
713
|
-
|
714
|
-
|
671
|
+
type: "VFilter";
|
672
|
+
parent: VFilterSequenceExpression;
|
673
|
+
callee: ESLintIdentifier;
|
674
|
+
arguments: (ESLintExpression | ESLintSpreadElement)[];
|
715
675
|
}
|
716
676
|
/**
|
717
|
-
|
718
|
-
|
677
|
+
* The union type of any nodes.
|
678
|
+
*/
|
719
679
|
type VNode = VAttribute | VDirective | VDirectiveKey | VTemplateRoot | VElement | VEndTag | VExpressionContainer | VIdentifier | VLiteral | VStartTag | VText;
|
720
680
|
type VExpression = ESLintExpression | VFilterSequenceExpression | VForExpression | VOnExpression | VSlotScopeExpression;
|
721
681
|
/**
|
722
|
-
|
723
|
-
|
682
|
+
* Text nodes.
|
683
|
+
*/
|
724
684
|
interface VText extends HasLocation, HasParent {
|
725
|
-
|
726
|
-
|
727
|
-
|
685
|
+
type: "VText";
|
686
|
+
parent: VTemplateRoot | VElement;
|
687
|
+
value: string;
|
728
688
|
}
|
729
689
|
/**
|
730
|
-
|
731
|
-
|
732
|
-
|
690
|
+
* The node of JavaScript expression in text.
|
691
|
+
* e.g. `{{ name }}`
|
692
|
+
*/
|
733
693
|
interface VExpressionContainer extends HasLocation, HasParent {
|
734
|
-
|
735
|
-
|
736
|
-
|
737
|
-
|
694
|
+
type: "VExpressionContainer";
|
695
|
+
parent: VTemplateRoot | VElement | VDirective | VDirectiveKey;
|
696
|
+
expression: VExpression | null;
|
697
|
+
references: Reference[];
|
738
698
|
}
|
739
699
|
/**
|
740
|
-
|
741
|
-
|
700
|
+
* Attribute name nodes.
|
701
|
+
*/
|
742
702
|
interface VIdentifier extends HasLocation, HasParent {
|
743
|
-
|
744
|
-
|
745
|
-
|
746
|
-
|
703
|
+
type: "VIdentifier";
|
704
|
+
parent: VAttribute | VDirectiveKey;
|
705
|
+
name: string;
|
706
|
+
rawName: string;
|
747
707
|
}
|
748
708
|
/**
|
749
|
-
|
750
|
-
|
709
|
+
* Attribute name nodes.
|
710
|
+
*/
|
751
711
|
interface VDirectiveKey extends HasLocation, HasParent {
|
752
|
-
|
753
|
-
|
754
|
-
|
755
|
-
|
756
|
-
|
712
|
+
type: "VDirectiveKey";
|
713
|
+
parent: VDirective;
|
714
|
+
name: VIdentifier;
|
715
|
+
argument: VExpressionContainer | VIdentifier | null;
|
716
|
+
modifiers: VIdentifier[];
|
757
717
|
}
|
758
718
|
/**
|
759
|
-
|
760
|
-
|
719
|
+
* Attribute value nodes.
|
720
|
+
*/
|
761
721
|
interface VLiteral extends HasLocation, HasParent {
|
762
|
-
|
763
|
-
|
764
|
-
|
722
|
+
type: "VLiteral";
|
723
|
+
parent: VAttribute;
|
724
|
+
value: string;
|
765
725
|
}
|
766
726
|
/**
|
767
|
-
|
768
|
-
|
727
|
+
* Static attribute nodes.
|
728
|
+
*/
|
769
729
|
interface VAttribute extends HasLocation, HasParent {
|
770
|
-
|
771
|
-
|
772
|
-
|
773
|
-
|
774
|
-
|
730
|
+
type: "VAttribute";
|
731
|
+
parent: VStartTag;
|
732
|
+
directive: false;
|
733
|
+
key: VIdentifier;
|
734
|
+
value: VLiteral | null;
|
775
735
|
}
|
776
736
|
/**
|
777
|
-
|
778
|
-
|
737
|
+
* Directive nodes.
|
738
|
+
*/
|
779
739
|
interface VDirective extends HasLocation, HasParent {
|
780
|
-
|
781
|
-
|
782
|
-
|
783
|
-
|
784
|
-
|
740
|
+
type: "VAttribute";
|
741
|
+
parent: VStartTag;
|
742
|
+
directive: true;
|
743
|
+
key: VDirectiveKey;
|
744
|
+
value: VExpressionContainer | null;
|
785
745
|
}
|
786
746
|
/**
|
787
|
-
|
788
|
-
|
747
|
+
* Start tag nodes.
|
748
|
+
*/
|
789
749
|
interface VStartTag extends HasLocation, HasParent {
|
790
|
-
|
791
|
-
|
792
|
-
|
793
|
-
|
750
|
+
type: "VStartTag";
|
751
|
+
parent: VElement;
|
752
|
+
selfClosing: boolean;
|
753
|
+
attributes: (VAttribute | VDirective)[];
|
794
754
|
}
|
795
755
|
/**
|
796
|
-
|
797
|
-
|
756
|
+
* End tag nodes.
|
757
|
+
*/
|
798
758
|
interface VEndTag extends HasLocation, HasParent {
|
799
|
-
|
800
|
-
|
759
|
+
type: "VEndTag";
|
760
|
+
parent: VElement;
|
801
761
|
}
|
802
762
|
/**
|
803
|
-
|
804
|
-
|
763
|
+
* The property which has concrete information.
|
764
|
+
*/
|
805
765
|
interface HasConcreteInfo {
|
806
|
-
|
807
|
-
|
808
|
-
|
766
|
+
tokens: Token[];
|
767
|
+
comments: Token[];
|
768
|
+
errors: ParseError[];
|
809
769
|
}
|
810
770
|
/**
|
811
|
-
|
812
|
-
|
771
|
+
* Element nodes.
|
772
|
+
*/
|
813
773
|
interface VElement extends HasLocation, HasParent {
|
814
|
-
|
815
|
-
|
816
|
-
|
817
|
-
|
818
|
-
|
819
|
-
|
820
|
-
|
821
|
-
|
822
|
-
|
823
|
-
}
|
824
|
-
/**
|
825
|
-
|
826
|
-
|
774
|
+
type: "VElement";
|
775
|
+
parent: VTemplateRoot | VElement;
|
776
|
+
namespace: Namespace;
|
777
|
+
name: string;
|
778
|
+
rawName: string;
|
779
|
+
startTag: VStartTag;
|
780
|
+
children: (VElement | VText | VExpressionContainer)[];
|
781
|
+
endTag: VEndTag | null;
|
782
|
+
variables: Variable[];
|
783
|
+
}
|
784
|
+
/**
|
785
|
+
* Root nodes.
|
786
|
+
*/
|
827
787
|
interface VTemplateRoot extends HasLocation {
|
828
|
-
|
829
|
-
|
830
|
-
|
831
|
-
|
788
|
+
type: "VTemplateRoot";
|
789
|
+
parent: TSESTree$1.Node;
|
790
|
+
children: (VElement | VText | VExpressionContainer)[];
|
791
|
+
templateInfo?: PrettierType<Omit<FinalProcessTemplateInfo, "templateMeta" | "templateRootAST">>;
|
832
792
|
}
|
833
793
|
|
834
|
-
|
835
|
-
|
836
|
-
|
837
|
-
/**
|
838
|
-
|
839
|
-
|
840
|
-
|
841
|
-
|
842
|
-
declare function getFallbackKeys(node:
|
794
|
+
//#endregion
|
795
|
+
//#region src/ast/traverse.d.ts
|
796
|
+
declare const KEYS: VisitorKeys;
|
797
|
+
/**
|
798
|
+
* Get the keys of the given node to traverse it.
|
799
|
+
* @param node The node to get.
|
800
|
+
* @returns The keys to traverse.
|
801
|
+
*/
|
802
|
+
declare function getFallbackKeys(node: any): string[];
|
803
|
+
// ------------------------------------------------------------------------------
|
804
|
+
// Exports
|
805
|
+
// ------------------------------------------------------------------------------
|
843
806
|
interface Visitor {
|
844
|
-
|
845
|
-
|
846
|
-
|
807
|
+
visitorKeys?: VisitorKeys;
|
808
|
+
enterNode: (node: Node, parent: Node | null) => void;
|
809
|
+
leaveNode: (node: Node, parent: Node | null) => void;
|
847
810
|
}
|
848
811
|
/**
|
849
|
-
|
850
|
-
|
851
|
-
|
852
|
-
|
812
|
+
* Traverse the given AST tree.
|
813
|
+
* @param node Root node to traverse.
|
814
|
+
* @param visitor Visitor.
|
815
|
+
*/
|
853
816
|
declare function traverseNodes(node: Node, visitor: Visitor): void;
|
854
817
|
|
855
|
-
|
818
|
+
//#endregion
|
819
|
+
//#region src/common/parser-object.d.ts
|
820
|
+
/**
|
821
|
+
* The type of basic ESLint custom parser.
|
822
|
+
* e.g. espree
|
823
|
+
*/
|
824
|
+
interface BasicParserObject<R = ESLintProgram> {
|
825
|
+
parse: (code: string, options: any) => R;
|
826
|
+
parseForESLint: undefined;
|
827
|
+
}
|
828
|
+
/**
|
829
|
+
* The type of ESLint custom parser enhanced for ESLint.
|
830
|
+
* e.g. @babel/eslint-parser, @typescript-eslint/parser
|
831
|
+
*/
|
832
|
+
interface EnhancedParserObject<R = ESLintExtendedProgram> {
|
833
|
+
parseForESLint: (code: string, options: any) => R;
|
834
|
+
parse: undefined;
|
835
|
+
}
|
836
|
+
/**
|
837
|
+
* The type of ESLint (custom) parsers.
|
838
|
+
*/
|
839
|
+
type ParserObject<R1 = ESLintExtendedProgram, R2 = ESLintProgram> = EnhancedParserObject<R1> | BasicParserObject<R2>;
|
840
|
+
|
841
|
+
//#endregion
|
842
|
+
//#region src/template/utils/process-vine-template-node.d.ts
|
843
|
+
declare function prepareTemplate(templateNode: TSESTree.TaggedTemplateExpression): {
|
844
|
+
templatePositionInfo: VineTemplatePositionInfo;
|
845
|
+
templateRawContent: string;
|
846
|
+
};
|
847
|
+
|
848
|
+
//#endregion
|
849
|
+
//#region src/types.d.ts
|
850
|
+
type PrettierType<T> = { [K in keyof T]: T[K] } & {};
|
851
|
+
type TsESLintParseForESLint = ReturnType<typeof parseForESLint$1>;
|
852
|
+
interface ParseForESLintResult {
|
853
|
+
ast: ESLintProgram;
|
854
|
+
services: TsESLintParseForESLint["services"];
|
855
|
+
scopeManager: TsESLintParseForESLint["scopeManager"];
|
856
|
+
visitorKeys: TsESLintParseForESLint["visitorKeys"];
|
857
|
+
}
|
858
|
+
type VineESLintParserOptions = ParserOptions & {
|
859
|
+
// ...To be extended
|
860
|
+
parser?: boolean | string | ParserObject | Record<string, string | ParserObject | undefined>;
|
861
|
+
ecmaFeatures?: ParserOptions["ecmaFeatures"] & {
|
862
|
+
[key: string]: any;
|
863
|
+
};
|
864
|
+
sourceType?: "module" | "script";
|
865
|
+
};
|
866
|
+
interface VineTemplatePositionInfo {
|
867
|
+
templateStartLine: number;
|
868
|
+
templateStartColumn: number;
|
869
|
+
templateStartOffset: number;
|
870
|
+
templateEndOffset: number;
|
871
|
+
templateEndLine: number;
|
872
|
+
templateEndColumn: number;
|
873
|
+
}
|
874
|
+
interface VineTemplateMeta {
|
875
|
+
tokens: Token[];
|
876
|
+
comments: Token[];
|
877
|
+
errors: ParseError[];
|
878
|
+
}
|
879
|
+
type FinalProcessTemplateInfo = ReturnType<typeof prepareTemplate> & {
|
880
|
+
templateRootAST: VTemplateRoot;
|
881
|
+
templateMeta: VineTemplateMeta;
|
882
|
+
};
|
883
|
+
|
884
|
+
//#endregion
|
885
|
+
//#region src/index.d.ts
|
886
|
+
declare const meta: ESLint.ObjectMetaProperties;
|
887
|
+
declare function parse(code: string, parserOptions: VineESLintParserOptions): ParseForESLintResult["ast"];
|
856
888
|
declare function parseForESLint(code: string, parserOptions: VineESLintParserOptions): ParseForESLintResult;
|
889
|
+
declare const _default: Linter.Parser;
|
857
890
|
|
858
|
-
|
891
|
+
//#endregion
|
892
|
+
export { ESLintArrayExpression, ESLintArrayPattern, ESLintArrowFunctionExpression, ESLintAssignmentExpression, ESLintAssignmentPattern, ESLintAssignmentProperty, ESLintAwaitExpression, ESLintBigIntLiteral, ESLintBinaryExpression, ESLintBlockStatement, ESLintBooleanLiteral, ESLintBreakStatement, ESLintCallExpression, ESLintCatchClause, ESLintChainElement, ESLintChainExpression, ESLintClassBody, ESLintClassDeclaration, ESLintClassExpression, ESLintConditionalExpression, ESLintContinueStatement, ESLintDebuggerStatement, ESLintDeclaration, ESLintDirective, ESLintDoWhileStatement, ESLintEmptyStatement, ESLintExportAllDeclaration, ESLintExportDefaultDeclaration, ESLintExportNamedDeclaration, ESLintExportSpecifier, ESLintExpression, ESLintExpressionStatement, ESLintExtendedProgram, ESLintForInStatement, ESLintForOfStatement, ESLintForStatement, ESLintFunctionDeclaration, ESLintFunctionExpression, ESLintIdentifier, ESLintIfStatement, ESLintImportDeclaration, ESLintImportDefaultSpecifier, ESLintImportExpression, ESLintImportNamespaceSpecifier, ESLintImportSpecifier, ESLintLabeledStatement, ESLintLegacyRestProperty, ESLintLegacySpreadProperty, ESLintLiteral, ESLintLogicalExpression, ESLintMemberExpression, ESLintMetaProperty, ESLintMethodDefinition, ESLintModuleDeclaration, ESLintModuleSpecifier, ESLintNewExpression, ESLintNode, ESLintNullLiteral, ESLintNumberLiteral, ESLintObjectExpression, ESLintObjectPattern, ESLintPattern, ESLintPrivateIdentifier, ESLintProgram, ESLintProperty, ESLintPropertyDefinition, ESLintRegExpLiteral, ESLintRestElement, ESLintReturnStatement, ESLintSequenceExpression, ESLintSpreadElement, ESLintStatement, ESLintStaticBlock, ESLintStringLiteral, ESLintSuper, ESLintSwitchCase, ESLintSwitchStatement, ESLintTaggedTemplateExpression, ESLintTemplateElement, ESLintTemplateLiteral, ESLintThisExpression, ESLintThrowStatement, ESLintTryStatement, ESLintUnaryExpression, ESLintUpdateExpression, ESLintVariableDeclaration, ESLintVariableDeclarator, ESLintWhileStatement, ESLintWithStatement, ESLintYieldExpression, ErrorCode, HasConcreteInfo, HasLocation, HasParent, KEYS, Location, LocationRange, NS, Namespace, Node, Offset, OffsetRange, ParseError, Reference, Token, VAttribute, VDirective, VDirectiveKey, VElement, VEndTag, VExpression, VExpressionContainer, VFilter, VFilterSequenceExpression, VForExpression, VIdentifier, VLiteral, VNode, VOnExpression, VSlotScopeExpression, VStartTag, VTemplateNode, VTemplateRoot, VText, Variable, Visitor, _default as default, getFallbackKeys, meta, parse, parseForESLint, traverseNodes };
|