/
parser-options.ts
69 lines (64 loc) · 2.05 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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
import { Program } from 'typescript';
import { TSESTree, TSNode } from './ts-estree';
type DebugModule = 'typescript-eslint' | 'eslint' | 'typescript';
/**
* For convenience:
* - true === ['typescript-eslint']
* - false === []
*
* An array of modules to turn explicit debugging on for.
* - 'typescript-eslint' is the same as setting the env var `DEBUG=typescript-eslint:*`
* - 'eslint' is the same as setting the env var `DEBUG=eslint:*`
* - 'typescript' is the same as setting `extendedDiagnostics: true` in your tsconfig compilerOptions
*/
export type DebugLevel = boolean | DebugModule[];
export interface Extra {
code: string;
comment: boolean;
comments: TSESTree.Comment[];
createDefaultProgram: boolean;
debugLevel: Set<DebugModule>;
errorOnTypeScriptSyntacticAndSemanticIssues: boolean;
errorOnUnknownASTType: boolean;
extraFileExtensions: string[];
filePath: string;
jsx: boolean;
loc: boolean;
log: Function;
preserveNodeMaps?: boolean;
projects: string[];
range: boolean;
strict: boolean;
tokens: null | TSESTree.Token[];
tsconfigRootDir: string;
useJSXTextNode: boolean;
}
export interface TSESTreeOptions {
comment?: boolean;
createDefaultProgram?: boolean;
debugLevel?: DebugLevel;
errorOnTypeScriptSyntacticAndSemanticIssues?: boolean;
errorOnUnknownASTType?: boolean;
extraFileExtensions?: string[];
filePath?: string;
jsx?: boolean;
loc?: boolean;
loggerFn?: Function | false;
preserveNodeMaps?: boolean;
project?: string | string[];
range?: boolean;
tokens?: boolean;
tsconfigRootDir?: string;
useJSXTextNode?: 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;
}