Skip to content

Commit

Permalink
@types/eslint loosen parser type for flat config files
Browse files Browse the repository at this point in the history
  • Loading branch information
Logicer16 committed Jan 29, 2024
1 parent eb3890d commit e1705c2
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion types/eslint/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1179,6 +1179,18 @@ export namespace Linter {
messages: LintMessage[];
}

// Temporarily loosen type for just flat config files (see #68232)
type FlatConfigParserModule =
& Omit<ParserModule, "parseForESLint">
& ({
parse(text: string, options?: any): unknown;
} | {
parseForESLint(text: string, options?: any): Omit<ESLintParseResult, "ast" | "scopeManager"> & {
ast: unknown;
scopeManager?: unknown;
};
});

type ParserModule =
& ESLint.ObjectMetaProperties
& (
Expand Down Expand Up @@ -1252,7 +1264,7 @@ export namespace Linter {
* An object containing a parse() or parseForESLint() method.
* If not configured, the default ESLint parser (Espree) will be used.
*/
parser?: ParserModule;
parser?: FlatConfigParserModule;

/**
* An object specifying additional options that are passed directly to the
Expand Down

0 comments on commit e1705c2

Please sign in to comment.