Course contentsShow
← Web Development
Lesson 1429 of 2,98226. Code Quality ToolsFree lesson

Extending Configurations

Using extends to inherit from popular configs like eslint:recommended and community presets.

Extending Configurations

You'll learn how to inherit sensible defaults and community-tested rules using ESLint's extends feature instead of writing every rule from scratch.

The Core Idea

Writing hundreds of linting rules by hand would be tedious and error-prone. Instead, ESLint lets you extend existing configurations—pre-packaged collections of rules that experts have already assembled. Think of it like inheriting traits: rather than defining every characteristic yourself, you start with a strong foundation and customize only what you need.

The extends property in your .eslintrc file accepts one or more configuration names. These configs can be:

  • Built-in presets like "eslint:recommended" (the official starter set)
  • Community packages like "eslint-config-airbnb" or "eslint-config-standard"
  • Plugin configs from libraries you've installed

How It Works

{
  "extends": "eslint:recommended",
  "rules": {
    "semi": ["error", "always"]
  }
}

Here, you inherit all the rules from eslint:recommended, then override or add specific rules. You can extend multiple configs as an array:

{
  "extends": ["eslint:recommended", "eslint:recommended/node"],
  "rules": {}
}

Later configs in the array override earlier ones if there are conflicts—order matters.

Why This Matters

Starting with eslint:recommended gives you solid error-prevention rules instantly. Community configs like Airbnb's style guide save you from debating code style internally—you adopt battle-tested conventions used by thousands of developers.

Key Takeaway: Use extends to inherit curated rule sets rather than configuring ESLint from zero; start with "eslint:recommended" and layer on community presets to match your team's style preferences.