Skip to content

feat(template): Husky フックと VSCode 設定を追加する#16

Merged
XeicuLy merged 2 commits into
mainfrom
feature/issues/4
Jul 4, 2026
Merged

feat(template): Husky フックと VSCode 設定を追加する#16
XeicuLy merged 2 commits into
mainfrom
feature/issues/4

Conversation

@XeicuLy

@XeicuLy XeicuLy commented Jul 4, 2026

Copy link
Copy Markdown
Owner

背景

git コミット時の品質ゲートが未整備で、Biome/ESLint/Prettier のチェックやコミットメッセージ規約が強制されていなかった。lint-staged では Biome を ESLint より先に逐次実行する必要がある(並列実行すると同一ファイルへの競合が起きるため)。

変更内容

  • .husky/install.mts を追加し、CI/production 環境ではフック登録をスキップするようにした
  • .husky/pre-commitpnpm exec lint-staged --concurrent false を実行するようにした
  • .husky/commit-msgpnpm exec commitlint を実行するようにした
  • .vscode/settings.json で Biome を TS/TSX フォーマッタに設定し、routeTree.gen.ts を読み取り専用にした
  • .vscode/extensions.json で推奨拡張機能を追加した
  • package.jsonprepare スクリプトと husky/jiti/consola/@types/node を追加した

テスト方法

  1. templates/tanstack-start-hono-cfpnpm install を実行し、(自身が git ルートのプロジェクトでは)Husky フックが登録されることを確認する
  2. CI=true pnpm install および NODE_ENV=production pnpm install を実行し、フック登録がスキップされることを確認する
  3. pnpm lint を実行し、eslint/biome/prettier がすべて通過することを確認する

関連 Issue

closes #4

Summary by CodeRabbit

  • New Features
    • コミット時の メッセージ検証 と、コミット前の 段階的Lint 実行が 自動化 されました。
    • 保存時の 整形・コード修正 が有効化 され、推奨の VS Code 拡張機能 も追加 されました。
  • Chores
    • 開発セットアップ時の フック初期化 が 作業手順に組み込まれ 、初期体験が 改善 されました。

コミット時の品質ゲートとして pre-commit(lint-staged --concurrent false)
と commit-msg(commitlint)の Husky フックを追加した。CI/production 環境
では install.mts がフック登録をスキップし、不要な実行を防ぐ。あわせて
VSCode の拡張機能推奨と Biome フォーマッタ設定を整備し、routeTree.gen.ts
を読み取り専用にした。
@coderabbitai

coderabbitai Bot commented Jul 4, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: b26475e5-911d-4d91-84ef-4d25641b76de

📥 Commits

Reviewing files that changed from the base of the PR and between 1d232ed and e03f837.

📒 Files selected for processing (2)
  • templates/tanstack-start-hono-cf/.vscode/settings.json
  • templates/tanstack-start-hono-cf/package.json
✅ Files skipped from review due to trivial changes (1)
  • templates/tanstack-start-hono-cf/.vscode/settings.json
🚧 Files skipped from review as they are similar to previous changes (1)
  • templates/tanstack-start-hono-cf/package.json

Walkthrough

tanstack-start-hono-cf テンプレートに Husky のフックと install スクリプトを追加し、VSCode の推奨拡張機能とエディタ設定を整備した。あわせて package.json に prepare スクリプトと関連 devDependencies を反映した。

Changes

Husky と VSCode 設定の追加

Layer / File(s) Summary
Husky フックとインストーラースクリプト
templates/tanstack-start-hono-cf/.husky/install.mts, .husky/commit-msg, .husky/pre-commit
commit-msg で commitlint、pre-commit で lint-staged(--concurrent false)を実行し、install.mts で production/CI 環境時に即終了し husky を動的インポートする。
package.json のスクリプトと依存関係更新
templates/tanstack-start-hono-cf/package.json
prepare スクリプトを追加して jiti .husky/install.mts を実行し、@types/nodeconsolahuskyjiti を devDependencies に反映する。
VSCode 拡張機能推奨と設定ファイル
templates/tanstack-start-hono-cf/.vscode/extensions.json, .vscode/settings.json
Prettier、ESLint、Error Lens、Biome を推奨拡張として設定し、保存時フォーマット・言語別フォーマッタ・routeTree.gen.ts の除外設定を追加する。

Estimated code review effort: 2 (Simple) | ~10 minutes

Poem

ぴょんと跳ねて フックを整え
コミット前に ちょこんと確認
Biome と Prettier 手をつないで
VSCode も ぴかぴか準備完了
うさぎの巣は すっきり快適 🐇

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed 主要な変更である Husky フックと VSCode 設定の追加を簡潔に示しており、内容と整合しています。
Linked Issues check ✅ Passed pre-commit/commit-msg フック、CI/production スキップ、VSCode 設定、prepare スクリプトが要件どおり追加されています。
Out of Scope Changes check ✅ Passed 要件外の変更は見当たらず、追加内容はいずれも Husky/VSCode 設定と準備処理に収まっています。
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feature/issues/4

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

@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.

Actionable comments posted: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@templates/tanstack-start-hono-cf/.vscode/settings.json`:
- Around line 3-6: The VS Code save action setting is using the wrong Biome key,
so fix the editor.codeActionsOnSave entry in settings.json by replacing
source.biome with source.fixAll.biome. Keep the existing explicit behavior, and
update only the Biome-related action so save-on-fix works correctly.

In `@templates/tanstack-start-hono-cf/package.json`:
- Around line 25-27: The package.json prepare script currently invokes jiti
directly, which can fail in prod/omit-dev installs before the install.mts guards
run. Update the prepare entry to use a runtime that is available without
devDependencies, or make it resilient when jiti is missing, so the
.husky/install.mts bootstrap can still reach its NODE_ENV/CI checks; use the
prepare script in package.json and the .husky/install.mts entrypoint as the main
symbols to locate the change.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: aeee54d9-1a8f-428d-8e36-939ee8cf6328

📥 Commits

Reviewing files that changed from the base of the PR and between 6210cb1 and 1d232ed.

📒 Files selected for processing (6)
  • templates/tanstack-start-hono-cf/.husky/commit-msg
  • templates/tanstack-start-hono-cf/.husky/install.mts
  • templates/tanstack-start-hono-cf/.husky/pre-commit
  • templates/tanstack-start-hono-cf/.vscode/extensions.json
  • templates/tanstack-start-hono-cf/.vscode/settings.json
  • templates/tanstack-start-hono-cf/package.json

Comment thread templates/tanstack-start-hono-cf/.vscode/settings.json
Comment thread templates/tanstack-start-hono-cf/package.json
VS Code設定でBiomeの保存時アクションキーが誤っており自動修正が動作しない問題と、
devDependenciesを含まないインストール環境(--prod等)でprepareスクリプトがjiti不在により
失敗する問題を修正した。

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
@XeicuLy
XeicuLy merged commit 7c53dcb into main Jul 4, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat: テンプレート Husky + VSCode 設定の追加

1 participant