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,376 @@
1
+ import { Linter } from './Linter';
2
+ declare class ESLintBase {
3
+ /**
4
+ * Creates a new instance of the main ESLint API.
5
+ * @param options The options for this instance.
6
+ */
7
+ constructor(options?: ESLint.ESLintOptions);
8
+ /**
9
+ * This method calculates the configuration for a given file, which can be useful for debugging purposes.
10
+ * - It resolves and merges extends and overrides settings into the top level configuration.
11
+ * - It resolves the parser setting to absolute paths.
12
+ * - It normalizes the plugins setting to align short names. (e.g., eslint-plugin-foo → foo)
13
+ * - It adds the processor setting if a legacy file extension processor is matched.
14
+ * - It doesn't interpret the env setting to the globals and parserOptions settings, so the result object contains
15
+ * the env setting as is.
16
+ * @param filePath The path to the file whose configuration you would like to calculate. Directory paths are forbidden
17
+ * because ESLint cannot handle the overrides setting.
18
+ * @returns The promise that will be fulfilled with a configuration object.
19
+ */
20
+ calculateConfigForFile(filePath: string): Promise<Linter.Config>;
21
+ /**
22
+ * This method checks if a given file is ignored by your configuration.
23
+ * @param filePath The path to the file you want to check.
24
+ * @returns The promise that will be fulfilled with whether the file is ignored or not. If the file is ignored, then
25
+ * it will return true.
26
+ */
27
+ isPathIgnored(filePath: string): Promise<boolean>;
28
+ /**
29
+ * This method lints the files that match the glob patterns and then returns the results.
30
+ * @param patterns The lint target files. This can contain any of file paths, directory paths, and glob patterns.
31
+ * @returns The promise that will be fulfilled with an array of LintResult objects.
32
+ */
33
+ lintFiles(patterns: string | string[]): Promise<ESLint.LintResult[]>;
34
+ /**
35
+ * This method lints the given source code text and then returns the results.
36
+ *
37
+ * By default, this method uses the configuration that applies to files in the current working directory (the cwd
38
+ * constructor option). If you want to use a different configuration, pass options.filePath, and ESLint will load the
39
+ * same configuration that eslint.lintFiles() would use for a file at options.filePath.
40
+ *
41
+ * If the options.filePath value is configured to be ignored, this method returns an empty array. If the
42
+ * options.warnIgnored option is set along with the options.filePath option, this method returns a LintResult object.
43
+ * In that case, the result may contain a warning that indicates the file was ignored.
44
+ * @param code The source code text to check.
45
+ * @param options The options.
46
+ * @returns The promise that will be fulfilled with an array of LintResult objects. This is an array (despite there
47
+ * being only one lint result) in order to keep the interfaces between this and the eslint.lintFiles()
48
+ * method similar.
49
+ */
50
+ lintText(code: string, options?: ESLint.LintTextOptions): Promise<ESLint.LintResult[]>;
51
+ /**
52
+ * This method loads a formatter. Formatters convert lint results to a human- or machine-readable string.
53
+ * @param name TThe path to the file you want to check.
54
+ * The following values are allowed:
55
+ * - undefined. In this case, loads the "stylish" built-in formatter.
56
+ * - A name of built-in formatters.
57
+ * - A name of third-party formatters. For examples:
58
+ * -- `foo` will load eslint-formatter-foo.
59
+ * -- `@foo` will load `@foo/eslint-formatter`.
60
+ * -- `@foo/bar` will load `@foo/eslint-formatter-bar`.
61
+ * - A path to the file that defines a formatter. The path must contain one or more path separators (/) in order to distinguish if it's a path or not. For example, start with ./.
62
+ * @returns The promise that will be fulfilled with a Formatter object.
63
+ */
64
+ loadFormatter(name?: string): Promise<ESLint.Formatter>;
65
+ /**
66
+ * This method copies the given results and removes warnings. The returned value contains only errors.
67
+ * @param results The LintResult objects to filter.
68
+ * @returns The filtered LintResult objects.
69
+ */
70
+ static getErrorResults(results: ESLint.LintResult): ESLint.LintResult;
71
+ /**
72
+ * This method writes code modified by ESLint's autofix feature into its respective file. If any of the modified
73
+ * files don't exist, this method does nothing.
74
+ * @param results The LintResult objects to write.
75
+ * @returns The promise that will be fulfilled after all files are written.
76
+ */
77
+ static outputFixes(results: ESLint.LintResult): Promise<void>;
78
+ /**
79
+ * The version text.
80
+ */
81
+ static readonly version: string;
82
+ }
83
+ declare namespace ESLint {
84
+ interface ESLintOptions {
85
+ /**
86
+ * If false is present, ESLint suppresses directive comments in source code.
87
+ * If this option is false, it overrides the noInlineConfig setting in your configurations.
88
+ */
89
+ allowInlineConfig?: boolean;
90
+ /**
91
+ * Configuration object, extended by all configurations used with this instance.
92
+ * You can use this option to define the default settings that will be used if your configuration files don't
93
+ * configure it.
94
+ */
95
+ baseConfig?: Linter.Config | null;
96
+ /**
97
+ * If true is present, the eslint.lintFiles() method caches lint results and uses it if each target file is not
98
+ * changed. Please mind that ESLint doesn't clear the cache when you upgrade ESLint plugins. In that case, you have
99
+ * to remove the cache file manually. The eslint.lintText() method doesn't use caches even if you pass the
100
+ * options.filePath to the method.
101
+ */
102
+ cache?: boolean;
103
+ /**
104
+ * The eslint.lintFiles() method writes caches into this file.
105
+ */
106
+ cacheLocation?: string;
107
+ /**
108
+ * The working directory. This must be an absolute path.
109
+ */
110
+ cwd?: string;
111
+ /**
112
+ * Unless set to false, the eslint.lintFiles() method will throw an error when no target files are found.
113
+ */
114
+ errorOnUnmatchedPattern?: boolean;
115
+ /**
116
+ * If you pass directory paths to the eslint.lintFiles() method, ESLint checks the files in those directories that
117
+ * have the given extensions. For example, when passing the src/ directory and extensions is [".js", ".ts"], ESLint
118
+ * will lint *.js and *.ts files in src/. If extensions is null, ESLint checks *.js files and files that match
119
+ * overrides[].files patterns in your configuration.
120
+ * Note: This option only applies when you pass directory paths to the eslint.lintFiles() method.
121
+ * If you pass glob patterns, ESLint will lint all files matching the glob pattern regardless of extension.
122
+ */
123
+ extensions?: string[] | null;
124
+ /**
125
+ * If true is present, the eslint.lintFiles() and eslint.lintText() methods work in autofix mode.
126
+ * If a predicate function is present, the methods pass each lint message to the function, then use only the
127
+ * lint messages for which the function returned true.
128
+ */
129
+ fix?: boolean | ((message: ESLint.LintMessage) => boolean);
130
+ /**
131
+ * The types of the rules that the eslint.lintFiles() and eslint.lintText() methods use for autofix.
132
+ */
133
+ fixTypes?: ('directive' | 'problem' | 'suggestion' | 'layout')[] | null;
134
+ /**
135
+ * If false is present, the eslint.lintFiles() method doesn't interpret glob patterns.
136
+ */
137
+ globInputPaths?: boolean;
138
+ /**
139
+ * If false is present, the eslint.lintFiles() method doesn't respect `.eslintignore` files or ignorePatterns in
140
+ * your configuration.
141
+ */
142
+ ignore?: boolean;
143
+ /**
144
+ * The path to a file ESLint uses instead of `$CWD/.eslintignore`.
145
+ * If a path is present and the file doesn't exist, this constructor will throw an error.
146
+ */
147
+ ignorePath?: string;
148
+ /**
149
+ * Configuration object, overrides all configurations used with this instance.
150
+ * You can use this option to define the settings that will be used even if your configuration files configure it.
151
+ */
152
+ overrideConfig?: Linter.ConfigOverride | null;
153
+ /**
154
+ * The path to a configuration file, overrides all configurations used with this instance.
155
+ * The options.overrideConfig option is applied after this option is applied.
156
+ */
157
+ overrideConfigFile?: string | null;
158
+ /**
159
+ * The plugin implementations that ESLint uses for the plugins setting of your configuration.
160
+ * This is a map-like object. Those keys are plugin IDs and each value is implementation.
161
+ */
162
+ plugins?: Record<string, Linter.Plugin> | null;
163
+ /**
164
+ * The severity to report unused eslint-disable directives.
165
+ * If this option is a severity, it overrides the reportUnusedDisableDirectives setting in your configurations.
166
+ */
167
+ reportUnusedDisableDirectives?: Linter.SeverityString | null;
168
+ /**
169
+ * The path to a directory where plugins should be resolved from.
170
+ * If null is present, ESLint loads plugins from the location of the configuration file that contains the plugin
171
+ * setting.
172
+ * If a path is present, ESLint loads all plugins from there.
173
+ */
174
+ resolvePluginsRelativeTo?: string | null;
175
+ /**
176
+ * An array of paths to directories to load custom rules from.
177
+ */
178
+ rulePaths?: string[];
179
+ /**
180
+ * If false is present, ESLint doesn't load configuration files (.eslintrc.* files).
181
+ * Only the configuration of the constructor options is valid.
182
+ */
183
+ useEslintrc?: boolean;
184
+ }
185
+ interface DeprecatedRuleInfo {
186
+ /**
187
+ * The rule ID.
188
+ */
189
+ ruleId: string;
190
+ /**
191
+ * The rule IDs that replace this deprecated rule.
192
+ */
193
+ replacedBy: string[];
194
+ }
195
+ /**
196
+ * The LintResult value is the information of the linting result of each file.
197
+ */
198
+ interface LintResult {
199
+ /**
200
+ * The number of errors. This includes fixable errors.
201
+ */
202
+ errorCount: number;
203
+ /**
204
+ * The number of fatal errors.
205
+ * @since 7.32.0
206
+ */
207
+ fatalErrorCount?: number;
208
+ /**
209
+ * The absolute path to the file of this result. This is the string "<text>" if the file path is unknown (when you
210
+ * didn't pass the options.filePath option to the eslint.lintText() method).
211
+ */
212
+ filePath: string;
213
+ /**
214
+ * The number of errors that can be fixed automatically by the fix constructor option.
215
+ */
216
+ fixableErrorCount: number;
217
+ /**
218
+ * The number of warnings that can be fixed automatically by the fix constructor option.
219
+ */
220
+ fixableWarningCount: number;
221
+ /**
222
+ * The array of LintMessage objects.
223
+ */
224
+ messages: ESLint.LintMessage[];
225
+ /**
226
+ * The source code of the file that was linted, with as many fixes applied as possible.
227
+ */
228
+ output?: string;
229
+ /**
230
+ * The original source code text. This property is undefined if any messages didn't exist or the output
231
+ * property exists.
232
+ */
233
+ source?: string;
234
+ /**
235
+ * The array of SuppressedLintMessage objects.
236
+ *
237
+ * @since 8.8.0
238
+ */
239
+ suppressedMessages?: SuppressedLintMessage[];
240
+ /**
241
+ * The information about the deprecated rules that were used to check this file.
242
+ */
243
+ usedDeprecatedRules: DeprecatedRuleInfo[];
244
+ /**
245
+ * The number of warnings. This includes fixable warnings.
246
+ */
247
+ warningCount: number;
248
+ }
249
+ interface LintTextOptions {
250
+ /**
251
+ * The path to the file of the source code text. If omitted, the result.filePath becomes the string "<text>".
252
+ */
253
+ filePath?: string;
254
+ /**
255
+ * If true is present and the options.filePath is a file ESLint should ignore, this method returns a lint result
256
+ * contains a warning message.
257
+ */
258
+ warnIgnored?: boolean;
259
+ }
260
+ /**
261
+ * The LintMessage value is the information of each linting error.
262
+ */
263
+ interface LintMessage {
264
+ /**
265
+ * The 1-based column number of the begin point of this message.
266
+ */
267
+ column: number | undefined;
268
+ /**
269
+ * The 1-based column number of the end point of this message. This property is undefined if this message
270
+ * is not a range.
271
+ */
272
+ endColumn: number | undefined;
273
+ /**
274
+ * The 1-based line number of the end point of this message. This property is undefined if this
275
+ * message is not a range.
276
+ */
277
+ endLine: number | undefined;
278
+ /**
279
+ * `true` if this is a fatal error unrelated to a rule, like a parsing error.
280
+ * @since 7.24.0
281
+ */
282
+ fatal?: boolean | undefined;
283
+ /**
284
+ * The EditInfo object of autofix. This property is undefined if this message is not fixable.
285
+ */
286
+ fix: EditInfo | undefined;
287
+ /**
288
+ * The 1-based line number of the begin point of this message.
289
+ */
290
+ line: number | undefined;
291
+ /**
292
+ * The error message
293
+ */
294
+ message: string;
295
+ /**
296
+ * The rule name that generates this lint message. If this message is generated by the ESLint core rather than
297
+ * rules, this is null.
298
+ */
299
+ ruleId: string | null;
300
+ /**
301
+ * The severity of this message. 1 means warning and 2 means error.
302
+ */
303
+ severity: 1 | 2;
304
+ /**
305
+ * The list of suggestions. Each suggestion is the pair of a description and an EditInfo object to fix code. API
306
+ * users such as editor integrations can choose one of them to fix the problem of this message. This property is
307
+ * undefined if this message doesn't have any suggestions.
308
+ */
309
+ suggestions: {
310
+ desc: string;
311
+ fix: EditInfo;
312
+ }[] | undefined;
313
+ }
314
+ /**
315
+ * The SuppressedLintMessage value is the information of each suppressed linting error.
316
+ */
317
+ interface SuppressedLintMessage extends ESLint.LintMessage {
318
+ /**
319
+ * The list of suppressions.
320
+ */
321
+ suppressions?: {
322
+ /**
323
+ * Right now, this is always `directive`
324
+ */
325
+ kind: string;
326
+ /**
327
+ * The free text description added after the `--` in the comment
328
+ */
329
+ justification: string;
330
+ }[];
331
+ }
332
+ /**
333
+ * The EditInfo value is information to edit text.
334
+ *
335
+ * This edit information means replacing the range of the range property by the text property value. It's like
336
+ * sourceCodeText.slice(0, edit.range[0]) + edit.text + sourceCodeText.slice(edit.range[1]). Therefore, it's an add
337
+ * if the range[0] and range[1] property values are the same value, and it's removal if the text property value is
338
+ * empty string.
339
+ */
340
+ interface EditInfo {
341
+ /**
342
+ * The pair of 0-based indices in source code text to remove.
343
+ */
344
+ range: [
345
+ number,
346
+ number
347
+ ];
348
+ /**
349
+ * The text to add.
350
+ */
351
+ text: string;
352
+ }
353
+ /**
354
+ * The Formatter value is the object to convert the LintResult objects to text.
355
+ */
356
+ interface Formatter {
357
+ /**
358
+ * The method to convert the LintResult objects to text.
359
+ * Promise return supported since 8.4.0
360
+ */
361
+ format(results: LintResult[]): string | Promise<string>;
362
+ }
363
+ }
364
+ declare const _ESLint: typeof ESLintBase;
365
+ /**
366
+ * The ESLint class is the primary class to use in Node.js applications.
367
+ * This class depends on the Node.js fs module and the file system, so you cannot use it in browsers.
368
+ *
369
+ * If you want to lint code on browsers, use the Linter class instead.
370
+ *
371
+ * @since 7.0.0
372
+ */
373
+ declare class ESLint extends _ESLint {
374
+ }
375
+ export { ESLint };
376
+ //# sourceMappingURL=ESLint.d.ts.map
@@ -0,0 +1,326 @@
1
+ import { TSESTree, ParserServices } from '../ts-estree';
2
+ import { ParserOptions as TSParserOptions } from './ParserOptions';
3
+ import { RuleCreateFunction, RuleFix, RuleModule, SharedConfigurationSettings } from './Rule';
4
+ import { Scope } from './Scope';
5
+ import { SourceCode } from './SourceCode';
6
+ declare class LinterBase {
7
+ /**
8
+ * Initialize the Linter.
9
+ * @param config the config object
10
+ */
11
+ constructor(config?: Linter.LinterOptions);
12
+ /**
13
+ * Define a new parser module
14
+ * @param parserId Name of the parser
15
+ * @param parserModule The parser object
16
+ */
17
+ defineParser(parserId: string, parserModule: Linter.ParserModule): void;
18
+ /**
19
+ * Defines a new linting rule.
20
+ * @param ruleId A unique rule identifier
21
+ * @param ruleModule Function from context to object mapping AST node types to event handlers
22
+ */
23
+ defineRule<TMessageIds extends string, TOptions extends readonly unknown[]>(ruleId: string, ruleModule: RuleModule<TMessageIds, TOptions> | RuleCreateFunction): void;
24
+ /**
25
+ * Defines many new linting rules.
26
+ * @param rulesToDefine map from unique rule identifier to rule
27
+ */
28
+ defineRules<TMessageIds extends string, TOptions extends readonly unknown[]>(rulesToDefine: Record<string, RuleModule<TMessageIds, TOptions> | RuleCreateFunction>): void;
29
+ /**
30
+ * Gets an object with all loaded rules.
31
+ * @returns All loaded rules
32
+ */
33
+ getRules(): Map<string, RuleModule<string, unknown[]>>;
34
+ /**
35
+ * Gets the `SourceCode` object representing the parsed source.
36
+ * @returns The `SourceCode` object.
37
+ */
38
+ getSourceCode(): SourceCode;
39
+ /**
40
+ * Verifies the text against the rules specified by the second argument.
41
+ * @param textOrSourceCode The text to parse or a SourceCode object.
42
+ * @param config An ESLintConfig instance to configure everything.
43
+ * @param filenameOrOptions The optional filename of the file being checked.
44
+ * If this is not set, the filename will default to '<input>' in the rule context.
45
+ * If this is an object, then it has "filename", "allowInlineConfig", and some properties.
46
+ * @returns The results as an array of messages or an empty array if no messages.
47
+ */
48
+ verify(textOrSourceCode: SourceCode | string, config: Linter.Config, filenameOrOptions?: string | Linter.VerifyOptions): Linter.LintMessage[];
49
+ /**
50
+ * Performs multiple autofix passes over the text until as many fixes as possible have been applied.
51
+ * @param code The source text to apply fixes to.
52
+ * @param config The ESLint config object to use.
53
+ * @param options The ESLint options object to use.
54
+ * @returns The result of the fix operation as returned from the SourceCodeFixer.
55
+ */
56
+ verifyAndFix(code: string, config: Linter.Config, options: Linter.FixOptions): Linter.FixReport;
57
+ /**
58
+ * The version from package.json.
59
+ */
60
+ readonly version: string;
61
+ /**
62
+ * The version from package.json.
63
+ */
64
+ static readonly version: string;
65
+ }
66
+ declare namespace Linter {
67
+ export interface LinterOptions {
68
+ /**
69
+ * path to a directory that should be considered as the current working directory.
70
+ */
71
+ cwd?: string;
72
+ }
73
+ export type Severity = 0 | 1 | 2;
74
+ export type SeverityString = 'off' | 'warn' | 'error';
75
+ export type RuleLevel = Severity | SeverityString;
76
+ export type RuleLevelAndOptions = [
77
+ RuleLevel,
78
+ ...unknown[]
79
+ ];
80
+ export type RuleEntry = RuleLevel | RuleLevelAndOptions;
81
+ export type RulesRecord = Partial<Record<string, RuleEntry>>;
82
+ export type GlobalVariableOption = 'readonly' | 'writable' | 'off' | boolean;
83
+ interface BaseConfig {
84
+ $schema?: string;
85
+ /**
86
+ * The environment settings.
87
+ */
88
+ env?: {
89
+ [name: string]: boolean;
90
+ };
91
+ /**
92
+ * The path to other config files or the package name of shareable configs.
93
+ */
94
+ extends?: string | string[];
95
+ /**
96
+ * The global variable settings.
97
+ */
98
+ globals?: {
99
+ [name: string]: GlobalVariableOption;
100
+ };
101
+ /**
102
+ * The flag that disables directive comments.
103
+ */
104
+ noInlineConfig?: boolean;
105
+ /**
106
+ * The override settings per kind of files.
107
+ */
108
+ overrides?: ConfigOverride[];
109
+ /**
110
+ * The path to a parser or the package name of a parser.
111
+ */
112
+ parser?: string;
113
+ /**
114
+ * The parser options.
115
+ */
116
+ parserOptions?: ParserOptions;
117
+ /**
118
+ * The plugin specifiers.
119
+ */
120
+ plugins?: string[];
121
+ /**
122
+ * The processor specifier.
123
+ */
124
+ processor?: string;
125
+ /**
126
+ * The flag to report unused `eslint-disable` comments.
127
+ */
128
+ reportUnusedDisableDirectives?: boolean;
129
+ /**
130
+ * The rule settings.
131
+ */
132
+ rules?: RulesRecord;
133
+ /**
134
+ * The shared settings.
135
+ */
136
+ settings?: SharedConfigurationSettings;
137
+ }
138
+ export interface ConfigOverride extends BaseConfig {
139
+ excludedFiles?: string | string[];
140
+ files: string | string[];
141
+ }
142
+ export interface Config extends BaseConfig {
143
+ /**
144
+ * The glob patterns that ignore to lint.
145
+ */
146
+ ignorePatterns?: string | string[];
147
+ /**
148
+ * The root flag.
149
+ */
150
+ root?: boolean;
151
+ }
152
+ export type ParserOptions = TSParserOptions;
153
+ export interface VerifyOptions {
154
+ /**
155
+ * Allow/disallow inline comments' ability to change config once it is set. Defaults to true if not supplied.
156
+ * Useful if you want to validate JS without comments overriding rules.
157
+ */
158
+ allowInlineConfig?: boolean;
159
+ /**
160
+ * if `true` then the linter doesn't make `fix` properties into the lint result.
161
+ */
162
+ disableFixes?: boolean;
163
+ /**
164
+ * the filename of the source code.
165
+ */
166
+ filename?: string;
167
+ /**
168
+ * the predicate function that selects adopt code blocks.
169
+ */
170
+ filterCodeBlock?: (filename: string, text: string) => boolean;
171
+ /**
172
+ * postprocessor for report messages.
173
+ * If provided, this should accept an array of the message lists
174
+ * for each code block returned from the preprocessor, apply a mapping to
175
+ * the messages as appropriate, and return a one-dimensional array of
176
+ * messages.
177
+ */
178
+ postprocess?: Processor['postprocess'];
179
+ /**
180
+ * preprocessor for source text.
181
+ * If provided, this should accept a string of source text, and return an array of code blocks to lint.
182
+ */
183
+ preprocess?: Processor['preprocess'];
184
+ /**
185
+ * Adds reported errors for unused `eslint-disable` directives.
186
+ */
187
+ reportUnusedDisableDirectives?: boolean | SeverityString;
188
+ }
189
+ export interface FixOptions extends VerifyOptions {
190
+ /**
191
+ * Determines whether fixes should be applied.
192
+ */
193
+ fix?: boolean;
194
+ }
195
+ export interface LintSuggestion {
196
+ desc: string;
197
+ fix: RuleFix;
198
+ messageId?: string;
199
+ }
200
+ export interface LintMessage {
201
+ /**
202
+ * The 1-based column number.
203
+ */
204
+ column: number;
205
+ /**
206
+ * The 1-based column number of the end location.
207
+ */
208
+ endColumn?: number;
209
+ /**
210
+ * The 1-based line number of the end location.
211
+ */
212
+ endLine?: number;
213
+ /**
214
+ * If `true` then this is a fatal error.
215
+ */
216
+ fatal?: true;
217
+ /**
218
+ * Information for autofix.
219
+ */
220
+ fix?: RuleFix;
221
+ /**
222
+ * The 1-based line number.
223
+ */
224
+ line: number;
225
+ /**
226
+ * The error message.
227
+ */
228
+ message: string;
229
+ messageId?: string;
230
+ nodeType: string;
231
+ /**
232
+ * The ID of the rule which makes this message.
233
+ */
234
+ ruleId: string | null;
235
+ /**
236
+ * The severity of this message.
237
+ */
238
+ severity: Severity;
239
+ source: string | null;
240
+ /**
241
+ * Information for suggestions
242
+ */
243
+ suggestions?: LintSuggestion[];
244
+ }
245
+ export interface FixReport {
246
+ /**
247
+ * True, if the code was fixed
248
+ */
249
+ fixed: boolean;
250
+ /**
251
+ * Fixed code text (might be the same as input if no fixes were applied).
252
+ */
253
+ output: string;
254
+ /**
255
+ * Collection of all messages for the given code
256
+ */
257
+ messages: LintMessage[];
258
+ }
259
+ export type ParserModule = {
260
+ parse(text: string, options?: ParserOptions): TSESTree.Program;
261
+ } | {
262
+ parseForESLint(text: string, options?: ParserOptions): ESLintParseResult;
263
+ };
264
+ export interface ESLintParseResult {
265
+ ast: TSESTree.Program;
266
+ services?: ParserServices;
267
+ scopeManager?: Scope.ScopeManager;
268
+ visitorKeys?: SourceCode.VisitorKeys;
269
+ }
270
+ export interface Processor {
271
+ /**
272
+ * The function to extract code blocks.
273
+ */
274
+ preprocess?: (text: string, filename: string) => Array<string | {
275
+ text: string;
276
+ filename: string;
277
+ }>;
278
+ /**
279
+ * The function to merge messages.
280
+ */
281
+ postprocess?: (messagesList: Linter.LintMessage[][], filename: string) => Linter.LintMessage[];
282
+ /**
283
+ * If `true` then it means the processor supports autofix.
284
+ */
285
+ supportsAutofix?: boolean;
286
+ }
287
+ export interface Environment {
288
+ /**
289
+ * The definition of global variables.
290
+ */
291
+ globals?: Record<string, Linter.Config>;
292
+ /**
293
+ * The parser options that will be enabled under this environment.
294
+ */
295
+ parserOptions?: ParserOptions;
296
+ }
297
+ export interface Plugin {
298
+ /**
299
+ * The definition of plugin configs.
300
+ */
301
+ configs?: Record<string, Linter.Config>;
302
+ /**
303
+ * The definition of plugin environments.
304
+ */
305
+ environments?: Record<string, Environment>;
306
+ /**
307
+ * The definition of plugin processors.
308
+ */
309
+ processors?: Record<string, Processor>;
310
+ /**
311
+ * The definition of plugin rules.
312
+ */
313
+ rules?: Record<string, RuleCreateFunction | RuleModule<string, unknown[]>>;
314
+ }
315
+ export {};
316
+ }
317
+ declare const Linter_base: typeof LinterBase;
318
+ /**
319
+ * The Linter object does the actual evaluation of the JavaScript code. It doesn't do any filesystem operations, it
320
+ * simply parses and reports on the code. In particular, the Linter object does not process configuration objects
321
+ * or files.
322
+ */
323
+ declare class Linter extends Linter_base {
324
+ }
325
+ export { Linter };
326
+ //# sourceMappingURL=Linter.d.ts.map