Skip to content

Instantly share code, notes, and snippets.

@JustinLivi
Last active August 30, 2016 21:06
Show Gist options
  • Save JustinLivi/a5f87a8d9288b618c09c97da8f988ff3 to your computer and use it in GitHub Desktop.
Save JustinLivi/a5f87a8d9288b618c09c97da8f988ff3 to your computer and use it in GitHub Desktop.
Cascading glob configuration

I'd really like to see the cascading functionality within a single .eslintrc file:

{
    "includes": "**/*.js",
    "rules": { "indent": [ 2, 4, { "SwitchCase": 1 }] },
    "children": [
        {
            // overrides the parent includes and excludes for these rules
            "includes": ["src/components/**/*.js", "src/routes/**/client.js"],
            "excludes": ["*.min.js"],
            "ecmaFeatures": { "modules": true },
            "children": [
                // additional children
            ]
        },
        {
            "includes":  "src/routes/**/server.js",
            "ecmaFeatures": { "modules": false },
        }
    ]
}

The proposal would add three additional properties to the config

  1. the optional "includes" glob property to which the entire parent rule tree would be applied
  2. the optional "excludes" glob property to which the entire parent rule tree would be excluded
  3. an optional "children" property which would be an array of children configurations. These would cascade in the same manner that actual .eslintrc files do currently

Cascaded actual .eslintrc files with "includes" and "excludes" properties would simply override the parents.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment