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