Skip to content

Proposal: preset and config to be extendable #210

@azu

Description

@azu

Summary

Make textlint preset and config more casual.

Purpose

textlint has three abstruction of collection rules.

Config is similar with Preset.

My implementation of these:

  • Config is come from ESLint.
    • Config is a shareable .textlintrc
    • It has rules and rulesConfig
    • The use create own Config.
  • Preset is come from Babel.
    • Preset is a collection of rules
    • It has rules and rulesConfig
    • The developer create own Preset of rules.

JSCS has same terms, but Preset is a alias of Config.


Question: How to use multiple presets and configs?

Currently, The user can use multiple presets like that

{
    "rules": {
        "preset-a": true,
        "preset-b": true
    }
}

But, it has a issue about "duplicated errors".
I exaplain this issue in #209

On the other hand, The use can't use multiple config.
textlint only support --config option.

textlint should provide a solution for these issues:

  • duplicated of rules in preset
  • config is not overrided by user

My idea:

textlit will support "extends" like ESLint and resolve these issue on the above.

Images of textlintrc

Pattern A that same with ESLint

{
    // preset override config
    "extends": [
        "config",
        "preset"
    ],

    // rules override extends
    "rules": {
        // Override any settings from the "parent" configuration
        "eqeqeq": "warn"
    }
}

Pattern B: rules allow to set Array

"rules": ["config", "preset", {

}]

Pattern C: programatic

"rules": Object.assign({}, config, preset, {

})

We need to other idea!

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions