eslint-config-next, a shareable ESLint configuration that bundles recommended rule-sets for React, React Hooks, and Next.js-specific patterns.
next lint and the eslint option in next.config.js were removed in Next.js 16. Use the ESLint CLI directly.Configurations
Three configurations are available:Setup
1
Install ESLint and the config package
- pnpm
- npm
- yarn
- bun
2
Create eslint.config.mjs
eslint.config.mjs
3
Run ESLint
Rules
The@next/eslint-plugin-next package provides the following rules (all enabled in the recommended config):
Examples
With TypeScript
eslint.config.mjs
Disabling rules
eslint.config.mjs
With Prettier
Installeslint-config-prettier to prevent conflicts between ESLint formatting rules and Prettier:
- pnpm
- npm
eslint.config.mjs
Monorepo setup
When Next.js is not installed at the repository root, tell the plugin where to find your app:eslint.config.mjs
Using the plugin directly
Use@next/eslint-plugin-next directly when you already have conflicting plugins (e.g. airbnb, react-app):
eslint.config.mjs
Lint-staged
Run ESLint only on staged files withlint-staged:
.lintstagedrc.js
