textlint
Version:
The pluggable linting tool for text and markdown.
55 lines • 2.16 kB
JavaScript
Object.defineProperty(exports, "__esModule", { value: true });
exports.TextFixEngine = void 0;
const textlint_engine_core_1 = require("./engine/textlint-engine-core");
const fixer_formatter_1 = require("@textlint/fixer-formatter");
const logger_1 = require("../util/logger");
/**
* TextFixEngine a adapter for TextLintEngineCore.
* It aim to pull the whole look together. (TextLintEngine and TextFixEngine)
* @deprecated use new APIs https://textlint.github.io/docs/use-as-modules.html#new-apis
*/
class TextFixEngine extends textlint_engine_core_1.AbstractTextLintEngine {
constructor(...args) {
super(...args);
/**
* @param {TextLintCore} textlintCore
* @returns {function()}
*/
this.onFile = (textlintCore) => {
/**
* Fixes the current configuration on an array of file and directory names.
* TextFixEngine#executeOnFiles
* @returns {TextlintFixResult[]} The results for all files that were linted.
*/
return (file) => {
return textlintCore.fixFile(file);
};
};
/**
* @param {TextLintCore} textlintCore
* @returns {function()}
*/
this.onText = (textlintCore) => {
/**
* Fix texts with ext option.
* TextFixEngine#executeOnText
* @param {string} text linting text content
* @param {string} [ext] ext is a type for linting. default: ".txt"
* @returns {TextlintFixResult[]}
*/
return (text, ext) => {
return textlintCore.fixText(text, ext);
};
};
/**
* @param {TextLintFormatterOption} formatterConfig
*/
this.onFormat = (formatterConfig) => {
return (0, fixer_formatter_1.createFormatter)(formatterConfig);
};
logger_1.Logger.deprecate("TextFixEngine is deprecated. Please use new APIs https://github.com/textlint/textlint/issues/1310");
}
}
exports.TextFixEngine = TextFixEngine;
//# sourceMappingURL=textfix-engine.js.map
;