Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
this.config = config;
// Markdown and Text is enabled by default
// Markdown and Text are for backward compatibility.
this.defaultPlugins = [
{
pluginId: "markdown",
plugin: markdownPlugin
},
{
pluginId: "text",
plugin: textPlugin
}
];
// TODO: remove `config`
// https://github.com/textlint/textlint/issues/296
this.kernel = new TextlintKernel(config);
this.textlintKernelDescriptor = new TextlintKernelDescriptor({
rules: [],
plugins: this.defaultPlugins,
filterRules: []
});
}
// Markdown and Text is enabled by default
// Markdown and Text are for backward compatibility.
this.defaultPlugins = [
{
pluginId: "markdown",
plugin: markdownPlugin
},
{
pluginId: "text",
plugin: textPlugin
}
];
// TODO: remove `config`
// https://github.com/textlint/textlint/issues/296
this.kernel = new TextlintKernel(config);
this.textlintKernelDescriptor = new TextlintKernelDescriptor({
rules: [],
plugins: this.defaultPlugins,
filterRules: []
});
}
import textlintToCodeMirror from "textlint-message-to-codemirror";
import { updateRuleErrors } from "../../actions/textlintActions";
import CodeMirrorEditor from "./CodeMirrorEditor";
require("codemirror/addon/mode/overlay.js");
require("codemirror/mode/xml/xml.js");
require("codemirror/mode/markdown/markdown.js");
require("codemirror/mode/gfm/gfm.js");
require("codemirror/mode/javascript/javascript.js");
require("codemirror/mode/css/css.js");
require("codemirror/mode/htmlmixed/htmlmixed.js");
require("codemirror/mode/clike/clike.js");
require("codemirror/mode/meta.js");
require("codemirror/addon/edit/continuelist.js");
require("codemirror/addon/lint/lint.js");
const textlintKernel = new TextlintKernel();
const createSetupRules = (rules, ruleOptions) => {
return Object.keys(rules).map(ruleName => {
return {
ruleId: ruleName,
rule: rules[ruleName],
options: ruleOptions[ruleName]
};
});
};
let textlintOption = {};
const createValidator = ({ rules, rulesOption }) => {
textlintOption = Object.assign(
{},
{
rules: createSetupRules(rules, rulesOption),
plugins: [
resetRules() {
this.textlintKernelDescriptor = new TextlintKernelDescriptor({
rules: [],
plugins: this.defaultPlugins,
filterRules: []
});
}