-
-
Notifications
You must be signed in to change notification settings - Fork 2.6k
/
index.ts
131 lines (106 loc) · 2.99 KB
/
index.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
import type * as ts from 'typescript';
import type { CanonicalPath } from '../create-program/shared';
import type { TSESTree } from '../ts-estree';
type DebugModule = 'typescript-eslint' | 'eslint' | 'typescript';
/**
* Internal settings used by the parser to run on a file.
*/
export interface MutableParseSettings {
/**
* Code of the file being parsed, or raw source file containing it.
*/
code: string | ts.SourceFile;
/**
* Full text of the file being parsed.
*/
codeFullText: string;
/**
* Whether the `comment` parse option is enabled.
*/
comment: boolean;
/**
* If the `comment` parse option is enabled, retrieved comments.
*/
comments: TSESTree.Comment[];
/**
* @deprecated
* This is a legacy option that comes with severe performance penalties.
* Please do not use it.
*/
DEPRECATED__createDefaultProgram: boolean;
/**
* Which debug areas should be logged.
*/
debugLevel: Set<DebugModule>;
/**
* Whether to error if TypeScript reports a semantic or syntactic error diagnostic.
*/
errorOnTypeScriptSyntacticAndSemanticIssues: boolean;
/**
* Whether to error if an unknown AST node type is encountered.
*/
errorOnUnknownASTType: boolean;
/**
* Whether TS should use the source files for referenced projects instead of the compiled .d.ts files.
*
* @remarks
* This feature is not yet optimized, and is likely to cause OOMs for medium to large projects.
* This flag REQUIRES at least TS v3.9, otherwise it does nothing.
*/
EXPERIMENTAL_useSourceOfProjectReferenceRedirect: boolean;
/**
* Any non-standard file extensions which will be parsed.
*/
extraFileExtensions: string[];
/**
* Path of the file being parsed.
*/
filePath: string;
/**
* Whether parsing of JSX is enabled.
*
* @remarks The applicable file extension is still required.
*/
jsx: boolean;
/**
* Whether to add `loc` information to each node.
*/
loc: boolean;
/**
* Log function, if not `console.log`.
*/
log: (message: string) => void;
/**
* Path for a module resolver to use for the compiler host's `resolveModuleNames`.
*/
moduleResolver: string;
/**
* Whether two-way AST node maps are preserved during the AST conversion process.
*/
preserveNodeMaps?: boolean;
/**
* One or more instances of TypeScript Program objects to be used for type information.
*/
programs: null | Iterable<ts.Program>;
/**
* Normalized paths to provided project paths.
*/
projects: CanonicalPath[];
/**
* Whether to add the `range` property to AST nodes.
*/
range: boolean;
/**
* Whether this is part of a single run, rather than a long-running process.
*/
singleRun: boolean;
/**
* If the `tokens` parse option is enabled, retrieved tokens.
*/
tokens: null | TSESTree.Token[];
/**
* The absolute path to the root directory for all provided `project`s.
*/
tsconfigRootDir: string;
}
export type ParseSettings = Readonly<MutableParseSettings>;