It this the correct way of extending eslint rules?

Viewed 6468

In my eslint config (YAML format), I'm extending 3 different configurations:

extends:
- airbnb-base
- plugin:angular/johnpapa
- ionic

My questions are as follows:

  • Is this the correct format in YAML?
  • Some of these extensions have overlapping rules (or multiple of them extend eslint:recommended): will I get the same error multiple times if the error is related to one of these "shared" rules?
2 Answers

At first, Yes, it's the correct format in YAML (see for example ESLint - Configuring Plugins). As JSON, it would be

{
  "extends": [
    "airbnb-base",
    "plugin:angular/johnpapa",
    "ionic"
  ]
}

If you have multiple rulesets in your extend section, each following ruleset will extend or overwrite the previous ones. So you will only have one setting for each rule (see ESLint - Extending Configuration Files) Sometimes when the rules from the shareable configs are conflicting and you can't define a specific order for the extend section you have to manually define this specific rule in you rules section.

So the answer to you second question is: No, you won't get the same error multiple times.

Related