import type { Program } from 'estree'; import { Chapter, Variant } from '../langs'; import type { Context, Node, NodeTypeToNode } from '../types'; import type { RuleError } from './errors'; export type { ParserOptions as BabelOptions } from '@babel/parser'; export type { Options as AcornOptions } from 'acorn'; export interface Parser { parse(programStr: string, context: Context, options?: Partial, throwOnError?: boolean): Program | null; validate(ast: Program, context: Context, throwOnError?: boolean): boolean; } export interface Rule { name: U; disableFromChapter?: Chapter; disableForVariants?: Variant[]; checkers: { [K in T['type']]?: (node: NodeTypeToNode, ancestors: Node[]) => RuleError[]; }; } /** * Helper function for defining a parser {@link Rule}. */ export declare function defineRule(name: U, checkers: { [K in T]: (node: NodeTypeToNode, ancestors: Node[]) => RuleError[]; }, disableFromChapter?: Chapter, disableForVariants?: Variant[]): Rule, U>;