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
March 11, 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.
Published   Apr 12, 2024
🌐
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,564 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
November 1, 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...
Published   Apr 06, 2024
🌐
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 - Strict: Includes Next.js' base ESLint configuration along with a stricter Core Web Vitals rule-set.
🌐
Medium
medium.com › @wahvanessa22 › im-setting-up-eslint-for-my-next-js-a6f22ebf768b
I'm setting up ESLint for my Next.js + TypeScript project to keep my code clean, consistent, and bug-free. A step you should consider when writing like a pro! | by Wah Vanessa | Medium
May 13, 2025 - If you have ever used a configured linters file, and how it works, you will understand better will I mean by ESLint is an advanced linting configuration that helps you to write cleaner and clearer code.