{"id":19694,"library":"eslint-plugin-babel","title":"eslint-plugin-babel","description":"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 🛠).","status":"active","version":"5.3.1","language":"javascript","source_language":"en","source_url":"https://github.com/babel/eslint-plugin-babel","tags":["javascript","babel","eslint","eslintplugin","eslint-plugin","babel-eslint"],"install":[{"cmd":"npm install eslint-plugin-babel","lang":"bash","label":"npm"},{"cmd":"yarn add eslint-plugin-babel","lang":"bash","label":"yarn"},{"cmd":"pnpm add eslint-plugin-babel","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"used internally to compose rules (since v5.0.0)","package":"eslint-rule-composer","optional":false}],"imports":[{"note":"Replace core 'new-cap' with 'babel/new-cap' to ignore capitalized decorators.","wrong":"// wrong: using core rule with Babel code - false positives on decorators","symbol":"babel/new-cap","correct":"// In .eslintrc: \"rules\": { \"babel/new-cap\": \"error\" }"},{"note":"Supports optional chaining without false positives.","wrong":"// wrong: core camelcase flags optional chaining like foo?.a_b","symbol":"babel/camelcase","correct":"// In .eslintrc: \"rules\": { \"babel/camelcase\": \"error\" }"},{"note":"Allows this inside class properties.","wrong":"// wrong: core no-invalid-this errors on class properties using this","symbol":"babel/no-invalid-this","correct":"// In .eslintrc: \"rules\": { \"babel/no-invalid-this\": \"error\" }"},{"note":"Handles for-await and class properties; autofixable.","wrong":"// wrong: core semi fails on for await and class properties","symbol":"babel/semi","correct":"// In .eslintrc: \"rules\": { \"babel/semi\": \"error\" }"},{"note":"Supports export x from and export * as x from; autofixable.","wrong":"// wrong: core object-curly-spacing complains on export x from 'mod'","symbol":"babel/object-curly-spacing","correct":"// In .eslintrc: \"rules\": { \"babel/object-curly-spacing\": \"error\" }"}],"quickstart":{"code":"npm install eslint-plugin-babel --save-dev\n\n// .eslintrc.json\n{\n  \"plugins\": [\"babel\"],\n  \"rules\": {\n    \"babel/new-cap\": \"error\",\n    \"babel/camelcase\": \"error\",\n    \"babel/no-invalid-this\": \"error\",\n    \"babel/semi\": \"error\"\n  }\n}\n\n// Disable the original rules in your config if they conflict:\n{\n  \"rules\": {\n    \"new-cap\": \"off\",\n    \"camelcase\": \"off\",\n    \"no-invalid-this\": \"off\",\n    \"semi\": \"off\"\n  }\n}","lang":"json","description":"Shows installation, plugin setup, and rule configuration. Remember to disable the core versions of replaced rules."},"warnings":[{"fix":"Upgrade ESLint to >=4.0.0 and Node to >=4. Ensure eslint-rule-composer is installed.","message":"v5.0.0 dropped support for ESLint <4.0.0 and Node <4. Use eslint-rule-composer for rules.","severity":"breaking","affected_versions":">=5.0.0"},{"fix":"Use corresponding core ESLint rules (or eslint-plugin-flowtype for flow-object-type) as listed in the README.","message":"Rules 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.","severity":"deprecated","affected_versions":">=4.0.0"},{"fix":"Use core ESLint rule no-await-in-loop (supported since ESLint 3.12.0).","message":"babel/no-await-in-loop was deprecated in v4.1.1 and removed in later versions.","severity":"deprecated","affected_versions":">=4.1.1"},{"fix":"Install eslint-plugin-flowtype and use flowtype/object-type-delimiter.","message":"babel/flow-object-type was deprecated in v4.0.0. Use eslint-plugin-flowtype's object-type-delimiter rule instead.","severity":"deprecated","affected_versions":">=4.0.0"},{"fix":"Disable the core rule (e.g., 'new-cap': 'off') when using the babel version.","message":"Do not enable both the core rule and the babel rule for the same rule name — they will conflict.","severity":"gotcha","affected_versions":">=0.0.0"},{"fix":"Add '\"plugins\": [\"babel\"]' to your .eslintrc.","message":"The plugin does not automatically apply to all files; you must add the babel plugin to your ESLint config.","severity":"gotcha","affected_versions":">=0.0.0"}],"env_vars":null,"last_verified":"2026-04-25T00:00:00.000Z","next_check":"2026-07-24T00:00:00.000Z","problems":[{"fix":"Run 'npm install eslint-plugin-babel --save-dev'","cause":"eslint-plugin-babel is not installed as a dev dependency.","error":"Error: Failed to load plugin 'babel': Cannot find module 'eslint-plugin-babel'"},{"fix":"Add '\"plugins\": [\"babel\"]' to your .eslintrc.","cause":"The 'babel' plugin is not listed in the 'plugins' section of your ESLint config.","error":"Error: ESLint configuration error: Unknown rule \"babel/new-cap\""},{"fix":"Install babel-eslint: 'npm install babel-eslint --save-dev' and set \"parser\": \"babel-eslint\" in your ESLint config.","cause":"The plugin expects babel-eslint or @babel/eslint-parser as a parser, but it's missing.","error":"Error: Cannot find module '@babel/eslint-parser' (or babel-eslint)"},{"fix":"Replace 'babel/flow-object-type' with 'flowtype/object-type-delimiter' and install eslint-plugin-flowtype.","cause":"The rule was deprecated in favor of eslint-plugin-flowtype's object-type-delimiter.","error":"Warning: Rule 'babel/flow-object-type' is deprecated"}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}