{"id":20005,"library":"eslint-transforms","title":"eslint-transforms","description":"A collection of jscodeshift-based codemods for automating ESLint rule upgrades across major versions. Current stable version is 3.0.0, released June 2024. Active development with recent transforms for ESLint v9 migration. Key differentiator: provides automated transforms for rule format changes (new-rule-format, v9-rule-migration) that would otherwise require manual refactoring. Requires Node >=20 and jscodeshift as a peer dependency. Alternative to manual upgrading or using ESLint's built-in migration tools.","status":"active","version":"3.0.0","language":"javascript","source_language":"en","source_url":"https://github.com/eslint/eslint-transforms","tags":["javascript","eslint","jscodeshift"],"install":[{"cmd":"npm install eslint-transforms","lang":"bash","label":"npm"},{"cmd":"yarn add eslint-transforms","lang":"bash","label":"yarn"},{"cmd":"pnpm add eslint-transforms","lang":"bash","label":"pnpm"}],"dependencies":[],"imports":[{"note":"CLI is the primary usage; no JavaScript import needed. Use npx for direct execution.","wrong":"npm run eslint-transforms (unless configured in package.json)","symbol":"eslint-transforms CLI","correct":"npx eslint-transforms <transform-name> <path>"},{"note":"Package is ESM-only since v3. CommonJS require will fail. Programmatic usage is undocumented but possible.","wrong":"const eslintTransforms = require('eslint-transforms')","symbol":"default import (if used programmatically)","correct":"import eslintTransforms from 'eslint-transforms'"},{"note":"Individual transforms are exported as named exports. Check package for actual export names.","wrong":"const newRuleFormat = require('eslint-transforms').newRuleFormat","symbol":"transform functions","correct":"import { newRuleFormat, v9RuleMigration } from 'eslint-transforms'"}],"quickstart":{"code":"npm install eslint-transforms --save-dev\nnpx eslint-transforms v9-rule-migration ./lib/rules\nnpx eslint-transforms new-rule-format ./legacy-rules","lang":"javascript","description":"Install the package as a dev dependency and run the v9-rule-migration transform on a rules directory, then new-rule-format on legacy rules."},"warnings":[{"fix":"Upgrade Node.js to v20 or higher.","message":"Node.js >=20 required. Older versions unsupported.","severity":"breaking","affected_versions":">=3.0.0"},{"fix":"Use ESM imports or ensure compatibility with ESM modules.","message":"ESM-only from v3.0.0. CommonJS require() will fail.","severity":"breaking","affected_versions":">=3.0.0"},{"fix":"Convert ES6 modules to CommonJS before running the transform, or manually update the rule.","message":"The new-rule-format transform does not work for rules using ES6 module syntax.","severity":"gotcha","affected_versions":"all"},{"fix":"Commit changes or use version control before running transforms. Use --dry flag if available (check docs).","message":"Transforms modify files in-place. No undo mechanism provided.","severity":"gotcha","affected_versions":"all"},{"fix":"Upgrade to Node >=12 to use v2+, or stay on v1.x if stuck on older Node.","message":"Drop support for Node <12 in v2.0.0.","severity":"breaking","affected_versions":"<2.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-transforms --save-dev`. If using ESM, ensure package.json has type: module or use .mjs extension.","cause":"Package not installed or incorrect import path.","error":"Error: Cannot find module 'eslint-transforms'"},{"fix":"Switch to ESM imports: `import eslintTransforms from 'eslint-transforms'` or convert your script to ESM.","cause":"Using CommonJS require() with ESM-only package (v3+).","error":"Error [ERR_REQUIRE_ESM]: require() of ES Module ... from ... not supported."},{"fix":"Use CLI: `npx eslint-transforms v9-rule-migration <path>`. Or import named transform functions.","cause":"Incorrect usage: attempting to call the package as a function instead of using CLI or named exports.","error":"TypeError: eslintTransforms is not a function"},{"fix":"Upgrade Node to v20 or higher. If unable, use v2.x with Node 12+ by pinning version: `npm install eslint-transforms@2`.","cause":"Running on Node <20 with v3.0.0.","error":"Error: Node.js version 14 is not supported."}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}