I have few questions about cascading eslint config file:
- Can I use eslint like a
tsconfig.json(in typescript) where I have a root.eslintrc.ymland I can extend/cascade that to each.eslintrc.ymlfor each folder (project)? I'm not sure if this is what the documentation says here. - If I can extend a root config file how does it work on the case of
extendsoption where sometimes the order is important like on the case ofeslint-config-prettieras mentioned on their docs. There it says:
Make sure to put it last, so it gets the chance to override other configs.
- Correct me if my understanding is correct that with
pluginsoption the order is not important but onextendssometimes the order is important like what I mentioned on question #2. - If the order is important on
extendsoption, how can I make sure that it follows the order when I have an extension likeeslint-plugin-prettierwhere it should be the last when I'm not using cascading. For example:
If I'm not using cascading it should be like this as what is mentioned here:
extends:
- "some-other-config-you-use"
- "prettier"
- "prettier/@typescript-eslint"
- "prettier/react"
If I'm using cascading my setup will be like this:
# root
root: true
parser: "@typescript-eslint/parser"
extends:
- "eslint:recommended"
- "plugin:@typescript-eslint/recommended"
- "prettier"
- "prettier/@typescript-eslint"
# sub-folder
env:
browser: true
extends:
- "plugins:react/recommended"
- "plugins:jsx-a11y/recommended"
- "prettier/react"