import type { Language, RuleVisitor, SourceLocation, SourceRange, TraversalStep } from "@eslint/core"; import { TextSourceCodeBase } from "@eslint/plugin-kit"; /** A single line of a plain text file. */ export interface PlainTextLineNode { type: "Line"; /** The text of the line, without its terminator. */ value: string; loc: SourceLocation; range: SourceRange; } /** The root node of a plain text file. */ export interface PlainTextDocumentNode { type: "Document"; lines: PlainTextLineNode[]; loc: SourceLocation; range: SourceRange; } export type PlainTextNode = PlainTextDocumentNode | PlainTextLineNode; /** Plain text has nothing to configure. */ export type PlainTextLanguageOptions = Record; export interface PlainTextRuleVisitor extends RuleVisitor { Document?(node: PlainTextDocumentNode): void; Line?(node: PlainTextLineNode, parent?: PlainTextDocumentNode): void; "Document:exit"?(node: PlainTextDocumentNode): void; "Line:exit"?(node: PlainTextLineNode, parent?: PlainTextDocumentNode): void; } export declare class PlainTextSourceCode extends TextSourceCodeBase<{ LangOptions: PlainTextLanguageOptions; RootNode: PlainTextDocumentNode; SyntaxElementWithLoc: PlainTextNode; ConfigNode: never; }> { #private; ast: PlainTextDocumentNode; constructor({ text, ast }: { text: string; ast: PlainTextDocumentNode; }); getAllComments(): never[]; getParent(node: PlainTextNode): PlainTextNode | undefined; traverse(): Iterable; } /** * An ESLint language that exposes each line of a text file as a `Line` node. * * This is a language rather than a parser on purpose. A parser is set through * `languageOptions.parser`, which ESLint merges by key, so any later config * object without a `files` restriction replaces it -- and a LICENSE file then * reaches, say, the TypeScript parser, which fails on an extensionless file. * A `language` is only replaced by another `language`, so the LICENSE block * cannot be clobbered by an unrelated `languageOptions` entry. */ export declare const PlainTextLanguage: Language<{ LangOptions: PlainTextLanguageOptions; Code: PlainTextSourceCode; RootNode: PlainTextDocumentNode; Node: PlainTextNode; }>;