This page provides a comprehensive reference for all ESLint rules configured in the Airbnb JavaScript Style Guide packages. The configuration consists of hundreds of rules organized into functional categories, distributed across modular rule definition files in both eslint-config-airbnb-base and eslint-config-airbnb packages.
This reference covers the overall rule organization, severity levels, and configuration patterns. For detailed documentation of specific rule categories, see:
For information about the package architecture that contains these rules, see ESLint Package Architecture.
The rules are organized into separate JavaScript modules that export ESLint configuration objects. The base package provides foundational rules for any JavaScript project, while the React package extends these with library-specific rules.
The following diagram maps the file-based organization of rules across the two primary configuration packages as defined in their respective exports maps.
Sources: packages/eslint-config-airbnb-base/package.json10-17 packages/eslint-config-airbnb/package.json12-14
Each rule is configured with one of three severity levels. The Airbnb configuration uses a strict enforcement model where the majority of rules are set to error severity to ensure style guide compliance.
| Severity | ESLint Value | CI/CD Behavior | Use Case |
|---|---|---|---|
| Error | 'error' or 2 | Fails build/merge | Critical violations that must be fixed |
| Warning | 'warn' or 1 | Allows build/merge | Suggestions, deprecated patterns, or non-critical style |
| Off | 'off' or 0 | No enforcement | Disabled rules or future consideration |
Rules are defined using standard ESLint configuration syntax. While many rules are simple severity strings, many utilize complex option objects or arrays to fine-tune behavior. For example, the whitespace entry point specifically updates rules to support ESLint 8 and sets erroring rules to "warn" in specific contexts.
Sources: packages/eslint-config-airbnb/CHANGELOG.md17 packages/eslint-config-airbnb-base/CHANGELOG.md42
The rules are organized into functional categories based on the source files exported by the packages.
These rules form the foundation of the Airbnb style and are used in both React and non-React projects.
| Category | Configuration File | Documentation Page |
|---|---|---|
| Best Practices | rules/best-practices.js | Best Practices Rules |
| ES6+ Features | rules/es6.js | ES6+ Feature Rules |
| Style & Format | rules/style.js | Style and Formatting Rules |
| Import/Module | rules/imports.js | Import and Module Rules |
| Error Prevention | rules/errors.js | Error Prevention Rules |
Sources: packages/eslint-config-airbnb-base/package.json10-17
These rules are added when using the full eslint-config-airbnb package and require specific plugins.
| Category | Configuration File | Documentation Page |
|---|---|---|
| React Components | rules/react.js | React Component Rules |
| Accessibility | rules/react-a11y.js | React Accessibility Rules |
| Hooks | rules/react-hooks.js | React Component Rules |
Sources: packages/eslint-config-airbnb/package.json12-14
The following diagram bridges the "Natural Language" requirements of the style guide to the actual "Code Entities" (plugins and configuration files) used in the implementation.
Sources: packages/eslint-config-airbnb/package.json89-92 packages/eslint-config-airbnb-base/package.json84-85
The rules rely on several key ESLint plugins defined as peer dependencies in the package manifests. Version compatibility is strictly managed, such as the support for ESLint 8 and specific plugin versions.
eslint-plugin-import: Validates ES6+ imports and module resolution packages/eslint-config-airbnb-base/package.json84eslint-plugin-react: Core React linting patterns packages/eslint-config-airbnb/package.json91eslint-plugin-jsx-a11y: Accessibility checks for JSX packages/eslint-config-airbnb/package.json90eslint-plugin-react-hooks: Enforces Rules of Hooks packages/eslint-config-airbnb/package.json92The eslint-config-airbnb package directly depends on eslint-config-airbnb-base to inherit the core JavaScript rules before adding React-specific layers.
Sources: packages/eslint-config-airbnb/package.json69 packages/eslint-config-airbnb/package.json87-93 packages/eslint-config-airbnb-base/package.json82-85
Refresh this wiki