Skip to content

docs: Biome の noConsole ルールを推奨設定に追加 - #526

Merged
keito4 merged 1 commit into
mainfrom
docs/biome-no-console-rule
Mar 4, 2026
Merged

docs: Biome の noConsole ルールを推奨設定に追加#526
keito4 merged 1 commit into
mainfrom
docs/biome-no-console-rule

Conversation

@keito4

@keito4 keito4 commented Mar 4, 2026

Copy link
Copy Markdown
Owner

概要

Next.js プロジェクトの推奨 biome.jsonsuspicious.noConsole ルールを追加します。

変更内容

  • biome.json 推奨設定に suspicious.noConsole を追記
    • console.log / console.debugerror(CI でブロック)
    • console.error / console.warn → 許可
  • ロギング設計指針の原則を「Biome で CI がブロック」に更新

背景

テスト

  • ✅ Format Check: 通過
  • ✅ Lint: 通過
  • ✅ Test: 101 tests 通過

🤖 Generated with Claude Code

Summary by CodeRabbit

Release Notes

  • Documentation
    • Updated web app setup documentation to reflect console logging restrictions enforced in CI.
    • Documented the noConsole rule that restricts console.log and console.debug while allowing console.error and console.warn.
    • Added guidance on recommended logging approaches.

biome.json の推奨設定に suspicious.noConsole を追記。
console.log/debug をエラー、console.error/warn は許可する設定例を記載。
ロギング設計指針の原則を「Biome で CI がブロック」に更新。

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Mar 4, 2026

Copy link
Copy Markdown
📝 Walkthrough

Walkthrough

Documentation update to the Next.js web app setup guide that introduces a Biome linter rule blocking console.log and console.debug in CI, while allowing console.error and console.warn. Includes explanatory notes on the unified logging and error handling approach using @vercel/logger and Sentry.

Changes

Cohort / File(s) Summary
Logging Policy Documentation
docs/setup/web-app-nextjs.md
Adds noConsole linter rule configuration to Biome rules, blocking console.log and console.debug during CI. Inserts documentation explaining the rule behavior and recommends using @vercel/logger for logs and Sentry for errors.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~3 minutes

Possibly related PRs

Poem

🐰 Hop along with cleaner logs, no more .log to clog!
Biome polices our prints with care,
Sentry catches errors in the air,
@vercel whispers logs so bright,
The console shines with only light! ✨

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately reflects the main change: adding Biome's noConsole rule to recommended settings for a Next.js project, which is the core focus of the changeset.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch docs/biome-no-console-rule

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@keito4

keito4 commented Mar 4, 2026

Copy link
Copy Markdown
Owner Author

🔍 AI Code Review (Local Hook)

Models: Codex (default) / Gemini (default)

🤖 Codex Review

指摘事項はありません。

判定: patch is correct
理由: ドキュメント変更のみで、正確性・性能・安全性・保守性・DXに影響する問題は見当たりません。
信頼度: 0.62

✨ Gemini Review

レビュー結果

指摘すべきアクション可能な問題は見当たりませんでした。

この変更は、Biomeのリンター設定に noConsole ルールを追加し、本番環境での不用意な console.log の使用をCIレベルで制限するものです。設定内容(error, warn を許可)はドキュメントに記載された「ログ出力の標準化方針」と整合しており、保守性の向上に寄与します。


判定: patch is correct
理由: Biomeの設定とドキュメントの説明が正確に一致しており、プロジェクトのコーディング規約と運用方針を強化する適切な変更であるため。
信頼度: 1.0


🤖 Generated by post_pr_ai_review.py hook

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick comments (1)
docs/setup/web-app-nextjs.md (1)

372-372: 説明文を console.debug まで含めると一貫性が上がります。

Line 101 では console.logconsole.debug の両方を禁止としているため、Line 372 も同じ表現に揃えるのが望ましいです。

