Migrate .eslintrc to ESLint v9 Flat Config
Convert legacy .eslintrc.json and .eslintrc.js configurations into ESLint v9 flat config (eslint.config.mjs) with typescript-eslint support.
import js from '@eslint/js';
import tseslint from 'typescript-eslint';
export default tseslint.config(
js.configs.recommended,
...tseslint.configs.recommended,
{
rules: {
"no-unused-vars": "off",
"@typescript-eslint/no-unused-vars": [
"error"
],
"no-console": "warn"
},
},
{
ignores: ['dist/**', '.next/**', 'node_modules/**'],
},
);
Detected Breaking Changes & Semantic Shifts (2)
ESLint v9 replaces .eslintrc.* with an exported array of configuration objects in eslint.config.mjs.
Plugins must now be imported as JavaScript modules rather than referenced as string names.
How to Migrate from ESLint Legacy (.eslintrc) to ESLint v9 Flat Config (eslint.config.mjs)
- 1
Paste your legacy .eslintrc.json or .eslintrc.js content.
- 2
The migrator structures an exported array conforming to ESLint v9 flat config specification.
- 3
Plugins are mapped to modern ESM module imports instead of string identifiers.
- 4
Copy the output to `eslint.config.mjs` in your project root.
ESLint Flat Config Lint Check in CI
name: Code Quality
on: [push, pull_request]
jobs:
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 20
- run: npm ci
- run: npx eslint .
Run Migration via Terminal CLI
Perform identical migration routines across entire directories or repositories in your local terminal:
devflow migrate eslintrc-to-flat-config -i .eslintrc.json -o eslint.config.mjsRelated DevOps & Stack Migrators
Migrate npm package.json to Bun Runtime & Scripts
Instantly migrate npm scripts, dependencies, and configurations to Bun. Optimize script execution speeds and strip obsolete transpilations.
Migrate Webpack 5 Config to Vite (10x Faster HMR)
Convert webpack.config.js bundles into lightning-fast Vite configs (vite.config.ts). Eliminate multi-minute cold starts and reload delays.
Associated DevFlow Tools
Frequently Asked Questions
- Does Next.js 15+ support ESLint Flat Config?
- Yes, Next.js 15 and 16 fully support `eslint.config.mjs` with `@next/eslint-plugin-next`.
- Can I still use Prettier with Flat Config?
- Yes, simply import `eslint-config-prettier` and append it as the final object in your config array.