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