Use the npx @eslint/migrate-config .eslintrc.json command.

It produces ugly output, but seems to work - I assume we will eventually be able to do it as recommended in the eslint docs.

Heres the output I got (placed inside eslint.config.mjs file).

import path from "node:path";
import { fileURLToPath } from "node:url";
import js from "@eslint/js";
import { FlatCompat } from "@eslint/eslintrc";

const __filename = fileURLToPath(import.meta.url);
const __dirname = path.dirname(__filename);
const compat = new FlatCompat({
    baseDirectory: __dirname,
    recommendedConfig: js.configs.recommended,
    allConfig: js.configs.all
});
export default [...compat.extends("next")];
🌐
npm
npmjs.com › package › eslint-config-next
eslint-config-next - npm
January 27, 2026 - Latest version: 16.1.6, last published: a month ago. Start using eslint-config-next in your project by running `npm i eslint-config-next`. There are 1677 other projects in the npm registry using eslint-config-next.
      » npm install eslint-config-next
    
Published   Jan 27, 2026
Version   16.1.6
🌐
Next.js
nextjs.org › docs › app › api-reference › config › eslint
Configuration: ESLint | Next.js
2 weeks ago - Latest Version · 16.1.6 · API ReferenceConfigurationESLint · Copy page · Last updated February 27, 2026 · Next.js provides an ESLint configuration package, eslint-config-next, that makes it easy to catch common issues in your application.
Discussions

