Course contentsShow
← JavaScript
Lesson 2568 of 2,72352. Linting and FormattingFree lesson

Using Shareable Configs with 'extends'

Learn how to extend popular configs like eslint:recommended, airbnb, or standard to inherit rule sets.

Using Shareable Configs with 'extends'

You'll learn how to inherit battle-tested rule sets from popular ESLint configurations instead of defining hundreds of rules yourself.

The Core Idea

Think of ESLint shareable configs like recipe collections from master chefs. Instead of deciding every single ingredient and technique yourself, you can say "I want to cook Italian-style" and inherit all those established practices at once. The extends field in your ESLint configuration lets you pull in entire rule sets that teams have refined over years.

Popular Shareable Configs

The most widely-used configurations include:

  • eslint:recommended — ESLint's built-in baseline that catches common errors
  • airbnb (or airbnb-base for non-React) — Airbnb's comprehensive style guide
  • standard — The "JavaScript Standard Style" with no semicolons

How It Works

In your .eslintrc file, use the extends field:

{
  "extends": "eslint:recommended"
}

Or extend multiple configs (they cascade in order):

{
  "extends": [
    "eslint:recommended",
    "airbnb-base"
  ]
}

Later configs override earlier ones. You can still add your own rules afterward to customize further:

{
  "extends": "eslint:recommended",
  "rules": {
    "no-console": "off"  // Override one specific rule
  }
}

Why This Matters

Shareable configs save you from manually enabling 200+ rules. They represent community consensus on best practices, keep your codebase consistent with industry standards, and make onboarding new developers easier ("we follow Airbnb style").

Key Takeaway: Use extends to inherit entire rule sets from popular configurations like eslint:recommended or airbnb, giving you professional-grade linting without reinventing the wheel.