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