@eslint/migrate-config

中文文档
3.0.4发布于 2026/11/14Apache-2.0ES Module构建来源已验证近 30 天下载 6.7万

Configuration migration for ESLint

原始使用文档
文档目录15 节
  1. Overview
  2. Limitations
  3. Usage
  4. CommonJS Output
  5. Including a .gitignore file
  6. Targeting a specific ESLint version
  7. Followup Steps
  8. Upgrade Plugins and Double-Check Compatibility
  9. --ext
  10. License
  11. Sponsors
  12. Gold Sponsors
  13. Silver Sponsors
  14. Bronze Sponsors
  15. Technology Sponsors

ESLint Configuration Migrator

Overview

This package aids in the migration of the legacy ESLint configuration file format (.eslintrc.) to the new ESLint configuration file format (eslint.config.js).

Note: The generated configuration file isn't guaranteed to work in all cases, but it should get you a lot closer to a working configuration file than manually trying to migrate.

Limitations

This tool currently works well for the following config file formats:

  • .eslintrc
  • .eslintrc.json
  • .eslintrc.yml

If you are using a JavaScript configuration file (.eslintrc.js, .eslintrc.cjs, .eslintrc.mjs), this tool currently is only capable of migrating the evaluated configuration. That means any logic you may have inside of the file will be lost. If your configuration file is mostly static, then you'll get a good result; if your configuration file is more complex (using functions, calculating paths, etc.) then this tool will not provide an equivalent configuration file.

Usage

You can run this package on the command line without installing it first by using npx or a similar tool:

npx @eslint/migrate-config .eslintrc.json
# or
bunx @eslint/migrate-config .eslintrc.json

The tool will automatically find your .eslintignore file in the same directory and migrate that into your new configuration file.

If you receive any npm errors while running using npx, install the package manually first:

npm i @eslint/migrate-config
npx @eslint/migrate-config .eslintrc.json

CommonJS Output

By default, this tool generates an ESM file (.mjs extension). If you'd like to generate a CommonJS file instead, pass the --commonjs flag:

npx @eslint/migrate-config .eslintrc.json --commonjs
# or
bunx @eslint/migrate-config .eslintrc.json --commonjs

Including a .gitignore file

If you are currently using --ignore-path .gitignore on the CLI, you'll need to read the .gitignore file into your config file. The migration can handle this for you by passing the --gitignore flag:

npx @eslint/migrate-config .eslintrc.json --gitignore
# or
bunx @eslint/migrate-config .eslintrc.json --gitignore

Targeting a specific ESLint version

By default, this tool targets the latest ESLint version available (v10). You can target v9 by passing the --target-version option:

npx @eslint/migrate-config .eslintrc.json --target-version 9
# or
bunx @eslint/migrate-config .eslintrc.json --target-version 9

Followup Steps

Once you have completed the migration, you may need to manually modify the resulting config file.

Upgrade Plugins and Double-Check Compatibility

For any plugins used in your configuration file, make sure to upgrade to the latest version. Many plugins are creating their v9-compatible versions and this tool may be out-of-date in relation to which plugins fully support v9.

After upgrading, double-check if the plugin still needs any of the compatibility utilities that were autogenerated as part of the migration.

--ext

If you are using --ext on the command line, such as:

npx eslint --ext .ts .

You'll need to remove the --ext from the command line and add an equivalent object into your configuration file. For example, --ext .ts requires an object like this in your configuration file:

export default [
    {
        files: ["**/*.ts"],
    },

    // the rest of your config
];

This tells ESLint to search for all files ending with .ts when a directory is passed on the command line. You can choose to add additional properties to this object if you'd like, but it's not required.

License

Apache 2.0

Sponsors

The following companies, organizations, and individuals support ESLint's ongoing maintenance and development. Become a Sponsor to get your logo on our READMEs and website.

Gold Sponsors

Vite Ecosystem Fund ForceIndexer Qlty Software Shopify CodeRabbit Automattic

Silver Sponsors

Vite Liftoff StackBlitz

Bronze Sponsors

Cybozu SAP Discord GitBook Citadel AI TestMu AI Open Source Office (Formerly LambdaTest)

Technology Sponsors

Technology sponsors allow us to use their products and services for free as part of a contribution to the open source ecosystem and our work.

Netlify Algolia 1Password

版本与发布记录

@eslint/migrate-config 共发布 38 个版本,首次发布于 2024/05/31;过去 12 个月发布了 14 个版本。最新版本附带 npm provenance 构建来源证明,可追溯到公开的 CI 构建记录。

版本发布日期距今
3.0.4latest2026/11/14今天
3.0.32026/09/042 个月前
3.0.22026/07/213 个月前
3.0.12026/07/153 个月前
3.0.02026/06/224 个月前
2.1.02026/05/086 个月前

关于 @eslint/migrate-config 的常见问题

@eslint/migrate-config 是什么?

Configuration migration for ESLint

如何安装 @eslint/migrate-config?

在项目目录运行 npm install @eslint/migrate-config,或使用 pnpm add / yarn add / bun add。它还提供命令行工具 eslint-migrate-config,可以用 npx eslint-migrate-config 直接运行。

@eslint/migrate-config 支持 TypeScript 吗?

该包的 package.json 没有声明类型入口。需要类型提示时,可以在 npm 上查找社区维护的 @types/eslint__migrate-config 是否存在。

@eslint/migrate-config 支持 ESM 还是 CommonJS?

以 ES Module 形式发布,推荐使用 import 引入。在 CommonJS 项目中,Node.js 20.19+ / 22.12+ 可以直接 require() 不含顶层 await 的 ES Module,更早的版本需要改用动态 import()。

@eslint/migrate-config 需要什么版本的 Node.js?

package.json 的 engines 字段要求 Node.js ^20.19.0 || ^22.13.0 || >=24。版本不符时 npm 默认只给出警告,开启 engine-strict 后会拒绝安装。

@eslint/migrate-config 可以商用吗?

@eslint/migrate-config 使用 Apache-2.0 许可。宽松许可:允许商业使用、修改和再分发,并附带明确的专利授权;分发时需保留许可与 NOTICE 文件,修改过的文件要注明改动。以上为概括,不构成法律意见,请以许可原文为准。

@eslint/migrate-config 的下载量有多少?

根据 npm 官方下载统计,@eslint/migrate-config 在 2026/10/14 – 2026/11/12 这 30 天内被下载 67,299 次,日均约 2,243 次。下载量会把 CI 构建、镜像同步和作为其他包依赖的安装一并计入,适合横向比较热度,不能直接等同于使用人数。

@eslint/migrate-config 还在维护吗?

最新版本 3.0.4 发布于 2026/11/14(今天);至今共发布 38 个版本,其中过去 12 个月发布了 14 个;首次发布于 2024/05/31。发布频率只是参考信号:功能稳定的工具可能很少需要更新,建议结合源码仓库的 issue 和提交记录判断。