Use compatibility mode

Original:

{
  "extends": [
    "next/core-web-vitals",
    "plugin:@tanstack/eslint-plugin-query/recommended",
    "prettier"
  ],
  "plugins": ["@tanstack/query"]
}

Flat:

import { FlatCompat } from "@eslint/eslintrc"
import path from "path"
import { fileURLToPath } from "url"

const __filename = fileURLToPath(import.meta.url)
const __dirname = path.dirname(__filename)

const compat = new FlatCompat({
  baseDirectory: __dirname,
})

/** @type {import('eslint').Linter.Config[]} */
const configs = [
  ...compat.extends("next/core-web-vitals"),
  ...compat.extends("next/typescript"),
  ...compat.extends("plugin:@tanstack/eslint-plugin-query/recommended"),
  ...compat.extends("prettier"),
  ...compat.plugins("@tanstack/query"),
]

export default configs

https://github.com/vercel/next.js/issues/71763#issuecomment-2436288395

Answer from Marcelo Mason on Stack Overflow
🌐
Next.js
nextjs.org › docs › app › api-reference › config › eslint
Configuration: ESLint | Next.js
2 weeks ago - Learn how to use and configure the ESLint plugin to catch common issues and problems in a Next.js application.
🌐
GitHub
github.com › vercel › next.js › issues › 64409
next-lint Doesn't Support ESLint 9 · Issue #64409 · vercel/next.js
April 12, 2024 - It looks like this is coming from https://github.com/vercel/next.js/blob/canary/packages/next/src/cli/next-lint.ts. This needs to be changed to support ESLint 9's flat config https://eslint.org/docs/latest/use/migrate-to-9.0.0#flat-config.
Author   dylandignan
🌐
Medium
blog.linotte.dev › eslint-9-next-js-935c2b6d0371
Next.js & ESLint 9 Setup Guide | Linotte Blog
October 14, 2024 - Oops! Something went wrong! :( ESLint: 9.8.0 ESLint couldn't find an eslint.config.(js|mjs|cjs) file. From ESLint v9.0.0, the default configuration file is now eslint.config.js.
🌐
Chris
chris.lu › web_development › tutorials › next-js-static-first-mdx-starterkit › linting-setup-using-eslint
Linting setup using ESLint 9 flat config - Next.js 15 Tutorial
Package 2: eslint-plugin-next is the actual ESLint plugin for Nextjs (called @next/eslint-plugin-next on npmjs), it aims to catch common problems in a Next.js application
Find elsewhere
🌐
Medium
medium.com › @mdnoushadsiddiqi › fixing-next-js-eslint-errors-with-flat-config-in-eslint-9-f622d4570af0
Fixing Next.js ESLint Errors with Flat Config in ESLint 9 | by Mohammad Noushad Siddiqi | Medium
October 2, 2025 - ESLint 9 only supports flat config. Old .eslintrc configs with plugins: ["@next/next"] are no longer valid. Next.js still bundles legacy configs. That’s why you see “plugin not detected” warnings unless you switch to flatConfig. Don’t redefine the Next.js plugin. If you extend nextPlugin.flatConfig.coreWebVitals, it already includes the plugin. Nextjs ·
🌐
npm
npmjs.com › package › eslint-config-next
eslint-config-next - npm
9 Dependencies · 1677 Dependents · 2,573 Versions · This package does not have a README. Add a README to your package so that users know how to get started. none · Share feedback · npm i eslint-config-next · github.com/vercel/next.js · nextjs.org/docs/app/api-reference/config/eslint ·
      » npm install eslint-config-next
    
Published   Jan 27, 2026
Version   16.1.6
🌐
GitHub
gist.github.com › ixahmedxi › 9d87c66a8245ca02a0f81b6ccb58a825
ESLint v9 Next.js · GitHub
ESLint v9 Next.js. GitHub Gist: instantly share code, notes, and snippets.
🌐
GitHub
github.com › vercel › next.js › issues › 64136
`next lint` installs incompatible `eslint@9` · Issue #64136 · vercel/next.js
October 30, 2023 - Link to the code that reproduces this issue https://github.com/devjiwonchoi/repro-next-64114 To Reproduce Run pnpm next lint To start over, run pnpm remove eslint eslint-config-next, delete .eslint...
Author   devjiwonchoi
🌐
GitHub
github.com › vercel › next.js › discussions › 49337
How to use new "flat config" approach in Eslint? · vercel/next.js · Discussion #49337
I wrote a setup guide for Eslint 9 with Next.js detailing my approach to flat config with Next.js : Eslint 9 & Next.js — Setup Guide
Author   vercel
🌐
npm
npmjs.com › package › @next › eslint-plugin-next
@next/eslint-plugin-next - npm
ESLint plugin for Next.js.. Latest version: 16.1.6, last published: a month ago. Start using @next/eslint-plugin-next in your project by running `npm i @next/eslint-plugin-next`. There are 650 other projects in the npm registry using @next/eslint-plugin-next.
      » npm install @next/eslint-plugin-next
    
Published   Jan 27, 2026
Version   16.1.6
🌐
Next.js
nextjs.org › docs › 14 › app › building-your-application › configuring › eslint
Configuring: ESLint | Next.js
August 22, 2024 - If either of the two configuration options are selected, Next.js will automatically install eslint and eslint-config-next as dependencies in your application and create an .eslintrc.json file in the root of your project that includes your selected configuration.
🌐
DEV Community
dev.to › jordanahaines › just-use-this-nextjs-eslint-configuration-540
Just use this Next.js Eslint Configuration - DEV Community
January 12, 2025 - Because I couldn't easily extend this deprecated configuration, I (swore and then) scrapped it and initialized a new eslint config with npm init @eslint/config@latest. I then added the configuration for next wrapped with eslint's flat compat utility.