@types/eslint
Advanced tools
Comparing version 8.56.10 to 9.6.0
@@ -1,5 +0,4 @@ | ||
/// <reference path="helpers.d.ts" /> | ||
import * as ESTree from "estree"; | ||
import { JSONSchema4 } from "json-schema"; | ||
import { LegacyESLint } from "./use-at-your-own-risk"; | ||
@@ -147,4 +146,2 @@ export namespace AST { | ||
getComments(node: ESTree.Node): { leading: ESTree.Comment[]; trailing: ESTree.Comment[] }; | ||
getDeclaredVariables(node: ESTree.Node): Scope.Variable[]; | ||
@@ -486,12 +483,5 @@ | ||
export namespace Rule { | ||
/** | ||
* TODO: Old style rules are planned to be removed in v9, remove this type then (https://github.com/eslint/rfcs/blob/main/designs/2021-schema-object-rules/README.md) | ||
* @deprecated Use `RuleModule` instead. | ||
*/ | ||
type OldStyleRule = RuleModule["create"]; | ||
interface RuleModule { | ||
create(context: RuleContext): RuleListener; | ||
meta?: RuleMetaData | undefined; | ||
schema?: RuleMetaData["schema"]; | ||
} | ||
@@ -682,4 +672,7 @@ | ||
type CodePathOrigin = "program" | "function" | "class-field-initializer" | "class-static-block"; | ||
interface CodePath { | ||
id: string; | ||
origin: CodePathOrigin; | ||
initialSegment: CodePathSegment; | ||
@@ -689,3 +682,2 @@ finalSegments: CodePathSegment[]; | ||
thrownSegments: CodePathSegment[]; | ||
currentSegments: CodePathSegment[]; | ||
upper: CodePath | null; | ||
@@ -713,7 +705,2 @@ childCodePaths: CodePath[]; | ||
url?: string | undefined; | ||
/** | ||
* TODO: remove this field in next major release of @types/eslint. | ||
* @deprecated use `meta.hasSuggestions` instead | ||
*/ | ||
suggestion?: boolean | undefined; | ||
} | undefined; | ||
@@ -728,7 +715,7 @@ /** Violation and suggestion messages. */ | ||
/** | ||
* Specifies the [options](https://eslint.org/docs/latest/developer-guide/working-with-rules#options-schemas) | ||
* so ESLint can prevent invalid [rule configurations](https://eslint.org/docs/latest/user-guide/configuring/rules#configuring-rules). | ||
* Specifies the [options](https://eslint.org/docs/latest/extend/custom-rules#options-schemas) | ||
* so ESLint can prevent invalid [rule configurations](https://eslint.org/docs/latest/use/configure/rules#configuring-rules). | ||
* Mandatory for rules with options. | ||
*/ | ||
schema?: JSONSchema4 | JSONSchema4[] | undefined; | ||
schema?: JSONSchema4 | JSONSchema4[] | false | undefined; | ||
@@ -761,5 +748,4 @@ /** Indicates whether the rule has been deprecated. Omit if not deprecated. */ | ||
parserPath: string | undefined; | ||
languageOptions: Linter.FlatConfig["languageOptions"]; | ||
languageOptions: Linter.LanguageOptions; | ||
parserOptions: Linter.ParserOptions; | ||
parserServices: SourceCode.ParserServices; | ||
cwd: string; | ||
@@ -847,3 +833,3 @@ filename: string; | ||
export class Linter { | ||
static version: string; | ||
static readonly version: string; | ||
@@ -856,3 +842,3 @@ version: string; | ||
code: SourceCode | string, | ||
config: Linter.Config | Linter.FlatConfig[], | ||
config: Linter.LegacyConfig | Linter.Config | Linter.Config[], | ||
filename?: string, | ||
@@ -862,10 +848,14 @@ ): Linter.LintMessage[]; | ||
code: SourceCode | string, | ||
config: Linter.Config | Linter.FlatConfig[], | ||
config: Linter.LegacyConfig | Linter.Config | Linter.Config[], | ||
options: Linter.LintOptions, | ||
): Linter.LintMessage[]; | ||
verifyAndFix(code: string, config: Linter.Config | Linter.FlatConfig[], filename?: string): Linter.FixReport; | ||
verifyAndFix( | ||
code: string, | ||
config: Linter.Config | Linter.FlatConfig[], | ||
config: Linter.LegacyConfig | Linter.Config | Linter.Config[], | ||
filename?: string, | ||
): Linter.FixReport; | ||
verifyAndFix( | ||
code: string, | ||
config: Linter.LegacyConfig | Linter.Config | Linter.Config[], | ||
options: Linter.FixOptions, | ||
@@ -882,3 +872,7 @@ ): Linter.FixReport; | ||
defineParser(name: string, parser: Linter.ParserModule): void; | ||
defineParser(name: string, parser: Linter.Parser): void; | ||
getTimes(): Linter.Stats["times"]; | ||
getFixPassCount(): Linter.Stats["fixPasses"]; | ||
} | ||
@@ -910,3 +904,3 @@ | ||
*/ | ||
type RuleLevel = Severity | StringSeverity; | ||
type RuleSeverity = Severity | StringSeverity; | ||
@@ -916,5 +910,5 @@ /** | ||
* | ||
* @see [Rules](https://eslint.org/docs/user-guide/configuring/rules) | ||
* @see [Rules](https://eslint.org/docs/latest/use/configure/rules) | ||
*/ | ||
type RuleLevelAndOptions<Options extends any[] = any[]> = Prepend<Partial<Options>, RuleLevel>; | ||
type RuleSeverityAndOptions<Options extends any[] = any[]> = [RuleSeverity, ...Partial<Options>]; | ||
@@ -924,5 +918,5 @@ /** | ||
* | ||
* @see [Rules](https://eslint.org/docs/user-guide/configuring/rules) | ||
* @see [Rules](https://eslint.org/docs/latest/use/configure/rules) | ||
*/ | ||
type RuleEntry<Options extends any[] = any[]> = RuleLevel | RuleLevelAndOptions<Options>; | ||
type RuleEntry<Options extends any[] = any[]> = RuleSeverity | RuleSeverityAndOptions<Options>; | ||
@@ -944,5 +938,40 @@ /** | ||
/** | ||
* ESLint configuration. | ||
* The ECMAScript version of the code being linted. | ||
*/ | ||
type EcmaVersion = | ||
| 3 | ||
| 5 | ||
| 6 | ||
| 7 | ||
| 8 | ||
| 9 | ||
| 10 | ||
| 11 | ||
| 12 | ||
| 13 | ||
| 14 | ||
| 15 | ||
| 16 | ||
| 2015 | ||
| 2016 | ||
| 2017 | ||
| 2018 | ||
| 2019 | ||
| 2020 | ||
| 2021 | ||
| 2022 | ||
| 2023 | ||
| 2024 | ||
| 2025 | ||
| "latest"; | ||
/** | ||
* The type of JavaScript source code. | ||
*/ | ||
type SourceType = "script" | "module" | "commonjs"; | ||
/** | ||
* ESLint legacy configuration. | ||
* | ||
* @see [ESLint Configuration](https://eslint.org/docs/latest/user-guide/configuring/) | ||
* @see [ESLint Legacy Configuration](https://eslint.org/docs/latest/use/configure/) | ||
*/ | ||
@@ -957,3 +986,3 @@ interface BaseConfig<Rules extends RulesRecord = RulesRecord, OverrideRules extends RulesRecord = Rules> | ||
* | ||
* @see [Environments](https://eslint.org/docs/latest/user-guide/configuring/language-options#specifying-environments) | ||
* @see [Environments](https://eslint.org/docs/latest/use/configure/language-options-deprecated#specifying-environments) | ||
*/ | ||
@@ -965,3 +994,3 @@ env?: { [name: string]: boolean } | undefined; | ||
* | ||
* @see [Extends](https://eslint.org/docs/latest/user-guide/configuring/configuration-files#extending-configuration-files) | ||
* @see [Extends](https://eslint.org/docs/latest/use/configure/configuration-files-deprecated#extending-configuration-files) | ||
*/ | ||
@@ -973,5 +1002,5 @@ extends?: string | string[] | undefined; | ||
* | ||
* @see [Globals](https://eslint.org/docs/latest/user-guide/configuring/language-options#specifying-globals) | ||
* @see [Globals](https://eslint.org/docs/latest/use/configure/language-options-deprecated#specifying-globals) | ||
*/ | ||
globals?: { [name: string]: boolean | "off" | "readonly" | "readable" | "writable" | "writeable" } | undefined; | ||
globals?: Linter.Globals | undefined; | ||
@@ -981,3 +1010,3 @@ /** | ||
* | ||
* @see [Disabling Inline Comments](https://eslint.org/docs/latest/user-guide/configuring/rules#disabling-inline-comments) | ||
* @see [Disabling Inline Comments](https://eslint.org/docs/latest/use/configure/rules-deprecated#disabling-inline-comments) | ||
*/ | ||
@@ -989,3 +1018,3 @@ noInlineConfig?: boolean | undefined; | ||
* | ||
* @see [How do overrides work](https://eslint.org/docs/latest/user-guide/configuring/configuration-files#how-do-overrides-work) | ||
* @see [How do overrides work](https://eslint.org/docs/latest/use/configure/configuration-files-deprecated#how-do-overrides-work) | ||
*/ | ||
@@ -997,4 +1026,4 @@ overrides?: Array<ConfigOverride<OverrideRules>> | undefined; | ||
* | ||
* @see [Working with Custom Parsers](https://eslint.org/docs/latest/developer-guide/working-with-custom-parsers) | ||
* @see [Specifying Parser](https://eslint.org/docs/latest/user-guide/configuring/plugins#configure-a-parser) | ||
* @see [Working with Custom Parsers](https://eslint.org/docs/latest/extend/custom-parsers) | ||
* @see [Specifying Parser](https://eslint.org/docs/latest/use/configure/parser-deprecated) | ||
*/ | ||
@@ -1006,4 +1035,4 @@ parser?: string | undefined; | ||
* | ||
* @see [Working with Custom Parsers](https://eslint.org/docs/latest/developer-guide/working-with-custom-parsers) | ||
* @see [Specifying Parser Options](https://eslint.org/docs/latest/user-guide/configuring/language-options#specifying-parser-options) | ||
* @see [Working with Custom Parsers](https://eslint.org/docs/latest/extend/custom-parsers) | ||
* @see [Specifying Parser Options](https://eslint.org/docs/latest/use/configure/language-options-deprecated#specifying-parser-options) | ||
*/ | ||
@@ -1015,3 +1044,3 @@ parserOptions?: ParserOptions | undefined; | ||
* | ||
* @see [Configuring Plugins](https://eslint.org/docs/latest/user-guide/configuring/plugins#configure-plugins) | ||
* @see [Configuring Plugins](https://eslint.org/docs/latest/use/configure/plugins-deprecated#configure-plugins) | ||
*/ | ||
@@ -1023,3 +1052,3 @@ plugins?: string[] | undefined; | ||
* | ||
* @see [processor](https://eslint.org/docs/latest/user-guide/configuring/plugins#specify-a-processor) | ||
* @see [processor](https://eslint.org/docs/latest/use/configure/plugins-deprecated#specify-a-processor) | ||
*/ | ||
@@ -1029,5 +1058,5 @@ processor?: string | undefined; | ||
/** | ||
* Report unused `ESLint-disable` comments as warning. | ||
* Report unused eslint-disable comments as warning. | ||
* | ||
* @see [Report unused `ESLint-disable` comments](https://eslint.org/docs/latest/user-guide/configuring/rules#report-unused-eslint-disable-comments) | ||
* @see [Report unused eslint-disable comments](https://eslint.org/docs/latest/use/configure/rules-deprecated#report-unused-eslint-disable-comments) | ||
*/ | ||
@@ -1039,3 +1068,3 @@ reportUnusedDisableDirectives?: boolean | undefined; | ||
* | ||
* @see [Settings](https://eslint.org/docs/latest/user-guide/configuring/configuration-files#adding-shared-settings) | ||
* @see [Settings](https://eslint.org/docs/latest/use/configure/configuration-files-deprecated#adding-shared-settings) | ||
*/ | ||
@@ -1061,8 +1090,8 @@ settings?: { [name: string]: any } | undefined; | ||
/** | ||
* ESLint configuration. | ||
* ESLint legacy configuration. | ||
* | ||
* @see [ESLint Configuration](https://eslint.org/docs/latest/user-guide/configuring/) | ||
* @see [ESLint Legacy Configuration](https://eslint.org/docs/latest/use/configure/) | ||
*/ | ||
// https://github.com/eslint/eslint/blob/v6.8.0/conf/config-schema.js | ||
interface Config<Rules extends RulesRecord = RulesRecord, OverrideRules extends RulesRecord = Rules> | ||
// https://github.com/eslint/eslint/blob/v8.57.0/conf/config-schema.js | ||
interface LegacyConfig<Rules extends RulesRecord = RulesRecord, OverrideRules extends RulesRecord = Rules> | ||
extends BaseConfig<Rules, OverrideRules> | ||
@@ -1073,3 +1102,3 @@ { | ||
* | ||
* @see [Ignore Patterns](https://eslint.org/docs/latest/user-guide/configuring/ignoring-code) | ||
* @see [Ignore Patterns](https://eslint.org/docs/latest/use/configure/ignore-deprecated#ignorepatterns-in-config-files) | ||
*/ | ||
@@ -1079,3 +1108,3 @@ ignorePatterns?: string | string[] | undefined; | ||
/** | ||
* @see [Using Configuration Files](https://eslint.org/docs/latest/user-guide/configuring/configuration-files#using-configuration-files) | ||
* @see [Using Configuration Files](https://eslint.org/docs/latest/use/configure/configuration-files-deprecated#using-configuration-files) | ||
*/ | ||
@@ -1088,3 +1117,3 @@ root?: boolean | undefined; | ||
* | ||
* @see [Specifying Parser Options](https://eslint.org/docs/user-guide/configuring/language-options#specifying-parser-options) | ||
* @see [Specifying Parser Options](https://eslint.org/docs/latest/use/configure/language-options-deprecated#specifying-parser-options) | ||
*/ | ||
@@ -1103,40 +1132,16 @@ interface ParserOptions { | ||
* | ||
* @default 2018 | ||
* | ||
* @see https://typescript-eslint.io/architecture/parser/#ecmaversion | ||
* @default 5 | ||
*/ | ||
ecmaVersion?: | ||
| 3 | ||
| 5 | ||
| 6 | ||
| 7 | ||
| 8 | ||
| 9 | ||
| 10 | ||
| 11 | ||
| 12 | ||
| 13 | ||
| 14 | ||
| 15 | ||
| 2015 | ||
| 2016 | ||
| 2017 | ||
| 2018 | ||
| 2019 | ||
| 2020 | ||
| 2021 | ||
| 2022 | ||
| 2023 | ||
| 2024 | ||
| "latest" | ||
| undefined; | ||
ecmaVersion?: EcmaVersion | undefined; | ||
/** | ||
* Set to "script" (default) or "module" if your code is in ECMAScript modules. | ||
* The type of JavaScript source code. Possible values are "script" for | ||
* traditional script files, "module" for ECMAScript modules (ESM), and | ||
* "commonjs" for CommonJS files. | ||
* | ||
* @default 'script' | ||
* | ||
* @see https://eslint.org/docs/latest/user-guide/configuring/language-options#specifying-parser-options | ||
* @see https://eslint.org/docs/latest/use/configure/language-options-deprecated#specifying-parser-options | ||
*/ | ||
sourceType?: "script" | "module" | undefined; | ||
sourceType?: SourceType | undefined; | ||
@@ -1146,4 +1151,3 @@ /** | ||
* | ||
* @see https://eslint.org/docs/latest/user-guide/configuring/language-options#specifying-parser-options | ||
* @see https://typescript-eslint.io/architecture/parser#ecmafeatures | ||
* @see https://eslint.org/docs/latest/use/configure/language-options-deprecated#specifying-parser-options | ||
*/ | ||
@@ -1186,6 +1190,4 @@ ecmaFeatures?: { | ||
fatal?: true | undefined; | ||
severity: Severity; | ||
severity: Exclude<Severity, 0>; | ||
fix?: Rule.Fix | undefined; | ||
/** @deprecated Use `linter.getSourceCode()` */ | ||
source?: string | null | undefined; | ||
suggestions?: LintSuggestion[] | undefined; | ||
@@ -1214,4 +1216,4 @@ } | ||
// Temporarily loosen type for just flat config files (see #68232) | ||
type FlatConfigParserModule = | ||
& Omit<ParserModule, "parseForESLint"> | ||
type NonESTreeParser = | ||
& Omit<ESTreeParser, "parseForESLint"> | ||
& ({ | ||
@@ -1226,3 +1228,3 @@ parse(text: string, options?: any): unknown; | ||
type ParserModule = | ||
type ESTreeParser = | ||
& ESLint.ObjectMetaProperties | ||
@@ -1234,2 +1236,4 @@ & ( | ||
type Parser = NonESTreeParser | ESTreeParser; | ||
interface ESLintParseResult { | ||
@@ -1247,3 +1251,3 @@ ast: AST.Program; | ||
// https://eslint.org/docs/developer-guide/working-with-plugins#processors-in-plugins | ||
// https://eslint.org/docs/latest/extend/plugins#processors-in-plugins | ||
interface Processor<T extends string | ProcessorFile = string | ProcessorFile> extends ESLint.ObjectMetaProperties { | ||
@@ -1255,3 +1259,3 @@ supportsAutofix?: boolean | undefined; | ||
interface FlatConfig<Rules extends RulesRecord = RulesRecord> { | ||
interface Config<Rules extends RulesRecord = RulesRecord> { | ||
/** | ||
@@ -1281,53 +1285,9 @@ * An string to identify the configuration object. Used in error messages and | ||
*/ | ||
languageOptions?: { | ||
/** | ||
* The version of ECMAScript to support. May be any year (i.e., 2022) or | ||
* version (i.e., 5). Set to "latest" for the most recent supported version. | ||
* @default "latest" | ||
*/ | ||
ecmaVersion?: ParserOptions["ecmaVersion"]; | ||
languageOptions?: LanguageOptions; | ||
/** | ||
* The type of JavaScript source code. Possible values are "script" for | ||
* traditional script files, "module" for ECMAScript modules (ESM), and | ||
* "commonjs" for CommonJS files. (default: "module" for .js and .mjs | ||
* files; "commonjs" for .cjs files) | ||
*/ | ||
sourceType?: "script" | "module" | "commonjs"; | ||
/** | ||
* An object specifying additional objects that should be added to the | ||
* global scope during linting. | ||
*/ | ||
globals?: ESLint.Environment["globals"]; | ||
/** | ||
* An object containing a parse() or parseForESLint() method. | ||
* If not configured, the default ESLint parser (Espree) will be used. | ||
*/ | ||
parser?: FlatConfigParserModule; | ||
/** | ||
* An object specifying additional options that are passed directly to the | ||
* parser() method on the parser. The available options are parser-dependent | ||
*/ | ||
parserOptions?: ESLint.Environment["parserOptions"]; | ||
}; | ||
/** | ||
* An object containing settings related to the linting process | ||
*/ | ||
linterOptions?: { | ||
/** | ||
* A boolean value indicating if inline configuration is allowed. | ||
*/ | ||
noInlineConfig?: boolean; | ||
linterOptions?: LinterOptions; | ||
/** | ||
* A severity value indicating if and how unused disable directives should be | ||
* tracked and reported. | ||
*/ | ||
reportUnusedDisableDirectives?: Severity | StringSeverity | boolean; | ||
}; | ||
/** | ||
@@ -1358,2 +1318,78 @@ * Either an object containing preprocess() and postprocess() methods or a | ||
} | ||
/** @deprecated Use `Config` instead of `FlatConfig` */ | ||
type FlatConfig = Config; | ||
type GlobalConf = boolean | "off" | "readable" | "readonly" | "writable" | "writeable"; | ||
interface Globals { | ||
[name: string]: GlobalConf; | ||
} | ||
interface LanguageOptions { | ||
/** | ||
* The version of ECMAScript to support. May be any year (i.e., 2022) or | ||
* version (i.e., 5). Set to "latest" for the most recent supported version. | ||
* @default "latest" | ||
*/ | ||
ecmaVersion?: EcmaVersion | undefined; | ||
/** | ||
* The type of JavaScript source code. Possible values are "script" for | ||
* traditional script files, "module" for ECMAScript modules (ESM), and | ||
* "commonjs" for CommonJS files. (default: "module" for .js and .mjs | ||
* files; "commonjs" for .cjs files) | ||
*/ | ||
sourceType?: SourceType | undefined; | ||
/** | ||
* An object specifying additional objects that should be added to the | ||
* global scope during linting. | ||
*/ | ||
globals?: Globals | undefined; | ||
/** | ||
* An object containing a parse() or parseForESLint() method. | ||
* If not configured, the default ESLint parser (Espree) will be used. | ||
*/ | ||
parser?: Parser | undefined; | ||
/** | ||
* An object specifying additional options that are passed directly to the | ||
* parser() method on the parser. The available options are parser-dependent | ||
*/ | ||
parserOptions?: Linter.ParserOptions | undefined; | ||
} | ||
interface LinterOptions { | ||
/** | ||
* A boolean value indicating if inline configuration is allowed. | ||
*/ | ||
noInlineConfig?: boolean; | ||
/** | ||
* A severity value indicating if and how unused disable directives should be | ||
* tracked and reported. | ||
*/ | ||
reportUnusedDisableDirectives?: Severity | StringSeverity | boolean; | ||
} | ||
interface Stats { | ||
/** | ||
* The number of times ESLint has applied at least one fix after linting. | ||
*/ | ||
fixPasses: number; | ||
/** | ||
* The times spent on (parsing, fixing, linting) a file, where the linting refers to the timing information for each rule. | ||
*/ | ||
times: { passes: TimePass[] }; | ||
} | ||
interface TimePass { | ||
parse: { total: number }; | ||
rules?: Record<string, { total: number }>; | ||
fix: { total: number }; | ||
total: number; | ||
} | ||
} | ||
@@ -1366,4 +1402,6 @@ | ||
export class ESLint { | ||
static version: string; | ||
static configType: "flat"; | ||
static readonly version: string; | ||
static outputFixes(results: ESLint.LintResult[]): Promise<void>; | ||
@@ -1384,4 +1422,8 @@ | ||
hasFlag(flag: string): boolean; | ||
calculateConfigForFile(filePath: string): Promise<any>; | ||
findConfigFile(): Promise<string | undefined>; | ||
isPathIgnored(filePath: string): Promise<boolean>; | ||
@@ -1393,10 +1435,9 @@ | ||
export namespace ESLint { | ||
type ConfigData<Rules extends Linter.RulesRecord = Linter.RulesRecord> = Omit<Linter.Config<Rules>, "$schema">; | ||
type ConfigData<Rules extends Linter.RulesRecord = Linter.RulesRecord> = Omit< | ||
Linter.LegacyConfig<Rules>, | ||
"$schema" | ||
>; | ||
interface Globals { | ||
[name: string]: boolean | "writable" | "readonly" | "off"; | ||
} | ||
interface Environment { | ||
globals?: Globals | undefined; | ||
globals?: Linter.Globals | undefined; | ||
parserOptions?: Linter.ParserOptions | undefined; | ||
@@ -1419,8 +1460,12 @@ } | ||
interface Plugin extends ObjectMetaProperties { | ||
configs?: Record<string, ConfigData | Linter.FlatConfig | Linter.FlatConfig[]> | undefined; | ||
configs?: Record<string, Linter.LegacyConfig | Linter.Config | Linter.Config[]> | undefined; | ||
environments?: Record<string, Environment> | undefined; | ||
processors?: Record<string, Linter.Processor> | undefined; | ||
rules?: Record<string, Rule.OldStyleRule | Rule.RuleModule> | undefined; | ||
rules?: Record<string, Rule.RuleModule> | undefined; | ||
} | ||
type FixType = "directive" | "problem" | "suggestion" | "layout"; | ||
type CacheStrategy = "content" | "metadata"; | ||
interface Options { | ||
@@ -1430,2 +1475,34 @@ // File enumeration | ||
errorOnUnmatchedPattern?: boolean | undefined; | ||
globInputPaths?: boolean | undefined; | ||
ignore?: boolean | undefined; | ||
ignorePatterns?: string[] | null | undefined; | ||
passOnNoPatterns?: boolean | undefined; | ||
warnIgnored?: boolean | undefined; | ||
// Linting | ||
allowInlineConfig?: boolean | undefined; | ||
baseConfig?: Linter.Config | Linter.Config[] | null | undefined; | ||
overrideConfig?: Linter.Config | Linter.Config[] | null | undefined; | ||
overrideConfigFile?: string | boolean | undefined; | ||
plugins?: Record<string, Plugin> | null | undefined; | ||
ruleFilter?: ((arg: { ruleId: string; severity: Exclude<Linter.Severity, 0> }) => boolean) | undefined; | ||
stats?: boolean | undefined; | ||
// Autofix | ||
fix?: boolean | ((message: Linter.LintMessage) => boolean) | undefined; | ||
fixTypes?: FixType[] | undefined; | ||
// Cache-related | ||
cache?: boolean | undefined; | ||
cacheLocation?: string | undefined; | ||
cacheStrategy?: CacheStrategy | undefined; | ||
// Other Options | ||
flags?: string[] | undefined; | ||
} | ||
interface LegacyOptions { | ||
// File enumeration | ||
cwd?: string | undefined; | ||
errorOnUnmatchedPattern?: boolean | undefined; | ||
extensions?: string[] | undefined; | ||
@@ -1438,4 +1515,4 @@ globInputPaths?: boolean | undefined; | ||
allowInlineConfig?: boolean | undefined; | ||
baseConfig?: Linter.Config | undefined; | ||
overrideConfig?: Linter.Config | undefined; | ||
baseConfig?: Linter.LegacyConfig | undefined; | ||
overrideConfig?: Linter.LegacyConfig | undefined; | ||
overrideConfigFile?: string | undefined; | ||
@@ -1450,3 +1527,3 @@ plugins?: Record<string, Plugin> | undefined; | ||
fix?: boolean | ((message: Linter.LintMessage) => boolean) | undefined; | ||
fixTypes?: Array<Rule.RuleMetaData["type"]> | undefined; | ||
fixTypes?: FixType[] | undefined; | ||
@@ -1456,3 +1533,6 @@ // Cache-related | ||
cacheLocation?: string | undefined; | ||
cacheStrategy?: "content" | "metadata" | undefined; | ||
cacheStrategy?: CacheStrategy | undefined; | ||
// Other Options | ||
flags?: string[] | undefined; | ||
} | ||
@@ -1471,2 +1551,3 @@ | ||
source?: string | undefined; | ||
stats?: Linter.Stats | undefined; | ||
usedDeprecatedRules: DeprecatedRuleUse[]; | ||
@@ -1488,7 +1569,9 @@ } | ||
interface Formatter { | ||
format(results: LintResult[], data?: LintResultData): string | Promise<string>; | ||
format(results: LintResult[], data: LintResultData): string | Promise<string>; | ||
} | ||
// Docs reference the type by this name | ||
// Docs reference the types by those name | ||
type EditInfo = Rule.Fix; | ||
type LoadedFormatter = Formatter; | ||
type ResultsMeta = LintResultData; | ||
} | ||
@@ -1498,7 +1581,17 @@ | ||
export function loadESLint(options: { useFlatConfig: true }): Promise<typeof ESLint>; | ||
export function loadESLint(options: { useFlatConfig: false }): Promise<typeof LegacyESLint>; | ||
export function loadESLint( | ||
options?: { useFlatConfig?: boolean | undefined }, | ||
): Promise<typeof ESLint | typeof LegacyESLint>; | ||
// #region RuleTester | ||
export class RuleTester { | ||
constructor(config?: any); | ||
static describe: ((...args: any) => any) | null; | ||
static it: ((...args: any) => any) | null; | ||
static itOnly: ((...args: any) => any) | null; | ||
constructor(config?: Linter.Config); | ||
run( | ||
@@ -1508,4 +1601,4 @@ name: string, | ||
tests: { | ||
valid?: Array<string | RuleTester.ValidTestCase> | undefined; | ||
invalid?: RuleTester.InvalidTestCase[] | undefined; | ||
valid: Array<string | RuleTester.ValidTestCase>; | ||
invalid: RuleTester.InvalidTestCase[]; | ||
}, | ||
@@ -1526,11 +1619,9 @@ ): void; | ||
only?: boolean; | ||
parserOptions?: Linter.ParserOptions | undefined; | ||
languageOptions?: Linter.LanguageOptions | undefined; | ||
settings?: { [name: string]: any } | undefined; | ||
parser?: string | undefined; | ||
globals?: { [name: string]: boolean } | undefined; | ||
} | ||
interface SuggestionOutput { | ||
messageId?: string | undefined; | ||
desc?: string | undefined; | ||
messageId?: string; | ||
desc?: string; | ||
data?: Record<string, unknown> | undefined; | ||
@@ -1546,4 +1637,4 @@ output: string; | ||
interface TestCaseError { | ||
message?: string | RegExp | undefined; | ||
messageId?: string | undefined; | ||
message?: string | RegExp; | ||
messageId?: string; | ||
type?: string | undefined; | ||
@@ -1550,0 +1641,0 @@ data?: any; |
{ | ||
"name": "@types/eslint", | ||
"version": "8.56.10", | ||
"version": "9.6.0", | ||
"description": "TypeScript definitions for eslint", | ||
@@ -68,4 +68,4 @@ "homepage": "https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/eslint", | ||
}, | ||
"typesPublisherContentHash": "522d3c76ab9a1be04075a38852c1f9c8c64f6722d17428f2cbbddc55e0477b81", | ||
"typeScriptVersion": "4.7" | ||
"typesPublisherContentHash": "b9dc2442a6de9477777294005e6b8dcf6c0dee1bdcf1fe79fea879291a522175", | ||
"typeScriptVersion": "4.8" | ||
} |
@@ -11,3 +11,3 @@ # Installation | ||
### Additional Details | ||
* Last updated: Thu, 18 Apr 2024 18:35:25 GMT | ||
* Last updated: Mon, 22 Jul 2024 16:38:53 GMT | ||
* Dependencies: [@types/estree](https://npmjs.com/package/@types/estree), [@types/json-schema](https://npmjs.com/package/@types/json-schema) | ||
@@ -14,0 +14,0 @@ |
@@ -0,3 +1,6 @@ | ||
import { ESLint, Rule } from "./index.js"; | ||
/** @deprecated */ | ||
export const builtinRules: Map<string, import("./index.js").Rule.RuleModule>; | ||
export const builtinRules: Map<string, Rule.RuleModule>; | ||
/** @deprecated */ | ||
@@ -20,1 +23,36 @@ export class FileEnumerator { | ||
} | ||
export { /** @deprecated */ ESLint as FlatESLint }; | ||
/** @deprecated */ | ||
export class LegacyESLint { | ||
static configType: "eslintrc"; | ||
static readonly version: string; | ||
static outputFixes(results: ESLint.LintResult[]): Promise<void>; | ||
static getErrorResults(results: ESLint.LintResult[]): ESLint.LintResult[]; | ||
constructor(options?: ESLint.LegacyOptions); | ||
lintFiles(patterns: string | string[]): Promise<ESLint.LintResult[]>; | ||
lintText( | ||
code: string, | ||
options?: { filePath?: string | undefined; warnIgnored?: boolean | undefined }, | ||
): Promise<ESLint.LintResult[]>; | ||
getRulesMetaForResults(results: ESLint.LintResult[]): ESLint.LintResultData["rulesMeta"]; | ||
hasFlag(flag: string): false; | ||
calculateConfigForFile(filePath: string): Promise<any>; | ||
isPathIgnored(filePath: string): Promise<boolean>; | ||
loadFormatter(nameOrPath?: string): Promise<ESLint.Formatter>; | ||
} | ||
/** @deprecated */ | ||
export function shouldUseFlatConfig(): Promise<boolean>; |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
195449
5798
14