✏️ 文言の揃え方(例)
-- `console.log` の本番利用は禁止 → Biome の `noConsole` ルールで CI がブロック
+- `console.log` / `console.debug` の本番利用は禁止 → Biome の `noConsole` ルールで CI がブロック
As per coding guidelines "Fail on code formatting violations during code review", this keeps the doc update clean while preserving formatting compliance.
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@docs/setup/web-app-nextjs.md` at line 372, Update the sentence that currently
reads "`console.log` の本番利用は禁止 → Biome の `noConsole` ルールで CI がブロック`" so it
matches the wording on Line 101 by including `console.debug`; replace the single
`console.log` reference with a consistent "`console.log` と `console.debug`
の本番利用は禁止 → Biome の `noConsole` ルールで CI がブロック`" phrasing to ensure consistency
across the document (look for the existing sentence containing `console.log` on
Line 372 and the related rule mention on Line 101).
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Nitpick comments:
In `@docs/setup/web-app-nextjs.md`:
- Line 372: Update the sentence that currently reads "`console.log` の本番利用は禁止 →
Biome の `noConsole` ルールで CI がブロック`" so it matches the wording on Line 101 by
including `console.debug`; replace the single `console.log` reference with a
consistent "`console.log` と `console.debug` の本番利用は禁止 → Biome の `noConsole` ルールで
CI がブロック`" phrasing to ensure consistency across the document (look for the
existing sentence containing `console.log` on Line 372 and the related rule
mention on Line 101).

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: d0f57932-d588-4a8e-b80d-e1c22bf326d5

📥 Commits

Reviewing files that changed from the base of the PR and between d1cf711 and 94f7162.

📒 Files selected for processing (1)
  • docs/setup/web-app-nextjs.md

@claude

claude Bot commented Mar 4, 2026

Copy link
Copy Markdown
Contributor

コードレビュー

概要

ドキュメントの小規模な更新で、Biome の noConsole ルールを推奨設定に追加する変更です。CIレベルで console.log の混入を防ぐというアプローチは適切だと評価します。


良い点

  • 機械的な品質保証: console.log の本番混入を Lint エラーとして CI でブロックするアプローチは、属人的なレビューに依存しない堅牢な方法
  • 適切な粒度の許可設定: console.error / console.warn を許可リストに残しているのは実用的(エラーハンドリングやデバッグで必要になる場面を考慮)
  • 前 PR docs: Next.js + Supabase 推奨構成に @vercel/logger と Sentry を追加 #525 との一貫性: ロギング統一方針と Biome ルール追加が連動しており、変更の文脈が明確

指摘事項

軽微: ドキュメントの説明が不足している可能性

この注記は追加されていますが、「ではどうすれば良いか」の代替手段がこの直下に明示されていません。次行の「ログ出力は @vercel/logger、エラー通知は Sentry に統一する」と合わせて読めば分かりますが、注記を 1 文にまとめて代替手段まで誘導するとより親切です。

確認: console.info の扱いについて

allowerror / warn は指定されていますが、console.info はブロック対象になります。意図的な設計かと思いますが、ドキュメントに console.info もブロック対象である旨を明記しておくと誤解が減ります。


セキュリティ

変更はドキュメントのみのため、セキュリティ上の懸念はありません。


テスト

PR 説明に記載のとおり 101 tests 通過・Format / Lint チェック通過を確認。ドキュメント変更のみのため、追加テストは不要です。


総評

承認可能な変更です。上記の指摘事項は軽微であり、マージブロックとなるものではありません。指摘の対応はオプションとして検討ください。

🤖 Generated with Claude Code

@keito4

keito4 commented Mar 4, 2026

Copy link
Copy Markdown
Owner Author

🔍 AI Code Review (Local Hook)

Models: Codex (default) / Gemini (default)

🤖 Codex Review

指摘事項はありません。変更はドキュメント更新のみで、正確性・パフォーマンス・セキュリティ・保守性・開発者体験に対する新たな問題は見当たりません。

判定: patch is correct
理由: 変更は docs/setup/web-app-nextjs.md の設定例と説明の追記・更新のみで、挙動変更やリスクを伴う実装変更がありません。
信頼度: 0.74

✨ Gemini Review

修正の指摘事項

  1. docs/setup/web-app-nextjs.md (98-99行目, 368行目): @vercel/logger という名称の公式npmパッケージは存在しません。Vercelのプラットフォームは標準の console.log 出力を自動的に収集しますが、明示的に「置き換える」対象として実在しないパッケージ名(@vercel/logger)を指定すると、セットアップ時に開発者が混乱したり、存在しないパッケージのインストールを試みたりする可能性があります。pinonext-logger などの実在するライブラリ名を挙げるか、単に「Vercelのログ収集機能」と表現を修正することをお勧めします。

  2. docs/setup/web-app-nextjs.md (98行目): noConsole ルールの説明において、console.log / console.debug のみが対象であるかのように記載されていますが、実際には console.infoconsole.table などもエラー対象となります(allow で指定した errorwarn 以外)。「error/warn を除く console メソッド」と表現する方がより正確です。


判定: patch is correct

理由:
Biomeの設定ファイル (biome.json) に追加された noConsole ルールおよび allow オプションの構文は、Biome v1.6.0以降の仕様として正しく動作します。また、CIで不適切なログ出力をブロックするというポリシーの明文化は、保守性とコード品質の向上に寄与します。ドキュメント内のパッケージ名の誤りは既存の内容を引き継いだものであり、本パッチの主な目的である「Biomeによる制約の追加」を損なうものではありません。

信頼度: 0.95


🤖 Generated by post_pr_ai_review.py hook

@keito4
keito4 merged commit 05f8b9f into main Mar 4, 2026
5 checks passed
@github-actions

github-actions Bot commented Mar 4, 2026

Copy link
Copy Markdown
Contributor

🎉 This PR is included in version 1.83.0 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

@github-actions github-actions Bot added the released リリース済み label Mar 4, 2026
@keito4
keito4 deleted the docs/biome-no-console-rule branch March 20, 2026 05:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

released リリース済み

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant