@typescript-eslint/utils 6.0.1-alpha.0 → 7.0.0-alpha.0

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 (31) hide show
  1. package/package.json +5 -5
  2. package/_ts4.3/dist/ast-utils/eslint-utils/PatternMatcher.d.ts +0 -48
  3. package/_ts4.3/dist/ast-utils/eslint-utils/ReferenceTracker.d.ts +0 -76
  4. package/_ts4.3/dist/ast-utils/eslint-utils/astUtilities.d.ts +0 -76
  5. package/_ts4.3/dist/ast-utils/eslint-utils/index.d.ts +0 -6
  6. package/_ts4.3/dist/ast-utils/eslint-utils/predicates.d.ts +0 -32
  7. package/_ts4.3/dist/ast-utils/eslint-utils/scopeAnalysis.d.ts +0 -18
  8. package/_ts4.3/dist/ast-utils/helpers.d.ts +0 -1207
  9. package/_ts4.3/dist/ast-utils/index.d.ts +0 -5
  10. package/_ts4.3/dist/ast-utils/misc.d.ts +0 -8
  11. package/_ts4.3/dist/ast-utils/predicates.d.ts +0 -70
  12. package/_ts4.3/dist/eslint-utils/InferTypesFromRule.d.ts +0 -11
  13. package/_ts4.3/dist/eslint-utils/RuleCreator.d.ts +0 -35
  14. package/_ts4.3/dist/eslint-utils/applyDefault.d.ts +0 -10
  15. package/_ts4.3/dist/eslint-utils/deepMerge.d.ts +0 -17
  16. package/_ts4.3/dist/eslint-utils/getParserServices.d.ts +0 -24
  17. package/_ts4.3/dist/eslint-utils/index.d.ts +0 -7
  18. package/_ts4.3/dist/eslint-utils/nullThrows.d.ts +0 -14
  19. package/_ts4.3/dist/index.d.ts +0 -7
  20. package/_ts4.3/dist/json-schema.d.ts +0 -392
  21. package/_ts4.3/dist/ts-eslint/AST.d.ts +0 -9
  22. package/_ts4.3/dist/ts-eslint/CLIEngine.d.ts +0 -137
  23. package/_ts4.3/dist/ts-eslint/ESLint.d.ts +0 -376
  24. package/_ts4.3/dist/ts-eslint/Linter.d.ts +0 -331
  25. package/_ts4.3/dist/ts-eslint/ParserOptions.d.ts +0 -2
  26. package/_ts4.3/dist/ts-eslint/Rule.d.ts +0 -400
  27. package/_ts4.3/dist/ts-eslint/RuleTester.d.ts +0 -161
  28. package/_ts4.3/dist/ts-eslint/Scope.d.ts +0 -44
  29. package/_ts4.3/dist/ts-eslint/SourceCode.d.ts +0 -346
  30. package/_ts4.3/dist/ts-eslint/index.d.ts +0 -10
  31. package/_ts4.3/dist/ts-estree.d.ts +0 -3
@@ -1,400 +0,0 @@
1
- import type { JSONSchema4 } from '../json-schema';
2
- import type { ParserServices, TSESTree } from '../ts-estree';
3
- import type { AST } from './AST';
4
- import type { Linter } from './Linter';
5
- import type { Scope } from './Scope';
6
- import type { SourceCode } from './SourceCode';
7
- export type RuleRecommendation = 'recommended' | 'strict' | 'stylistic';
8
- interface RuleMetaDataDocs {
9
- /**
10
- * Concise description of the rule
11
- */
12
- description: string;
13
- /**
14
- * The recommendation level for the rule.
15
- * Used by the build tools to generate the recommended and strict configs.
16
- * Set to false to not include it as a recommendation
17
- */
18
- recommended?: RuleRecommendation;
19
- /**
20
- * The URL of the rule's docs
21
- */
22
- url?: string;
23
- /**
24
- * Does the rule require us to create a full TypeScript Program in order for it
25
- * to type-check code. This is only used for documentation purposes.
26
- */
27
- requiresTypeChecking?: boolean;
28
- /**
29
- * Does the rule extend (or is it based off of) an ESLint code rule?
30
- * Alternately accepts the name of the base rule, in case the rule has been renamed.
31
- * This is only used for documentation purposes.
32
- */
33
- extendsBaseRule?: boolean | string;
34
- }
35
- interface RuleMetaData<TMessageIds extends string> {
36
- /**
37
- * True if the rule is deprecated, false otherwise
38
- */
39
- deprecated?: boolean;
40
- /**
41
- * Documentation for the rule, unnecessary for custom rules/plugins
42
- */
43
- docs?: RuleMetaDataDocs;
44
- /**
45
- * The fixer category. Omit if there is no fixer
46
- */
47
- fixable?: 'code' | 'whitespace';
48
- /**
49
- * Specifies whether rules can return suggestions. Omit if there is no suggestions
50
- */
51
- hasSuggestions?: boolean;
52
- /**
53
- * A map of messages which the rule can report.
54
- * The key is the messageId, and the string is the parameterised error string.
55
- * See: https://eslint.org/docs/developer-guide/working-with-rules#messageids
56
- */
57
- messages: Record<TMessageIds, string>;
58
- /**
59
- * The type of rule.
60
- * - `"problem"` means the rule is identifying code that either will cause an error or may cause a confusing behavior. Developers should consider this a high priority to resolve.
61
- * - `"suggestion"` means the rule is identifying something that could be done in a better way but no errors will occur if the code isn’t changed.
62
- * - `"layout"` means the rule cares primarily about whitespace, semicolons, commas, and parentheses, all the parts of the program that determine how the code looks rather than how it executes. These rules work on parts of the code that aren’t specified in the AST.
63
- */
64
- type: 'layout' | 'problem' | 'suggestion';
65
- /**
66
- * The name of the rule this rule was replaced by, if it was deprecated.
67
- */
68
- replacedBy?: readonly string[];
69
- /**
70
- * The options schema. Supply an empty array if there are no options.
71
- */
72
- schema: JSONSchema4 | readonly JSONSchema4[];
73
- }
74
- interface RuleFix {
75
- range: Readonly<AST.Range>;
76
- text: string;
77
- }
78
- interface RuleFixer {
79
- insertTextAfter(nodeOrToken: TSESTree.Node | TSESTree.Token, text: string): RuleFix;
80
- insertTextAfterRange(range: Readonly<AST.Range>, text: string): RuleFix;
81
- insertTextBefore(nodeOrToken: TSESTree.Node | TSESTree.Token, text: string): RuleFix;
82
- insertTextBeforeRange(range: Readonly<AST.Range>, text: string): RuleFix;
83
- remove(nodeOrToken: TSESTree.Node | TSESTree.Token): RuleFix;
84
- removeRange(range: Readonly<AST.Range>): RuleFix;
85
- replaceText(nodeOrToken: TSESTree.Node | TSESTree.Token, text: string): RuleFix;
86
- replaceTextRange(range: Readonly<AST.Range>, text: string): RuleFix;
87
- }
88
- interface SuggestionReportDescriptor<TMessageIds extends string> extends Omit<ReportDescriptorBase<TMessageIds>, 'fix'> {
89
- readonly fix: ReportFixFunction;
90
- }
91
- type ReportFixFunction = (fixer: RuleFixer) => IterableIterator<RuleFix> | RuleFix | readonly RuleFix[] | null;
92
- type ReportSuggestionArray<TMessageIds extends string> = SuggestionReportDescriptor<TMessageIds>[];
93
- type ReportDescriptorMessageData = Readonly<Record<string, unknown>>;
94
- interface ReportDescriptorBase<TMessageIds extends string> {
95
- /**
96
- * The parameters for the message string associated with `messageId`.
97
- */
98
- readonly data?: ReportDescriptorMessageData;
99
- /**
100
- * The fixer function.
101
- */
102
- readonly fix?: ReportFixFunction | null;
103
- /**
104
- * The messageId which is being reported.
105
- */
106
- readonly messageId: TMessageIds;
107
- }
108
- interface ReportDescriptorWithSuggestion<TMessageIds extends string> extends ReportDescriptorBase<TMessageIds> {
109
- /**
110
- * 6.7's Suggestions API
111
- */
112
- readonly suggest?: Readonly<ReportSuggestionArray<TMessageIds>> | null;
113
- }
114
- interface ReportDescriptorNodeOptionalLoc {
115
- /**
116
- * The Node or AST Token which the report is being attached to
117
- */
118
- readonly node: TSESTree.Node | TSESTree.Token;
119
- /**
120
- * An override of the location of the report
121
- */
122
- readonly loc?: Readonly<TSESTree.Position> | Readonly<TSESTree.SourceLocation>;
123
- }
124
- interface ReportDescriptorLocOnly {
125
- /**
126
- * An override of the location of the report
127
- */
128
- loc: Readonly<TSESTree.Position> | Readonly<TSESTree.SourceLocation>;
129
- }
130
- type ReportDescriptor<TMessageIds extends string> = ReportDescriptorWithSuggestion<TMessageIds> & (ReportDescriptorLocOnly | ReportDescriptorNodeOptionalLoc);
131
- /**
132
- * Plugins can add their settings using declaration
133
- * merging against this interface.
134
- */
135
- interface SharedConfigurationSettings {
136
- [name: string]: unknown;
137
- }
138
- interface RuleContext<TMessageIds extends string, TOptions extends readonly unknown[]> {
139
- /**
140
- * The rule ID.
141
- */
142
- id: string;
143
- /**
144
- * An array of the configured options for this rule.
145
- * This array does not include the rule severity.
146
- */
147
- options: TOptions;
148
- /**
149
- * The name of the parser from configuration.
150
- */
151
- parserPath: string;
152
- /**
153
- * The parser options configured for this run
154
- */
155
- parserOptions: Linter.ParserOptions;
156
- /**
157
- * An object containing parser-provided services for rules
158
- */
159
- parserServices?: ParserServices;
160
- /**
161
- * The shared settings from configuration.
162
- * We do not have any shared settings in this plugin.
163
- */
164
- settings: SharedConfigurationSettings;
165
- /**
166
- * Returns an array of the ancestors of the currently-traversed node, starting at
167
- * the root of the AST and continuing through the direct parent of the current node.
168
- * This array does not include the currently-traversed node itself.
169
- */
170
- getAncestors(): TSESTree.Node[];
171
- /**
172
- * Returns a list of variables declared by the given node.
173
- * This information can be used to track references to variables.
174
- */
175
- getDeclaredVariables(node: TSESTree.Node): readonly Scope.Variable[];
176
- /**
177
- * Returns the current working directory passed to Linter.
178
- * It is a path to a directory that should be considered as the current working directory.
179
- * @since 6.6.0
180
- */
181
- getCwd?(): string;
182
- /**
183
- * Returns the filename associated with the source.
184
- */
185
- getFilename(): string;
186
- /**
187
- * Returns the full path of the file on disk without any code block information (unlike `getFilename()`).
188
- * @since 7.28.0
189
- */
190
- getPhysicalFilename?(): string;
191
- /**
192
- * Returns the scope of the currently-traversed node.
193
- * This information can be used track references to variables.
194
- */
195
- getScope(): Scope.Scope;
196
- /**
197
- * Returns a SourceCode object that you can use to work with the source that
198
- * was passed to ESLint.
199
- */
200
- getSourceCode(): Readonly<SourceCode>;
201
- /**
202
- * Marks a variable with the given name in the current scope as used.
203
- * This affects the no-unused-vars rule.
204
- */
205
- markVariableAsUsed(name: string): boolean;
206
- /**
207
- * Reports a problem in the code.
208
- */
209
- report(descriptor: ReportDescriptor<TMessageIds>): void;
210
- }
211
- type RuleFunction<T extends TSESTree.NodeOrTokenData = never> = (node: T) => void;
212
- interface RuleListenerBaseSelectors {
213
- ArrayExpression?: RuleFunction<TSESTree.ArrayExpression>;
214
- ArrayPattern?: RuleFunction<TSESTree.ArrayPattern>;
215
- ArrowFunctionExpression?: RuleFunction<TSESTree.ArrowFunctionExpression>;
216
- AssignmentExpression?: RuleFunction<TSESTree.AssignmentExpression>;
217
- AssignmentPattern?: RuleFunction<TSESTree.AssignmentPattern>;
218
- AwaitExpression?: RuleFunction<TSESTree.AwaitExpression>;
219
- BigIntLiteral?: RuleFunction<TSESTree.BigIntLiteral>;
220
- BinaryExpression?: RuleFunction<TSESTree.BinaryExpression>;
221
- BlockStatement?: RuleFunction<TSESTree.BlockStatement>;
222
- BreakStatement?: RuleFunction<TSESTree.BreakStatement>;
223
- CallExpression?: RuleFunction<TSESTree.CallExpression>;
224
- CatchClause?: RuleFunction<TSESTree.CatchClause>;
225
- ChainExpression?: RuleFunction<TSESTree.ChainExpression>;
226
- ClassBody?: RuleFunction<TSESTree.ClassBody>;
227
- ClassDeclaration?: RuleFunction<TSESTree.ClassDeclaration>;
228
- ClassExpression?: RuleFunction<TSESTree.ClassExpression>;
229
- ConditionalExpression?: RuleFunction<TSESTree.ConditionalExpression>;
230
- ContinueStatement?: RuleFunction<TSESTree.ContinueStatement>;
231
- DebuggerStatement?: RuleFunction<TSESTree.DebuggerStatement>;
232
- Decorator?: RuleFunction<TSESTree.Decorator>;
233
- DoWhileStatement?: RuleFunction<TSESTree.DoWhileStatement>;
234
- EmptyStatement?: RuleFunction<TSESTree.EmptyStatement>;
235
- ExportAllDeclaration?: RuleFunction<TSESTree.ExportAllDeclaration>;
236
- ExportDefaultDeclaration?: RuleFunction<TSESTree.ExportDefaultDeclaration>;
237
- ExportNamedDeclaration?: RuleFunction<TSESTree.ExportNamedDeclaration>;
238
- ExportSpecifier?: RuleFunction<TSESTree.ExportSpecifier>;
239
- ExpressionStatement?: RuleFunction<TSESTree.ExpressionStatement>;
240
- ForInStatement?: RuleFunction<TSESTree.ForInStatement>;
241
- ForOfStatement?: RuleFunction<TSESTree.ForOfStatement>;
242
- ForStatement?: RuleFunction<TSESTree.ForStatement>;
243
- FunctionDeclaration?: RuleFunction<TSESTree.FunctionDeclaration>;
244
- FunctionExpression?: RuleFunction<TSESTree.FunctionExpression>;
245
- Identifier?: RuleFunction<TSESTree.Identifier>;
246
- IfStatement?: RuleFunction<TSESTree.IfStatement>;
247
- ImportDeclaration?: RuleFunction<TSESTree.ImportDeclaration>;
248
- ImportDefaultSpecifier?: RuleFunction<TSESTree.ImportDefaultSpecifier>;
249
- ImportExpression?: RuleFunction<TSESTree.ImportExpression>;
250
- ImportNamespaceSpecifier?: RuleFunction<TSESTree.ImportNamespaceSpecifier>;
251
- ImportSpecifier?: RuleFunction<TSESTree.ImportSpecifier>;
252
- JSXAttribute?: RuleFunction<TSESTree.JSXAttribute>;
253
- JSXClosingElement?: RuleFunction<TSESTree.JSXClosingElement>;
254
- JSXClosingFragment?: RuleFunction<TSESTree.JSXClosingFragment>;
255
- JSXElement?: RuleFunction<TSESTree.JSXElement>;
256
- JSXEmptyExpression?: RuleFunction<TSESTree.JSXEmptyExpression>;
257
- JSXExpressionContainer?: RuleFunction<TSESTree.JSXExpressionContainer>;
258
- JSXFragment?: RuleFunction<TSESTree.JSXFragment>;
259
- JSXIdentifier?: RuleFunction<TSESTree.JSXIdentifier>;
260
- JSXMemberExpression?: RuleFunction<TSESTree.JSXMemberExpression>;
261
- JSXOpeningElement?: RuleFunction<TSESTree.JSXOpeningElement>;
262
- JSXOpeningFragment?: RuleFunction<TSESTree.JSXOpeningFragment>;
263
- JSXSpreadAttribute?: RuleFunction<TSESTree.JSXSpreadAttribute>;
264
- JSXSpreadChild?: RuleFunction<TSESTree.JSXSpreadChild>;
265
- JSXText?: RuleFunction<TSESTree.JSXText>;
266
- LabeledStatement?: RuleFunction<TSESTree.LabeledStatement>;
267
- Literal?: RuleFunction<TSESTree.Literal>;
268
- LogicalExpression?: RuleFunction<TSESTree.LogicalExpression>;
269
- MemberExpression?: RuleFunction<TSESTree.MemberExpression>;
270
- MetaProperty?: RuleFunction<TSESTree.MetaProperty>;
271
- MethodDefinition?: RuleFunction<TSESTree.MethodDefinition>;
272
- NewExpression?: RuleFunction<TSESTree.NewExpression>;
273
- ObjectExpression?: RuleFunction<TSESTree.ObjectExpression>;
274
- ObjectPattern?: RuleFunction<TSESTree.ObjectPattern>;
275
- Program?: RuleFunction<TSESTree.Program>;
276
- Property?: RuleFunction<TSESTree.Property>;
277
- PropertyDefinition?: RuleFunction<TSESTree.PropertyDefinition>;
278
- RestElement?: RuleFunction<TSESTree.RestElement>;
279
- ReturnStatement?: RuleFunction<TSESTree.ReturnStatement>;
280
- SequenceExpression?: RuleFunction<TSESTree.SequenceExpression>;
281
- SpreadElement?: RuleFunction<TSESTree.SpreadElement>;
282
- Super?: RuleFunction<TSESTree.Super>;
283
- SwitchCase?: RuleFunction<TSESTree.SwitchCase>;
284
- SwitchStatement?: RuleFunction<TSESTree.SwitchStatement>;
285
- TaggedTemplateExpression?: RuleFunction<TSESTree.TaggedTemplateExpression>;
286
- TemplateElement?: RuleFunction<TSESTree.TemplateElement>;
287
- TemplateLiteral?: RuleFunction<TSESTree.TemplateLiteral>;
288
- ThisExpression?: RuleFunction<TSESTree.ThisExpression>;
289
- ThrowStatement?: RuleFunction<TSESTree.ThrowStatement>;
290
- TryStatement?: RuleFunction<TSESTree.TryStatement>;
291
- TSAbstractKeyword?: RuleFunction<TSESTree.TSAbstractKeyword>;
292
- TSAbstractMethodDefinition?: RuleFunction<TSESTree.TSAbstractMethodDefinition>;
293
- TSAbstractPropertyDefinition?: RuleFunction<TSESTree.TSAbstractPropertyDefinition>;
294
- TSAnyKeyword?: RuleFunction<TSESTree.TSAnyKeyword>;
295
- TSArrayType?: RuleFunction<TSESTree.TSArrayType>;
296
- TSAsExpression?: RuleFunction<TSESTree.TSAsExpression>;
297
- TSAsyncKeyword?: RuleFunction<TSESTree.TSAsyncKeyword>;
298
- TSBigIntKeyword?: RuleFunction<TSESTree.TSBigIntKeyword>;
299
- TSBooleanKeyword?: RuleFunction<TSESTree.TSBooleanKeyword>;
300
- TSCallSignatureDeclaration?: RuleFunction<TSESTree.TSCallSignatureDeclaration>;
301
- TSClassImplements?: RuleFunction<TSESTree.TSClassImplements>;
302
- TSConditionalType?: RuleFunction<TSESTree.TSConditionalType>;
303
- TSConstructorType?: RuleFunction<TSESTree.TSConstructorType>;
304
- TSConstructSignatureDeclaration?: RuleFunction<TSESTree.TSConstructSignatureDeclaration>;
305
- TSDeclareFunction?: RuleFunction<TSESTree.TSDeclareFunction>;
306
- TSDeclareKeyword?: RuleFunction<TSESTree.TSDeclareKeyword>;
307
- TSEmptyBodyFunctionExpression?: RuleFunction<TSESTree.TSEmptyBodyFunctionExpression>;
308
- TSEnumDeclaration?: RuleFunction<TSESTree.TSEnumDeclaration>;
309
- TSEnumMember?: RuleFunction<TSESTree.TSEnumMember>;
310
- TSExportAssignment?: RuleFunction<TSESTree.TSExportAssignment>;
311
- TSExportKeyword?: RuleFunction<TSESTree.TSExportKeyword>;
312
- TSExternalModuleReference?: RuleFunction<TSESTree.TSExternalModuleReference>;
313
- TSFunctionType?: RuleFunction<TSESTree.TSFunctionType>;
314
- TSImportEqualsDeclaration?: RuleFunction<TSESTree.TSImportEqualsDeclaration>;
315
- TSImportType?: RuleFunction<TSESTree.TSImportType>;
316
- TSIndexedAccessType?: RuleFunction<TSESTree.TSIndexedAccessType>;
317
- TSIndexSignature?: RuleFunction<TSESTree.TSIndexSignature>;
318
- TSInferType?: RuleFunction<TSESTree.TSInferType>;
319
- TSInterfaceBody?: RuleFunction<TSESTree.TSInterfaceBody>;
320
- TSInterfaceDeclaration?: RuleFunction<TSESTree.TSInterfaceDeclaration>;
321
- TSInterfaceHeritage?: RuleFunction<TSESTree.TSInterfaceHeritage>;
322
- TSIntersectionType?: RuleFunction<TSESTree.TSIntersectionType>;
323
- TSLiteralType?: RuleFunction<TSESTree.TSLiteralType>;
324
- TSMappedType?: RuleFunction<TSESTree.TSMappedType>;
325
- TSMethodSignature?: RuleFunction<TSESTree.TSMethodSignature>;
326
- TSModuleBlock?: RuleFunction<TSESTree.TSModuleBlock>;
327
- TSModuleDeclaration?: RuleFunction<TSESTree.TSModuleDeclaration>;
328
- TSNamespaceExportDeclaration?: RuleFunction<TSESTree.TSNamespaceExportDeclaration>;
329
- TSNeverKeyword?: RuleFunction<TSESTree.TSNeverKeyword>;
330
- TSNonNullExpression?: RuleFunction<TSESTree.TSNonNullExpression>;
331
- TSNullKeyword?: RuleFunction<TSESTree.TSNullKeyword>;
332
- TSNumberKeyword?: RuleFunction<TSESTree.TSNumberKeyword>;
333
- TSObjectKeyword?: RuleFunction<TSESTree.TSObjectKeyword>;
334
- TSOptionalType?: RuleFunction<TSESTree.TSOptionalType>;
335
- TSParameterProperty?: RuleFunction<TSESTree.TSParameterProperty>;
336
- TSPrivateKeyword?: RuleFunction<TSESTree.TSPrivateKeyword>;
337
- TSPropertySignature?: RuleFunction<TSESTree.TSPropertySignature>;
338
- TSProtectedKeyword?: RuleFunction<TSESTree.TSProtectedKeyword>;
339
- TSPublicKeyword?: RuleFunction<TSESTree.TSPublicKeyword>;
340
- TSQualifiedName?: RuleFunction<TSESTree.TSQualifiedName>;
341
- TSReadonlyKeyword?: RuleFunction<TSESTree.TSReadonlyKeyword>;
342
- TSRestType?: RuleFunction<TSESTree.TSRestType>;
343
- TSStaticKeyword?: RuleFunction<TSESTree.TSStaticKeyword>;
344
- TSStringKeyword?: RuleFunction<TSESTree.TSStringKeyword>;
345
- TSSymbolKeyword?: RuleFunction<TSESTree.TSSymbolKeyword>;
346
- TSThisType?: RuleFunction<TSESTree.TSThisType>;
347
- TSTupleType?: RuleFunction<TSESTree.TSTupleType>;
348
- TSTypeAliasDeclaration?: RuleFunction<TSESTree.TSTypeAliasDeclaration>;
349
- TSTypeAnnotation?: RuleFunction<TSESTree.TSTypeAnnotation>;
350
- TSTypeAssertion?: RuleFunction<TSESTree.TSTypeAssertion>;
351
- TSTypeLiteral?: RuleFunction<TSESTree.TSTypeLiteral>;
352
- TSTypeOperator?: RuleFunction<TSESTree.TSTypeOperator>;
353
- TSTypeParameter?: RuleFunction<TSESTree.TSTypeParameter>;
354
- TSTypeParameterDeclaration?: RuleFunction<TSESTree.TSTypeParameterDeclaration>;
355
- TSTypeParameterInstantiation?: RuleFunction<TSESTree.TSTypeParameterInstantiation>;
356
- TSTypePredicate?: RuleFunction<TSESTree.TSTypePredicate>;
357
- TSTypeQuery?: RuleFunction<TSESTree.TSTypeQuery>;
358
- TSTypeReference?: RuleFunction<TSESTree.TSTypeReference>;
359
- TSUndefinedKeyword?: RuleFunction<TSESTree.TSUndefinedKeyword>;
360
- TSUnionType?: RuleFunction<TSESTree.TSUnionType>;
361
- TSUnknownKeyword?: RuleFunction<TSESTree.TSUnknownKeyword>;
362
- TSVoidKeyword?: RuleFunction<TSESTree.TSVoidKeyword>;
363
- UnaryExpression?: RuleFunction<TSESTree.UnaryExpression>;
364
- UpdateExpression?: RuleFunction<TSESTree.UpdateExpression>;
365
- VariableDeclaration?: RuleFunction<TSESTree.VariableDeclaration>;
366
- VariableDeclarator?: RuleFunction<TSESTree.VariableDeclarator>;
367
- WhileStatement?: RuleFunction<TSESTree.WhileStatement>;
368
- WithStatement?: RuleFunction<TSESTree.WithStatement>;
369
- YieldExpression?: RuleFunction<TSESTree.YieldExpression>;
370
- }
371
- type RuleListenerExitSelectors = {
372
- [K in keyof RuleListenerBaseSelectors as `${K}:exit`]: RuleListenerBaseSelectors[K];
373
- };
374
- interface RuleListenerCatchAllBaseCase {
375
- [nodeSelector: string]: RuleFunction | undefined;
376
- }
377
- interface RuleListenerExtension {
378
- }
379
- type RuleListener = RuleListenerBaseSelectors & RuleListenerCatchAllBaseCase & RuleListenerExitSelectors;
380
- interface RuleModule<TMessageIds extends string, TOptions extends readonly unknown[] = [
381
- ], TRuleListener extends RuleListener = RuleListener> {
382
- /**
383
- * Default options the rule will be run with
384
- */
385
- defaultOptions: TOptions;
386
- /**
387
- * Metadata about the rule
388
- */
389
- meta: RuleMetaData<TMessageIds>;
390
- /**
391
- * Function which returns an object with methods that ESLint calls to “visit”
392
- * nodes while traversing the abstract syntax tree.
393
- */
394
- create(context: Readonly<RuleContext<TMessageIds, TOptions>>): TRuleListener;
395
- }
396
- type AnyRuleModule = RuleModule<string, readonly unknown[]>;
397
- type RuleCreateFunction<TMessageIds extends string = never, TOptions extends readonly unknown[] = unknown[]> = (context: Readonly<RuleContext<TMessageIds, TOptions>>) => RuleListener;
398
- type AnyRuleCreateFunction = RuleCreateFunction<string, readonly unknown[]>;
399
- export { AnyRuleCreateFunction, AnyRuleModule, ReportDescriptor, ReportDescriptorMessageData, ReportFixFunction, ReportSuggestionArray, RuleContext, RuleCreateFunction, RuleFix, RuleFixer, RuleFunction, RuleListener, RuleListenerExtension, RuleMetaData, RuleMetaDataDocs, RuleModule, SharedConfigurationSettings, };
400
- //# sourceMappingURL=Rule.d.ts.map
@@ -1,161 +0,0 @@
1
- import type { AST_NODE_TYPES, AST_TOKEN_TYPES } from '../ts-estree';
2
- import type { Linter } from './Linter';
3
- import type { ParserOptions } from './ParserOptions';
4
- import type { ReportDescriptorMessageData, RuleCreateFunction, RuleModule, SharedConfigurationSettings } from './Rule';
5
- interface ValidTestCase<TOptions extends Readonly<unknown[]>> {
6
- /**
7
- * Name for the test case.
8
- * @since 8.1.0
9
- */
10
- readonly name?: string;
11
- /**
12
- * Code for the test case.
13
- */
14
- readonly code: string;
15
- /**
16
- * Environments for the test case.
17
- */
18
- readonly env?: Readonly<Record<string, boolean>>;
19
- /**
20
- * The fake filename for the test case. Useful for rules that make assertion about filenames.
21
- */
22
- readonly filename?: string;
23
- /**
24
- * The additional global variables.
25
- */
26
- readonly globals?: Record<string, 'off' | 'readonly' | 'writable' | true>;
27
- /**
28
- * Options for the test case.
29
- */
30
- readonly options?: Readonly<TOptions>;
31
- /**
32
- * The absolute path for the parser.
33
- */
34
- readonly parser?: string;
35
- /**
36
- * Options for the parser.
37
- */
38
- readonly parserOptions?: Readonly<ParserOptions>;
39
- /**
40
- * Settings for the test case.
41
- */
42
- readonly settings?: Readonly<SharedConfigurationSettings>;
43
- /**
44
- * Run this case exclusively for debugging in supported test frameworks.
45
- * @since 7.29.0
46
- */
47
- readonly only?: boolean;
48
- }
49
- interface SuggestionOutput<TMessageIds extends string> {
50
- /**
51
- * Reported message ID.
52
- */
53
- readonly messageId: TMessageIds;
54
- /**
55
- * The data used to fill the message template.
56
- */
57
- readonly data?: ReportDescriptorMessageData;
58
- /**
59
- * NOTE: Suggestions will be applied as a stand-alone change, without triggering multi-pass fixes.
60
- * Each individual error has its own suggestion, so you have to show the correct, _isolated_ output for each suggestion.
61
- */
62
- readonly output: string;
63
- }
64
- interface InvalidTestCase<TMessageIds extends string, TOptions extends Readonly<unknown[]>> extends ValidTestCase<TOptions> {
65
- /**
66
- * Expected errors.
67
- */
68
- readonly errors: readonly TestCaseError<TMessageIds>[];
69
- /**
70
- * The expected code after autofixes are applied. If set to `null`, the test runner will assert that no autofix is suggested.
71
- */
72
- readonly output?: string | null;
73
- }
74
- interface TestCaseError<TMessageIds extends string> {
75
- /**
76
- * The 1-based column number of the reported start location.
77
- */
78
- readonly column?: number;
79
- /**
80
- * The data used to fill the message template.
81
- */
82
- readonly data?: ReportDescriptorMessageData;
83
- /**
84
- * The 1-based column number of the reported end location.
85
- */
86
- readonly endColumn?: number;
87
- /**
88
- * The 1-based line number of the reported end location.
89
- */
90
- readonly endLine?: number;
91
- /**
92
- * The 1-based line number of the reported start location.
93
- */
94
- readonly line?: number;
95
- /**
96
- * Reported message ID.
97
- */
98
- readonly messageId: TMessageIds;
99
- /**
100
- * Reported suggestions.
101
- */
102
- readonly suggestions?: readonly SuggestionOutput<TMessageIds>[] | null;
103
- /**
104
- * The type of the reported AST node.
105
- */
106
- readonly type?: AST_NODE_TYPES | AST_TOKEN_TYPES;
107
- }
108
- /**
109
- * @param text a string describing the rule
110
- * @param callback the test callback
111
- */
112
- type RuleTesterTestFrameworkFunction = (text: string, callback: () => void) => void;
113
- interface RunTests<TMessageIds extends string, TOptions extends Readonly<unknown[]>> {
114
- readonly valid: readonly (ValidTestCase<TOptions> | string)[];
115
- readonly invalid: readonly InvalidTestCase<TMessageIds, TOptions>[];
116
- }
117
- interface RuleTesterConfig extends Linter.Config {
118
- readonly parser: string;
119
- readonly parserOptions?: Readonly<ParserOptions>;
120
- }
121
- declare class RuleTesterBase {
122
- /**
123
- * Creates a new instance of RuleTester.
124
- * @param testerConfig extra configuration for the tester
125
- */
126
- constructor(testerConfig?: RuleTesterConfig);
127
- /**
128
- * Adds a new rule test to execute.
129
- * @param ruleName The name of the rule to run.
130
- * @param rule The rule to test.
131
- * @param test The collection of tests to run.
132
- */
133
- run<TMessageIds extends string, TOptions extends Readonly<unknown[]>>(ruleName: string, rule: RuleModule<TMessageIds, TOptions>, tests: RunTests<TMessageIds, TOptions>): void;
134
- /**
135
- * If you supply a value to this property, the rule tester will call this instead of using the version defined on
136
- * the global namespace.
137
- */
138
- static get describe(): RuleTesterTestFrameworkFunction;
139
- static set describe(value: RuleTesterTestFrameworkFunction | undefined);
140
- /**
141
- * If you supply a value to this property, the rule tester will call this instead of using the version defined on
142
- * the global namespace.
143
- */
144
- static get it(): RuleTesterTestFrameworkFunction;
145
- static set it(value: RuleTesterTestFrameworkFunction | undefined);
146
- /**
147
- * If you supply a value to this property, the rule tester will call this instead of using the version defined on
148
- * the global namespace.
149
- */
150
- static get itOnly(): RuleTesterTestFrameworkFunction;
151
- static set itOnly(value: RuleTesterTestFrameworkFunction | undefined);
152
- /**
153
- * Define a rule for one particular run of tests.
154
- */
155
- defineRule<TMessageIds extends string, TOptions extends Readonly<unknown[]>>(name: string, rule: RuleCreateFunction<TMessageIds, TOptions> | RuleModule<TMessageIds, TOptions>): void;
156
- }
157
- declare const RuleTester_base: typeof RuleTesterBase;
158
- declare class RuleTester extends RuleTester_base {
159
- }
160
- export { InvalidTestCase, SuggestionOutput, RuleTester, RuleTesterConfig, RuleTesterTestFrameworkFunction, RunTests, TestCaseError, ValidTestCase, };
161
- //# sourceMappingURL=RuleTester.d.ts.map
@@ -1,44 +0,0 @@
1
- import * as scopeManager from '@typescript-eslint/scope-manager';
2
- declare namespace Scope {
3
- type ScopeManager = scopeManager.ScopeManager;
4
- type Reference = scopeManager.Reference;
5
- type Variable = scopeManager.ESLintScopeVariable | scopeManager.Variable;
6
- type Scope = scopeManager.Scope;
7
- const ScopeType: typeof scopeManager.ScopeType;
8
- type DefinitionType = scopeManager.Definition;
9
- type Definition = scopeManager.Definition;
10
- const DefinitionType: typeof scopeManager.DefinitionType;
11
- namespace Definitions {
12
- type CatchClauseDefinition = scopeManager.CatchClauseDefinition;
13
- type ClassNameDefinition = scopeManager.ClassNameDefinition;
14
- type FunctionNameDefinition = scopeManager.FunctionNameDefinition;
15
- type ImplicitGlobalVariableDefinition = scopeManager.ImplicitGlobalVariableDefinition;
16
- type ImportBindingDefinition = scopeManager.ImportBindingDefinition;
17
- type ParameterDefinition = scopeManager.ParameterDefinition;
18
- type TSEnumMemberDefinition = scopeManager.TSEnumMemberDefinition;
19
- type TSEnumNameDefinition = scopeManager.TSEnumNameDefinition;
20
- type TSModuleNameDefinition = scopeManager.TSModuleNameDefinition;
21
- type TypeDefinition = scopeManager.TypeDefinition;
22
- type VariableDefinition = scopeManager.VariableDefinition;
23
- }
24
- namespace Scopes {
25
- type BlockScope = scopeManager.BlockScope;
26
- type CatchScope = scopeManager.CatchScope;
27
- type ClassScope = scopeManager.ClassScope;
28
- type ConditionalTypeScope = scopeManager.ConditionalTypeScope;
29
- type ForScope = scopeManager.ForScope;
30
- type FunctionExpressionNameScope = scopeManager.FunctionExpressionNameScope;
31
- type FunctionScope = scopeManager.FunctionScope;
32
- type FunctionTypeScope = scopeManager.FunctionTypeScope;
33
- type GlobalScope = scopeManager.GlobalScope;
34
- type MappedTypeScope = scopeManager.MappedTypeScope;
35
- type ModuleScope = scopeManager.ModuleScope;
36
- type SwitchScope = scopeManager.SwitchScope;
37
- type TSEnumScope = scopeManager.TSEnumScope;
38
- type TSModuleScope = scopeManager.TSModuleScope;
39
- type TypeScope = scopeManager.TypeScope;
40
- type WithScope = scopeManager.WithScope;
41
- }
42
- }
43
- export { Scope };
44
- //# sourceMappingURL=Scope.d.ts.map