@depup/typescript-eslint__utils 8.57.1-depup.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 (82) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +25 -0
  3. package/changes.json +5 -0
  4. package/dist/ast-utils/eslint-utils/PatternMatcher.d.ts +47 -0
  5. package/dist/ast-utils/eslint-utils/PatternMatcher.js +44 -0
  6. package/dist/ast-utils/eslint-utils/ReferenceTracker.d.ts +75 -0
  7. package/dist/ast-utils/eslint-utils/ReferenceTracker.js +48 -0
  8. package/dist/ast-utils/eslint-utils/astUtilities.d.ts +83 -0
  9. package/dist/ast-utils/eslint-utils/astUtilities.js +101 -0
  10. package/dist/ast-utils/eslint-utils/index.d.ts +5 -0
  11. package/dist/ast-utils/eslint-utils/index.js +21 -0
  12. package/dist/ast-utils/eslint-utils/predicates.d.ts +31 -0
  13. package/dist/ast-utils/eslint-utils/predicates.js +59 -0
  14. package/dist/ast-utils/eslint-utils/scopeAnalysis.d.ts +16 -0
  15. package/dist/ast-utils/eslint-utils/scopeAnalysis.js +51 -0
  16. package/dist/ast-utils/helpers.d.ts +18 -0
  17. package/dist/ast-utils/helpers.js +21 -0
  18. package/dist/ast-utils/index.d.ts +4 -0
  19. package/dist/ast-utils/index.js +20 -0
  20. package/dist/ast-utils/misc.d.ts +6 -0
  21. package/dist/ast-utils/misc.js +11 -0
  22. package/dist/ast-utils/predicates.d.ts +68 -0
  23. package/dist/ast-utils/predicates.js +108 -0
  24. package/dist/eslint-utils/InferTypesFromRule.d.ts +9 -0
  25. package/dist/eslint-utils/InferTypesFromRule.js +2 -0
  26. package/dist/eslint-utils/RuleCreator.d.ts +32 -0
  27. package/dist/eslint-utils/RuleCreator.js +54 -0
  28. package/dist/eslint-utils/applyDefault.d.ts +8 -0
  29. package/dist/eslint-utils/applyDefault.js +33 -0
  30. package/dist/eslint-utils/deepMerge.d.ts +14 -0
  31. package/dist/eslint-utils/deepMerge.js +46 -0
  32. package/dist/eslint-utils/getParserServices.d.ts +22 -0
  33. package/dist/eslint-utils/getParserServices.js +41 -0
  34. package/dist/eslint-utils/index.d.ts +6 -0
  35. package/dist/eslint-utils/index.js +22 -0
  36. package/dist/eslint-utils/nullThrows.d.ts +12 -0
  37. package/dist/eslint-utils/nullThrows.js +21 -0
  38. package/dist/eslint-utils/parserSeemsToBeTSESLint.d.ts +1 -0
  39. package/dist/eslint-utils/parserSeemsToBeTSESLint.js +6 -0
  40. package/dist/index.d.ts +6 -0
  41. package/dist/index.js +45 -0
  42. package/dist/json-schema.d.ts +387 -0
  43. package/dist/json-schema.js +8 -0
  44. package/dist/ts-eslint/AST.d.ts +8 -0
  45. package/dist/ts-eslint/AST.js +3 -0
  46. package/dist/ts-eslint/Config.d.ts +291 -0
  47. package/dist/ts-eslint/Config.js +3 -0
  48. package/dist/ts-eslint/ESLint.d.ts +7 -0
  49. package/dist/ts-eslint/ESLint.js +13 -0
  50. package/dist/ts-eslint/Linter.d.ts +255 -0
  51. package/dist/ts-eslint/Linter.js +13 -0
  52. package/dist/ts-eslint/Parser.d.ts +94 -0
  53. package/dist/ts-eslint/Parser.js +3 -0
  54. package/dist/ts-eslint/ParserOptions.d.ts +1 -0
  55. package/dist/ts-eslint/ParserOptions.js +2 -0
  56. package/dist/ts-eslint/Processor.d.ts +63 -0
  57. package/dist/ts-eslint/Processor.js +3 -0
  58. package/dist/ts-eslint/Rule.d.ts +614 -0
  59. package/dist/ts-eslint/Rule.js +2 -0
  60. package/dist/ts-eslint/RuleTester.d.ts +183 -0
  61. package/dist/ts-eslint/RuleTester.js +11 -0
  62. package/dist/ts-eslint/Scope.d.ts +42 -0
  63. package/dist/ts-eslint/Scope.js +43 -0
  64. package/dist/ts-eslint/SourceCode.d.ts +354 -0
  65. package/dist/ts-eslint/SourceCode.js +8 -0
  66. package/dist/ts-eslint/eslint/ESLintShared.d.ts +381 -0
  67. package/dist/ts-eslint/eslint/ESLintShared.js +2 -0
  68. package/dist/ts-eslint/eslint/FlatESLint.d.ts +87 -0
  69. package/dist/ts-eslint/eslint/FlatESLint.js +19 -0
  70. package/dist/ts-eslint/eslint/LegacyESLint.d.ts +72 -0
  71. package/dist/ts-eslint/eslint/LegacyESLint.js +36 -0
  72. package/dist/ts-eslint/index.d.ts +11 -0
  73. package/dist/ts-eslint/index.js +27 -0
  74. package/dist/ts-estree.d.ts +3 -0
  75. package/dist/ts-estree.js +9 -0
  76. package/dist/ts-utils/NoInfer.d.ts +9 -0
  77. package/dist/ts-utils/NoInfer.js +2 -0
  78. package/dist/ts-utils/index.d.ts +2 -0
  79. package/dist/ts-utils/index.js +18 -0
  80. package/dist/ts-utils/isArray.d.ts +1 -0
  81. package/dist/ts-utils/isArray.js +7 -0
  82. package/package.json +120 -0
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,63 @@
1
+ import type { Linter } from './Linter';
2
+ export declare namespace Processor {
3
+ interface ProcessorMeta {
4
+ /**
5
+ * The unique name of the processor.
6
+ */
7
+ name: string;
8
+ /**
9
+ * The a string identifying the version of the processor.
10
+ */
11
+ version?: string;
12
+ }
13
+ type PreProcess = (text: string, filename: string) => (string | {
14
+ filename: string;
15
+ text: string;
16
+ })[];
17
+ type PostProcess = (messagesList: Linter.LintMessage[][], filename: string) => Linter.LintMessage[];
18
+ interface ProcessorModule {
19
+ /**
20
+ * Information about the processor to uniquely identify it when serializing.
21
+ */
22
+ meta?: ProcessorMeta;
23
+ /**
24
+ * The function to merge messages.
25
+ */
26
+ postprocess?: PostProcess;
27
+ /**
28
+ * The function to extract code blocks.
29
+ */
30
+ preprocess?: PreProcess;
31
+ /**
32
+ * If `true` then it means the processor supports autofix.
33
+ */
34
+ supportsAutofix?: boolean;
35
+ }
36
+ /**
37
+ * A loose definition of the ParserModule type for use with configs
38
+ * This type intended to relax validation of configs so that parsers that have
39
+ * different AST types or scope managers can still be passed to configs
40
+ *
41
+ * @see {@link LooseRuleDefinition}, {@link LooseParserModule}
42
+ */
43
+ interface LooseProcessorModule {
44
+ /**
45
+ * Information about the processor to uniquely identify it when serializing.
46
+ */
47
+ meta?: {
48
+ [K in keyof ProcessorMeta]?: ProcessorMeta[K] | undefined;
49
+ };
50
+ /**
51
+ * The function to merge messages.
52
+ */
53
+ postprocess?: (messagesList: any, filename: string) => any;
54
+ /**
55
+ * The function to extract code blocks.
56
+ */
57
+ preprocess?: (text: string, filename: string) => any;
58
+ /**
59
+ * If `true` then it means the processor supports autofix.
60
+ */
61
+ supportsAutofix?: boolean | undefined;
62
+ }
63
+ }
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ /* eslint-disable @typescript-eslint/no-namespace */
3
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,614 @@
1
+ import type { JSONSchema4 } from '../json-schema';
2
+ import type { ParserServices, TSESTree } from '../ts-estree';
3
+ import type { AST } from './AST';
4
+ import type { FlatConfig } from './Config';
5
+ import type { Linter } from './Linter';
6
+ import type { Scope } from './Scope';
7
+ import type { SourceCode } from './SourceCode';
8
+ export type RuleRecommendation = 'recommended' | 'strict' | 'stylistic';
9
+ export interface RuleRecommendationAcrossConfigs<Options extends readonly unknown[]> {
10
+ recommended?: true;
11
+ strict: Partial<Options>;
12
+ }
13
+ export interface RuleMetaDataDocs {
14
+ /**
15
+ * Concise description of the rule.
16
+ */
17
+ description: string;
18
+ /**
19
+ * The URL of the rule's docs.
20
+ */
21
+ url?: string;
22
+ /**
23
+ * Mark this rule as feature-frozen.
24
+ */
25
+ frozen?: boolean;
26
+ }
27
+ export interface ExternalSpecifier {
28
+ /**
29
+ * Name of the referenced plugin / rule.
30
+ */
31
+ name?: string;
32
+ /**
33
+ * URL pointing to documentation for the plugin / rule.
34
+ */
35
+ url?: string;
36
+ }
37
+ export interface ReplacedByInfo {
38
+ /**
39
+ * General message presented to the user, e.g. how to replace the rule
40
+ */
41
+ message?: string;
42
+ /**
43
+ * URL to more information about this replacement in general
44
+ */
45
+ url?: string;
46
+ /**
47
+ * Name should be "eslint" if the replacement is an ESLint core rule. Omit
48
+ * the property if the replacement is in the same plugin.
49
+ */
50
+ plugin?: ExternalSpecifier;
51
+ /**
52
+ * Name and documentation of the replacement rule
53
+ */
54
+ rule?: ExternalSpecifier;
55
+ }
56
+ export interface DeprecatedInfo {
57
+ /**
58
+ * General message presented to the user, e.g. for the key rule why the rule
59
+ * is deprecated or for info how to replace the rule.
60
+ */
61
+ message?: string;
62
+ /**
63
+ * URL to more information about this deprecation in general.
64
+ */
65
+ url?: string;
66
+ /**
67
+ * An empty array explicitly states that there is no replacement.
68
+ */
69
+ replacedBy?: ReplacedByInfo[];
70
+ /**
71
+ * The package version since when the rule is deprecated (should use full
72
+ * semver without a leading "v").
73
+ */
74
+ deprecatedSince?: string;
75
+ /**
76
+ * The estimated version when the rule is removed (probably the next major
77
+ * version). null means the rule is "frozen" (will be available but will not
78
+ * be changed).
79
+ */
80
+ availableUntil?: string | null;
81
+ }
82
+ export interface RuleMetaData<MessageIds extends string, PluginDocs = unknown, Options extends readonly unknown[] = []> {
83
+ /**
84
+ * True if the rule is deprecated, false otherwise
85
+ */
86
+ deprecated?: boolean | DeprecatedInfo;
87
+ /**
88
+ * Documentation for the rule
89
+ */
90
+ docs?: PluginDocs & RuleMetaDataDocs;
91
+ /**
92
+ * The fixer category. Omit if there is no fixer
93
+ */
94
+ fixable?: 'code' | 'whitespace';
95
+ /**
96
+ * Specifies whether rules can return suggestions. Omit if there is no suggestions
97
+ */
98
+ hasSuggestions?: boolean;
99
+ /**
100
+ * A map of messages which the rule can report.
101
+ * The key is the messageId, and the string is the parameterised error string.
102
+ * See: https://eslint.org/docs/developer-guide/working-with-rules#messageids
103
+ */
104
+ messages: Record<MessageIds, string>;
105
+ /**
106
+ * The name of the rule this rule was replaced by, if it was deprecated.
107
+ *
108
+ * @deprecated since eslint 9.21.0, in favor of `RuleMetaData#deprecated.replacedBy`
109
+ */
110
+ replacedBy?: readonly string[];
111
+ /**
112
+ * The options schema. Supply an empty array if there are no options.
113
+ */
114
+ schema: JSONSchema4 | readonly JSONSchema4[];
115
+ /**
116
+ * The type of rule.
117
+ * - `"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.
118
+ * - `"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.
119
+ * - `"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.
120
+ */
121
+ type: 'layout' | 'problem' | 'suggestion';
122
+ /**
123
+ * Specifies default options for the rule. If present, any user-provided options in their config will be merged on top of them recursively.
124
+ * This merging will be applied directly to `context.options`.
125
+ * If you want backwards-compatible support for earlier ESLint version, consider using the top-level `defaultOptions` instead.
126
+ *
127
+ * since ESLint 9.15.0
128
+ */
129
+ defaultOptions?: Options;
130
+ }
131
+ export interface RuleMetaDataWithDocs<MessageIds extends string, PluginDocs = unknown, Options extends readonly unknown[] = []> extends RuleMetaData<MessageIds, PluginDocs, Options> {
132
+ /**
133
+ * Documentation for the rule
134
+ */
135
+ docs: PluginDocs & RuleMetaDataDocs;
136
+ }
137
+ export interface RuleFix {
138
+ range: Readonly<AST.Range>;
139
+ text: string;
140
+ }
141
+ export interface RuleFixer {
142
+ insertTextAfter(nodeOrToken: TSESTree.Node | TSESTree.Token, text: string): RuleFix;
143
+ insertTextAfterRange(range: Readonly<AST.Range>, text: string): RuleFix;
144
+ insertTextBefore(nodeOrToken: TSESTree.Node | TSESTree.Token, text: string): RuleFix;
145
+ insertTextBeforeRange(range: Readonly<AST.Range>, text: string): RuleFix;
146
+ remove(nodeOrToken: TSESTree.Node | TSESTree.Token): RuleFix;
147
+ removeRange(range: Readonly<AST.Range>): RuleFix;
148
+ replaceText(nodeOrToken: TSESTree.Node | TSESTree.Token, text: string): RuleFix;
149
+ replaceTextRange(range: Readonly<AST.Range>, text: string): RuleFix;
150
+ }
151
+ export interface SuggestionReportDescriptor<MessageIds extends string> extends Omit<ReportDescriptorBase<MessageIds>, 'fix'> {
152
+ readonly fix: ReportFixFunction;
153
+ }
154
+ export type ReportFixFunction = (fixer: RuleFixer) => IterableIterator<RuleFix> | readonly RuleFix[] | RuleFix | null;
155
+ export type ReportSuggestionArray<MessageIds extends string> = SuggestionReportDescriptor<MessageIds>[];
156
+ export type ReportDescriptorMessageData = Readonly<Record<string, unknown>>;
157
+ interface ReportDescriptorBase<MessageIds extends string> {
158
+ /**
159
+ * The parameters for the message string associated with `messageId`.
160
+ */
161
+ readonly data?: ReportDescriptorMessageData;
162
+ /**
163
+ * The fixer function.
164
+ */
165
+ readonly fix?: ReportFixFunction | null;
166
+ /**
167
+ * The messageId which is being reported.
168
+ */
169
+ readonly messageId: MessageIds;
170
+ }
171
+ interface ReportDescriptorWithSuggestion<MessageIds extends string> extends ReportDescriptorBase<MessageIds> {
172
+ /**
173
+ * 6.7's Suggestions API
174
+ */
175
+ readonly suggest?: Readonly<ReportSuggestionArray<MessageIds>> | null;
176
+ }
177
+ interface ReportDescriptorNodeOptionalLoc {
178
+ /**
179
+ * An override of the location of the report
180
+ */
181
+ readonly loc?: Readonly<TSESTree.Position> | Readonly<TSESTree.SourceLocation>;
182
+ /**
183
+ * The Node or AST Token which the report is being attached to
184
+ */
185
+ readonly node: TSESTree.Node | TSESTree.Token;
186
+ }
187
+ interface ReportDescriptorLocOnly {
188
+ /**
189
+ * An override of the location of the report
190
+ */
191
+ loc: Readonly<TSESTree.Position> | Readonly<TSESTree.SourceLocation>;
192
+ }
193
+ export type ReportDescriptor<MessageIds extends string> = (ReportDescriptorLocOnly | ReportDescriptorNodeOptionalLoc) & ReportDescriptorWithSuggestion<MessageIds>;
194
+ /**
195
+ * Plugins can add their settings using declaration
196
+ * merging against this interface.
197
+ */
198
+ export interface SharedConfigurationSettings {
199
+ [name: string]: unknown;
200
+ }
201
+ export interface RuleContext<MessageIds extends string, Options extends readonly unknown[]> {
202
+ /**
203
+ * The rule ID.
204
+ */
205
+ id: string;
206
+ /**
207
+ * The language options configured for this run
208
+ */
209
+ languageOptions: FlatConfig.LanguageOptions & {
210
+ parserOptions: FlatConfig.ParserOptions;
211
+ };
212
+ /**
213
+ * An array of the configured options for this rule.
214
+ * This array does not include the rule severity.
215
+ */
216
+ options: Options;
217
+ /**
218
+ * The parser options configured for this run
219
+ * @deprecated This was deprecated in ESLint 9 and removed in ESLint 10.
220
+ */
221
+ parserOptions: Linter.ParserOptions;
222
+ /**
223
+ * The name of the parser from configuration, if in eslintrc (legacy) config.
224
+ * @deprecated This was deprecated in ESLint 9 and removed in ESLint 10.
225
+ */
226
+ parserPath: string | undefined;
227
+ /**
228
+ * An object containing parser-provided services for rules
229
+ *
230
+ * @deprecated in favor of `SourceCode#parserServices`
231
+ */
232
+ parserServices?: ParserServices;
233
+ /**
234
+ * The shared settings from configuration.
235
+ * We do not have any shared settings in this plugin.
236
+ */
237
+ settings: SharedConfigurationSettings;
238
+ /**
239
+ * Returns an array of the ancestors of the currently-traversed node, starting at
240
+ * the root of the AST and continuing through the direct parent of the current node.
241
+ * This array does not include the currently-traversed node itself.
242
+ *
243
+ * @deprecated in favor of `SourceCode#getAncestors`
244
+ */
245
+ getAncestors(): TSESTree.Node[];
246
+ /**
247
+ * Returns a list of variables declared by the given node.
248
+ * This information can be used to track references to variables.
249
+ *
250
+ * @deprecated in favor of `SourceCode#getDeclaredVariables`
251
+ */
252
+ getDeclaredVariables(node: TSESTree.Node): readonly Scope.Variable[];
253
+ /**
254
+ * Returns the current working directory passed to Linter.
255
+ * It is a path to a directory that should be considered as the current working directory.
256
+ * @deprecated in favor of `RuleContext#cwd`
257
+ */
258
+ getCwd(): string;
259
+ /**
260
+ * The current working directory passed to Linter.
261
+ * It is a path to a directory that should be considered as the current working directory.
262
+ */
263
+ cwd: string;
264
+ /**
265
+ * Returns the filename associated with the source.
266
+ *
267
+ * @deprecated in favor of `RuleContext#filename`
268
+ */
269
+ getFilename(): string;
270
+ /**
271
+ * The filename associated with the source.
272
+ */
273
+ filename: string;
274
+ /**
275
+ * Returns the full path of the file on disk without any code block information (unlike `getFilename()`).
276
+ * @deprecated in favor of `RuleContext#physicalFilename`
277
+ */
278
+ getPhysicalFilename(): string;
279
+ /**
280
+ * The full path of the file on disk without any code block information (unlike `filename`).
281
+ */
282
+ physicalFilename: string;
283
+ /**
284
+ * Returns the scope of the currently-traversed node.
285
+ * This information can be used track references to variables.
286
+ *
287
+ * @deprecated in favor of `SourceCode#getScope`
288
+ */
289
+ getScope(): Scope.Scope;
290
+ /**
291
+ * Returns a SourceCode object that you can use to work with the source that
292
+ * was passed to ESLint.
293
+ *
294
+ * @deprecated in favor of `RuleContext#sourceCode`
295
+ */
296
+ getSourceCode(): Readonly<SourceCode>;
297
+ /**
298
+ * A SourceCode object that you can use to work with the source that
299
+ * was passed to ESLint.
300
+ */
301
+ sourceCode: Readonly<SourceCode>;
302
+ /**
303
+ * Marks a variable with the given name in the current scope as used.
304
+ * This affects the no-unused-vars rule.
305
+ *
306
+ * @deprecated in favor of `SourceCode#markVariableAsUsed`
307
+ */
308
+ markVariableAsUsed(name: string): boolean;
309
+ /**
310
+ * Reports a problem in the code.
311
+ */
312
+ report(descriptor: ReportDescriptor<MessageIds>): void;
313
+ }
314
+ /**
315
+ * Part of the code path analysis feature of ESLint:
316
+ * https://eslint.org/docs/latest/extend/code-path-analysis
317
+ *
318
+ * These are used in the `onCodePath*` methods. (Note that the `node` parameter
319
+ * of these methods is intentionally omitted.)
320
+ *
321
+ * @see https://github.com/typescript-eslint/typescript-eslint/issues/6993
322
+ */
323
+ export interface CodePath {
324
+ /** Code paths of functions this code path contains. */
325
+ childCodePaths: CodePath[];
326
+ /**
327
+ * Segments of the current traversal position.
328
+ *
329
+ * @deprecated
330
+ */
331
+ currentSegments: CodePathSegment[];
332
+ /** The final segments which includes both returned and thrown. */
333
+ finalSegments: CodePathSegment[];
334
+ /**
335
+ * A unique string. Respective rules can use `id` to save additional
336
+ * information for each code path.
337
+ */
338
+ id: string;
339
+ initialSegment: CodePathSegment;
340
+ /** The final segments which includes only returned. */
341
+ returnedSegments: CodePathSegment[];
342
+ /** The final segments which includes only thrown. */
343
+ thrownSegments: CodePathSegment[];
344
+ /** The code path of the upper function/global scope. */
345
+ upper: CodePath | null;
346
+ }
347
+ /**
348
+ * Part of the code path analysis feature of ESLint:
349
+ * https://eslint.org/docs/latest/extend/code-path-analysis
350
+ *
351
+ * These are used in the `onCodePath*` methods. (Note that the `node` parameter
352
+ * of these methods is intentionally omitted.)
353
+ *
354
+ * @see https://github.com/typescript-eslint/typescript-eslint/issues/6993
355
+ */
356
+ export interface CodePathSegment {
357
+ /**
358
+ * A unique string. Respective rules can use `id` to save additional
359
+ * information for each segment.
360
+ */
361
+ id: string;
362
+ /**
363
+ * The next segments. If forking, there are two or more. If final, there is
364
+ * nothing.
365
+ */
366
+ nextSegments: CodePathSegment[];
367
+ /**
368
+ * The previous segments. If merging, there are two or more. If initial, there
369
+ * is nothing.
370
+ */
371
+ prevSegments: CodePathSegment[];
372
+ /**
373
+ * A flag which shows whether it is reachable. This becomes `false` when
374
+ * preceded by `return`, `throw`, `break`, or `continue`.
375
+ */
376
+ reachable: boolean;
377
+ }
378
+ /**
379
+ * Part of the code path analysis feature of ESLint:
380
+ * https://eslint.org/docs/latest/extend/code-path-analysis
381
+ *
382
+ * This type is unused in the `typescript-eslint` codebase since putting it on
383
+ * the `nodeSelector` for `RuleListener` would break the existing definition.
384
+ * However, it is exported here for the purposes of manual type-assertion.
385
+ *
386
+ * @see https://github.com/typescript-eslint/typescript-eslint/issues/6993
387
+ */
388
+ export type CodePathFunction = ((codePath: CodePath, node: TSESTree.Node) => void) | ((fromSegment: CodePathSegment, toSegment: CodePathSegment, node: TSESTree.Node) => void) | ((segment: CodePathSegment, node: TSESTree.Node) => void);
389
+ export type RuleFunction<T extends TSESTree.NodeOrTokenData = never> = (node: T) => void;
390
+ interface RuleListenerBaseSelectors {
391
+ AccessorProperty?: RuleFunction<TSESTree.AccessorProperty>;
392
+ ArrayExpression?: RuleFunction<TSESTree.ArrayExpression>;
393
+ ArrayPattern?: RuleFunction<TSESTree.ArrayPattern>;
394
+ ArrowFunctionExpression?: RuleFunction<TSESTree.ArrowFunctionExpression>;
395
+ AssignmentExpression?: RuleFunction<TSESTree.AssignmentExpression>;
396
+ AssignmentPattern?: RuleFunction<TSESTree.AssignmentPattern>;
397
+ AwaitExpression?: RuleFunction<TSESTree.AwaitExpression>;
398
+ BinaryExpression?: RuleFunction<TSESTree.BinaryExpression>;
399
+ BlockStatement?: RuleFunction<TSESTree.BlockStatement>;
400
+ BreakStatement?: RuleFunction<TSESTree.BreakStatement>;
401
+ CallExpression?: RuleFunction<TSESTree.CallExpression>;
402
+ CatchClause?: RuleFunction<TSESTree.CatchClause>;
403
+ ChainExpression?: RuleFunction<TSESTree.ChainExpression>;
404
+ ClassBody?: RuleFunction<TSESTree.ClassBody>;
405
+ ClassDeclaration?: RuleFunction<TSESTree.ClassDeclaration>;
406
+ ClassExpression?: RuleFunction<TSESTree.ClassExpression>;
407
+ ConditionalExpression?: RuleFunction<TSESTree.ConditionalExpression>;
408
+ ContinueStatement?: RuleFunction<TSESTree.ContinueStatement>;
409
+ DebuggerStatement?: RuleFunction<TSESTree.DebuggerStatement>;
410
+ Decorator?: RuleFunction<TSESTree.Decorator>;
411
+ DoWhileStatement?: RuleFunction<TSESTree.DoWhileStatement>;
412
+ EmptyStatement?: RuleFunction<TSESTree.EmptyStatement>;
413
+ ExportAllDeclaration?: RuleFunction<TSESTree.ExportAllDeclaration>;
414
+ ExportDefaultDeclaration?: RuleFunction<TSESTree.ExportDefaultDeclaration>;
415
+ ExportNamedDeclaration?: RuleFunction<TSESTree.ExportNamedDeclaration>;
416
+ ExportSpecifier?: RuleFunction<TSESTree.ExportSpecifier>;
417
+ ExpressionStatement?: RuleFunction<TSESTree.ExpressionStatement>;
418
+ ForInStatement?: RuleFunction<TSESTree.ForInStatement>;
419
+ ForOfStatement?: RuleFunction<TSESTree.ForOfStatement>;
420
+ ForStatement?: RuleFunction<TSESTree.ForStatement>;
421
+ FunctionDeclaration?: RuleFunction<TSESTree.FunctionDeclaration>;
422
+ FunctionExpression?: RuleFunction<TSESTree.FunctionExpression>;
423
+ Identifier?: RuleFunction<TSESTree.Identifier>;
424
+ IfStatement?: RuleFunction<TSESTree.IfStatement>;
425
+ ImportAttribute?: RuleFunction<TSESTree.ImportAttribute>;
426
+ ImportDeclaration?: RuleFunction<TSESTree.ImportDeclaration>;
427
+ ImportDefaultSpecifier?: RuleFunction<TSESTree.ImportDefaultSpecifier>;
428
+ ImportExpression?: RuleFunction<TSESTree.ImportExpression>;
429
+ ImportNamespaceSpecifier?: RuleFunction<TSESTree.ImportNamespaceSpecifier>;
430
+ ImportSpecifier?: RuleFunction<TSESTree.ImportSpecifier>;
431
+ JSXAttribute?: RuleFunction<TSESTree.JSXAttribute>;
432
+ JSXClosingElement?: RuleFunction<TSESTree.JSXClosingElement>;
433
+ JSXClosingFragment?: RuleFunction<TSESTree.JSXClosingFragment>;
434
+ JSXElement?: RuleFunction<TSESTree.JSXElement>;
435
+ JSXEmptyExpression?: RuleFunction<TSESTree.JSXEmptyExpression>;
436
+ JSXExpressionContainer?: RuleFunction<TSESTree.JSXExpressionContainer>;
437
+ JSXFragment?: RuleFunction<TSESTree.JSXFragment>;
438
+ JSXIdentifier?: RuleFunction<TSESTree.JSXIdentifier>;
439
+ JSXMemberExpression?: RuleFunction<TSESTree.JSXMemberExpression>;
440
+ JSXNamespacedName?: RuleFunction<TSESTree.JSXNamespacedName>;
441
+ JSXOpeningElement?: RuleFunction<TSESTree.JSXOpeningElement>;
442
+ JSXOpeningFragment?: RuleFunction<TSESTree.JSXOpeningFragment>;
443
+ JSXSpreadAttribute?: RuleFunction<TSESTree.JSXSpreadAttribute>;
444
+ JSXSpreadChild?: RuleFunction<TSESTree.JSXSpreadChild>;
445
+ JSXText?: RuleFunction<TSESTree.JSXText>;
446
+ LabeledStatement?: RuleFunction<TSESTree.LabeledStatement>;
447
+ Literal?: RuleFunction<TSESTree.Literal>;
448
+ LogicalExpression?: RuleFunction<TSESTree.LogicalExpression>;
449
+ MemberExpression?: RuleFunction<TSESTree.MemberExpression>;
450
+ MetaProperty?: RuleFunction<TSESTree.MetaProperty>;
451
+ MethodDefinition?: RuleFunction<TSESTree.MethodDefinition>;
452
+ NewExpression?: RuleFunction<TSESTree.NewExpression>;
453
+ ObjectExpression?: RuleFunction<TSESTree.ObjectExpression>;
454
+ ObjectPattern?: RuleFunction<TSESTree.ObjectPattern>;
455
+ PrivateIdentifier?: RuleFunction<TSESTree.PrivateIdentifier>;
456
+ Program?: RuleFunction<TSESTree.Program>;
457
+ Property?: RuleFunction<TSESTree.Property>;
458
+ PropertyDefinition?: RuleFunction<TSESTree.PropertyDefinition>;
459
+ RestElement?: RuleFunction<TSESTree.RestElement>;
460
+ ReturnStatement?: RuleFunction<TSESTree.ReturnStatement>;
461
+ SequenceExpression?: RuleFunction<TSESTree.SequenceExpression>;
462
+ SpreadElement?: RuleFunction<TSESTree.SpreadElement>;
463
+ StaticBlock?: RuleFunction<TSESTree.StaticBlock>;
464
+ Super?: RuleFunction<TSESTree.Super>;
465
+ SwitchCase?: RuleFunction<TSESTree.SwitchCase>;
466
+ SwitchStatement?: RuleFunction<TSESTree.SwitchStatement>;
467
+ TaggedTemplateExpression?: RuleFunction<TSESTree.TaggedTemplateExpression>;
468
+ TemplateElement?: RuleFunction<TSESTree.TemplateElement>;
469
+ TemplateLiteral?: RuleFunction<TSESTree.TemplateLiteral>;
470
+ ThisExpression?: RuleFunction<TSESTree.ThisExpression>;
471
+ ThrowStatement?: RuleFunction<TSESTree.ThrowStatement>;
472
+ TryStatement?: RuleFunction<TSESTree.TryStatement>;
473
+ TSAbstractAccessorProperty?: RuleFunction<TSESTree.TSAbstractAccessorProperty>;
474
+ TSAbstractKeyword?: RuleFunction<TSESTree.TSAbstractKeyword>;
475
+ TSAbstractMethodDefinition?: RuleFunction<TSESTree.TSAbstractMethodDefinition>;
476
+ TSAbstractPropertyDefinition?: RuleFunction<TSESTree.TSAbstractPropertyDefinition>;
477
+ TSAnyKeyword?: RuleFunction<TSESTree.TSAnyKeyword>;
478
+ TSArrayType?: RuleFunction<TSESTree.TSArrayType>;
479
+ TSAsExpression?: RuleFunction<TSESTree.TSAsExpression>;
480
+ TSAsyncKeyword?: RuleFunction<TSESTree.TSAsyncKeyword>;
481
+ TSBigIntKeyword?: RuleFunction<TSESTree.TSBigIntKeyword>;
482
+ TSBooleanKeyword?: RuleFunction<TSESTree.TSBooleanKeyword>;
483
+ TSCallSignatureDeclaration?: RuleFunction<TSESTree.TSCallSignatureDeclaration>;
484
+ TSClassImplements?: RuleFunction<TSESTree.TSClassImplements>;
485
+ TSConditionalType?: RuleFunction<TSESTree.TSConditionalType>;
486
+ TSConstructorType?: RuleFunction<TSESTree.TSConstructorType>;
487
+ TSConstructSignatureDeclaration?: RuleFunction<TSESTree.TSConstructSignatureDeclaration>;
488
+ TSDeclareFunction?: RuleFunction<TSESTree.TSDeclareFunction>;
489
+ TSDeclareKeyword?: RuleFunction<TSESTree.TSDeclareKeyword>;
490
+ TSEmptyBodyFunctionExpression?: RuleFunction<TSESTree.TSEmptyBodyFunctionExpression>;
491
+ TSEnumBody?: RuleFunction<TSESTree.TSEnumBody>;
492
+ TSEnumDeclaration?: RuleFunction<TSESTree.TSEnumDeclaration>;
493
+ TSEnumMember?: RuleFunction<TSESTree.TSEnumMember>;
494
+ TSExportAssignment?: RuleFunction<TSESTree.TSExportAssignment>;
495
+ TSExportKeyword?: RuleFunction<TSESTree.TSExportKeyword>;
496
+ TSExternalModuleReference?: RuleFunction<TSESTree.TSExternalModuleReference>;
497
+ TSFunctionType?: RuleFunction<TSESTree.TSFunctionType>;
498
+ TSImportEqualsDeclaration?: RuleFunction<TSESTree.TSImportEqualsDeclaration>;
499
+ TSImportType?: RuleFunction<TSESTree.TSImportType>;
500
+ TSIndexedAccessType?: RuleFunction<TSESTree.TSIndexedAccessType>;
501
+ TSIndexSignature?: RuleFunction<TSESTree.TSIndexSignature>;
502
+ TSInferType?: RuleFunction<TSESTree.TSInferType>;
503
+ TSInstantiationExpression?: RuleFunction<TSESTree.TSInstantiationExpression>;
504
+ TSInterfaceBody?: RuleFunction<TSESTree.TSInterfaceBody>;
505
+ TSInterfaceDeclaration?: RuleFunction<TSESTree.TSInterfaceDeclaration>;
506
+ TSInterfaceHeritage?: RuleFunction<TSESTree.TSInterfaceHeritage>;
507
+ TSIntersectionType?: RuleFunction<TSESTree.TSIntersectionType>;
508
+ TSIntrinsicKeyword?: RuleFunction<TSESTree.TSIntrinsicKeyword>;
509
+ TSLiteralType?: RuleFunction<TSESTree.TSLiteralType>;
510
+ TSMappedType?: RuleFunction<TSESTree.TSMappedType>;
511
+ TSMethodSignature?: RuleFunction<TSESTree.TSMethodSignature>;
512
+ TSModuleBlock?: RuleFunction<TSESTree.TSModuleBlock>;
513
+ TSModuleDeclaration?: RuleFunction<TSESTree.TSModuleDeclaration>;
514
+ TSNamedTupleMember?: RuleFunction<TSESTree.TSNamedTupleMember>;
515
+ TSNamespaceExportDeclaration?: RuleFunction<TSESTree.TSNamespaceExportDeclaration>;
516
+ TSNeverKeyword?: RuleFunction<TSESTree.TSNeverKeyword>;
517
+ TSNonNullExpression?: RuleFunction<TSESTree.TSNonNullExpression>;
518
+ TSNullKeyword?: RuleFunction<TSESTree.TSNullKeyword>;
519
+ TSNumberKeyword?: RuleFunction<TSESTree.TSNumberKeyword>;
520
+ TSObjectKeyword?: RuleFunction<TSESTree.TSObjectKeyword>;
521
+ TSOptionalType?: RuleFunction<TSESTree.TSOptionalType>;
522
+ TSParameterProperty?: RuleFunction<TSESTree.TSParameterProperty>;
523
+ TSPrivateKeyword?: RuleFunction<TSESTree.TSPrivateKeyword>;
524
+ TSPropertySignature?: RuleFunction<TSESTree.TSPropertySignature>;
525
+ TSProtectedKeyword?: RuleFunction<TSESTree.TSProtectedKeyword>;
526
+ TSPublicKeyword?: RuleFunction<TSESTree.TSPublicKeyword>;
527
+ TSQualifiedName?: RuleFunction<TSESTree.TSQualifiedName>;
528
+ TSReadonlyKeyword?: RuleFunction<TSESTree.TSReadonlyKeyword>;
529
+ TSRestType?: RuleFunction<TSESTree.TSRestType>;
530
+ TSSatisfiesExpression?: RuleFunction<TSESTree.TSSatisfiesExpression>;
531
+ TSStaticKeyword?: RuleFunction<TSESTree.TSStaticKeyword>;
532
+ TSStringKeyword?: RuleFunction<TSESTree.TSStringKeyword>;
533
+ TSSymbolKeyword?: RuleFunction<TSESTree.TSSymbolKeyword>;
534
+ TSTemplateLiteralType?: RuleFunction<TSESTree.TSTemplateLiteralType>;
535
+ TSThisType?: RuleFunction<TSESTree.TSThisType>;
536
+ TSTupleType?: RuleFunction<TSESTree.TSTupleType>;
537
+ TSTypeAliasDeclaration?: RuleFunction<TSESTree.TSTypeAliasDeclaration>;
538
+ TSTypeAnnotation?: RuleFunction<TSESTree.TSTypeAnnotation>;
539
+ TSTypeAssertion?: RuleFunction<TSESTree.TSTypeAssertion>;
540
+ TSTypeLiteral?: RuleFunction<TSESTree.TSTypeLiteral>;
541
+ TSTypeOperator?: RuleFunction<TSESTree.TSTypeOperator>;
542
+ TSTypeParameter?: RuleFunction<TSESTree.TSTypeParameter>;
543
+ TSTypeParameterDeclaration?: RuleFunction<TSESTree.TSTypeParameterDeclaration>;
544
+ TSTypeParameterInstantiation?: RuleFunction<TSESTree.TSTypeParameterInstantiation>;
545
+ TSTypePredicate?: RuleFunction<TSESTree.TSTypePredicate>;
546
+ TSTypeQuery?: RuleFunction<TSESTree.TSTypeQuery>;
547
+ TSTypeReference?: RuleFunction<TSESTree.TSTypeReference>;
548
+ TSUndefinedKeyword?: RuleFunction<TSESTree.TSUndefinedKeyword>;
549
+ TSUnionType?: RuleFunction<TSESTree.TSUnionType>;
550
+ TSUnknownKeyword?: RuleFunction<TSESTree.TSUnknownKeyword>;
551
+ TSVoidKeyword?: RuleFunction<TSESTree.TSVoidKeyword>;
552
+ UnaryExpression?: RuleFunction<TSESTree.UnaryExpression>;
553
+ UpdateExpression?: RuleFunction<TSESTree.UpdateExpression>;
554
+ VariableDeclaration?: RuleFunction<TSESTree.VariableDeclaration>;
555
+ VariableDeclarator?: RuleFunction<TSESTree.VariableDeclarator>;
556
+ WhileStatement?: RuleFunction<TSESTree.WhileStatement>;
557
+ WithStatement?: RuleFunction<TSESTree.WithStatement>;
558
+ YieldExpression?: RuleFunction<TSESTree.YieldExpression>;
559
+ }
560
+ type RuleListenerExitSelectors = {
561
+ [K in keyof RuleListenerBaseSelectors as `${K}:exit`]: RuleListenerBaseSelectors[K];
562
+ };
563
+ type RuleListenerCatchAllBaseCase = Record<string, RuleFunction | undefined>;
564
+ export interface RuleListenerExtension {
565
+ }
566
+ export type RuleListener = RuleListenerBaseSelectors & RuleListenerCatchAllBaseCase & RuleListenerExitSelectors;
567
+ export interface RuleModule<MessageIds extends string, Options extends readonly unknown[] = [], Docs = unknown, ExtendedRuleListener extends RuleListener = RuleListener> {
568
+ /**
569
+ * Function which returns an object with methods that ESLint calls to “visit”
570
+ * nodes while traversing the abstract syntax tree.
571
+ */
572
+ create(context: Readonly<RuleContext<MessageIds, Options>>): ExtendedRuleListener;
573
+ /**
574
+ * @deprecated Use meta.defaultOptions instead
575
+ * Default options the rule will be run with
576
+ */
577
+ defaultOptions?: Options;
578
+ /**
579
+ * Metadata about the rule
580
+ */
581
+ meta: RuleMetaData<MessageIds, Docs, Options>;
582
+ /**
583
+ * Rule name
584
+ */
585
+ name?: string;
586
+ }
587
+ export type AnyRuleModule = RuleModule<string, readonly unknown[]>;
588
+ export interface RuleModuleWithMetaDocs<MessageIds extends string, Options extends readonly unknown[] = [], Docs = unknown, ExtendedRuleListener extends RuleListener = RuleListener> extends RuleModule<MessageIds, Options, Docs, ExtendedRuleListener> {
589
+ /**
590
+ * Metadata about the rule
591
+ */
592
+ meta: RuleMetaDataWithDocs<MessageIds, Docs, Options>;
593
+ }
594
+ export type AnyRuleModuleWithMetaDocs = RuleModuleWithMetaDocs<string, unknown[]>;
595
+ /**
596
+ * A loose definition of the RuleModule type for use with configs. This type is
597
+ * intended to relax validation of types so that we can have basic validation
598
+ * without being overly strict about nitty gritty details matching.
599
+ *
600
+ * For example the plugin might be declared using an old version of our types or
601
+ * they might use the DefinitelyTyped eslint types. Ultimately we don't need
602
+ * super strict validation in a config - a loose shape match is "good enough" to
603
+ * help validate the config is correct.
604
+ *
605
+ * @see {@link LooseParserModule}, {@link LooseProcessorModule}
606
+ */
607
+ export type LooseRuleDefinition = LooseRuleCreateFunction | {
608
+ create: LooseRuleCreateFunction;
609
+ meta?: object | undefined;
610
+ };
611
+ export type LooseRuleCreateFunction = (context: any) => Record<string, Function | undefined>;
612
+ export type RuleCreateFunction<MessageIds extends string = never, Options extends readonly unknown[] = unknown[]> = (context: Readonly<RuleContext<MessageIds, Options>>) => RuleListener;
613
+ export type AnyRuleCreateFunction = RuleCreateFunction<string, readonly unknown[]>;
614
+ export {};