Registry / devops / eslint-cjs-to-esm

eslint-cjs-to-esm

JSON →
library6.2.0jsnpmunverified

ESLint wrapper for migrating JavaScript/TypeScript projects from CommonJS (CJS) to ES Modules (ESM). Version 6.2.0. This tool bundles a set of ESLint rules (e.g., from eslint-plugin-import, eslint-plugin-node) with autofix support to automate the migration. Unlike manual ESLint configuration, it provides a zero-config CLI that wraps standard ESLint arguments. It is actively maintained and supports both .js and .ts file extensions. The tool is designed for one-time migration, not as a permanent linting setup.

npm install eslint-cjs-to-esm
INSTALL
IMPORT
SIG · ESLINT-CJS-TO-ESM
E
eslint-cjs-to-esm
devopsjavascriptv6.2.0
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

eslint-cjs-to-esm
npx eslint-cjs-to-esm [eslint args]
npx eslint-cjs-to-esm src/**/*.js
Always prefix globs with './'. The tool is a CLI, not a library; there is no programmatic API.

Run migration with autofix on all JS/TS files under src. Note the required './' prefix.

npx eslint-cjs-to-esm "./src/**/*.{js,ts}" --fix
Debug
Known issues
gotchaGlob patterns must start with './' (e.g., './src/**/*.js'). Using 'src/**/*.js' without './' will fail silently.
fix
Prefix your glob pattern with './'.
affects: *
breakingESLint v9+ dropped support for some legacy config formats. This tool may not work with ESLint v9 without adjustments.
fix
Ensure ESLint is v8.x or refer to the tool's peerDependencies.
affects: >=6.0.0
deprecatedThe bundled rule 'node/file-extension-in-import' is deprecated in eslint-plugin-node v12+.
fix
Use eslint-plugin-import's 'extensions' rule instead.
affects: >=5.0.0
gotchaThis tool is intended for migration only; running it repeatedly may produce unexpected results after initial migration.
fix
Use it once, then switch to standard ESLint config.
affects: *
Errors
Common errors & fixes
No files matching the pattern were found.
Glob pattern missing './' prefix, or pattern doesn't match any files.
fix
Use './src/**/*.{js,ts}' (with './').
TypeError: Cannot read properties of undefined (reading 'startsWith')
The tool encountered an invalid or missing glob pattern.
fix
Ensure the glob argument is a string starting with './'.
Upgrade
Version history
6.2.0latest on npm
Audit
Dependencies
eslintrequiredRuntime peer dependency; the tool wraps ESLint and reuses its CLI.
eslint-plugin-importrequiredBuilt-in rules for import/export syntax migration.
eslint-plugin-noderequiredBuilt-in rules for Node.js-specific CJS patterns.
eslint-plugin-file-extension-in-import-tsoptionalBuilt-in rules for file extension enforcement in import statements.
Agent activity
2 hits · last 30 days
node
2
Resources
eslint-cjs-to-esm — npm install eslint-cjs-to-esm · libregistry