Skip to main content
Both packages require you to install peer dependencies alongside the config itself. The easiest way to do this is with npx install-peerdeps.

Install eslint-config-airbnb (with React)

1

Install the package and its peer dependencies

The quickest approach uses install-peerdeps, which resolves and installs all required peer packages in a single command.
npx install-peerdeps --dev eslint-config-airbnb
If you prefer to install manually, run npm info "eslint-config-airbnb@latest" peerDependencies to list each package and version, then install them individually.
The command installs:
  • eslint-config-airbnb
  • eslint
  • eslint-plugin-import
  • eslint-plugin-react
  • eslint-plugin-react-hooks
  • eslint-plugin-jsx-a11y
2

Extend the config in your .eslintrc

Add "extends": "airbnb" to your ESLint configuration file.
.eslintrc.json
{
  "extends": "airbnb"
}
Or in YAML format:
.eslintrc.yml
extends: airbnb
3

Enable React Hooks rules (optional)

The default entry point does not enable the hooks plugin rules. To enable them, add "airbnb/hooks" to your extends array.
.eslintrc.json
{
  "extends": ["airbnb", "airbnb/hooks"]
}
Hooks rules require React 16.8 or later.

Install eslint-config-airbnb-base (without React)

1

Install the package and its peer dependencies

npx install-peerdeps --dev eslint-config-airbnb-base
The command installs:
  • eslint-config-airbnb-base
  • eslint
  • eslint-plugin-import
2

Extend the config in your .eslintrc

.eslintrc.json
{
  "extends": "airbnb-base"
}

Configuration examples

Custom rules on top of the base config

You can override or extend any rule after extending the shared config.
.eslintrc.json
{
  "extends": "airbnb-base",
  "rules": {
    "no-console": "warn",
    "import/prefer-default-export": "off"
  }
}

React project with hooks and TypeScript parser

.eslintrc.json
{
  "extends": [
    "airbnb",
    "airbnb/hooks"
  ],
  "parser": "@typescript-eslint/parser",
  "parserOptions": {
    "ecmaVersion": 2021,
    "sourceType": "module",
    "ecmaFeatures": {
      "jsx": true
    }
  }
}

ES5 / legacy JavaScript

Use the airbnb-base/legacy entry point for projects that do not use ES6+.
.eslintrc.json
{
  "extends": "airbnb-base/legacy"
}

Whitespace-only mode

Both packages expose a /whitespace entry point that errors only on whitespace rules and downgrades all other rules to warnings. This is useful for incremental adoption.
.eslintrc.json
{
  "extends": "airbnb/whitespace"
}
Or for the base package:
.eslintrc.json
{
  "extends": "airbnb-base/whitespace"
}
The airbnb/base and airbnb/legacy entry points on eslint-config-airbnb are deprecated. Use eslint-config-airbnb-base directly instead.

Build docs developers (and LLMs) love