UNPKG

eslint-mdx

Version:
78 lines (77 loc) 2.16 kB
import type { Position } from 'acorn'; import type { AST, Linter } from 'eslint'; import type { BaseNode, Program } from 'estree'; import type { JSXElement } from 'estree-jsx'; import type { Root } from 'mdast'; import type { VFileMessage } from 'vfile-message'; export interface CommonOptions { ignoreRemarkConfig?: boolean; remarkConfigPath?: string; } export interface ParserOptions extends Linter.ParserOptions, CommonOptions { extensions?: string[] | string; markdownExtensions?: string[] | string; filePath?: string; } export interface NormalPosition { start: number; end: number; loc: { start: Position; end: Position; }; range: [number, number]; } export interface SyncOptions extends CommonOptions { cwd?: string; } export interface WorkerOptions extends SyncOptions { filePath: string; code: string; isMdx: boolean; process?: boolean; } export interface WorkerParseResult { root: Root; body: Program['body']; comments: Program['comments']; tokens: AST.Token[]; } export interface WorkerProcessResult { messages: VFileMessage[]; content?: string; } export type WorkerResult = WorkerParseResult | WorkerProcessResult; type _Arrayable<T, R = T extends Array<infer U> ? U : T> = R | R[]; export type Arrayable<T> = _Arrayable<T>; export interface MDXCode extends BaseNode { type: 'MDXCode'; value: string; lang?: string | null; meta?: string | null; } export type HeadingDepth = 1 | 2 | 3 | 4 | 5 | 6; export interface MDXHeading extends BaseNode { type: 'MDXHeading'; depth: HeadingDepth; children: JSXElement['children']; } export interface CjsRequire extends NodeJS.Require { <T>(id: string): T; } export interface PackageJson { name: string; version: string; } export declare class Ignore { constructor(options: Options); check(filePath: string, callback: Callback): void; } export type IgnoreClass = typeof Ignore; export type Callback = (error?: Error, result?: boolean) => void; export interface Options { cwd: string; detectIgnore: boolean | undefined; ignoreName?: string; } export {};