Migration to EsLint v9

The ESLint Configuration Migrator is a new tool that helps transition to ESLint v9 by converting various .eslintrc.* files into the new eslint.config.js format, supporting JSON, YAML, JS, and CJS files. It also integrates .eslintignore patterns and applies compatibility utilities as needed. The migrator can be used directly through command-line tools like npx or yarn, and by default, generates an eslint.config.mjs file, with an option to output a CommonJS file using the --commonjs flag.

The ESLint Configuration Migrator is a new tool that helps transition to ESLint v9 by converting various .eslintrc.* files into the new eslint.config.js format, supporting JSON, YAML, JS, and CJS files. It also integrates .eslintignore patterns and applies compatibility utilities as needed. The migrator can be used directly through command-line tools like npx or yarn, and by default, generates an eslint.config.mjs file, with an option to output a CommonJS file using the --commonjs flag.

Are you ready for the new version, ESLint v9? That’s why we’re excited to announce the release of the ESLint Configuration Migrator. This utility is designed to translate: eslintrc.* files into eslint.config.js files, including:

  • 1-for-1 migration of .eslintrc, .eslintrc.json, .eslintrc.yml, and .eslintrc.yaml files.
  • Reasonable migration of simple: .eslintrc.js, .eslintrc.cjs, and .eslintrc.mjs files. (These will often need edits if you are using variables to build your config).
  • Automatic inclusion of .eslintignore patterns into your new config file. Automatic use of FlatCompat when necessary.
  • Automatic use of the compatibility utilities when necessary.

You can use the configuration migrator directly from npm without installing it via npx or similar commands. Pass the location of the .eslintrc.* file to convert, like this:

npx @eslint/migrate-config .eslintrc.json
yarn dlx @eslint/migrate-config .eslintrc.json
pnpm dlx @eslint/migrate-config.eslintrc.json
bunx @eslint/migrate-config .eslintrc.json

By default, this command will output a eslint.config.mjs

file. If you’d like to output a CommonJS file instead, add the --commonjs flag:

npx @eslint/migrate-config .eslintrc.json --commonjs
yarn dlx @eslint/migrate-config .eslintrc.json --commonjs
pnpm dlx @eslint/migrate-config .eslintrc.json --commonjs
bunx @eslint/migrate-config .eslintrc.json --commonjs

Link

Subscribe
Notify of
guest
0 Comments
Newest
Oldest Most Voted
Inline Feedbacks
View all comments