UNPKG

textlint

Version:

The pluggable linting tool for text and markdown.

56 lines 2.29 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.TextLintEngine = void 0; const linter_formatter_1 = require("@textlint/linter-formatter"); const textlint_engine_core_1 = require("./engine/textlint-engine-core"); const logger_1 = require("../util/logger"); /** * TextLintEngine 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 TextLintEngine extends textlint_engine_core_1.AbstractTextLintEngine { constructor(...args) { super(...args); /** * @param {TextLintCore} textlintCore * @returns {function()} */ this.onFile = (textlintCore) => { /** * Executes the current configuration on an array of file and directory names. * TextLintEngine#executeOnFile * @param {String} file An array of file and directory names. * @returns {TextlintResult[]} The results for all files that were linted. */ return function executeOnFile(file) { return textlintCore.lintFile(file); }; }; /** * @param {TextLintCore} textlintCore * @returns {function()} */ this.onText = (textlintCore) => { /** * lint text, and return TextlintResult[] * TextLintEngine#executeOnText * @param {string} text linting text content * @param {string} ext ext is a type for linting. default: ".txt" * @returns {TextlintResult[]} */ return function executeOnText(text, ext) { return textlintCore.lintText(text, ext); }; }; /** * @param {TextLintFormatterOption} formatterConfig */ this.onFormat = (formatterConfig) => { return (0, linter_formatter_1.createFormatter)(formatterConfig); }; logger_1.Logger.deprecate("TextLintEngine is deprecated. Please use new APIs https://github.com/textlint/textlint/issues/1310"); } } exports.TextLintEngine = TextLintEngine; //# sourceMappingURL=textlint-engine.js.map