@typescript-eslint/typescript-estree 6.2.2-alpha.0 → 6.2.2-alpha.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (43) hide show
  1. package/dist/parser.js.map +1 -1
  2. package/dist/simple-traverse.d.ts +1 -3
  3. package/dist/simple-traverse.d.ts.map +1 -1
  4. package/dist/simple-traverse.js.map +1 -1
  5. package/package.json +4 -4
  6. package/_ts4.3/dist/ast-converter.d.ts +0 -9
  7. package/_ts4.3/dist/clear-caches.d.ts +0 -10
  8. package/_ts4.3/dist/convert-comments.d.ts +0 -11
  9. package/_ts4.3/dist/convert.d.ts +0 -142
  10. package/_ts4.3/dist/create-program/WatchCompilerHostOfConfigFile.d.ts +0 -13
  11. package/_ts4.3/dist/create-program/createDefaultProgram.d.ts +0 -12
  12. package/_ts4.3/dist/create-program/createIsolatedProgram.d.ts +0 -9
  13. package/_ts4.3/dist/create-program/createProjectProgram.d.ts +0 -10
  14. package/_ts4.3/dist/create-program/createProjectService.d.ts +0 -4
  15. package/_ts4.3/dist/create-program/createSourceFile.d.ts +0 -7
  16. package/_ts4.3/dist/create-program/describeFilePath.d.ts +0 -2
  17. package/_ts4.3/dist/create-program/getScriptKind.d.ts +0 -5
  18. package/_ts4.3/dist/create-program/getWatchProgramsForProjects.d.ts +0 -15
  19. package/_ts4.3/dist/create-program/shared.d.ts +0 -32
  20. package/_ts4.3/dist/create-program/useProvidedPrograms.d.ts +0 -16
  21. package/_ts4.3/dist/createParserServices.d.ts +0 -5
  22. package/_ts4.3/dist/getModifiers.d.ts +0 -4
  23. package/_ts4.3/dist/index.d.ts +0 -13
  24. package/_ts4.3/dist/jsx/xhtml-entities.d.ts +0 -2
  25. package/_ts4.3/dist/node-utils.d.ts +0 -254
  26. package/_ts4.3/dist/parseSettings/ExpiringCache.d.ts +0 -17
  27. package/_ts4.3/dist/parseSettings/createParseSettings.d.ts +0 -7
  28. package/_ts4.3/dist/parseSettings/getProjectConfigFiles.d.ts +0 -12
  29. package/_ts4.3/dist/parseSettings/index.d.ts +0 -122
  30. package/_ts4.3/dist/parseSettings/inferSingleRun.d.ts +0 -15
  31. package/_ts4.3/dist/parseSettings/resolveProjectList.d.ts +0 -19
  32. package/_ts4.3/dist/parseSettings/warnAboutTSVersion.d.ts +0 -3
  33. package/_ts4.3/dist/parser-options.d.ts +0 -192
  34. package/_ts4.3/dist/parser.d.ts +0 -20
  35. package/_ts4.3/dist/semantic-or-syntactic-errors.d.ts +0 -13
  36. package/_ts4.3/dist/simple-traverse.d.ts +0 -14
  37. package/_ts4.3/dist/source-files.d.ts +0 -4
  38. package/_ts4.3/dist/ts-estree/estree-to-ts-node-types.d.ts +0 -178
  39. package/_ts4.3/dist/ts-estree/index.d.ts +0 -4
  40. package/_ts4.3/dist/ts-estree/ts-nodes.d.ts +0 -14
  41. package/_ts4.3/dist/use-at-your-own-risk.d.ts +0 -7
  42. package/_ts4.3/dist/useProgramFromProjectService.d.ts +0 -5
  43. package/_ts4.3/dist/version-check.d.ts +0 -3
