forked from eslint/typescript-eslint-parser
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathvisitor-keys.js
87 lines (83 loc) · 3.23 KB
/
visitor-keys.js
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
/**
* @fileoverview The visitor keys for the new and updated node types
* @author Michał Sajnóg <https://github.com/michalsnik>
* MIT License
*/
"use strict";
const Evk = require("eslint-visitor-keys");
module.exports = Evk.unionWith({
ArrayPattern: ["typeAnnotation"],
ArrowFunctionExpression: ["returnType", "typeParameters"],
AssignmentPattern: ["typeAnnotation"],
CallExpression: ["typeParameters"],
ClassDeclaration: ["superTypeParameters", "typeParameters"],
ClassExpression: ["superTypeParameters", "typeParameters"],
ClassImplements: ["typeParameters"],
ClassProperty: ["typeAnnotation"],
FunctionDeclaration: ["returnType", "typeParameters"],
FunctionExpression: ["returnType", "typeParameters"],
Identifier: ["typeAnnotation"],
InterfaceDeclaration: ["typeParameters"],
NewExpression: ["typeParameters"],
ObjectPattern: ["typeAnnotation"],
/**
* According to https://github.com/estree/estree/blob/master/extensions/type-annotations.md
* RestElement should have "typeAnnotation", but has not. Annotation is added on the "parameter" node
*/
RestElement: [],
TaggedTemplateExpression: ["typeParameters"],
VariableDeclarator: ["typeParameters"],
TSAbstractClassProperty: ["typeAnnotation", "key", "value"],
TSAbstractClassDeclaration: ["id", "body", "superClass", "implements"],
TSAbstractKeyword: [],
TSAbstractMethodDefinition: ["key", "value"],
TSAnyKeyword: [],
TSArrayType: ["elementType"],
TSAsyncKeyword: [],
TSBooleanKeyword: [],
TSConstructorType: ["typeAnnotation", "parameters"],
TSConstructSignature: ["typeAnnotation", "typeParameters"],
TSDeclareKeyword: [],
TSEnumDeclaration: ["members"],
TSEnumMember: ["initializer"],
TSExportAssignment: ["expression"],
TSExportKeyword: [],
TSImportType: ["parameter", "qualifier", "typeParameters"],
TSLiteralType: ["literal"],
TSIndexSignature: ["typeAnnotation", "index"],
TSInterfaceBody: ["body"],
TSInterfaceDeclaration: ["body", "id", "heritage"],
TSInterfaceHeritage: ["id", "typeParameters"],
TSFunctionType: ["typeAnnotation"],
TSMethodSignature: ["typeAnnotation", "typeParameters", "key", "params"],
TSModuleBlock: ["body"],
TSModuleDeclaration: ["id", "body"],
TSNamespaceFunctionDeclaration: [],
TSNonNullExpression: ["expression"],
TSNeverKeyword: [],
TSNullKeyword: [],
TSNumberKeyword: [],
TSObjectKeyword: [],
TSParameterProperty: ["parameter"],
TSPrivateKeyword: [],
TSPropertySignature: ["typeAnnotation", "key", "initializer"],
TSProtectedKeyword: [],
TSPublicKeyword: [],
TSQualifiedName: ["left", "right"],
TSQuestionToken: [],
TSReadonlyKeyword: [],
TSStaticKeyword: [],
TSStringKeyword: [],
TSSymbolKeyword: [],
TSTypeAnnotation: ["typeAnnotation"],
TSTypeLiteral: ["members"],
TSTypeOperator: ["typeAnnotation"],
TSTypeParameter: ["constraint", "default"],
TSTypeParameterDeclaration: ["params"],
TSTypeParameterInstantiation: ["params"],
TSTypePredicate: ["typeAnnotation", "parameterName"],
TSTypeReference: ["typeName", "typeParameters"],
TSUnionType: ["types"],
TSUndefinedKeyword: [],
TSVoidKeyword: []
});