Skip to content

Commit 7c53dcb

Browse files
XeicuLyclaude
andauthored
feat(template): Husky フックと VSCode 設定を追加する (#16)
* feat(template): Husky フックと VSCode 設定を追加する コミット時の品質ゲートとして pre-commit(lint-staged --concurrent false) と commit-msg(commitlint)の Husky フックを追加した。CI/production 環境 では install.mts がフック登録をスキップし、不要な実行を防ぐ。あわせて VSCode の拡張機能推奨と Biome フォーマッタ設定を整備し、routeTree.gen.ts を読み取り専用にした。 * fix(template): Biomeの保存時キーとprepareスクリプトを修正する VS Code設定でBiomeの保存時アクションキーが誤っており自動修正が動作しない問題と、 devDependenciesを含まないインストール環境(--prod等)でprepareスクリプトがjiti不在により 失敗する問題を修正した。 Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> --------- Co-authored-by: Claude Sonnet 5 <noreply@anthropic.com>
1 parent 6210cb1 commit 7c53dcb

6 files changed

Lines changed: 44 additions & 1 deletion

File tree

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
set -e
2+
3+
pnpm exec commitlint --edit "$1"
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
import consola from 'consola';
2+
3+
if (process.env.NODE_ENV === 'production' || process.env.CI === 'true') {
4+
process.exit(0);
5+
}
6+
7+
const husky = (await import('husky')).default;
8+
consola.log(husky());
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
set -e
2+
3+
pnpm exec lint-staged --concurrent false
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"recommendations": ["esbenp.prettier-vscode", "dbaeumer.vscode-eslint", "usernamehw.errorlens", "biomejs.biome"]
3+
}
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
{
2+
"editor.formatOnSave": true,
3+
"editor.codeActionsOnSave": {
4+
"source.fixAll": "explicit",
5+
"source.fixAll.biome": "explicit"
6+
},
7+
"[javascript][javascriptreact][typescript][typescriptreact]": {
8+
"editor.defaultFormatter": "biomejs.biome"
9+
},
10+
"editor.defaultFormatter": "esbenp.prettier-vscode",
11+
"prettier.configPath": "prettier.config.ts",
12+
"files.watcherExclude": {
13+
"**/routeTree.gen.ts": true
14+
},
15+
"search.exclude": {
16+
"**/routeTree.gen.ts": true
17+
},
18+
"files.readonlyInclude": {
19+
"**/routeTree.gen.ts": true
20+
}
21+
}

templates/tanstack-start-hono-cf/package.json

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,16 +22,21 @@
2222
"prettier:ci": "prettier --check --log-level warn .",
2323
"typecheck": "pnpm --recursive run typecheck",
2424
"lint": "pnpm eslint && pnpm biome && pnpm prettier",
25-
"lint:fix": "pnpm eslint:fix && pnpm biome:fix && pnpm prettier:fix"
25+
"lint:fix": "pnpm eslint:fix && pnpm biome:fix && pnpm prettier:fix",
26+
"prepare": "command -v jiti >/dev/null 2>&1 && jiti .husky/install.mts || exit 0"
2627
},
2728
"devDependencies": {
2829
"@biomejs/biome": "2.3.10",
2930
"@commitlint/cli": "20.2.0",
3031
"@commitlint/config-conventional": "20.2.0",
3132
"@commitlint/types": "20.2.0",
33+
"@types/node": "24.13.2",
34+
"consola": "3.4.2",
3235
"eslint": "9.39.2",
3336
"eslint-plugin-react-hooks": "7.0.1",
3437
"globals": "16.5.0",
38+
"husky": "9.1.7",
39+
"jiti": "2.6.1",
3540
"lint-staged": "16.2.7",
3641
"prettier": "3.7.4",
3742
"typescript": "5.9.3",

0 commit comments

Comments
 (0)