xo 0.52.2 → 0.52.3

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