@textlint/kernel
Version:
textlint kernel is core logic by pure JavaScript.
52 lines • 1.6 kB
TypeScript
import type { TextlintFilterRuleReporter, TextlintRuleReporter } from "@textlint/types";
/**
* detect that ruleCreator has linter function
* @param {*} ruleCreator
* @returns {boolean}
*/
export declare function hasLinter(ruleCreator: any): boolean;
/**
* get linter function from ruleCreator
* if not found, throw error
* @param {Function|Object|any} ruleCreator
* @returns {Function} linter function
* @throws
*/
export declare function getLinter(ruleCreator: Function | object | any): TextlintRuleReporter;
/**
* detect that ruleCreator has fixer function
* @param {*} ruleCreator
* @returns {boolean}
*/
export declare function hasFixer(ruleCreator: any): boolean;
/**
* get fixer function from ruleCreator
* if not found, throw error
* @param {Function|Object|any} ruleCreator
* @returns {Function} fixer function
* @throws
*/
export declare function getFixer(ruleCreator: Function | object | any): TextlintRuleReporter;
/**
* RuleModule should has either linter or fixer.
* @param {*} ruleCreator
* @returns {boolean}
**/
export declare function isRuleModule(ruleCreator: any): boolean;
/**
* Validate rule module.
* if invalid throw error
* @param {*} ruleModule
* @param {string} [key]
* @throws
*/
export declare function assertRuleShape(ruleModule: any, key?: string): void;
/**
* get linter function from ruleCreator
* if not found, throw error
* @param {*} ruleCreator
* @returns {Function} linter function
* @throws
*/
export declare function getFilter(ruleCreator: any): TextlintFilterRuleReporter;
//# sourceMappingURL=rule-creator-helper.d.ts.map