@depup/typescript-eslint__utils 8.57.1-depup.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (82) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +25 -0
  3. package/changes.json +5 -0
  4. package/dist/ast-utils/eslint-utils/PatternMatcher.d.ts +47 -0
  5. package/dist/ast-utils/eslint-utils/PatternMatcher.js +44 -0
  6. package/dist/ast-utils/eslint-utils/ReferenceTracker.d.ts +75 -0
  7. package/dist/ast-utils/eslint-utils/ReferenceTracker.js +48 -0
  8. package/dist/ast-utils/eslint-utils/astUtilities.d.ts +83 -0
  9. package/dist/ast-utils/eslint-utils/astUtilities.js +101 -0
  10. package/dist/ast-utils/eslint-utils/index.d.ts +5 -0
  11. package/dist/ast-utils/eslint-utils/index.js +21 -0
  12. package/dist/ast-utils/eslint-utils/predicates.d.ts +31 -0
  13. package/dist/ast-utils/eslint-utils/predicates.js +59 -0
  14. package/dist/ast-utils/eslint-utils/scopeAnalysis.d.ts +16 -0
  15. package/dist/ast-utils/eslint-utils/scopeAnalysis.js +51 -0
  16. package/dist/ast-utils/helpers.d.ts +18 -0
  17. package/dist/ast-utils/helpers.js +21 -0
  18. package/dist/ast-utils/index.d.ts +4 -0
  19. package/dist/ast-utils/index.js +20 -0
  20. package/dist/ast-utils/misc.d.ts +6 -0
  21. package/dist/ast-utils/misc.js +11 -0
  22. package/dist/ast-utils/predicates.d.ts +68 -0
  23. package/dist/ast-utils/predicates.js +108 -0
  24. package/dist/eslint-utils/InferTypesFromRule.d.ts +9 -0
  25. package/dist/eslint-utils/InferTypesFromRule.js +2 -0
  26. package/dist/eslint-utils/RuleCreator.d.ts +32 -0
  27. package/dist/eslint-utils/RuleCreator.js +54 -0
  28. package/dist/eslint-utils/applyDefault.d.ts +8 -0
  29. package/dist/eslint-utils/applyDefault.js +33 -0
  30. package/dist/eslint-utils/deepMerge.d.ts +14 -0
  31. package/dist/eslint-utils/deepMerge.js +46 -0
  32. package/dist/eslint-utils/getParserServices.d.ts +22 -0
  33. package/dist/eslint-utils/getParserServices.js +41 -0
  34. package/dist/eslint-utils/index.d.ts +6 -0
  35. package/dist/eslint-utils/index.js +22 -0
  36. package/dist/eslint-utils/nullThrows.d.ts +12 -0
  37. package/dist/eslint-utils/nullThrows.js +21 -0
  38. package/dist/eslint-utils/parserSeemsToBeTSESLint.d.ts +1 -0
  39. package/dist/eslint-utils/parserSeemsToBeTSESLint.js +6 -0
  40. package/dist/index.d.ts +6 -0
  41. package/dist/index.js +45 -0
  42. package/dist/json-schema.d.ts +387 -0
  43. package/dist/json-schema.js +8 -0
  44. package/dist/ts-eslint/AST.d.ts +8 -0
  45. package/dist/ts-eslint/AST.js +3 -0
  46. package/dist/ts-eslint/Config.d.ts +291 -0
  47. package/dist/ts-eslint/Config.js +3 -0
  48. package/dist/ts-eslint/ESLint.d.ts +7 -0
  49. package/dist/ts-eslint/ESLint.js +13 -0
  50. package/dist/ts-eslint/Linter.d.ts +255 -0
  51. package/dist/ts-eslint/Linter.js +13 -0
  52. package/dist/ts-eslint/Parser.d.ts +94 -0
  53. package/dist/ts-eslint/Parser.js +3 -0
  54. package/dist/ts-eslint/ParserOptions.d.ts +1 -0
  55. package/dist/ts-eslint/ParserOptions.js +2 -0
  56. package/dist/ts-eslint/Processor.d.ts +63 -0
  57. package/dist/ts-eslint/Processor.js +3 -0
  58. package/dist/ts-eslint/Rule.d.ts +614 -0
  59. package/dist/ts-eslint/Rule.js +2 -0
  60. package/dist/ts-eslint/RuleTester.d.ts +183 -0
  61. package/dist/ts-eslint/RuleTester.js +11 -0
  62. package/dist/ts-eslint/Scope.d.ts +42 -0
  63. package/dist/ts-eslint/Scope.js +43 -0
  64. package/dist/ts-eslint/SourceCode.d.ts +354 -0
  65. package/dist/ts-eslint/SourceCode.js +8 -0
  66. package/dist/ts-eslint/eslint/ESLintShared.d.ts +381 -0
  67. package/dist/ts-eslint/eslint/ESLintShared.js +2 -0
  68. package/dist/ts-eslint/eslint/FlatESLint.d.ts +87 -0
  69. package/dist/ts-eslint/eslint/FlatESLint.js +19 -0
  70. package/dist/ts-eslint/eslint/LegacyESLint.d.ts +72 -0
  71. package/dist/ts-eslint/eslint/LegacyESLint.js +36 -0
  72. package/dist/ts-eslint/index.d.ts +11 -0
  73. package/dist/ts-eslint/index.js +27 -0
  74. package/dist/ts-estree.d.ts +3 -0
  75. package/dist/ts-estree.js +9 -0
  76. package/dist/ts-utils/NoInfer.d.ts +9 -0
  77. package/dist/ts-utils/NoInfer.js +2 -0
  78. package/dist/ts-utils/index.d.ts +2 -0
  79. package/dist/ts-utils/index.js +18 -0
  80. package/dist/ts-utils/isArray.d.ts +1 -0
  81. package/dist/ts-utils/isArray.js +7 -0
  82. package/package.json +120 -0