@@ -1,254 +0,0 @@
1
- import * as ts from 'typescript';
2
- import type { TSESTree, TSNode } from './ts-estree';
3
- import { AST_NODE_TYPES, AST_TOKEN_TYPES } from './ts-estree';
4
- declare const SyntaxKind: typeof ts.SyntaxKind;
5
- type LogicalOperatorKind = ts.SyntaxKind.AmpersandAmpersandToken | ts.SyntaxKind.BarBarToken | ts.SyntaxKind.QuestionQuestionToken;
6
- interface TokenToText extends TSESTree.PunctuatorTokenToText, TSESTree.BinaryOperatorToText {
7
- [SyntaxKind.ImportKeyword]: 'import';
8
- [SyntaxKind.NewKeyword]: 'new';
9
- [SyntaxKind.KeyOfKeyword]: 'keyof';
10
- [SyntaxKind.ReadonlyKeyword]: 'readonly';
11
- [SyntaxKind.UniqueKeyword]: 'unique';
12
- }
13
- type AssignmentOperatorKind = keyof TSESTree.AssignmentOperatorToText;
14
- type BinaryOperatorKind = keyof TSESTree.BinaryOperatorToText;
15
- /**
16
- * Returns true if the given ts.Token is a logical operator
17
- * @param operator the operator token
18
- * @returns is a logical operator
19
- */
20
- export declare function isLogicalOperator(operator: ts.BinaryOperatorToken): operator is ts.Token<LogicalOperatorKind>;
21
- export declare function isESTreeBinaryOperator(operator: ts.BinaryOperatorToken): operator is ts.Token<BinaryOperatorKind>;
22
- type TokenForTokenKind<T extends ts.SyntaxKind> = T extends keyof TokenToText ? TokenToText[T] : string | undefined;
23
- /**
24
- * Returns the string form of the given TSToken SyntaxKind
25
- * @param kind the token's SyntaxKind
26
- * @returns the token applicable token as a string
27
- */
28
- export declare function getTextForTokenKind<T extends ts.SyntaxKind>(kind: T): TokenForTokenKind<T>;
29
- /**
30
- * Returns true if the given ts.Node is a valid ESTree class member
31
- * @param node TypeScript AST node
32
- * @returns is valid ESTree class member
33
- */
34
- export declare function isESTreeClassMember(node: ts.Node): boolean;
35
- /**
36
- * Checks if a ts.Node has a modifier
37
- * @param modifierKind TypeScript SyntaxKind modifier
38
- * @param node TypeScript AST node
39
- * @returns has the modifier specified
40
- */
41
- export declare function hasModifier(modifierKind: ts.KeywordSyntaxKind, node: ts.Node): boolean;
42
- /**
43
- * Get last last modifier in ast
44
- * @param node TypeScript AST node
45
- * @returns returns last modifier if present or null
46
- */
47
- export declare function getLastModifier(node: ts.Node): ts.Modifier | null;
48
- /**
49
- * Returns true if the given ts.Token is a comma
50
- * @param token the TypeScript token
51
- * @returns is comma
52
- */
53
- export declare function isComma(token: ts.Node): token is ts.Token<ts.SyntaxKind.CommaToken>;
54
- /**
55
- * Returns true if the given ts.Node is a comment
56
- * @param node the TypeScript node
57
- * @returns is comment
58
- */
59
- export declare function isComment(node: ts.Node): boolean;
60
- /**
61
- * Returns the binary expression type of the given ts.Token
62
- * @param operator the operator token
63
- * @returns the binary expression type
64
- */
65
- export declare function getBinaryExpressionType(operator: ts.BinaryOperatorToken): {
66
- type: AST_NODE_TYPES.AssignmentExpression;
67
- operator: TokenForTokenKind<AssignmentOperatorKind>;
68
- } | {
69
- type: AST_NODE_TYPES.BinaryExpression;
70
- operator: TokenForTokenKind<BinaryOperatorKind>;
71
- } | {
72
- type: AST_NODE_TYPES.LogicalExpression;
73
- operator: TokenForTokenKind<LogicalOperatorKind>;
74
- };
75
- /**
76
- * Returns line and column data for the given positions,
77
- * @param pos position to check
78
- * @param ast the AST object
79
- * @returns line and column
80
- */
81
- export declare function getLineAndCharacterFor(pos: number, ast: ts.SourceFile): TSESTree.Position;
82
- /**
83
- * Returns line and column data for the given start and end positions,
84
- * for the given AST
85
- * @param range start end data
86
- * @param ast the AST object
87
- * @returns the loc data
88
- */
89
- export declare function getLocFor(range: TSESTree.Range, ast: ts.SourceFile): TSESTree.SourceLocation;
90
- /**
91
- * Check whatever node can contain directive
92
- * @param node
93
- * @returns returns true if node can contain directive
94
- */
95
- export declare function canContainDirective(node: ts.Block | ts.ClassStaticBlockDeclaration | ts.ModuleBlock | ts.SourceFile): boolean;
96
- /**
97
- * Returns range for the given ts.Node
98
- * @param node the ts.Node or ts.Token
99
- * @param ast the AST object
100
- * @returns the range data
101
- */
102
- export declare function getRange(node: Pick<ts.Node, 'getEnd' | 'getStart'>, ast: ts.SourceFile): [
103
- number,
104
- number
105
- ];
106
- /**
107
- * Returns true if a given ts.Node is a JSX token
108
- * @param node ts.Node to be checked
109
- * @returns is a JSX token
110
- */
111
- export declare function isJSXToken(node: ts.Node): boolean;
112
- /**
113
- * Returns the declaration kind of the given ts.Node
114
- * @param node TypeScript AST node
115
- * @returns declaration kind
116
- */
117
- export declare function getDeclarationKind(node: ts.VariableDeclarationList): 'const' | 'let' | 'var';
118
- /**
119
- * Gets a ts.Node's accessibility level
120
- * @param node The ts.Node
121
- * @returns accessibility "public", "protected", "private", or null
122
- */
123
- export declare function getTSNodeAccessibility(node: ts.Node): 'private' | 'protected' | 'public' | undefined;
124
- /**
125
- * Finds the next token based on the previous one and its parent
126
- * Had to copy this from TS instead of using TS's version because theirs doesn't pass the ast to getChildren
127
- * @param previousToken The previous TSToken
128
- * @param parent The parent TSNode
129
- * @param ast The TS AST
130
- * @returns the next TSToken
131
- */
132
- export declare function findNextToken(previousToken: ts.TextRange, parent: ts.Node, ast: ts.SourceFile): ts.Node | undefined;
133
- /**
134
- * Find the first matching ancestor based on the given predicate function.
135
- * @param node The current ts.Node
136
- * @param predicate The predicate function to apply to each checked ancestor
137
- * @returns a matching parent ts.Node
138
- */
139
- export declare function findFirstMatchingAncestor(node: ts.Node, predicate: (node: ts.Node) => boolean): ts.Node | undefined;
140
- /**
141
- * Returns true if a given ts.Node has a JSX token within its hierarchy
142
- * @param node ts.Node to be checked
143
- * @returns has JSX ancestor
144
- */
145
- export declare function hasJSXAncestor(node: ts.Node): boolean;
146
- /**
147
- * Unescape the text content of string literals, e.g. &amp; -> &
148
- * @param text The escaped string literal text.
149
- * @returns The unescaped string literal text.
150
- */
151
- export declare function unescapeStringLiteralText(text: string): string;
152
- /**
153
- * Returns true if a given ts.Node is a computed property
154
- * @param node ts.Node to be checked
155
- * @returns is Computed Property
156
- */
157
- export declare function isComputedProperty(node: ts.Node): node is ts.ComputedPropertyName;
158
- /**
159
- * Returns true if a given ts.Node is optional (has QuestionToken)
160
- * @param node ts.Node to be checked
161
- * @returns is Optional
162
- */
163
- export declare function isOptional(node: {
164
- questionToken?: ts.QuestionToken;
165
- }): boolean;
166
- /**
167
- * Returns true if the node is an optional chain node
168
- */
169
- export declare function isChainExpression(node: TSESTree.Node): node is TSESTree.ChainExpression;
170
- /**
171
- * Returns true of the child of property access expression is an optional chain
172
- */
173
- export declare function isChildUnwrappableOptionalChain(node: ts.CallExpression | ts.ElementAccessExpression | ts.NonNullExpression | ts.PropertyAccessExpression, child: TSESTree.Node): boolean;
174
- /**
175
- * Returns the type of a given ts.Token
176
- * @param token the ts.Token
177
- * @returns the token type
178
- */
179
- export declare function getTokenType(token: ts.Identifier | ts.Token<ts.SyntaxKind>): Exclude<AST_TOKEN_TYPES, AST_TOKEN_TYPES.Block | AST_TOKEN_TYPES.Line>;
180
- /**
181
- * Extends and formats a given ts.Token, for a given AST
182
- * @param token the ts.Token
183
- * @param ast the AST object
184
- * @returns the converted Token
185
- */
186
- export declare function convertToken(token: ts.Token<ts.TokenSyntaxKind>, ast: ts.SourceFile): TSESTree.Token;
187
- /**
188
- * Converts all tokens for the given AST
189
- * @param ast the AST object
190
- * @returns the converted Tokens
191
- */
192
- export declare function convertTokens(ast: ts.SourceFile): TSESTree.Token[];
193
- export declare class TSError extends Error {
194
- readonly fileName: string;
195
- readonly location: {
196
- start: {
197
- line: number;
198
- column: number;
199
- offset: number;
200
- };
201
- end: {
202
- line: number;
203
- column: number;
204
- offset: number;
205
- };
206
- };
207
- constructor(message: string, fileName: string, location: {
208
- start: {
209
- line: number;
210
- column: number;
211
- offset: number;
212
- };
213
- end: {
214
- line: number;
215
- column: number;
216
- offset: number;
217
- };
218
- });
219
- get index(): number;
220
- get lineNumber(): number;
221
- get column(): number;
222
- }
223
- /**
224
- * @param message the error message
225
- * @param ast the AST object
226
- * @param startIndex the index at which the error starts
227
- * @param endIndex the index at which the error ends
228
- * @returns converted error object
229
- */
230
- export declare function createError(message: string, ast: ts.SourceFile, startIndex: number, endIndex?: number): TSError;
231
- export declare function nodeHasIllegalDecorators(node: ts.Node): node is ts.Node & {
232
- illegalDecorators: ts.Node[];
233
- };
234
- /**
235
- * @param n the TSNode
236
- * @param ast the TS AST
237
- */
238
- export declare function nodeHasTokens(n: ts.Node, ast: ts.SourceFile): boolean;
239
- /**
240
- * Like `forEach`, but suitable for use with numbers and strings (which may be falsy).
241
- * @template T
242
- * @template U
243
- * @param array
244
- * @param callback
245
- */
246
- export declare function firstDefined<T, U>(array: readonly T[] | undefined, callback: (element: T, index: number) => U | undefined): U | undefined;
247
- export declare function identifierIsThisKeyword(id: ts.Identifier): boolean;
248
- export declare function isThisIdentifier(node: ts.Node | undefined): node is ts.Identifier;
249
- export declare function isThisInTypeQuery(node: ts.Node): boolean;
250
- export declare function nodeIsPresent(node: ts.Node | undefined): node is ts.Node;
251
- export declare function getContainingFunction(node: ts.Node): ts.SignatureDeclaration | undefined;
252
- export declare function nodeCanBeDecorated(node: TSNode): boolean;
253
- export {};
254
- //# sourceMappingURL=node-utils.d.ts.map
@@ -1,17 +0,0 @@
1
- import type { CacheDurationSeconds } from '@typescript-eslint/types';
2
- export declare const DEFAULT_TSCONFIG_CACHE_DURATION_SECONDS = 30;
3
- export interface CacheLike<Key, Value> {
4
- get(key: Key): Value | void;
5
- set(key: Key, value: Value): this;
6
- }
7
- /**
8
- * A map with key-level expiration.
9
- */
10
- export declare class ExpiringCache<TKey, TValue> implements CacheLike<TKey, TValue> {
11
- #private;
12
- constructor(cacheDurationSeconds: CacheDurationSeconds);
13
- set(key: TKey, value: TValue): this;
14
- get(key: TKey): TValue | undefined;
15
- clear(): void;
16
- }
17
- //# sourceMappingURL=ExpiringCache.d.ts.map
@@ -1,7 +0,0 @@
1
- import type * as ts from 'typescript';
2
- import type { TSESTreeOptions } from '../parser-options';
3
- import type { MutableParseSettings } from './index';
4
- export declare function createParseSettings(code: ts.SourceFile | string, options?: Partial<TSESTreeOptions>): MutableParseSettings;
5
- export declare function clearTSConfigMatchCache(): void;
6
- export declare function clearTSServerProjectService(): void;
7
- //# sourceMappingURL=createParseSettings.d.ts.map
@@ -1,12 +0,0 @@
1
- import type { ParseSettings } from '.';
2
- /**
3
- * Checks for a matching TSConfig to a file including its parent directories,
4
- * permanently caching results under each directory it checks.
5
- *
6
- * @remarks
7
- * We don't (yet!) have a way to attach file watchers on disk, but still need to
8
- * cache file checks for rapid subsequent calls to fs.existsSync. See discussion
9
- * in https://github.com/typescript-eslint/typescript-eslint/issues/101.
10
- */
11
- export declare function getProjectConfigFiles(parseSettings: Pick<ParseSettings, 'filePath' | 'tsconfigMatchCache' | 'tsconfigRootDir'>, project: string[] | string | true | null | undefined): string[] | null;
12
- //# sourceMappingURL=getProjectConfigFiles.d.ts.map
@@ -1,122 +0,0 @@
1
- import type * as ts from 'typescript';
2
- import type * as tsserverlibrary from 'typescript/lib/tsserverlibrary';
3
- import type { CanonicalPath } from '../create-program/shared';
4
- import type { TSESTree } from '../ts-estree';
5
- import type { CacheLike } from './ExpiringCache';
6
- type DebugModule = 'eslint' | 'typescript-eslint' | 'typescript';
7
- /**
8
- * Internal settings used by the parser to run on a file.
9
- */
10
- export interface MutableParseSettings {
11
- /**
12
- * Prevents the parser from throwing an error if it receives an invalid AST from TypeScript.
13
- */
14
- allowInvalidAST: boolean;
15
- /**
16
- * Code of the file being parsed, or raw source file containing it.
17
- */
18
- code: ts.SourceFile | string;
19
- /**
20
- * Full text of the file being parsed.
21
- */
22
- codeFullText: string;
23
- /**
24
- * Whether the `comment` parse option is enabled.
25
- */
26
- comment: boolean;
27
- /**
28
- * If the `comment` parse option is enabled, retrieved comments.
29
- */
30
- comments: TSESTree.Comment[];
31
- /**
32
- * @deprecated
33
- * This is a legacy option that comes with severe performance penalties.
34
- * Please do not use it.
35
- */
36
- DEPRECATED__createDefaultProgram: boolean;
37
- /**
38
- * Which debug areas should be logged.
39
- */
40
- debugLevel: Set<DebugModule>;
41
- /**
42
- * Whether to error if TypeScript reports a semantic or syntactic error diagnostic.
43
- */
44
- errorOnTypeScriptSyntacticAndSemanticIssues: boolean;
45
- /**
46
- * Whether to error if an unknown AST node type is encountered.
47
- */
48
- errorOnUnknownASTType: boolean;
49
- /**
50
- * Experimental: TypeScript server to power program creation.
51
- */
52
- EXPERIMENTAL_projectService: tsserverlibrary.server.ProjectService | undefined;
53
- /**
54
- * Whether TS should use the source files for referenced projects instead of the compiled .d.ts files.
55
- *
56
- * @remarks
57
- * This feature is not yet optimized, and is likely to cause OOMs for medium to large projects.
58
- * This flag REQUIRES at least TS v3.9, otherwise it does nothing.
59
- */
60
- EXPERIMENTAL_useSourceOfProjectReferenceRedirect: boolean;
61
- /**
62
- * Any non-standard file extensions which will be parsed.
63
- */
64
- extraFileExtensions: string[];
65
- /**
66
- * Path of the file being parsed.
67
- */
68
- filePath: string;
69
- /**
70
- * Whether parsing of JSX is enabled.
71
- *
72
- * @remarks The applicable file extension is still required.
73
- */
74
- jsx: boolean;
75
- /**
76
- * Whether to add `loc` information to each node.
77
- */
78
- loc: boolean;
79
- /**
80
- * Log function, if not `console.log`.
81
- */
82
- log: (message: string) => void;
83
- /**
84
- * Whether two-way AST node maps are preserved during the AST conversion process.
85
- */
86
- preserveNodeMaps?: boolean;
87
- /**
88
- * One or more instances of TypeScript Program objects to be used for type information.
89
- */
90
- programs: Iterable<ts.Program> | null;
91
- /**
92
- * Normalized paths to provided project paths.
93
- */
94
- projects: readonly CanonicalPath[];
95
- /**
96
- * Whether to add the `range` property to AST nodes.
97
- */
98
- range: boolean;
99
- /**
100
- * Whether this is part of a single run, rather than a long-running process.
101
- */
102
- singleRun: boolean;
103
- /**
104
- * Whether deprecated AST properties should skip calling console.warn on accesses.
105
- */
106
- suppressDeprecatedPropertyWarnings: boolean;
107
- /**
108
- * If the `tokens` parse option is enabled, retrieved tokens.
109
- */
110
- tokens: TSESTree.Token[] | null;
111
- /**
112
- * Caches searches for TSConfigs from project directories.
113
- */
114
- tsconfigMatchCache: CacheLike<string, string>;
115
- /**
116
- * The absolute path to the root directory for all provided `project`s.
117
- */
118
- tsconfigRootDir: string;
119
- }
120
- export type ParseSettings = Readonly<MutableParseSettings>;
121
- export {};
122
- //# sourceMappingURL=index.d.ts.map
@@ -1,15 +0,0 @@
1
- import type { TSESTreeOptions } from '../parser-options';
2
- /**
3
- * ESLint (and therefore typescript-eslint) is used in both "single run"/one-time contexts,
4
- * such as an ESLint CLI invocation, and long-running sessions (such as continuous feedback
5
- * on a file in an IDE).
6
- *
7
- * When typescript-eslint handles TypeScript Program management behind the scenes, this distinction
8
- * is important because there is significant overhead to managing the so called Watch Programs
9
- * needed for the long-running use-case. We therefore use the following logic to figure out which
10
- * of these contexts applies to the current execution.
11
- *
12
- * @returns Whether this is part of a single run, rather than a long-running process.
13
- */
14
- export declare function inferSingleRun(options: TSESTreeOptions | undefined): boolean;
15
- //# sourceMappingURL=inferSingleRun.d.ts.map
@@ -1,19 +0,0 @@
1
- import type { CanonicalPath } from '../create-program/shared';
2
- import type { TSESTreeOptions } from '../parser-options';
3
- export declare function clearGlobCache(): void;
4
- /**
5
- * Normalizes, sanitizes, resolves and filters the provided project paths
6
- */
7
- export declare function resolveProjectList(options: Readonly<{
8
- cacheLifetime?: TSESTreeOptions['cacheLifetime'];
9
- project: string[] | null;
10
- projectFolderIgnoreList: TSESTreeOptions['projectFolderIgnoreList'];
11
- singleRun: boolean;
12
- tsconfigRootDir: string;
13
- }>): readonly CanonicalPath[];
14
- /**
15
- * Exported for testing purposes only
16
- * @internal
17
- */
18
- export declare function clearGlobResolutionCache(): void;
19
- //# sourceMappingURL=resolveProjectList.d.ts.map
@@ -1,3 +0,0 @@
1
- import type { ParseSettings } from './index';
2
- export declare function warnAboutTSVersion(parseSettings: ParseSettings): void;
3
- //# sourceMappingURL=warnAboutTSVersion.d.ts.map
@@ -1,192 +0,0 @@
1
- import type { CacheDurationSeconds, DebugLevel } from '@typescript-eslint/types';
2
- import type * as ts from 'typescript';
3
- import type { TSESTree, TSESTreeToTSNode, TSNode, TSToken } from './ts-estree';
4
- interface ParseOptions {
5
- /**
6
- * Prevents the parser from throwing an error if it receives an invalid AST from TypeScript.
7
- * This case only usually occurs when attempting to lint invalid code.
8
- */
9
- allowInvalidAST?: boolean;
10
- /**
11
- * create a top-level comments array containing all comments
12
- */
13
- comment?: boolean;
14
- /**
15
- * An array of modules to turn explicit debugging on for.
16
- * - 'typescript-eslint' is the same as setting the env var `DEBUG=typescript-eslint:*`
17
- * - 'eslint' is the same as setting the env var `DEBUG=eslint:*`
18
- * - 'typescript' is the same as setting `extendedDiagnostics: true` in your tsconfig compilerOptions
19
- *
20
- * For convenience, also supports a boolean:
21
- * - true === ['typescript-eslint']
22
- * - false === []
23
- */
24
- debugLevel?: DebugLevel;
25
- /**
26
- * Cause the parser to error if it encounters an unknown AST node type (useful for testing).
27
- * This case only usually occurs when TypeScript releases new features.
28
- */
29
- errorOnUnknownASTType?: boolean;
30
- /**
31
- * Absolute (or relative to `cwd`) path to the file being parsed.
32
- */
33
- filePath?: string;
34
- /**
35
- * Enable parsing of JSX.
36
- * For more details, see https://www.typescriptlang.org/docs/handbook/jsx.html
37
- *
38
- * NOTE: this setting does not effect known file types (.js, .cjs, .mjs, .jsx, .ts, .mts, .cts, .tsx, .json) because the
39
- * TypeScript compiler has its own internal handling for known file extensions.
40
- *
41
- * For the exact behavior, see https://github.com/typescript-eslint/typescript-eslint/tree/main/packages/parser#parseroptionsecmafeaturesjsx
42
- */
43
- jsx?: boolean;
44
- /**
45
- * Controls whether the `loc` information to each node.
46
- * The `loc` property is an object which contains the exact line/column the node starts/ends on.
47
- * This is similar to the `range` property, except it is line/column relative.
48
- */
49
- loc?: boolean;
50
- loggerFn?: false | ((message: string) => void);
51
- /**
52
- * Controls whether the `range` property is included on AST nodes.
53
- * The `range` property is a [number, number] which indicates the start/end index of the node in the file contents.
54
- * This is similar to the `loc` property, except this is the absolute index.
55
- */
56
- range?: boolean;
57
- /**
58
- * Set to true to create a top-level array containing all tokens from the file.
59
- */
60
- tokens?: boolean;
61
- /**
62
- * Whether deprecated AST properties should skip calling console.warn on accesses.
63
- */
64
- suppressDeprecatedPropertyWarnings?: boolean;
65
- }
66
- interface ParseAndGenerateServicesOptions extends ParseOptions {
67
- /**
68
- * Causes the parser to error if the TypeScript compiler returns any unexpected syntax/semantic errors.
69
- */
70
- errorOnTypeScriptSyntacticAndSemanticIssues?: boolean;
71
- /**
72
- * ***EXPERIMENTAL FLAG*** - Use this at your own risk.
73
- *
74
- * Whether to create a shared TypeScript server to power program creation.
75
- *
76
- * @see https://github.com/typescript-eslint/typescript-eslint/issues/6575
77
- */
78
- EXPERIMENTAL_useProjectService?: boolean;
79
- /**
80
- * ***EXPERIMENTAL FLAG*** - Use this at your own risk.
81
- *
82
- * Causes TS to use the source files for referenced projects instead of the compiled .d.ts files.
83
- * This feature is not yet optimized, and is likely to cause OOMs for medium to large projects.
84
- *
85
- * This flag REQUIRES at least TS v3.9, otherwise it does nothing.
86
- *
87
- * @see https://github.com/typescript-eslint/typescript-eslint/issues/2094
88
- */
89
- EXPERIMENTAL_useSourceOfProjectReferenceRedirect?: boolean;
90
- /**
91
- * When `project` is provided, this controls the non-standard file extensions which will be parsed.
92
- * It accepts an array of file extensions, each preceded by a `.`.
93
- */
94
- extraFileExtensions?: string[];
95
- /**
96
- * Absolute (or relative to `tsconfigRootDir`) path to the file being parsed.
97
- * When `project` is provided, this is required, as it is used to fetch the file from the TypeScript compiler's cache.
98
- */
99
- filePath?: string;
100
- /**
101
- * Allows the user to control whether or not two-way AST node maps are preserved
102
- * during the AST conversion process.
103
- *
104
- * By default: the AST node maps are NOT preserved, unless `project` has been specified,
105
- * in which case the maps are made available on the returned `parserServices`.
106
- *
107
- * NOTE: If `preserveNodeMaps` is explicitly set by the user, it will be respected,
108
- * regardless of whether or not `project` is in use.
109
- */
110
- preserveNodeMaps?: boolean;
111
- /**
112
- * Absolute (or relative to `tsconfigRootDir`) paths to the tsconfig(s),
113
- * or `true` to find the nearest tsconfig.json to the file.
114
- * If this is provided, type information will be returned.
115
- */
116
- project?: string[] | string | true | null;
117
- /**
118
- * If you provide a glob (or globs) to the project option, you can use this option to ignore certain folders from
119
- * being matched by the globs.
120
- * This accepts an array of globs to ignore.
121
- *
122
- * By default, this is set to ["**\/node_modules/**"]
123
- */
124
- projectFolderIgnoreList?: string[];
125
- /**
126
- * The absolute path to the root directory for all provided `project`s.
127
- */
128
- tsconfigRootDir?: string;
129
- /**
130
- * An array of one or more instances of TypeScript Program objects to be used for type information.
131
- * This overrides any program or programs that would have been computed from the `project` option.
132
- * All linted files must be part of the provided program(s).
133
- */
134
- programs?: ts.Program[] | null;
135
- /**
136
- * @deprecated - this flag will be removed in the next major.
137
- * Do not rely on the behavior provided by this flag.
138
- */
139
- DEPRECATED__createDefaultProgram?: boolean;
140
- /**
141
- * ESLint (and therefore typescript-eslint) is used in both "single run"/one-time contexts,
142
- * such as an ESLint CLI invocation, and long-running sessions (such as continuous feedback
143
- * on a file in an IDE).
144
- *
145
- * When typescript-eslint handles TypeScript Program management behind the scenes, this distinction
146
- * is important because there is significant overhead to managing the so called Watch Programs
147
- * needed for the long-running use-case.
148
- *
149
- * When allowAutomaticSingleRunInference is enabled, we will use common heuristics to infer
150
- * whether or not ESLint is being used as part of a single run.
151
- */
152
- allowAutomaticSingleRunInference?: boolean;
153
- /**
154
- * Granular control of the expiry lifetime of our internal caches.
155
- * You can specify the number of seconds as an integer number, or the string
156
- * 'Infinity' if you never want the cache to expire.
157
- *
158
- * By default cache entries will be evicted after 30 seconds, or will persist
159
- * indefinitely if `allowAutomaticSingleRunInference = true` AND the parser
160
- * infers that it is a single run.
161
- */
162
- cacheLifetime?: {
163
- /**
164
- * Glob resolution for `parserOptions.project` values.
165
- */
166
- glob?: CacheDurationSeconds;
167
- };
168
- }
169
- export type TSESTreeOptions = ParseAndGenerateServicesOptions;
170
- export interface ParserWeakMap<TKey, TValueBase> {
171
- get<TValue extends TValueBase>(key: TKey): TValue;
172
- has(key: unknown): boolean;
173
- }
174
- export interface ParserWeakMapESTreeToTSNode<TKey extends TSESTree.Node = TSESTree.Node> {
175
- get<TKeyBase extends TKey>(key: TKeyBase): TSESTreeToTSNode<TKeyBase>;
176
- has(key: unknown): boolean;
177
- }
178
- export interface ParserServicesNodeMaps {
179
- esTreeNodeToTSNodeMap: ParserWeakMapESTreeToTSNode;
180
- tsNodeToESTreeNodeMap: ParserWeakMap<TSNode | TSToken, TSESTree.Node>;
181
- }
182
- export interface ParserServicesWithTypeInformation extends ParserServicesNodeMaps {
183
- program: ts.Program;
184
- getSymbolAtLocation: (node: TSESTree.Node) => ts.Symbol | undefined;
185
- getTypeAtLocation: (node: TSESTree.Node) => ts.Type;
186
- }
187
- export interface ParserServicesWithoutTypeInformation extends ParserServicesNodeMaps {
188
- program: null;
189
- }
190
- export type ParserServices = ParserServicesWithoutTypeInformation | ParserServicesWithTypeInformation;
191
- export {};
192
- //# sourceMappingURL=parser-options.d.ts.map
@@ -1,20 +0,0 @@
1
- import type * as ts from 'typescript';
2
- import type { ParserServices, TSESTreeOptions } from './parser-options';
3
- import type { TSESTree } from './ts-estree';
4
- declare function clearProgramCache(): void;
5
- interface EmptyObject {
6
- }
7
- type AST<T extends TSESTreeOptions> = TSESTree.Program & (T['comment'] extends true ? {
8
- comments: TSESTree.Comment[];
9
- } : EmptyObject) & (T['tokens'] extends true ? {
10
- tokens: TSESTree.Token[];
11
- } : EmptyObject);
12
- interface ParseAndGenerateServicesResult<T extends TSESTreeOptions> {
13
- ast: AST<T>;
14
- services: ParserServices;
15
- }
16
- declare function parse<T extends TSESTreeOptions = TSESTreeOptions>(code: string, options?: T): AST<T>;
17
- declare function clearParseAndGenerateServicesCalls(): void;
18
- declare function parseAndGenerateServices<T extends TSESTreeOptions = TSESTreeOptions>(code: ts.SourceFile | string, options: T): ParseAndGenerateServicesResult<T>;
19
- export { AST, parse, parseAndGenerateServices, ParseAndGenerateServicesResult, clearProgramCache, clearParseAndGenerateServicesCalls, };
20
- //# sourceMappingURL=parser.d.ts.map