Philosophy
Every rule in the guide exists for a reason. Where it matters, each convention is accompanied by an explanation of why — not just what. This helps you understand the intent, so you can apply good judgment when edge cases arise. The guide takes a strong stance on ES6+ features. Modern JavaScript syntax — destructuring, arrow functions, template literals,const/let, modules — is not just permitted, it’s preferred. The goal is idiomatic, modern JavaScript.
This guide assumes you are using Babel and requires babel-preset-airbnb or the equivalent. It also assumes you are installing shims/polyfills in your app, with airbnb-browser-shims or the equivalent.
What’s covered
The style guide is organized into rule categories that span the full JavaScript language surface:Types and references
Primitive vs. complex types,
const over var, and when to use let.Objects and arrays
Object shorthand, computed property names, spread syntax, and array destructuring.
Functions
Default parameters, rest syntax, arrow functions, and avoiding the
arguments object.Classes and modules
ES6 class syntax,
import/export conventions, and module organization.Naming conventions
camelCase, PascalCase, SCREAMING_SNAKE_CASE — when to use each, and why.
Formatting
Whitespace, semicolons, commas, and consistent code structure.
ESLint packages
Reading the guide is one way to adopt these conventions. Enforcing them automatically is another. Airbnb publishes two ESLint configs that encode the rules from this guide directly into your linting pipeline:- eslint-config-airbnb — includes ECMAScript 6+ rules and React/JSX rules. Use this for React projects.
- eslint-config-airbnb-base — includes ECMAScript 6+ rules without React plugins. Use this for non-React projects.
Other style guides
This JavaScript guide is part of a broader family of Airbnb style guides:React / JSX
Style conventions for React components, JSX syntax, props, state, and hooks.
CSS-in-JavaScript
Conventions for styling components with CSS-in-JS libraries.