TopGit
GitHub Repo Review

Airbnb JavaScript Style Guide: Coding Conventions

airbnb/javascript
ATopGit review image for airbnb/javascript
Review by Topgit.dev for airbnb/javascript, with GitHub repository stats and README context.
Quick verdict

Airbnb JavaScript Style Guide is a set of JavaScript coding conventions Airbnb publishes with a matching ESLint rule for almost every guideline. Reach for it for a documented, lint-enforceable baseline on const/let, object and array literals, destructuring, and strings instead of relitigating style in every pull request. Skip it if your team already has a working convention, like Standard, and doesn't want to redo tooling to match a different one.

Stars
โ˜… 148.0k
Forks
โ‘‚ 26.5k
Contributors
๐Ÿ‘ฅ 564
Language
JavaScript
License
MIT
Topic
Frontend
Updated
Apr 2026
Homepage
โ€”

Understanding the Airbnb JavaScript Style Guide

Airbnb JavaScript Style Guide is a public reference of JavaScript coding conventions in the airbnb/javascript GitHub repository, spanning types, references, objects, arrays, destructuring, strings, and functions. Each guideline pairs a short rationale with bad-versus-good code samples, and many map to a named ESLint rule such as prefer-const or object-shorthand. It assumes Babel and links companion guides for React and CSS-in-JavaScript.

Key Principles and Coding Conventions

  • โœ“Requires const for anything not reassigned and let for anything that is, banning var outright and citing the prefer-const and no-var ESLint rules.
  • โœ“Treats let and const as block-scoped and var as function-scoped, with a code sample showing the ReferenceError that results from getting this wrong.
  • โœ“Favors literal syntax over constructors: {} instead of new Object(), and [] instead of new Array(), each tied to its own ESLint rule.
  • โœ“Uses object spread ({ ...original, c: 3 }) instead of Object.assign for shallow copies, since Object.assign on an existing object mutates it.
  • โœ“Requires object destructuring for accessing multiple properties and for multiple function return values, backed by the prefer-destructuring rule.
  • โœ“Converts iterables to arrays with spread (...foo) but switches to Array.from(foo, bar) specifically when mapping, to avoid an intermediate array.
  • โœ“Standardizes on single-quoted strings and template literals for concatenation, and bans eval() outright.
  • โœ“Requires named function expressions instead of anonymous ones or hoisted declarations, and wraps IIFEs in parentheses per the wrap-iife rule.
How this repository's GitHub stars have grown over time. Source: star-history.com.View the star history โ†—

Who Benefits From This Style Guide?

Airbnb JavaScript Style Guide suits a team that already uses Babel and ESLint and wants a documented, rule-by-rule baseline instead of writing conventions from scratch. The const/let/var section alone settles a debate most teams handle informally. It's less useful for a solo project or a team happy with its current linter config, since adopting it means reconciling every existing rule against Airbnb's own choices.

Strengths

  • โœ“Nearly every rule cites the exact ESLint rule name that enforces it: prefer-const, no-array-constructor, prefer-object-spread, quotes, no-eval. That makes it wireable into CI, not just a document to reread.
  • โœ“Rules show bad, good, and sometimes best code side by side instead of describing the change in prose.
  • โœ“Most guidelines include a short 'Why?' explaining the tradeoff, like why destructuring beats repeated property access.
  • โœ“Companion guides for React and CSS-in-JavaScript extend the same conventions into adjacent parts of a typical frontend stack.
  • โœ“MIT licensed, so copying rules or the whole document into an internal handbook carries no license friction.

Considerations and Requirements

  • โ–ณThe guide assumes a Babel-based build (babel-preset-airbnb or equivalent) plus shim/polyfill packages, so it's not a drop-in reference for a project without that toolchain.
  • โ–ณIts table of contents runs to several dozen sections beyond what's covered here (Classes, Modules, Naming Conventions, Comments, and more), so adopting it fully is a bigger lift than the object/array/string rules alone suggest.
  • โ–ณIt documents Airbnb's own house style, not a neutral spec, so teams already standardized on a different convention face a rewrite to switch.
  • โ–ณNo version number or last-updated date appears in the facts available here, so there's no way to tell how current a given section is from the repo metadata alone.
  • โ–ณInstall and everyday usage aren't spelled out as a getting-started section. The README works as a per-rule reference, not a walkthrough of adopting the guide end to end.

Other Popular JavaScript Style Guides

Frequently Asked Questions

What JavaScript versions does the Airbnb style guide support?

Airbnb JavaScript Style Guide targets modern ECMAScript, reflected in repo topics like es2015 through es2018, es6, and tc39, and its rules assume a Babel-compiled build rather than raw ES5 execution.

Does the Airbnb style guide require specific tools like Babel or ESLint?

Airbnb JavaScript Style Guide's README says it assumes Babel and requires babel-preset-airbnb (or an equivalent) plus shims from airbnb-browser-shims, and most rules cite a specific ESLint rule that enforces them.

Can the Airbnb JavaScript style guide be used with React projects?

Airbnb JavaScript Style Guide's repository lists a companion React guide under its Other Style Guides section (react/), meant to extend the same conventions into React-specific code.

What license is the Airbnb JavaScript Style Guide released under?

Airbnb JavaScript Style Guide is released under the MIT license, according to the airbnb/javascript repository's license metadata.

Are there translated versions of the Airbnb JavaScript Style Guide available?

Airbnb JavaScript Style Guide's README says translations into other languages exist and links out to a dedicated Translation section, though the specific language list isn't detailed in the excerpt reviewed here.

What are the core principles behind the Airbnb JavaScript Style Guide?

Airbnb JavaScript Style Guide favors block-scoped const and let over var, literal syntax over constructors like new Object() or new Array(), destructuring over repeated property access, and named function expressions over anonymous ones, pairing most rules with a specific ESLint rule.

Best use cases

  • โ€ขBootstrapping a new team's ESLint config by adopting Airbnb's named rules (prefer-const, no-var, object-shorthand, quotes) as a starting rule set.
  • โ€ขSettling recurring code-review arguments over const/let/var, quote style, or Object.assign versus spread by pointing to a documented, shared rule.
  • โ€ขTeaching a developer new to ES6+ syntax using the guide's paired bad/good code examples for destructuring, template literals, and spread.
  • โ€ขExtending the same conventions into a React codebase through the companion React guide the repo links under Other Style Guides.
  • โ€ขAuditing an existing JavaScript codebase's object, array, and string handling against a documented outside reference instead of team folklore.

Related repositories

Source & attribution

Facts and quotes sourced from the airbnb/javascript GitHub repository and its README.

GitHub data ยท last synced Aug 14, 2026Reviewed by Henry
โ† Back to TopGit

Want a second opinion on javascript?

Ask an AI that can read this page โ€” one click and you get its take on javascript.

GitHub