eslint-config-next on ESlint v9 example
Summary ESlint version 9 is supported, starting on version 15 https://nextjs.org/blog/next-15#eslint-9-support any example of how the config file would look like? i am trying to import the config o... More on github.com
🌐 github.com
1
5
October 25, 2024
Next.js v15 is being installed with ESLint v8
Operating System: Platform: darwin ... Binaries: Node: 20.18.0 npm: 10.8.2 Yarn: 1.22.22 pnpm: 9.9.0 Relevant Packages: next: 15.0.1 // Latest available version is detected (15.0.1). eslint-config-next: 15.0.1 react: 19.0.0-rc-69d4b800-20241021 react-dom: 19.0.0-rc-69d4b800-20241021 ... More on github.com
🌐 github.com
25
October 23, 2024
next-lint Doesn't Support ESLint 9
Operating System: Platform: linux ... Node: 20.9.0 npm: 9.8.1 Yarn: 1.22.19 pnpm: 8.10.2 Relevant Packages: next: 14.2.1-canary.0 // Latest available version is detected (14.2.1-canary.0). eslint-config-next: 14.1.4 react: 18.2.0 react-dom: 18.2.0 typescript: 5.1.3 Next.js Config: ... More on github.com
🌐 github.com
110
April 12, 2024
How to use new "flat config" approach in Eslint?
For anyone who want try eslint 9 flat config in Nextjs. Make sure to backup your old .eslintrc.json file, then try: See: https://eslint.org/docs/latest/use/configure/migration-guide#migrate-your-config-file More on github.com
🌐 github.com
9
25
🌐
GitHub
github.com › vercel › next.js › blob › canary › packages › eslint-config-next › package.json
next.js/packages/eslint-config-next/package.json at canary · vercel/next.js
"name": "eslint-config-next", "version": "16.2.0-canary.99", "description": "ESLint configuration used by Next.js.", "license": "MIT", "repository": { "url": "vercel/next.js", "directory": "packages/eslint-config-next" },  ...
Author   vercel
🌐
ESLint
eslint.org › docs › latest › use › getting-started
Getting Started with ESLint - ESLint - Pluggable JavaScript Linter
# use `eslint-config-xo` shared config - npm 7+ bun create @eslint/config@latest -- --config eslint-config-xo ... Note: npm init @eslint/config assumes you have a package.json file already. If you don’t, make sure to run npm init or yarn init beforehand. After that, you can run ESLint on any file or directory like this: ... Note: If you are coming from a version before 9.0.0 please see the migration guide.
🌐
ESLint
eslint.org › blog › 2026 › 02 › eslint-v10.0.0-released
ESLint v10.0.0 released - ESLint - Pluggable JavaScript Linter
February 6, 2026 - 39c638a chore: update eslint-config-eslint dependencies for v10 prereleases (#20278) (Milos Djermanovic) 8533b3f chore: update dependency @eslint/json to ^0.14.0 (#20288) (renovate[bot]) 796ddf6 chore: update dependency @eslint/js to ^9.39.1 (#20285) (renovate[bot]) Nicholas C. Zakas ESLint Technical Steering Committee · Creator of ESLint, independent software developer, consultant, coach, and author. Nicholas C. Zakas @nzakas ... The latest ESLint news, case studies, tutorials, and resources.
🌐
npm
npmjs.com › package › @next › eslint-plugin-next
@next/eslint-plugin-next - npm
January 27, 2026 - Latest version: 16.1.6, last published: 2 months ago. Start using @next/eslint-plugin-next in your project by running `npm i @next/eslint-plugin-next`. There are 651 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
🌐
GitHub
github.com › vercel › next.js › issues › 71763
Next.js v15 is being installed with ESLint v8 · Issue #71763 · vercel/next.js
October 23, 2024 - Binaries: Node: 20.18.0 npm: 10.8.2 Yarn: 1.22.22 pnpm: 9.9.0 Relevant Packages: next: 15.0.1 // Latest available version is detected (15.0.1). eslint-config-next: 15.0.1 react: 19.0.0-rc-69d4b800-20241021 react-dom: 19.0.0-rc-69d4b800-20241021 ...
Author   silvenon
Find elsewhere
🌐
Next.js
nextjs.org › docs › 15 › app › api-reference › config › next-config-js › eslint
next.config.js: eslint | Next.js
June 16, 2025 - You are currently viewing documentation for version 15 of Next.js. ... When ESLint is detected in your project, Next.js fails your production build (next build) when errors are present.
🌐
Reddit
reddit.com › r/nextjs › eslint-config-next v1.7
r/nextjs on Reddit: eslint-config-next V1.7
March 12, 2025 - This is a comprehensive EsLint 9 (flat config) for NextJS 15.
🌐
GitHub
github.com › vercel › next.js › issues › 64409
next-lint Doesn't Support ESLint 9 · Issue #64409 · vercel/next.js
April 12, 2024 - Node: 20.9.0 npm: 9.8.1 Yarn: 1.22.19 pnpm: 8.10.2 Relevant Packages: next: 14.2.1-canary.0 // Latest available version is detected (14.2.1-canary.0). eslint-config-next: 14.1.4 react: 18.2.0 react-dom: 18.2.0 typescript: 5.1.3 Next.js Config: ...
Author   dylandignan
🌐
GitHub
github.com › vercel › next.js › discussions › 49337
How to use new "flat config" approach in Eslint? · vercel/next.js · Discussion #49337
For anyone who want try eslint 9 flat config in Nextjs. Make sure to backup your old .eslintrc.json file, then try: See: https://eslint.org/docs/latest/use/configure/migration-guide#migrate-your-config-file
Author   vercel
🌐
DEV Community
dev.to › jordanahaines › just-use-this-nextjs-eslint-configuration-540
Just use this Next.js Eslint Configuration - DEV Community
January 12, 2025 - However, this configuration is now deprecated in favor of eslint.config.mjs. 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.
Top answer
1 of 3
37

Update

NextJS now has official guide to add eslint to project: https://nextjs.org/docs/basic-features/eslint Additionally you need to install ESLint extension.

Also, If you're looking for ESLint with typescript support: https://gourav.io/blog/nextjs-cheatsheet

Old answer:

Install ESLint

npm i eslint --save-dev

Install ESLint plugins:

npx install-peerdeps --dev eslint-config-airbnb

Above single command will install 6 plugins: eslint-config-airbnb, eslint-plugin-import, eslint-plugin-react, eslint-plugin-react-hooks, and eslint-plugin-jsx-a11y. You can also install these plugins individually.

Install babel eslint

npm i -D babel-eslint

Install prettier plugin (optional, so that prettier doesn't mess up with linting)

 npm i -D eslint-config-prettier eslint-plugin-prettier

Your "devDependencies" should look something like this:

"devDependencies": {
    "babel-eslint": "^10.1.0",
    "eslint": "^6.8.0",
    "eslint-config-airbnb": "^18.1.0",
    "eslint-config-prettier": "^6.11.0",
    "eslint-plugin-import": "^2.20.2",
    "eslint-plugin-jsx-a11y": "^6.2.3",
    "eslint-plugin-prettier": "^3.1.3",
    "eslint-plugin-react": "^7.20.0",
    "eslint-plugin-react-hooks": "^2.5.1"
  }

Now, create a file .eslintrc.json at root of project. Paste below config:

{
  "env": {
    "browser": true,
    "commonjs": true,
    "es6": true,
    "node": true
  },
  "parser": "babel-eslint",
  "extends": [
    "eslint:recommended",
    "airbnb",
    "airbnb/hooks",
    "plugin:react/recommended",
    "plugin:import/errors",
    "plugin:import/warnings",
    "plugin:jsx-a11y/recommended",
    // "plugin:react-hooks/recommended",
    // always put prettier at last
    "prettier"
  ],
  "globals": {
    "Atomics": "readonly",
    "SharedArrayBuffer": "readonly"
  },
  "parserOptions": {
    "ecmaFeatures": {
      "jsx": true // enable linting for jsx files
    },
    "ecmaVersion": 11,
    "sourceType": "module"
  },
  "settings": {
    "react": {
      "version": "detect"
    }
  },
  "plugins": ["react", "react-hooks"],
  "rules": {
    // NextJs specific fix: suppress errors for missing 'import React' in files for nextjs
    "react/react-in-jsx-scope": "off",
   // NextJs specific fix: allow jsx syntax in js files
    "react/jsx-filename-extension": [1, { "extensions": [".js", ".jsx"] }], //should add ".ts" if typescript project
    "react/display-name": 1
  }
}

Also, install ESLint extension for VSCode.

Reload VSCode window once to get proper linting

ESLint will automatically start detecting errors/warnings in *.js and *.jsx files. If that's not the case then either your project has no linting errors or ESLint is not properly setup. To test if linting works run eslint command in terminal with folder path i.e. eslint pages/** and notice output.

To disable linting of some files/folders you can create a .eslintignore at the root of project.

.eslintignore:

# don't ever lint node_modules
node_modules
# don't lint build output (make sure it's set to your correct build folder name)
dist
# don't lint nyc coverage output
coverage

Finally, you can also add linting to scripts in package.json as a part of your build/deploy process:

"scripts": {
    "lint": "eslint ./components/** ./pages/** -c .eslintrc.json --ext js,jsx",
    "lint-fix": "eslint ./components/** ./pages/** -c .eslintrc.json --fix --ext js,jsx",
}

See my current ESLint configuration for NextJS Typescript project: https://github.com/GorvGoyl/Personal-Site-Gourav.io/blob/main/.eslintrc.js

2 of 3
15

you need to install required npm modules.

with Npm:

npm i -D babel-eslint eslint-config-airbnb eslint eslint-plugin-jsx-a11y eslint-plugin-import eslint-plugin-react eslint-plugin-react-hooks

with Yarn:

yarn add -D babel-eslint eslint-config-airbnb eslint eslint-plugin-jsx-a11y eslint-plugin-import eslint-plugin-react eslint-plugin-react-hooks

Here is related article about that

https://medium.com/@melih193/next-js-eslint-setup-tutorial-for-airbnb-config-c2b04183a92a

🌐
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 - I decided to document my findings because of how hard it was, but it was fun to set up ESLint for my next project through its documentation and understanding what is going on, especially with the new changes. For those who do not know what ESLint is, I've got you. 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.
🌐
ESLint
eslint.org › docs › latest › use › configure › configuration-files
Configuration Files - ESLint - Pluggable JavaScript Linter
Selecting a version will take you to the chosen version of the ESLint docs. Version ... Results will be shown and updated as you type. ... This page explains how to use flat config files.
🌐
GitHub
github.com › vercel › next.js › issues › 85947
Docs: ESLint config ambiguities · Issue #85947 · vercel/next.js
November 9, 2025 - What is the documentation issue? https://nextjs.org/docs/app/api-reference/config/eslint could use somewhat of a re-write, as there are multiple ambiguities on the page and has some outdated inform...
Author   thernstig
🌐
ESLint
eslint.org › docs › latest › use › migrate-to-10.0.0
Migrate to v10.x - ESLint - Pluggable JavaScript Linter
ESLint is officially dropping support ... jiti v2.1.2 or earlier installed, be sure to update it to at least 2.2.0 when using ESLint v10.0.0. ... ESLint v10.0.0 uses the latest version of minimatch, which supports POSIX character ...