Home/Blog/How to Use the ESLint v9 Flat Config Migration Prompt to Retire .eslintrc Without Losing Rules
Blog

How to Use the ESLint v9 Flat Config Migration Prompt to Retire .eslintrc Without Losing Rules

P
promptstudio

Move a real project from legacy .eslintrc and .eslintignore files to an ESLint v9 eslint.config.js: overrides become file scoped objects, env becomes languageOptions.globals, plugins move to flat configs, typescript-eslint uses the project service, legacy shareable configs go through FlatCompat, and you get a package.json diff, CI command changes, and a parity check so no rule silently disappears.

How to Use the ESLint v9 Flat Config Migration Prompt to Retire .eslintrc Without Losing Rules

ESLint 9 made flat config the default. Your old .eslintrc file and .eslintignore are no longer read, overrides work differently, env is gone, and several plugins changed how they export their presets. Most projects can migrate in an afternoon, but the risk is quiet: a rule that used to run simply stops running, and nobody notices until a bug slips through. The ESLint v9 Flat Config Migration: .eslintrc and .eslintignore to eslint.config.js with typescript-eslint, React Plugins, and FlatCompat Fallbacks prompt translates your existing config line by line, writes a complete eslint.config.js, and finishes with a parity check so nothing disappears.

What the prompt produces

  1. A translation table that maps every legacy key, such as env, parser, extends, and overrides, to its flat config equivalent.
  2. A plugin readiness list showing which packages already ship flat configs, which need a version bump, and which need the FlatCompat layer.
  3. A complete eslint.config.js in a sensible order, from global ignores to Prettier last.
  4. Ignores converted from .eslintignore into the ignores array.
  5. A package.json diff and rewritten lint scripts without the removed --ext flag.
  6. Fixes for inline eslint-env comments that no longer apply.
  7. A parity check using eslint --print-config before and after, with a list of rules that changed.

How to fill the inputs

LegacyConfig is the full content of your .eslintrc file, including overrides. If your config extends a shared package, include the package name.

IgnoreFile is the content of .eslintignore plus any ignorePatterns. LintDeps should list exact versions from package.json for eslint and every plugin. Versions matter because flat config support arrived at different times for different plugins.

ModuleSetup tells the prompt whether your package is an ES module or CommonJS, which decides between eslint.config.js and eslint.config.mjs, and how your tsconfig files are laid out.

LintScripts and InlineDirectives cover the edges: the commands your CI runs and any comments in source files that set environments.

Reading the example output

The example migrates a React and TypeScript app that also uses an internal shared config:

  • typescript-eslint becomes one package. The old parser and plugin packages are replaced with typescript-eslint version 8, which supports the project service for type aware rules.
  • React plugins use their flat presets. The hooks plugin is registered and its recommended rules spread in, with a VERIFY note to check the preset name for the installed version.
  • The internal config goes through FlatCompat. That keeps the team moving until the platform team ships a flat export.
  • Overrides become file scoped objects. Node globals apply to scripts, Jest globals apply to test files, and type checking is disabled for plain JavaScript files.
  • The parity check is concrete. It names the command and the files to compare and explains which new rules came from switching to the type checked preset.

Tips for better results

  • Run the migration on a branch and commit the before and after print-config outputs. Reviewers can then see exactly what changed.
  • If type aware rules slow down your editor, start with the recommended preset and add the specific type aware rules you care about.
  • Remove .eslintignore only after the ignores array is merged, so nobody lints build output by accident.
  • Check editor integrations after merging. Most pick up flat config automatically, but older extension versions may need an update.

Mistakes to avoid

  • Do not guess plugin export names from memory. The prompt marks uncertain ones as VERIFY for a reason.
  • Do not leave eslint-env comments in test files and assume they still work.
  • Do not drop rules you do not recognize. Every rule must appear in the new config or in the REMOVED list with a reason.

Who it is for

Frontend and Node developers maintaining older repositories, tech leads planning a tooling upgrade, and platform teams moving many projects to ESLint 9.

Related PromptDig links

Start with the ESLint v9 Flat Config Migration: .eslintrc and .eslintignore to eslint.config.js with typescript-eslint, React Plugins, and FlatCompat Fallbacks prompt and paste your current config and package versions. To find more prompts for developers, Browse more prompts. If you have a migration prompt that saved your team time, Share a prompt.