Extending multiple recommended configurations in ESLint

10,536

How can we use all the recommended configurations at the same time - the one that ESLint and all the used plugins ship with?

Your syntax is correct, and multiple extensions are loaded like this:

{
  "extends": [
    "eslint:recommended",
    "plugin:protractor/recommended",
    "plugin:jasmine/recommended",
    "plugin:angular/recommended"
  ]
}

However, this requires that the plugins in question actually come bundled with recommended settings. eslint-plugin-angular does not, and you have to install it yourself:

npm install --save-dev eslint-config-angular

Change your eslint settings to

{
  "extends": [
    "eslint:recommended",
    "plugin:protractor/recommended",
    "plugin:jasmine/recommended",
    "angular"
  ]
}

and it should work.

Share:
10,536
alecxe
Author by

alecxe

"I am a soldier, at war with entropy itself" I am a Software Developer and generalist who is in love with the Python language and community. I greatly value clean and maintainable code, great software, but I know when I need to be a perfectionist and when it stands in a way of product delivery. I like to break things, to find new ways to break things, to solve hard problems, to put things under test and stress, and to have my mind blown by an interesting question. Some of my interests: Learning, Productivity, AI, Space Exploration, Internet of Things. "If you change the way you look at things, the things you look at change." - Wayne Dyer If you are looking for a different way to say "Thank you": Amazon wish list Pragmatic wish list Today I left my phone at home And went down to the sea. The sand was soft, the ocean glass, But I was still just me. Then pelicans in threes and fours, Glided by like dinosaurs, An otter basked upon its back, And dived to find another snack. The sun corpuscular and bright, Cast down a piercing shaft, And conjured an inspiring sight On glinting, bobbing craft. Two mermaids rose up from the reef, Out of the breaking waves. Their siren song was opium grief, Their faces from the grave. The mermaids asked a princely kiss To free them from their spell. I said to try a poet’s bliss. They shrugged and bid farewell. The sun grew dark and sinister, In unscheduled eclipse. As two eight-headed aliens Descended in their ships. They said the World was nice enough But didn’t like our star. And asked the way to Betelgeuse, If it wouldn’t be too far. Two whales breached far out to sea, And flew up to the sky, The crowd was busy frolicking, And didn’t ask me why. Today I left my phone at home, On the worst day, you’ll agree. If only I had pictures, If only you could see. Not everything was really there, I’m happy to confess, But I still have the memories, Worth more than tweets and stress. Today I left my phone at home, I had no shakes or sorrow. If that is what my mind can do, It stays at home tomorrow. Gavin Miller

Updated on June 06, 2022

Comments

  • alecxe
    alecxe about 2 years

    The Story:

    Currently, we are extending the recommended ESLint configuration:

    {
      "extends": "eslint:recommended",
      ...
      "plugins": [
        "angular",
        "jasmine",
        "protractor"
      ],
      "rules": {
        "no-multiple-empty-lines": 2,
        "no-trailing-spaces": 2,
        "jasmine/valid-expect": 2
      }
    }
    

    And also using angular, jasmine and protractor ESLint plugins which also ship with their own recommended configurations (default rule strictness levels and default rule parameters).

    The Question:

    How can we use all the recommended configurations at the same time - the one that ESLint and all the used plugins ship with?


    Tried the following:

    {
      "extends": [
        "eslint:recommended",
        "plugin:protractor/recommended",
        "plugin:jasmine/recommended",
        "plugin:angular/recommended"
      ],
      ...
    }
    

    but got the following error:

    Cannot read property 'recommended' of undefined

  • toesslab
    toesslab over 8 years
    Shouldn't that be rather a comment than an answer?
  • dannyjolie
    dannyjolie over 8 years
    @Daenu Yeah, probably. Updated my answer to better highlight the correct solution.
  • Rahul Yadav
    Rahul Yadav almost 3 years
    can we add airbnb as well to the extends?