本文へ移動
verified onnext@16.3.5react@19
最終検証日 2026-09-26
Next.js道場

next.config の eslint が使えない(Next.js 16)

実際に出るエラー

⚠ `eslint` configuration in next.config.ts is no longer supported. See more info here: https://nextjs.org/docs/app/api-reference/cli/next#next-lint-options
⚠ Invalid next.config.ts options detected:
⚠     Unrecognized key(s) in object: 'eslint'
next.config.ts(2,34): error TS2353: Object literal may only specify known properties, and 'eslint' does not exist in type 'NextConfig'.

Next.js 16 で next.config に eslint の設定を書くと出る警告とビルドエラーです。

何が起きているか

以前のプロジェクトの next.config.ts をそのまま写すと、よく入っている設定です。

const nextConfig: NextConfig = {
  eslint: { ignoreDuringBuilds: true },
}

公式のアップグレードガイドによると、Next.js 16 で next lint が無くなり、next build もリントを走らせなくなりました。それに合わせて、next.config の eslint も無くなっています。

構成によって、止まるかどうかが変わる

eslint の設定を書いたままビルドしたとき(実機で確かめた)
構成結果
型チェックあり警告のあと、'eslint' does not exist in type 'NextConfig' で止まる
ignoreBuildErrors も書いている警告だけ出て通る。eslint の設定は何もしない

どちらの場合も、最初に次の警告が出ます。

⚠ `eslint` configuration in next.config.ts is no longer supported.
⚠     Unrecognized key(s) in object: 'eslint'

直し方

1. next.config から eslint の行を消す

const nextConfig: NextConfig = {}

実機で、eslint の行が無い設定では、この警告も型のエラーも出ませんでした。

2. リントを続けるなら、ESLint を直接動かす

package.json に、ESLint を直接呼ぶスクリプトを書きます。

{
  "scripts": {
    "lint": "eslint ."
  }
}

公式のアップグレードガイドは、next lint から ESLint を直接動かす形へ移すための codemod(next-lint-to-eslint-cli)を案内しています。

出典

このページの内容は上記の一次情報を基準に書いています。個人ブログや二次情報を根拠にしていません。

理解できたか試す

では、このコードはどうなりますか。

以前のプロジェクトから next.config.ts を写してきました。型チェックは有効です。ビルドするとどうなりますか。

この問題を解くこのテーマの問題 3 問