diff --git a/types/eslint/eslint-tests.ts b/types/eslint/eslint-tests.ts index 624d438ea7..376cdf0a92 100644 --- a/types/eslint/eslint-tests.ts +++ b/types/eslint/eslint-tests.ts @@ -209,6 +209,7 @@ sourceCode.getTokens(AST, { includeComments: true }); sourceCode.getTokens(AST, { includeComments: true, filter: t => t.type === 'Identifier' }); sourceCode.commentsExistBetween(AST, AST); +sourceCode.commentsExistBetween(TOKEN, TOKEN); sourceCode.getCommentsBefore(AST); sourceCode.getCommentsBefore(TOKEN); diff --git a/types/eslint/index.d.ts b/types/eslint/index.d.ts index abe7b7ce90..9e0e68af0b 100644 --- a/types/eslint/index.d.ts +++ b/types/eslint/index.d.ts @@ -193,7 +193,7 @@ export class SourceCode { getTokens(node: ESTree.Node, beforeCount?: number, afterCount?: number): AST.Token[]; getTokens(node: ESTree.Node, options: SourceCode.FilterPredicate | SourceCode.CursorWithCountOptions): AST.Token[]; - commentsExistBetween(left: ESTree.Node, right: ESTree.Node): boolean; + commentsExistBetween(left: ESTree.Node | AST.Token, right: ESTree.Node | AST.Token): boolean; getCommentsBefore(nodeOrToken: ESTree.Node | AST.Token): ESTree.Comment[]; @@ -433,7 +433,7 @@ export namespace Linter { } type ParserModule = { - parse(text: string, options?: any): ESTree.Node; + parse(text: string, options?: any): AST.Program; } | { parseForESLint(text: string, options?: any): ESLintParseResult; };