canirequire

canirequireCommonJS › eslint-plugin-babel

Is eslint-plugin-babel ESM-only? Can you require() it?

an eslint rule plugin companion to babel-eslint

Last verified Sep 9, 2026 against eslint-plugin-babel@5.3.1. JSON

CommonJS CommonJS — require() works on every Node.js version

eslint-plugin-babel ships CommonJS only. require("eslint-plugin-babel") works everywhere. import "eslint-plugin-babel" also works because Node.js and Bun can import CommonJS from ES modules, but only the default export is guaranteed; named imports depend on Node's static analysis of the module.

Latest
5.3.1 (Jun 30, 2020)
Module format
CommonJS
Last CommonJS version
5.3.1
TypeScript types
None
Node engines
>=4
Weekly downloads
531K
License
MIT

Does eslint-plugin-babel@5.3.1 actually load? Runtime test results

Installed and executed on Sep 9, 2026 with require("eslint-plugin-babel") from a CommonJS file and import "eslint-plugin-babel" from an ES module.

Runtimerequire("eslint-plugin-babel")import "eslint-plugin-babel"
Node.js 18✗ failsTypeError✗ failsTypeError
Node.js 20✗ failsTypeError✗ failsTypeError
Node.js 22✗ failsTypeError✗ failsTypeError
Node.js 24✗ failsTypeError✗ failsTypeError
Node.js 26✗ failsTypeError✗ failsTypeError
Bun 1.4✗ failsTypeError✗ failsTypeError

A failing require() on a CommonJS package usually means the package needs a browser/DOM global, a peer dependency, or a native binary that is not available in a bare Node.js process.

How to import eslint-plugin-babel

ES modules (import)

import eslintPluginBabel from "eslint-plugin-babel";

Named imports from a CommonJS package only work when Node.js can statically detect them. If a named import fails, use the default import and destructure.

CommonJS (require)

const eslintPluginBabel = require("eslint-plugin-babel");

Module format by version

Derived from the type, main and exports fields of every stable release on npm (22 versions; the newest 22 shown).

VersionsFormatFirst published
1.0.0 – 5.3.1CommonJSJun 19, 2015

Frequently asked

Is eslint-plugin-babel ESM-only?

eslint-plugin-babel@5.3.1 is a CommonJS package. eslint-plugin-babel ships CommonJS only. require("eslint-plugin-babel") works everywhere. import "eslint-plugin-babel" also works because Node.js and Bun can import CommonJS from ES modules, but only the default export is guaranteed; named imports depend on Node's static analysis of the module.

Can I import eslint-plugin-babel with ES module syntax?

Yes. import eslintPluginBabel from "eslint-plugin-babel" works in Node.js and Bun because they support importing CommonJS modules. Named imports work only when Node.js can statically detect the exports.

Does eslint-plugin-babel work in Bun?

Importing eslint-plugin-babel failed in Bun 1.4 on Sep 9, 2026: TypeError: new eslint.Linter().getRules is not a function. (In 'new eslint.Linter().getRules()', 'new eslint.Linter().getRules' is undefined)

Does eslint-plugin-babel ship TypeScript types?

No. eslint-plugin-babel ships no type declarations and there is no @types package for it.

Links

Other commonjs packages

Similar popularity