本文整理汇总了TypeScript中@textlint/kernel.TextlintKernelDescriptor类的典型用法代码示例。如果您正苦于以下问题:TypeScript TextlintKernelDescriptor类的具体用法?TypeScript TextlintKernelDescriptor怎么用?TypeScript TextlintKernelDescriptor使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了TextlintKernelDescriptor类的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: setupPlugins
/**
* register Processors
* @param {Object} plugins
* @param {Object} [pluginsConfig]
*/
setupPlugins(
plugins: { [index: string]: TextlintPluginCreator } = {},
pluginsConfig: { [index: string]: TextlintPluginOptions } = {}
) {
// Append default plugin to the plugins list.
// Because, default plugin can be override by user plugins
this.textlintKernelDescriptor = this.textlintKernelDescriptor.shallowMerge({
plugins: pluginsObjectToKernelRule(plugins, pluginsConfig).concat(this.defaultPlugins)
});
}
示例2: addProcessor
/**
* Use setupPlugins insteadof it.
*
* ````
* textlint.setupPlugins({
* yourPluginName: yourPlugin
* });
* ````
*
* @param {*} Processor
* @deprecated
*
* It will be removed until textlint@10
*/
addProcessor(Processor: TextlintPluginProcessorConstructor) {
throwIfTesting(
"Use setupPlugins insteadof addProcessor method.`addProcessor` will be removed in the future." +
"For more details, See https://github.com/textlint/textlint/issues/293"
);
this.textlintKernelDescriptor = this.textlintKernelDescriptor.shallowMerge({
plugins: [
{
pluginId: "`${Processor.name}@deprecated`",
plugin: { Processor }
}
].concat(this.defaultPlugins)
});
}
示例3: setupFilterRules
/**
* Register filterRules and filterRulesConfig.
* if want to release rules, please call {@link resetRules}.
* @param {object} filterRules rule objects array
* @param {object} [filterRulesOption] ruleConfig is object
*/
setupFilterRules(filterRules = {}, filterRulesOption = {}) {
this.textlintKernelDescriptor = this.textlintKernelDescriptor.shallowMerge({
filterRules: filterRulesObjectToKernelRule(filterRules, filterRulesOption)
});
}
示例4: setupRules
/**
* Register rules and rulesConfig.
* if want to release rules, please call {@link resetRules}.
* @param {object} rules rule objects array
* @param {object} [rulesOption] ruleConfig is object
*/
setupRules(rules = {}, rulesOption = {}) {
this.textlintKernelDescriptor = this.textlintKernelDescriptor.shallowMerge({
rules: rulesObjectToKernelRule(rules, rulesOption)
});
}