eslint-config-babel
raw JSON → 9.0.0 verified Sat Apr 25 auth: no javascript maintenance
ESLint configuration preset for Babel's own codebase. Version 9.0.0 last updated 2021. Not actively maintained; the Babel team now uses @babel/eslint-plugin. This config enforces strict formatting and is primarily intended for internal Babel projects, not general use. Requires babel-eslint and eslint-plugin-flowtype as peer dependencies. Replaced by @babel/eslint-config in Babel 7.12+.
Common errors
error Error: Failed to load plugin 'flowtype' declared in 'node_modules/eslint-config-babel/index.js': Cannot find module 'eslint-plugin-flowtype' ↓
cause Missing required peer dependency eslint-plugin-flowtype.
fix
npm install --save-dev eslint-plugin-flowtype@^3.0.0
error Error: Cannot find module 'babel-eslint' ↓
cause Missing required peer dependency babel-eslint.
fix
npm install --save-dev babel-eslint@^10.0.0
error Warning: eslint-config-babel is deprecated. Use @babel/eslint-config instead. ↓
cause Package is no longer maintained.
fix
Migrate to @babel/eslint-config as recommended.
Warnings
deprecated eslint-config-babel is no longer actively maintained; use @babel/eslint-config instead. ↓
fix Switch to @babel/eslint-config and uninstall eslint-config-babel.
breaking Version 9.0.0 requires babel-eslint ^10.0.0 || ^11.0.0-0 – version 12+ incompatible. ↓
fix Downgrade babel-eslint to v10 or v11, or migrate to @babel/eslint-parser.
gotcha The config expects eslint-plugin-flowtype v3; install it as a devDependency. ↓
fix Run: npm install --save-dev eslint-plugin-flowtype@^3.0.0
Install
npm install eslint-config-babel yarn add eslint-config-babel pnpm add eslint-config-babel Imports
- default config wrong
module.exports = { extends: ['eslint-config-babel'] }correctmodule.exports = { extends: ['babel'] } - babel (ESM) wrong
import { babel } from 'eslint-config-babel'correctimport babel from 'eslint-config-babel'; export default { extends: ['babel'] } - require (CommonJS) wrong
const { babel } = require('eslint-config-babel')correctconst babel = require('eslint-config-babel'); module.exports = { extends: ['babel'] }
Quickstart
// .eslintrc.js
module.exports = {
extends: ['babel'],
parserOptions: {
ecmaFeatures: { jsx: true },
},
env: {
es6: true,
node: true,
},
plugins: ['flowtype'],
rules: {
'flowtype/define-flow-type': 'warn',
},
};