Description
As background, I am trying to provide a mechanism to bundle multiple rule presets into one Chrome extension and let users choose which one they want to use.
I tried to implement this using merge-config command while reading the documentation on the following page,
like this:
textlintWorker.postMessage({
command: "merge-config",
textlintrc: {
rules: {
"preset-ja-technical-writing": true,
"preset-japanese": false
},
},
});
but the above code did not work as intended to toggle disabling/enabling of the entire preset.
Is this currently not feasible without adding individual settings to switch disable/enable for each preset for each rule, as shown below?
textlintWorker.postMessage({
command: "merge-config",
textlintrc: {
rules: {
"preset-ja-technical-writing": {
"max-comma": {
max: Number.MAX_SAFE_INTEGER,
},
"sentence-length": {
max: Number.MAX_SAFE_INTEGER,
},
"max-ten": {
max: Number.MAX_SAFE_INTEGER,
},
"max-kanji-continuous-len": {
max: Number.MAX_SAFE_INTEGER,
allow: [],
},
"arabic-kanji-numbers": false,
// ...
},
"preset-japanese": {
// ...
},
},
},
});
In this case, though, it makes no sense to use presets in the first place, and it would be easier to use the individual rules without presets.
In addition, I would like to take this opportunity to ask a follow-up question: isn't it possible to "disable a specific rule" in merge-config? I think that just mergeing false
for each individual ruleId element won't work. By this issue, the above example also includes a workaround that sets a suitably large value for max
.