textlint-rule-helper
Version:
A helper library for textlint rule.
18 lines (17 loc) • 811 B
TypeScript
import { AnyTxtNode, TxtNodeType } from "@textlint/ast-node-types";
import type { TextlintRuleContext, TextlintRuleError, TextlintRuleReportHandler } from "@textlint/types";
export interface wrapReportHandlerOptions {
/**
* Define ignore node's type.
* It the node.type is matched, report error that is related with the location of node.
* You also should use `report` function that is passed as wrapReportHandler 3rd argument.
*/
ignoreNodeTypes: TxtNodeType[];
}
/**
*
* @param context
* @param options
* @param handler
*/
export declare function wrapReportHandler<T extends Readonly<TextlintRuleContext>, R extends TextlintRuleReportHandler>(context: T, options: wrapReportHandlerOptions, handler: (report: (node: AnyTxtNode, ruleError: TextlintRuleError) => void) => R): R;