feat(template): Husky フックと VSCode 設定を追加する#16
Conversation
コミット時の品質ゲートとして pre-commit(lint-staged --concurrent false) と commit-msg(commitlint)の Husky フックを追加した。CI/production 環境 では install.mts がフック登録をスキップし、不要な実行を防ぐ。あわせて VSCode の拡張機能推奨と Biome フォーマッタ設定を整備し、routeTree.gen.ts を読み取り専用にした。
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (2)
✅ Files skipped from review due to trivial changes (1)
🚧 Files skipped from review as they are similar to previous changes (1)
Walkthroughtanstack-start-hono-cf テンプレートに Husky のフックと install スクリプトを追加し、VSCode の推奨拡張機能とエディタ設定を整備した。あわせて package.json に prepare スクリプトと関連 devDependencies を反映した。 ChangesHusky と VSCode 設定の追加
Estimated code review effort: 2 (Simple) | ~10 minutes Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
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
📒 Files selected for processing (6)
templates/tanstack-start-hono-cf/.husky/commit-msgtemplates/tanstack-start-hono-cf/.husky/install.mtstemplates/tanstack-start-hono-cf/.husky/pre-committemplates/tanstack-start-hono-cf/.vscode/extensions.jsontemplates/tanstack-start-hono-cf/.vscode/settings.jsontemplates/tanstack-start-hono-cf/package.json
VS Code設定でBiomeの保存時アクションキーが誤っており自動修正が動作しない問題と、 devDependenciesを含まないインストール環境(--prod等)でprepareスクリプトがjiti不在により 失敗する問題を修正した。 Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
背景
git コミット時の品質ゲートが未整備で、Biome/ESLint/Prettier のチェックやコミットメッセージ規約が強制されていなかった。lint-staged では Biome を ESLint より先に逐次実行する必要がある(並列実行すると同一ファイルへの競合が起きるため)。
変更内容
.husky/install.mtsを追加し、CI/production 環境ではフック登録をスキップするようにした.husky/pre-commitでpnpm exec lint-staged --concurrent falseを実行するようにした.husky/commit-msgでpnpm exec commitlintを実行するようにした.vscode/settings.jsonで Biome を TS/TSX フォーマッタに設定し、routeTree.gen.tsを読み取り専用にした.vscode/extensions.jsonで推奨拡張機能を追加したpackage.jsonにprepareスクリプトとhusky/jiti/consola/@types/nodeを追加したテスト方法
templates/tanstack-start-hono-cfでpnpm installを実行し、(自身が git ルートのプロジェクトでは)Husky フックが登録されることを確認するCI=true pnpm installおよびNODE_ENV=production pnpm installを実行し、フック登録がスキップされることを確認するpnpm lintを実行し、eslint/biome/prettier がすべて通過することを確認する関連 Issue
closes #4
Summary by CodeRabbit