UNPKG

morpheme-match-textlint

Version:

morpheme-match for textlint rule.

36 lines (35 loc) 1.43 kB
import { ExpectedDictionary } from "morpheme-match-all"; declare type Token = import("morpheme-match").Token; declare type ExpectedToken = import("morpheme-match").ExpectedToken; export declare type ExpectedTokenWithCapture = ExpectedToken & { _capture?: string; }; export declare type ReporterOptions<T extends ExpectedTokenWithCapture, Dictionary extends ExpectedDictionary<T>> = { dictionaries: Dictionary[]; tokenize: (text: string) => Promise<Token[]>; createMessage?: ({ message, matcherTokens, actualTokens }: { message: string; dict: ExpectedDictionary<T>; matcherTokens: ExpectedTokenWithCapture[]; actualTokens: Token[]; }) => string; createExpected?: ({ expected, matcherTokens, actualTokens }: { expected?: string; dict: ExpectedDictionary<T>; matcherTokens: ExpectedTokenWithCapture[]; actualTokens: Token[]; }) => string; }; export declare type MatchTextlintResult<T extends ExpectedTokenWithCapture> = { message: string; expected: string | null; dict: ExpectedDictionary<T>; index: number; range: [number, number]; }; /** * create textlint matcher * @param options */ export declare const createTextlintMatcher: (options: ReporterOptions<ExpectedTokenWithCapture, ExpectedDictionary<ExpectedTokenWithCapture>>) => (text: string) => Promise<MatchTextlintResult<ExpectedTokenWithCapture>[]>; export {};