1
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

はじめに

Firebase Hosting/Functions 併用の Next.js プロジェクトで、ESLint がビルド成果物まで検査してしまい大量警告が出たときの対処メモです。

問題

npm run lint 実行時、.firebase/hosting/_next/... 配下のビルド済み JS を ESLint が拾い、@typescript-eslint/no-unused-expressions の警告が数千行も出て失敗していました。
スクリーンショット 2025-12-07 23.26.33.png

解決方法

ESLint の無視設定に Firebase のビルド成果物を追加。
eslint.config.mjs に以下を追記し、ビルド済みファイルを lint 対象外にしました。

eslint.config.mjs
globalIgnores([
  ".next/**",
  "out/**",
  "build/**",
  "next-env.d.ts",
  "functions/.next/**", // Functions にコピーした Next のビルド成果物を除外
  ".firebase/**",       // Firebase CLI が生成するキャッシュ/配信用ビルドを除外
]);

その後、npm run lint を再実行すると警告が消え、lint が通るようになりました。

おわりに

ビルド成果物やキャッシュを lint すると不要な警告が激増するので、生成物ディレクトリは早めに ignore に入れようと思いました。

1
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?