Registry / testing / eslint-plugin-babel

eslint-plugin-babel

JSON โ†’
library5.3.1jsnpmunverified

An ESLint plugin companion to babel-eslint that re-implements core ESLint rules to handle Babel experimental features such as decorators, optional chaining, class properties, do expressions, BigInt, and JSX fragment syntax. Version 5.3.1 is the latest stable release; it requires ESLint >=4.0.0 and Node >=4. The plugin replaces problematic built-in rules with Babel-aware versions to avoid false positives/negatives, and several older rules have been deprecated in favor of native ESLint rules or eslint-plugin-flowtype. It uses eslint-rule-composer for rule composition, is actively maintained, and supports autofix for some rules (marked with ๐Ÿ› ).

npm install eslint-plugin-babel
INSTALL
IMPORT
SIG ยท ESLINT-PLUGIN-BABE
E
eslint-plugin-babel
testingjavascriptv5.3.1
Install
โ€”
Import
โ€”
Disk
โ€”
Pass rate
0/ 6
Env Coverage0 / 6
glibc
18โ€“22
musl
18โ€“22
Install & Compatibility
Where this runs
tested against v? ยท npm install
Install ร— environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim ยท musl = Alpine Linux
musl
node 18โ€“226 runs
build_error
glibc
node 18โ€“226 runs
build_error
Code
Verified usage

Verified import paths โ€” ran on the pinned version, not inferred.

babel/new-cap
โœ“ // In .eslintrc: "rules": { "babel/new-cap": "error" }
โœ— // wrong: using core rule with Babel code - false positives on decorators
Replace core 'new-cap' with 'babel/new-cap' to ignore capitalized decorators.
babel/camelcase
โœ“ // In .eslintrc: "rules": { "babel/camelcase": "error" }
โœ— // wrong: core camelcase flags optional chaining like foo?.a_b
Supports optional chaining without false positives.
babel/no-invalid-this
โœ“ // In .eslintrc: "rules": { "babel/no-invalid-this": "error" }
โœ— // wrong: core no-invalid-this errors on class properties using this
Allows this inside class properties.
babel/semi
โœ“ // In .eslintrc: "rules": { "babel/semi": "error" }
โœ— // wrong: core semi fails on for await and class properties
Handles for-await and class properties; autofixable.
babel/object-curly-spacing
โœ“ // In .eslintrc: "rules": { "babel/object-curly-spacing": "error" }
โœ— // wrong: core object-curly-spacing complains on export x from 'mod'
Supports export x from and export * as x from; autofixable.

Shows installation, plugin setup, and rule configuration. Remember to disable the core versions of replaced rules.

npm install eslint-plugin-babel --save-dev // .eslintrc.json { "plugins": ["babel"], "rules": { "babel/new-cap": "error", "babel/camelcase": "error", "babel/no-invalid-this": "error", "babel/semi": "error" } } // Disable the original rules in your config if they conflict: { "rules": { "new-cap": "off", "camelcase": "off", "no-invalid-this": "off", "semi": "off" } }
Debug
Known issues
breakingv5.0.0 dropped support for ESLint <4.0.0 and Node <4. Use eslint-rule-composer for rules.
fix
Upgrade ESLint to >=4.0.0 and Node to >=4. Ensure eslint-rule-composer is installed.
affects: >=5.0.0
deprecatedRules babel/generator-star-spacing, babel/object-shorthand, babel/arrow-parens, babel/func-params-comma-dangle, babel/array-bracket-spacing, babel/flow-object-type, and babel/no-await-in-loop are deprecated.
fix
Use corresponding core ESLint rules (or eslint-plugin-flowtype for flow-object-type) as listed in the README.
affects: >=4.0.0
deprecatedbabel/no-await-in-loop was deprecated in v4.1.1 and removed in later versions.
fix
Use core ESLint rule no-await-in-loop (supported since ESLint 3.12.0).
affects: >=4.1.1
deprecatedbabel/flow-object-type was deprecated in v4.0.0. Use eslint-plugin-flowtype's object-type-delimiter rule instead.
fix
Install eslint-plugin-flowtype and use flowtype/object-type-delimiter.
affects: >=4.0.0
gotchaDo not enable both the core rule and the babel rule for the same rule name โ€” they will conflict.
fix
Disable the core rule (e.g., 'new-cap': 'off') when using the babel version.
affects: >=0.0.0
gotchaThe plugin does not automatically apply to all files; you must add the babel plugin to your ESLint config.
fix
Add '"plugins": ["babel"]' to your .eslintrc.
affects: >=0.0.0
Errors
Common errors & fixes
Error: Failed to load plugin 'babel': Cannot find module 'eslint-plugin-babel'
eslint-plugin-babel is not installed as a dev dependency.
fix
Run 'npm install eslint-plugin-babel --save-dev'
Error: ESLint configuration error: Unknown rule "babel/new-cap"
The 'babel' plugin is not listed in the 'plugins' section of your ESLint config.
fix
Add '"plugins": ["babel"]' to your .eslintrc.
Error: Cannot find module '@babel/eslint-parser' (or babel-eslint)
The plugin expects babel-eslint or @babel/eslint-parser as a parser, but it's missing.
fix
Install babel-eslint: 'npm install babel-eslint --save-dev' and set "parser": "babel-eslint" in your ESLint config.
Warning: Rule 'babel/flow-object-type' is deprecated
The rule was deprecated in favor of eslint-plugin-flowtype's object-type-delimiter.
fix
Replace 'babel/flow-object-type' with 'flowtype/object-type-delimiter' and install eslint-plugin-flowtype.
Upgrade
Version history
5.3.1latest on npm
Audit
Dependencies
eslint-rule-composerrequiredused internally to compose rules (since v5.0.0)
Agent activity
2 hits ยท last 30 days
node
2
Resources
eslint-plugin-babel โ€” npm install eslint-plugin-babel ยท libregistry