eslint-config-airbnb-base
raw JSON → 15.0.0 verified Sat Apr 25 auth: no javascript
Airbnb's base ESLint config (without React) for enforcing consistent JavaScript style, version 15.0.0. Provides two configs: 'airbnb-base' for ES6+ and 'airbnb-base/legacy' for ES5 and below. Requires peer dependencies eslint ^7.32.0 || ^8.2.0 and eslint-plugin-import ^2.25.2. Actively maintained as part of the Airbnb JavaScript style guide. Differentiators: widely adopted, opinionated ruleset, and explicit support for legacy environments.
Common errors
error ESLint couldn't find the config 'airbnb-base'. ↓
cause Package not installed or missing peer dependencies.
fix
Run npx install-peerdeps --dev eslint-config-airbnb-base.
error Rule 'import/no-unresolved' threw a fatal error. ↓
cause Missing eslint-plugin-import peer dependency.
fix
npm install --save-dev eslint-plugin-import@^2.25.2.
Warnings
breaking Version 15.0.0 requires eslint ^7.32.0 || ^8.2.0. Older eslint versions will not work. ↓
fix Update eslint to ^7.32.0 or ^8.2.0.
breaking Version 15.0.0 requires eslint-plugin-import ^2.25.2. Older versions may cause rule failures. ↓
fix Update eslint-plugin-import to ^2.25.2.
gotcha Do not install this package globally. It must be installed locally in your project. ↓
fix Install locally with --save-dev.
gotcha The config assumes ES6+ by default. For ES5, use airbnb-base/legacy. ↓
fix Use extends: 'airbnb-base/legacy' for ES5 projects.
Install
npm install eslint-config-airbnb-base yarn add eslint-config-airbnb-base pnpm add eslint-config-airbnb-base Imports
- eslint-config-airbnb-base wrong
Using require or import directly (not a module, it's a config)correctAdd "extends": "airbnb-base" to .eslintrc - eslint-config-airbnb-base/legacy wrong
Extending as 'airbnb-base-legacy'correctAdd "extends": "airbnb-base/legacy" to .eslintrc - eslint-config-airbnb-base/whitespace wrong
No common mistakecorrectAdd "extends": "airbnb-base/whitespace" to .eslintrc
Quickstart
// Install peer dependencies and the config
npx install-peerdeps --dev eslint-config-airbnb-base
// .eslintrc.json
{ "extends": "airbnb-base" }
// Example file to lint (test.js)
const foo = 1;
console.log(foo);
// Run ESLint
npx eslint test.js