eslint-config-fbjs
raw JSON → 4.0.0 verified Sat Apr 25 auth: no javascript
eslint-config-fbjs is an ESLint shareable config that mirrors Facebook's internal linting rules. Current stable version: 4.0.0. Released infrequently, this package provides a base configuration for JavaScript and React projects, with strict and non-strict variants. It requires peer dependencies: eslint 8.x, hermes-eslint, and plugins for babel, ft-flow, jsx-a11y, and react. Unlike many other configs, it purposely omits Facebook-specific custom rules and project-specific overrides, making it a lightweight starting point. Key differentiator: direct alignment with Facebook's open-source linting standards.
Common errors
error Error: Failed to load plugin 'babel' declared in 'fbjs': Cannot find module 'eslint-plugin-babel' ↓
cause Missing peer dependency
fix
npm install --save-dev eslint-plugin-babel
error Error: Failed to load config 'fbjs' to extend from. ↓
cause Missing eslint-config-fbjs module
fix
npm install --save-dev eslint-config-fbjs
error ESLint couldn't find the config "fbjs/strict". Check that the name of the config is correct. ↓
cause Outdated package version (<3.0.0) that does not export 'fbjs/strict'
fix
Upgrade to eslint-config-fbjs@>=3.0.0
Warnings
breaking Version 2.x dropped support for ESLint <6. Upgrade ESLint if using older versions. ↓
fix Update ESLint to >=6.0.0 and run npm install --save-dev eslint@^6
deprecated The 'strict' config is now built-in; manual overrides to turn warnings to errors are unnecessary. ↓
fix Use extends: 'fbjs/strict' instead of custom rules overrides
breaking Peer dependency hermes-eslint added in v4.0.0. Failing to install it causes eslint to fail. ↓
fix Run npm install --save-dev hermes-eslint@>=0.8.0
gotcha Internal custom rules are not present in this config. Do not expect Facebook-specific rules to work. ↓
fix Add custom rules via plugins or overrides in your .eslintrc
gotcha This config uses eslint-plugin-ft-flow for Flow type linting; it does not support eslint-plugin-flowtype. ↓
fix Use eslint-plugin-ft-flow instead of deprecated eslint-plugin-flowtype
Install
npm install eslint-config-fbjs yarn add eslint-config-fbjs pnpm add eslint-config-fbjs Imports
- eslint-config-fbjs wrong
extends: ['eslint-config-fbjs']correctextends: ['fbjs'] - eslint-config-fbjs/strict wrong
extends: ['fbjs'] with overridescorrectextends: ['fbjs/strict'] - Plugin: babel wrong
plugins: ['eslint-plugin-babel']correctplugins: ['babel']
Quickstart
// Install dev dependencies
npm install --save-dev eslint-config-fbjs eslint-plugin-babel eslint-plugin-ft-flow eslint-plugin-jsx-a11y eslint-plugin-react eslint hermes-eslint
// Create .eslintrc.json
{
"extends": "fbjs",
"plugins": ["babel", "ft-flow", "jsx-a11y", "react"],
"rules": {
"react/jsx-uses-vars": "error"
}
}
// Lint a file
npx eslint src/**/*.js