@@ -0,0 +1,291 @@
1
+ import type { Parser as ParserType } from './Parser';
2
+ import type * as ParserOptionsTypes from './ParserOptions';
3
+ import type { Processor as ProcessorType } from './Processor';
4
+ import type { LooseRuleDefinition, SharedConfigurationSettings } from './Rule';
5
+ /** @internal */
6
+ export declare namespace SharedConfig {
7
+ type Severity = 0 | 1 | 2;
8
+ type SeverityString = 'error' | 'off' | 'warn';
9
+ type RuleLevel = Severity | SeverityString;
10
+ type RuleLevelAndOptions = [RuleLevel, ...unknown[]];
11
+ type RuleEntry = RuleLevel | RuleLevelAndOptions;
12
+ type RulesRecord = Partial<Record<string, RuleEntry>>;
13
+ type GlobalVariableOptionBase = 'off' | /** @deprecated use `'readonly'` */ 'readable' | 'readonly' | 'writable' | /** @deprecated use `'writable'` */ 'writeable';
14
+ type GlobalVariableOptionBoolean = /** @deprecated use `'readonly'` */ false | /** @deprecated use `'writable'` */ true;
15
+ type GlobalVariableOption = GlobalVariableOptionBase | GlobalVariableOptionBoolean;
16
+ interface GlobalsConfig {
17
+ [name: string]: GlobalVariableOption;
18
+ }
19
+ interface EnvironmentConfig {
20
+ [name: string]: boolean;
21
+ }
22
+ type ParserOptions = ParserOptionsTypes.ParserOptions;
23
+ interface PluginMeta {
24
+ /**
25
+ * The meta.name property should match the npm package name for your plugin.
26
+ */
27
+ name: string;
28
+ /**
29
+ * If you followed the classic style to name your package
30
+ * (e.g. `eslint-plugin-X`, `@X/eslint-plugin`, or `@X/eslint-plugin-Y`),
31
+ * then this should match the classic namespace inferred for your package
32
+ * (e.g. `X`, `@X`, or `@X/Y`, respectively).
33
+ */
34
+ namespace?: string;
35
+ /**
36
+ * The meta.version property should match the npm package version for your plugin.
37
+ */
38
+ version: string;
39
+ }
40
+ }
41
+ export declare namespace ClassicConfig {
42
+ export type EnvironmentConfig = SharedConfig.EnvironmentConfig;
43
+ export type GlobalsConfig = SharedConfig.GlobalsConfig;
44
+ export type GlobalVariableOption = SharedConfig.GlobalVariableOption;
45
+ export type GlobalVariableOptionBase = SharedConfig.GlobalVariableOptionBase;
46
+ export type ParserOptions = SharedConfig.ParserOptions;
47
+ export type RuleEntry = SharedConfig.RuleEntry;
48
+ export type RuleLevel = SharedConfig.RuleLevel;
49
+ export type RuleLevelAndOptions = SharedConfig.RuleLevelAndOptions;
50
+ export type RulesRecord = SharedConfig.RulesRecord;
51
+ export type Severity = SharedConfig.Severity;
52
+ export type SeverityString = SharedConfig.SeverityString;
53
+ interface BaseConfig {
54
+ $schema?: string;
55
+ /**
56
+ * The environment settings.
57
+ */
58
+ env?: EnvironmentConfig;
59
+ /**
60
+ * The path to other config files or the package name of shareable configs.
61
+ */
62
+ extends?: string | string[];
63
+ /**
64
+ * The global variable settings.
65
+ */
66
+ globals?: GlobalsConfig;
67
+ /**
68
+ * The flag that disables comment directives.
69
+ */
70
+ noInlineConfig?: boolean;
71
+ /**
72
+ * The override settings per kind of files.
73
+ */
74
+ overrides?: ConfigOverride[];
75
+ /**
76
+ * The path to a parser or the package name of a parser.
77
+ */
78
+ parser?: string | null;
79
+ /**
80
+ * The parser options.
81
+ */
82
+ parserOptions?: ParserOptions;
83
+ /**
84
+ * The plugin specifiers.
85
+ */
86
+ plugins?: string[];
87
+ /**
88
+ * The processor specifier.
89
+ */
90
+ processor?: string;
91
+ /**
92
+ * The flag to report unused `eslint-disable` comments.
93
+ */
94
+ reportUnusedDisableDirectives?: boolean;
95
+ /**
96
+ * The rule settings.
97
+ */
98
+ rules?: RulesRecord;
99
+ /**
100
+ * The shared settings.
101
+ */
102
+ settings?: SharedConfigurationSettings;
103
+ }
104
+ export interface ConfigOverride extends BaseConfig {
105
+ excludedFiles?: string | string[];
106
+ files: string | string[];
107
+ }
108
+ export interface Config extends BaseConfig {
109
+ /**
110
+ * The glob patterns that ignore to lint.
111
+ */
112
+ ignorePatterns?: string | string[];
113
+ /**
114
+ * The root flag.
115
+ */
116
+ root?: boolean;
117
+ }
118
+ export {};
119
+ }
120
+ export declare namespace FlatConfig {
121
+ type EcmaVersion = ParserOptionsTypes.EcmaVersion;
122
+ type GlobalsConfig = SharedConfig.GlobalsConfig;
123
+ type Parser = ParserType.LooseParserModule;
124
+ type ParserOptions = SharedConfig.ParserOptions;
125
+ type PluginMeta = SharedConfig.PluginMeta;
126
+ type Processor = ProcessorType.LooseProcessorModule;
127
+ type RuleEntry = SharedConfig.RuleEntry;
128
+ type RuleLevel = SharedConfig.RuleLevel;
129
+ type RuleLevelAndOptions = SharedConfig.RuleLevelAndOptions;
130
+ type Rules = SharedConfig.RulesRecord;
131
+ type Settings = SharedConfigurationSettings;
132
+ type Severity = SharedConfig.Severity;
133
+ type SeverityString = SharedConfig.SeverityString;
134
+ type SourceType = 'commonjs' | ParserOptionsTypes.SourceType;
135
+ interface SharedConfigs {
136
+ [key: string]: Config | ConfigArray;
137
+ }
138
+ interface Plugin {
139
+ /**
140
+ * Shared configurations bundled with the plugin.
141
+ * Users will reference these directly in their config (i.e. `plugin.configs.recommended`).
142
+ */
143
+ configs?: SharedConfigs;
144
+ /**
145
+ * Metadata about your plugin for easier debugging and more effective caching of plugins.
146
+ */
147
+ meta?: {
148
+ [K in keyof PluginMeta]?: PluginMeta[K] | undefined;
149
+ };
150
+ /**
151
+ * The definition of plugin processors.
152
+ * Users can stringly reference the processor using the key in their config (i.e., `"pluginName/processorName"`).
153
+ */
154
+ processors?: Partial<Record<string, Processor>> | undefined;
155
+ /**
156
+ * The definition of plugin rules.
157
+ * The key must be the name of the rule that users will use
158
+ * Users can stringly reference the rule using the key they registered the plugin under combined with the rule name.
159
+ * i.e. for the user config `plugins: { foo: pluginReference }` - the reference would be `"foo/ruleName"`.
160
+ */
161
+ rules?: Record<string, LooseRuleDefinition> | undefined;
162
+ }
163
+ interface Plugins {
164
+ /**
165
+ * We intentionally omit the `configs` key from this object because it avoids
166
+ * type conflicts with old plugins that haven't updated their configs to flat configs yet.
167
+ * It's valid to reference these old plugins because ESLint won't access the
168
+ * `.config` property of a plugin when evaluating a flat config.
169
+ */
170
+ [pluginAlias: string]: Omit<Plugin, 'configs'>;
171
+ }
172
+ interface LinterOptions {
173
+ /**
174
+ * A Boolean value indicating if inline configuration is allowed.
175
+ */
176
+ noInlineConfig?: boolean;
177
+ /**
178
+ * A severity string indicating if and how unused disable and enable
179
+ * directives should be tracked and reported. For legacy compatibility, `true`
180
+ * is equivalent to `"warn"` and `false` is equivalent to `"off"`.
181
+ * @default "warn"
182
+ */
183
+ reportUnusedDisableDirectives?: boolean | SharedConfig.Severity | SharedConfig.SeverityString;
184
+ /**
185
+ * A severity string indicating if and how unused inline directives
186
+ * should be tracked and reported.
187
+ *
188
+ * since ESLint 9.19.0
189
+ * @default "off"
190
+ */
191
+ reportUnusedInlineConfigs?: SharedConfig.Severity | SharedConfig.SeverityString;
192
+ }
193
+ interface LanguageOptions {
194
+ /**
195
+ * The version of ECMAScript to support.
196
+ * May be any year (i.e., `2022`) or version (i.e., `5`).
197
+ * Set to `"latest"` for the most recent supported version.
198
+ * @default "latest"
199
+ */
200
+ ecmaVersion?: EcmaVersion | undefined;
201
+ /**
202
+ * An object specifying additional objects that should be added to the global scope during linting.
203
+ */
204
+ globals?: GlobalsConfig | undefined;
205
+ /**
206
+ * An object containing a `parse()` method or a `parseForESLint()` method.
207
+ * @default
208
+ * ```
209
+ * // https://github.com/eslint/espree
210
+ * require('espree')
211
+ * ```
212
+ */
213
+ parser?: Parser | undefined;
214
+ /**
215
+ * An object specifying additional options that are passed directly to the parser.
216
+ * The available options are parser-dependent.
217
+ */
218
+ parserOptions?: ParserOptions | undefined;
219
+ /**
220
+ * The type of JavaScript source code.
221
+ * Possible values are `"script"` for traditional script files, `"module"` for ECMAScript modules (ESM), and `"commonjs"` for CommonJS files.
222
+ * @default
223
+ * ```
224
+ * // for `.js` and `.mjs` files
225
+ * "module"
226
+ * // for `.cjs` files
227
+ * "commonjs"
228
+ * ```
229
+ */
230
+ sourceType?: SourceType | undefined;
231
+ }
232
+ interface Config {
233
+ /**
234
+ * The base path for files and ignores.
235
+ *
236
+ * Note that this is not permitted inside an `extends` array.
237
+ *
238
+ * Since ESLint 9.30.0
239
+ */
240
+ basePath?: string;
241
+ /**
242
+ * An array of glob patterns indicating the files that the configuration object should apply to.
243
+ * If not specified, the configuration object applies to all files matched by any other configuration object.
244
+ */
245
+ files?: (string | string[])[];
246
+ /**
247
+ * An array of glob patterns indicating the files that the configuration object should not apply to.
248
+ * If not specified, the configuration object applies to all files matched by files.
249
+ */
250
+ ignores?: string[];
251
+ /**
252
+ * Language specifier in the form `namespace/language-name` where `namespace` is a plugin name set in the `plugins` field.
253
+ */
254
+ language?: string;
255
+ /**
256
+ * An object containing settings related to how JavaScript is configured for linting.
257
+ */
258
+ languageOptions?: LanguageOptions;
259
+ /**
260
+ * An object containing settings related to the linting process.
261
+ */
262
+ linterOptions?: LinterOptions;
263
+ /**
264
+ * An string to identify the configuration object. Used in error messages and inspection tools.
265
+ */
266
+ name?: string;
267
+ /**
268
+ * An object containing a name-value mapping of plugin names to plugin objects.
269
+ * When `files` is specified, these plugins are only available to the matching files.
270
+ */
271
+ plugins?: Plugins;
272
+ /**
273
+ * Either an object containing `preprocess()` and `postprocess()` methods or
274
+ * a string indicating the name of a processor inside of a plugin
275
+ * (i.e., `"pluginName/processorName"`).
276
+ */
277
+ processor?: string | Processor;
278
+ /**
279
+ * An object containing the configured rules.
280
+ * When `files` or `ignores` are specified, these rule configurations are only available to the matching files.
281
+ */
282
+ rules?: Rules;
283
+ /**
284
+ * An object containing name-value pairs of information that should be available to all rules.
285
+ */
286
+ settings?: Settings;
287
+ }
288
+ type ConfigArray = Config[];
289
+ type ConfigPromise = Promise<ConfigArray>;
290
+ type ConfigFile = ConfigArray | ConfigPromise;
291
+ }
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ /* eslint-disable @typescript-eslint/consistent-indexed-object-style, @typescript-eslint/no-namespace */
3
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,7 @@
1
+ export { FlatESLint } from './eslint/FlatESLint';
2
+ export { FlatESLint as ESLint } from './eslint/FlatESLint';
3
+ export {
4
+ /**
5
+ * @deprecated - use ESLint instead
6
+ */
7
+ LegacyESLint, } from './eslint/LegacyESLint';
@@ -0,0 +1,13 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.LegacyESLint = exports.ESLint = exports.FlatESLint = void 0;
4
+ var FlatESLint_1 = require("./eslint/FlatESLint");
5
+ Object.defineProperty(exports, "FlatESLint", { enumerable: true, get: function () { return FlatESLint_1.FlatESLint; } });
6
+ var FlatESLint_2 = require("./eslint/FlatESLint");
7
+ Object.defineProperty(exports, "ESLint", { enumerable: true, get: function () { return FlatESLint_2.FlatESLint; } });
8
+ var LegacyESLint_1 = require("./eslint/LegacyESLint");
9
+ // TODO(typescript-eslint@v9) - remove this in the next major release
10
+ /**
11
+ * @deprecated - use ESLint instead
12
+ */
13
+ Object.defineProperty(exports, "LegacyESLint", { enumerable: true, get: function () { return LegacyESLint_1.LegacyESLint; } });
@@ -0,0 +1,255 @@
1
+ import type { ClassicConfig, FlatConfig, SharedConfig } from './Config';
2
+ import type { Parser } from './Parser';
3
+ import type { Processor as ProcessorType } from './Processor';
4
+ import type { AnyRuleCreateFunction, AnyRuleModule, RuleCreateFunction, RuleFix, RuleModule } from './Rule';
5
+ import type { SourceCode } from './SourceCode';
6
+ export type MinimalRuleModule<MessageIds extends string = string, Options extends readonly unknown[] = []> = Partial<Omit<RuleModule<MessageIds, Options>, 'create'>> & Pick<RuleModule<MessageIds, Options>, 'create'>;
7
+ declare class LinterBase {
8
+ /**
9
+ * The version from package.json.
10
+ */
11
+ readonly version: string;
12
+ /**
13
+ * Initialize the Linter.
14
+ * @param config the config object
15
+ */
16
+ constructor(config?: Linter.LinterOptions);
17
+ /**
18
+ * Define a new parser module
19
+ * @param parserId Name of the parser
20
+ * @param parserModule The parser object
21
+ */
22
+ defineParser(parserId: string, parserModule: Parser.LooseParserModule): void;
23
+ /**
24
+ * Defines a new linting rule.
25
+ * @param ruleId A unique rule identifier
26
+ * @param ruleModule Function from context to object mapping AST node types to event handlers
27
+ */
28
+ defineRule<MessageIds extends string, Options extends readonly unknown[]>(ruleId: string, ruleModule: MinimalRuleModule<MessageIds, Options> | RuleCreateFunction): void;
29
+ /**
30
+ * Defines many new linting rules.
31
+ * @param rulesToDefine map from unique rule identifier to rule
32
+ */
33
+ defineRules<MessageIds extends string, Options extends readonly unknown[]>(rulesToDefine: Record<string, MinimalRuleModule<MessageIds, Options> | RuleCreateFunction<MessageIds, Options>>): void;
34
+ /**
35
+ * Gets an object with all loaded rules.
36
+ * @returns All loaded rules
37
+ */
38
+ getRules(): Map<string, MinimalRuleModule<string, unknown[]>>;
39
+ /**
40
+ * Gets the `SourceCode` object representing the parsed source.
41
+ * @returns The `SourceCode` object.
42
+ */
43
+ getSourceCode(): SourceCode;
44
+ /**
45
+ * Verifies the text against the rules specified by the second argument.
46
+ * @param textOrSourceCode The text to parse or a SourceCode object.
47
+ * @param config An ESLintConfig instance to configure everything.
48
+ * @param filenameOrOptions The optional filename of the file being checked.
49
+ * If this is not set, the filename will default to '<input>' in the rule context.
50
+ * If this is an object, then it has "filename", "allowInlineConfig", and some properties.
51
+ * @returns The results as an array of messages or an empty array if no messages.
52
+ */
53
+ verify(textOrSourceCode: string | SourceCode, config: Linter.ConfigType, filenameOrOptions?: string | Linter.VerifyOptions): Linter.LintMessage[];
54
+ /**
55
+ * The version from package.json.
56
+ */
57
+ static readonly version: string;
58
+ /**
59
+ * Performs multiple autofix passes over the text until as many fixes as possible have been applied.
60
+ * @param code The source text to apply fixes to.
61
+ * @param config The ESLint config object to use.
62
+ * @param options The ESLint options object to use.
63
+ * @returns The result of the fix operation as returned from the SourceCodeFixer.
64
+ */
65
+ verifyAndFix(code: string, config: Linter.ConfigType, options: Linter.FixOptions): Linter.FixReport;
66
+ }
67
+ declare namespace Linter {
68
+ interface LinterOptions {
69
+ /**
70
+ * Which config format to use.
71
+ * @default 'flat'
72
+ */
73
+ configType?: ConfigTypeSpecifier;
74
+ /**
75
+ * path to a directory that should be considered as the current working directory.
76
+ */
77
+ cwd?: string;
78
+ }
79
+ type ConfigTypeSpecifier = 'eslintrc' | 'flat';
80
+ type EnvironmentConfig = SharedConfig.EnvironmentConfig;
81
+ type GlobalsConfig = SharedConfig.GlobalsConfig;
82
+ type GlobalVariableOption = SharedConfig.GlobalVariableOption;
83
+ type GlobalVariableOptionBase = SharedConfig.GlobalVariableOptionBase;
84
+ type ParserOptions = SharedConfig.ParserOptions;
85
+ type PluginMeta = SharedConfig.PluginMeta;
86
+ type RuleEntry = SharedConfig.RuleEntry;
87
+ type RuleLevel = SharedConfig.RuleLevel;
88
+ type RuleLevelAndOptions = SharedConfig.RuleLevelAndOptions;
89
+ type RulesRecord = SharedConfig.RulesRecord;
90
+ type Severity = SharedConfig.Severity;
91
+ type SeverityString = SharedConfig.SeverityString;
92
+ /** @deprecated use {@link Linter.ConfigType} instead */
93
+ type Config = ClassicConfig.Config;
94
+ type ConfigType = ClassicConfig.Config | FlatConfig.Config | FlatConfig.ConfigArray;
95
+ /** @deprecated use {@link ClassicConfig.ConfigOverride} instead */
96
+ type ConfigOverride = ClassicConfig.ConfigOverride;
97
+ interface VerifyOptions {
98
+ /**
99
+ * Allow/disallow inline comments' ability to change config once it is set. Defaults to true if not supplied.
100
+ * Useful if you want to validate JS without comments overriding rules.
101
+ */
102
+ allowInlineConfig?: boolean;
103
+ /**
104
+ * if `true` then the linter doesn't make `fix` properties into the lint result.
105
+ */
106
+ disableFixes?: boolean;
107
+ /**
108
+ * the filename of the source code.
109
+ */
110
+ filename?: string;
111
+ /**
112
+ * the predicate function that selects adopt code blocks.
113
+ */
114
+ filterCodeBlock?: (filename: string, text: string) => boolean;
115
+ /**
116
+ * postprocessor for report messages.
117
+ * If provided, this should accept an array of the message lists
118
+ * for each code block returned from the preprocessor, apply a mapping to
119
+ * the messages as appropriate, and return a one-dimensional array of
120
+ * messages.
121
+ */
122
+ postprocess?: ProcessorType.PostProcess;
123
+ /**
124
+ * preprocessor for source text.
125
+ * If provided, this should accept a string of source text, and return an array of code blocks to lint.
126
+ */
127
+ preprocess?: ProcessorType.PreProcess;
128
+ /**
129
+ * Adds reported errors for unused `eslint-disable` directives.
130
+ */
131
+ reportUnusedDisableDirectives?: boolean | SeverityString;
132
+ }
133
+ interface FixOptions extends VerifyOptions {
134
+ /**
135
+ * Determines whether fixes should be applied.
136
+ */
137
+ fix?: boolean;
138
+ }
139
+ interface LintSuggestion {
140
+ desc: string;
141
+ fix: RuleFix;
142
+ messageId?: string;
143
+ }
144
+ interface LintMessage {
145
+ /**
146
+ * The 1-based column number.
147
+ */
148
+ column: number;
149
+ /**
150
+ * The 1-based column number of the end location.
151
+ */
152
+ endColumn?: number;
153
+ /**
154
+ * The 1-based line number of the end location.
155
+ */
156
+ endLine?: number;
157
+ /**
158
+ * If `true` then this is a fatal error.
159
+ */
160
+ fatal?: true;
161
+ /**
162
+ * Information for autofix.
163
+ */
164
+ fix?: RuleFix;
165
+ /**
166
+ * The 1-based line number.
167
+ */
168
+ line: number;
169
+ /**
170
+ * The error message.
171
+ */
172
+ message: string;
173
+ messageId?: string;
174
+ /**
175
+ * @deprecated `nodeType` is deprecated and will be removed in the next major version.
176
+ */
177
+ nodeType?: string;
178
+ /**
179
+ * The ID of the rule which makes this message.
180
+ */
181
+ ruleId: string | null;
182
+ /**
183
+ * The severity of this message.
184
+ */
185
+ severity: Severity;
186
+ source: string | null;
187
+ /**
188
+ * Information for suggestions
189
+ */
190
+ suggestions?: LintSuggestion[];
191
+ }
192
+ interface FixReport {
193
+ /**
194
+ * True, if the code was fixed
195
+ */
196
+ fixed: boolean;
197
+ /**
198
+ * Collection of all messages for the given code
199
+ */
200
+ messages: LintMessage[];
201
+ /**
202
+ * Fixed code text (might be the same as input if no fixes were applied).
203
+ */
204
+ output: string;
205
+ }
206
+ /** @deprecated use {@link Parser.ParserModule} */
207
+ type ParserModule = Parser.LooseParserModule;
208
+ /** @deprecated use {@link Parser.ParseResult} */
209
+ type ESLintParseResult = Parser.ParseResult;
210
+ /** @deprecated use {@link ProcessorType.ProcessorModule} */
211
+ type Processor = ProcessorType.ProcessorModule;
212
+ interface Environment {
213
+ /**
214
+ * The definition of global variables.
215
+ */
216
+ globals?: GlobalsConfig;
217
+ /**
218
+ * The parser options that will be enabled under this environment.
219
+ */
220
+ parserOptions?: ParserOptions;
221
+ }
222
+ type LegacyPluginRules = Record<string, AnyRuleCreateFunction | AnyRuleModule>;
223
+ type PluginRules = Record<string, AnyRuleModule>;
224
+ interface Plugin {
225
+ /**
226
+ * The definition of plugin configs.
227
+ */
228
+ configs?: Record<string, ClassicConfig.Config>;
229
+ /**
230
+ * The definition of plugin environments.
231
+ */
232
+ environments?: Record<string, Environment>;
233
+ /**
234
+ * Metadata about your plugin for easier debugging and more effective caching of plugins.
235
+ */
236
+ meta?: PluginMeta;
237
+ /**
238
+ * The definition of plugin processors.
239
+ */
240
+ processors?: Record<string, ProcessorType.ProcessorModule>;
241
+ /**
242
+ * The definition of plugin rules.
243
+ */
244
+ rules?: LegacyPluginRules;
245
+ }
246
+ }
247
+ declare const Linter_base: typeof LinterBase;
248
+ /**
249
+ * The Linter object does the actual evaluation of the JavaScript code. It doesn't do any filesystem operations, it
250
+ * simply parses and reports on the code. In particular, the Linter object does not process configuration objects
251
+ * or files.
252
+ */
253
+ declare class Linter extends Linter_base {
254
+ }
255
+ export { Linter };
@@ -0,0 +1,13 @@
1
+ "use strict";
2
+ /* eslint-disable @typescript-eslint/no-namespace, no-restricted-syntax */
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ exports.Linter = void 0;
5
+ const eslint_1 = require("eslint");
6
+ /**
7
+ * The Linter object does the actual evaluation of the JavaScript code. It doesn't do any filesystem operations, it
8
+ * simply parses and reports on the code. In particular, the Linter object does not process configuration objects
9
+ * or files.
10
+ */
11
+ class Linter extends eslint_1.Linter {
12
+ }
13
+ exports.Linter = Linter;
@@ -0,0 +1,94 @@
1
+ import type { ParserServices, TSESTree } from '../ts-estree';
2
+ import type { ParserOptions } from './ParserOptions';
3
+ import type { Scope } from './Scope';
4
+ export declare namespace Parser {
5
+ interface ParserMeta {
6
+ /**
7
+ * The unique name of the parser.
8
+ */
9
+ name: string;
10
+ /**
11
+ * The a string identifying the version of the parser.
12
+ */
13
+ version?: string;
14
+ }
15
+ /**
16
+ * A loose definition of the ParserModule type for use with configs
17
+ * This type intended to relax validation of configs so that parsers that have
18
+ * different AST types or scope managers can still be passed to configs
19
+ *
20
+ * @see {@link LooseRuleDefinition}, {@link LooseProcessorModule}
21
+ */
22
+ type LooseParserModule = {
23
+ /**
24
+ * Information about the parser to uniquely identify it when serializing.
25
+ */
26
+ meta?: {
27
+ [K in keyof ParserMeta]?: ParserMeta[K] | undefined;
28
+ };
29
+ /**
30
+ * Parses the given text into an AST
31
+ */
32
+ parseForESLint(text: string, options?: unknown): {
33
+ [k in keyof ParseResult]: unknown;
34
+ };
35
+ } | {
36
+ /**
37
+ * Information about the parser to uniquely identify it when serializing.
38
+ */
39
+ meta?: {
40
+ [K in keyof ParserMeta]?: ParserMeta[K] | undefined;
41
+ };
42
+ /**
43
+ * Parses the given text into an ESTree AST
44
+ */
45
+ parse(text: string, options?: unknown): unknown;
46
+ };
47
+ type ParserModule = {
48
+ /**
49
+ * Information about the parser to uniquely identify it when serializing.
50
+ */
51
+ meta?: ParserMeta;
52
+ /**
53
+ * Parses the given text into an AST
54
+ */
55
+ parseForESLint(text: string, options?: ParserOptions): ParseResult;
56
+ } | {
57
+ /**
58
+ * Information about the parser to uniquely identify it when serializing.
59
+ */
60
+ meta?: ParserMeta;
61
+ /**
62
+ * Parses the given text into an ESTree AST
63
+ */
64
+ parse(text: string, options?: ParserOptions): TSESTree.Program;
65
+ };
66
+ interface ParseResult {
67
+ /**
68
+ * The ESTree AST
69
+ */
70
+ ast: TSESTree.Program;
71
+ /**
72
+ * A `ScopeManager` object.
73
+ * Custom parsers can use customized scope analysis for experimental/enhancement syntaxes.
74
+ * The default is the `ScopeManager` object which is created by `eslint-scope`.
75
+ */
76
+ scopeManager?: Scope.ScopeManager;
77
+ /**
78
+ * Any parser-dependent services (such as type checkers for nodes).
79
+ * The value of the services property is available to rules as `context.sourceCode.parserServices`.
80
+ * The default is an empty object.
81
+ */
82
+ services?: ParserServices;
83
+ /**
84
+ * An object to customize AST traversal.
85
+ * The keys of the object are the type of AST nodes.
86
+ * Each value is an array of the property names which should be traversed.
87
+ * The default is `KEYS` of `eslint-visitor-keys`.
88
+ */
89
+ visitorKeys?: VisitorKeys;
90
+ }
91
+ interface VisitorKeys {
92
+ [nodeType: string]: readonly string[];
93
+ }
94
+ }
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ /* eslint-disable @typescript-eslint/no-namespace */
3
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1 @@
1
+ export type { DebugLevel, EcmaVersion, ParserOptions, SourceType, } from '@typescript-eslint/types';