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