Lesson 3 / 25

ESLint Configuration Basics

Understand .eslintrc files and configuration options.

Configuration anatomy

.eslintrc.json contains env (runtime), extends (base config), rules (customizations), and parserOptions (language settings).

A complete config

This .eslintrc.json works for JavaScript projects with common rules enabled.

{
  "env": { "browser": true, "node": true, "es2021": true },
  "extends": ["eslint:recommended"],
  "parserOptions": { "ecmaVersion": "latest", "sourceType": "module" },
  "rules": {
    "no-unused-vars": "warn",
    "no-console": "warn",
    "semi": ["error", "always"]
  }
}

Output:

Configuration loaded successfully

Keep it DRY

Use extends to inherit from standard configurations (eslint:recommended, airbnb, google) instead of writing every rule manually.

Quick check

Quick check: What does 'extends' do in .eslintrc.json?

  • Inherits rule sets from a base configuration.
  • Adds extra files to lint.
  • Enables plugins.
Answer

Inherits rule sets from a base configuration. — 'extends' loads a predefined ruleset you can then customize with your own 'rules'.