1 | import { DebugLevel } from '@typescript-eslint/types';
|
2 | import { Program } from 'typescript';
|
3 | import { TSESTree, TSNode, TSESTreeToTSNode, TSToken } from './ts-estree';
|
4 | import { CanonicalPath } from './create-program/shared';
|
5 | declare type DebugModule = 'typescript-eslint' | 'eslint' | 'typescript';
|
6 | export interface Extra {
|
7 | code: string;
|
8 | comment: boolean;
|
9 | comments: TSESTree.Comment[];
|
10 | createDefaultProgram: boolean;
|
11 | debugLevel: Set<DebugModule>;
|
12 | errorOnTypeScriptSyntacticAndSemanticIssues: boolean;
|
13 | errorOnUnknownASTType: boolean;
|
14 | EXPERIMENTAL_useSourceOfProjectReferenceRedirect: boolean;
|
15 | extraFileExtensions: string[];
|
16 | filePath: string;
|
17 | jsx: boolean;
|
18 | loc: boolean;
|
19 | log: (message: string) => void;
|
20 | preserveNodeMaps?: boolean;
|
21 | projects: CanonicalPath[];
|
22 | range: boolean;
|
23 | strict: boolean;
|
24 | tokens: null | TSESTree.Token[];
|
25 | tsconfigRootDir: string;
|
26 | useJSXTextNode: boolean;
|
27 | }
|
28 | interface ParseOptions {
|
29 | |
30 |
|
31 |
|
32 | comment?: boolean;
|
33 | |
34 |
|
35 |
|
36 |
|
37 |
|
38 |
|
39 |
|
40 |
|
41 |
|
42 |
|
43 | debugLevel?: DebugLevel;
|
44 | |
45 |
|
46 |
|
47 |
|
48 | errorOnUnknownASTType?: boolean;
|
49 | |
50 |
|
51 |
|
52 | filePath?: string;
|
53 | |
54 |
|
55 |
|
56 |
|
57 |
|
58 |
|
59 |
|
60 |
|
61 |
|
62 | jsx?: boolean;
|
63 | |
64 |
|
65 |
|
66 |
|
67 |
|
68 | loc?: boolean;
|
69 | loggerFn?: ((message: string) => void) | false;
|
70 | /**
|
71 | * Controls whether the `range` property is included on AST nodes.
|
72 | * The `range` property is a [number, number] which indicates the start/end index of the node in the file contents.
|
73 | * This is similar to the `loc` property, except this is the absolute index.
|
74 | */
|
75 | range?: boolean;
|
76 | /**
|
77 | * Set to true to create a top-level array containing all tokens from the file.
|
78 | */
|
79 | tokens?: boolean;
|
80 | useJSXTextNode?: boolean;
|
81 | }
|
82 | interface ParseAndGenerateServicesOptions extends ParseOptions {
|
83 | /**
|
84 | * Causes the parser to error if the TypeScript compiler returns any unexpected syntax/semantic errors.
|
85 | */
|
86 | errorOnTypeScriptSyntacticAndSemanticIssues?: boolean;
|
87 | /**
|
88 | * ***EXPERIMENTAL FLAG*** - Use this at your own risk.
|
89 | *
|
90 | * Causes TS to use the source files for referenced projects instead of the compiled .d.ts files.
|
91 | * This feature is not yet optimized, and is likely to cause OOMs for medium to large projects.
|
92 | *
|
93 | * This flag REQUIRES at least TS v3.9, otherwise it does nothing.
|
94 | *
|
95 | * See: https://github.com/typescript-eslint/typescript-eslint/issues/2094
|
96 | */
|
97 | EXPERIMENTAL_useSourceOfProjectReferenceRedirect?: boolean;
|
98 | /**
|
99 | * When `project` is provided, this controls the non-standard file extensions which will be parsed.
|
100 | * It accepts an array of file extensions, each preceded by a `.`.
|
101 | */
|
102 | extraFileExtensions?: string[];
|
103 | /**
|
104 | * Absolute (or relative to `tsconfigRootDir`) path to the file being parsed.
|
105 | * When `project` is provided, this is required, as it is used to fetch the file from the TypeScript compiler's cache.
|
106 | */
|
107 | filePath?: string;
|
108 | /**
|
109 | * Allows the user to control whether or not two-way AST node maps are preserved
|
110 | * during the AST conversion process.
|
111 | *
|
112 | * By default: the AST node maps are NOT preserved, unless `project` has been specified,
|
113 | * in which case the maps are made available on the returned `parserServices`.
|
114 | *
|
115 | * NOTE: If `preserveNodeMaps` is explicitly set by the user, it will be respected,
|
116 | * regardless of whether or not `project` is in use.
|
117 | */
|
118 | preserveNodeMaps?: boolean;
|
119 | /**
|
120 | * Absolute (or relative to `tsconfigRootDir`) paths to the tsconfig(s).
|
121 | * If this is provided, type information will be returned.
|
122 | */
|
123 | project?: string | string[];
|
124 | /**
|
125 | * If you provide a glob (or globs) to the project option, you can use this option to ignore certain folders from
|
126 | * being matched by the globs.
|
127 | * This accepts an array of globs to ignore.
|
128 | *
|
129 | * By default, this is set to ["**\/node_modules/**"]
|
130 | */
|
131 | projectFolderIgnoreList?: string[];
|
132 | /**
|
133 | * The absolute path to the root directory for all provided `project`s.
|
134 | */
|
135 | tsconfigRootDir?: string;
|
136 | /**
|
137 | ***************************************************************************************
|
138 | * IT IS RECOMMENDED THAT YOU DO NOT USE THIS OPTION, AS IT CAUSES PERFORMANCE ISSUES. *
|
139 | ***************************************************************************************
|
140 | *
|
141 | * When passed with `project`, this allows the parser to create a catch-all, default program.
|
142 | * This means that if the parser encounters a file not included in any of the provided `project`s,
|
143 | * it will not error, but will instead parse the file and its dependencies in a new program.
|
144 | */
|
145 | createDefaultProgram?: boolean;
|
146 | }
|
147 | export declare type TSESTreeOptions = ParseAndGenerateServicesOptions;
|
148 | export interface ParserWeakMap<TKey, TValueBase> {
|
149 | get<TValue extends TValueBase>(key: TKey): TValue;
|
150 | has(key: unknown): boolean;
|
151 | }
|
152 | export interface ParserWeakMapESTreeToTSNode<TKey extends TSESTree.Node = TSESTree.Node> {
|
153 | get<TKeyBase extends TKey>(key: TKeyBase): TSESTreeToTSNode<TKeyBase>;
|
154 | has(key: unknown): boolean;
|
155 | }
|
156 | export interface ParserServices {
|
157 | program: Program;
|
158 | esTreeNodeToTSNodeMap: ParserWeakMapESTreeToTSNode;
|
159 | tsNodeToESTreeNodeMap: ParserWeakMap<TSNode | TSToken, TSESTree.Node>;
|
160 | hasFullTypeInformation: boolean;
|
161 | }
|
162 | export {};
|
163 | //# sourceMappingURL=parser-options.d.ts.map |
\ | No newline at end of file |