Skip to content

Airbnb JavaScript Style Guide

A widely used style guide with rules and ESLint configs for writing consistent JavaScript.airbnb/javascript

Stars
148k
Forks
26.5k
Licence
MIT
Language
JavaScript
Last update
7 months ago
Type
Learning resource

What it is

This is a written style guide for JavaScript, covering how to name things, format code, and use modern language features. Each rule is paired with examples of 'bad' and 'good' code and often a short explanation of why. The README also points to ESLint configs (eslint-config-airbnb and eslint-config-airbnb-base) that automatically enforce many of these rules in a project.

  • Set up ESLint with the Airbnb config so a project's code is checked against the guide's rules
  • Look up the recommended way to declare variables, such as preferring const over var
  • Use the examples as a reference during code review to keep naming and formatting consistent
  • Learn modern JavaScript conventions like object shorthand and computed property names

Great for

  • Teams that want one shared JavaScript style without debating every rule
  • Developers who want a documented set of modern JavaScript conventions
  • Projects that already use ESLint and want a ready-made rule set
  • Developers learning ES2015+ syntax who want clear examples

Not ideal for

  • Projects that already follow a different established style and do not want to change, since adopting it means many edits
  • Developers who need a guide for CSS, React, or Ruby specifically, since those are separate guides linked from the README
  • Teams targeting environments where the README's Babel and polyfill assumptions do not hold, since the guide assumes those tools are in use
Step-by-step guide: how to use Airbnb JavaScript Style GuideInstall, first run, examples, tips and FAQs

How to get it

  1. 1

    See the README

    You'll need: Node.js (required if using the ESLint configs; version not stated in the provided README)

    Clone the repository

    git clone https://github.com/airbnb/javascript.git
  2. 2

    Run it

    • Read the Types and References sections to see the style rules and examples
    • Decide whether to adopt the guide as-is or only parts of it
    • To enforce the rules, install the ESLint config named in the README (eslint-config-airbnb or eslint-config-airbnb-base) following its own documentation
    • Run ESLint on your code to see which rules it flags
  3. 3

    Get the most out of it

    • Use the eslint links next to each rule to find the matching ESLint rule for automatic checking
    • Read the 'Why?' explanations to understand the reasoning behind a rule before overriding it
    • Check the React, CSS-in-JavaScript, and CSS & Sass guides linked in the README if your project uses those technologies

Downloads

Strengths

  • Widely adopted, with rules that are explained with examples
  • Maps many rules to specific ESLint rules, so enforcement can be automated
  • Covers a broad range of topics, from types and naming to testing and performance

Trade-offs

  • It is opinionated; some rules are subjective and not every team will agree with them
  • The README assumes Babel and polyfill tooling, which adds setup for projects that do not use them
  • The README excerpt provided is truncated, so the full scope of later sections could not be verified here

How it compares

ProjectStarsTypeLevelUpdatedBest for
javascript (this)148kLearning resourcebeginner7 months agoTeams that want one shared JavaScript style without debating every rule
prettier52.4kDev toolbeginner4 days agoTeams that want one shared code style without writing their own rules
standard29.4kDev toolbeginner1.3 years agoJavaScript projects where the team wants consistent style without debating rules
ruff50.4kCLIbeginner4 days agoPython developers who want one tool for linting and formatting
babel44.1kDev toolintermediate4 days agoWeb developers who want to use recent JavaScript syntax while still supporting older browsers
core-js25.5kLibraryintermediate4 days agoWeb developers who must support older browsers or engines that lack modern JavaScript features

Stats synced from GitHub. The assessment above was drafted with AI from the project's README on 2026-10-29 and may miss recent changes — check the README before relying on a command. MIT licence: free to use, modify and distribute, including commercially, as long as you keep the copyright notice.