/
parser-options.ts
53 lines (49 loc) · 1.47 KB
/
parser-options.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
import { Program } from 'typescript';
import { TSESTree, TSNode } from './ts-estree';
export interface Extra {
errorOnUnknownASTType: boolean;
errorOnTypeScriptSyntacticAndSemanticIssues: boolean;
useJSXTextNode: boolean;
tokens: null | TSESTree.Token[];
comment: boolean;
code: string;
range: boolean;
loc: boolean;
comments: TSESTree.Comment[];
strict: boolean;
jsx: boolean;
log: Function;
projects: string[];
tsconfigRootDir: string;
extraFileExtensions: string[];
preserveNodeMaps?: boolean;
createDefaultProgram: boolean;
}
export interface TSESTreeOptions {
range?: boolean;
loc?: boolean;
tokens?: boolean;
comment?: boolean;
jsx?: boolean;
errorOnUnknownASTType?: boolean;
errorOnTypeScriptSyntacticAndSemanticIssues?: boolean;
useJSXTextNode?: boolean;
loggerFn?: Function | false;
project?: string | string[];
filePath?: string;
tsconfigRootDir?: string;
extraFileExtensions?: string[];
preserveNodeMaps?: boolean;
createDefaultProgram?: boolean;
}
// This lets us use generics to type the return value, and removes the need to
// handle the undefined type in the get method
export interface ParserWeakMap<TKey, TValueBase> {
get<TValue extends TValueBase>(key: TKey): TValue;
has(key: unknown): boolean;
}
export interface ParserServices {
program: Program | undefined;
esTreeNodeToTSNodeMap: ParserWeakMap<TSESTree.Node, TSNode> | undefined;
tsNodeToESTreeNodeMap: ParserWeakMap<TSNode, TSESTree.Node> | undefined;
}