Prettier Airbnb Config
raw JSON → 1.0.0 verified Sat Apr 25 auth: no javascript maintenance
A Prettier configuration package that translates the Airbnb JavaScript style guide into Prettier options. Version 1.0.0 is the only release; no updates or new releases since its initial publication. It provides a ready-to-use set of Prettier rules covering quotes, trailing commas, semicolons, bracket spacing, arrow parentheses, and JSX settings, aligning with common Airbnb style conventions. Unlike other configs that may be more opinionated or regularly updated, this package is a simple snapshot of Airbnb's style from that time and does not keep pace with Prettier or Airbnb guideline changes. It requires Prettier 1.18.2 as a peer dependency.
Common errors
error Cannot find module 'prettier-airbnb-config' ↓
cause The package is not installed or not in node_modules.
fix
Run: npm install prettier-airbnb-config --save-dev
error Cannot read property 'ars' of undefined ↓
cause Using import statement instead of require() in .prettierrc.js.
fix
Change to: const config = require('prettier-airbnb-config');
error Invalid configuration file: "prettierAirbnbConfig" is not allowed ↓
cause Using the package name as a key in .prettierrc.json incorrectly.
fix
Set the 'prettier' key in package.json to the string "prettier-airbnb-config" or use a .prettierrc.js with module.exports = require('prettier-airbnb-config');
error Parsing error: Unexpected token => ↓
cause Prettier 1.x with arrowParens: 'avoid' may cause syntax errors in some cases.
fix
Set arrowParens to 'always' or upgrade to a newer Prettier config.
Warnings
breaking The package is based on Prettier 1.x. Using with Prettier 2.x or higher may cause unexpected behavior or deprecation warnings. ↓
fix Upgrade to a maintained Prettier config or manually update your Prettier config to remove deprecated options.
gotcha The 'arrowParens' is set to 'avoid', which was deprecated in Prettier 2.0. In Prettier 2+, the default was changed to 'always', and 'avoid' may be removed in a future version. ↓
fix If using Prettier 2+, set arrowParens to 'always' or consider using a different config.
deprecated The 'jsxBracketSameLine' option is deprecated in Prettier 2.0+ in favor of 'bracketSameLine'. ↓
fix Replace 'jsxBracketSameLine' with 'bracketSameLine' in your config.
gotcha This config sets 'bracketSpacing' to false, which may conflict with other tools like ESLint's object-curly-spacing rule. ↓
fix Ensure your ESLint rule for object-curly-spacing matches Prettier's setting to avoid inconsistencies.
breaking The package is no longer maintained. It does not reflect the latest Airbnb style guide updates (e.g., Airbnb now recommends arrowParens: 'always'). ↓
fix Use a community-maintained alternative like @trivago/prettier-plugin-sort-imports or adjust settings manually.
Install
npm install prettier-airbnb-config yarn add prettier-airbnb-config pnpm add prettier-airbnb-config Imports
- prettier-airbnb-config wrong
require('prettier-airbnb-config') directly in codecorrectIn package.json: "prettier": "prettier-airbnb-config" - Default config export wrong
import prettierAirbnbConfig from 'prettier-airbnb-config';correctmodule.exports = { ...require('prettier-airbnb-config'), printWidth: 120 }; - Config file string wrong
["prettier-airbnb-config"]correct"prettier-airbnb-config" in .prettierrc.json
Quickstart
// Install
npm install prettier prettier-airbnb-config --save-dev
// In package.json:
{
"name": "my-project",
"version": "1.0.0",
"prettier": "prettier-airbnb-config"
}
// Or create .prettierrc.js:
module.exports = {
...require('prettier-airbnb-config'),
printWidth: 120
};