Skip to content

feat: モダンツール 4 種テンプレートを追加 (closes #724) - #726

Merged
keito4 merged 1 commit into
mainfrom
feat/modern-tooling-templates
May 9, 2026
Merged

feat: モダンツール 4 種テンプレートを追加 (closes #724)#726
keito4 merged 1 commit into
mainfrom
feat/modern-tooling-templates

Conversation

@keito4

@keito4 keito4 commented May 9, 2026

Copy link
Copy Markdown
Owner

Why

config-contribution-discover の網羅的スキャン (Issue #724) で発見した、複数 repo に共通するモダンツール設定を keito4/config に取り込む。

新規 repo セットアップ時の手書きコスト削減と、ツール選択の標準化が目的。Vitest / Biome / ESLint flat config は今後の標準なので早期テンプレート化が有用。

What

新規テンプレート 4 ファイル + 配布ロジック + ドキュメント更新。

新規ファイル

ファイル 内容 検出元
templates/testing/vitest.config.ts jsdom + v8 coverage + 70% threshold + 標準 alias 8 repos が vitest 採用
templates/eslint/eslint.config.mjs TypeScript ESLint flat config の base + Next.js セクション (optional) + 複雑度ルール (optional) 13 repos が flat config 採用
templates/biome.json Biome v2 統合フォーマッタ + リンタ (lineWidth 100, single quote) 3 repos が Biome 採用
templates/commitlint.config.js Conventional Commits + 日本語向け緩和 (body 100 文字許容) 9 repos が commitlint 使用

repo-maintenance.md section 3.22 への配布登録

  • 同期テーブルに 4 種を「テンプレート (欠落時のみ追加)」として追記
  • MODERN_TOOLS 連想配列で path-mapping (templates/X → ./Y) を実装
  • 採用判定:
    • vitest: package.json devDependencies.vitest が存在
    • eslint flat: devDependencies.eslint あり、かつ既存 .eslintrc* / eslint.config.* 不在
    • biome: devDependencies.@biomejs/biome が存在
    • commitlint: 既存 commitlint.config.* / .commitlintrc* 不在 (setup-husky とセット運用)

ドキュメント更新

  • setup-tests.md: Step 4.1.b として Vitest 採用基準 + 導入手順を追加
  • setup-husky.md: commitlint.config.js テンプレート参照を追加

keito4/config 自身の eslint.config.mjs 修正

  • ignorestemplates/ を追加。本 repo の ESLint v10 が templates/eslint/eslint.config.mjs を auto-discovery して typescript-eslint 未インストールエラーを起こすのを防ぐ

How

/repo-maintenance --mode full 実行時、新規 4 ブロックが順次評価される:

declare -A MODERN_TOOLS=(
  ["templates/testing/vitest.config.ts"]="vitest.config.ts"
  ["templates/eslint/eslint.config.mjs"]="eslint.config.mjs"
  ["templates/biome.json"]="biome.json"
  ["templates/commitlint.config.js"]="commitlint.config.js"
)
for src_rel in "${!MODERN_TOOLS[@]}"; do
  # 採用判定 (package.json 依存 + 既存設定不在) → コピー
done

Risk

  • 低: 新規テンプレート追加と配布ロジック追加のみ
  • 既存設定がある repo は判定で skip されるため上書き不可
  • vitest/biome/eslint flat 採用判定は package.json 依存をチェックするため、未採用 repo には何も配布されない (no-op)

Test plan

  • prettier --check パス
  • pre-commit hooks (test 95 件) パス
  • 本 repo 自身の ESLint 実行が成功 (templates/ 除外確認)
  • 別 repo (vitest 採用済み, 例: Elu-co-jp/calendar_management) で /repo-maintenance --mode full を実行し、既存 vitest.config.ts が上書きされないことを確認
  • 別 repo (vitest 未採用 + ESLint flat config 未配置) で実行し、配布判定が機能することを確認

Discovered but NOT included (rationale)

候補 不採用理由
release.yml (8 repos) publish 先 (npm/GHCR/Vercel) が project ごとに異なる
terraform-*.yml (3 repos) Terraform backend / state 構成が repo ごとに異なる
verify-ui.md / setup-project.md (4 repos) Next.js + Supabase 専用
Tailwind / Next.js config project 固有

詳細は issue #724 を参照。

Follow-up (別 PR で対応)

Closes #724

🤖 Generated with Claude Code

config-contribution-discover の網羅的スキャン (issue #724) で発見した、
複数 repo に共通するモダンツール設定をテンプレート化。

- templates/testing/vitest.config.ts: jsdom + v8 coverage + 70% threshold
- templates/eslint/eslint.config.mjs: TypeScript ESLint flat config の base
- templates/biome.json: Biome v2 統合フォーマッタ + リンタ
- templates/commitlint.config.js: Conventional Commits + 日本語向け緩和

repo-maintenance.md section 3.22 に「テンプレート (採用検出 + 欠落時のみ
追加)」として登録。各ツールは package.json の依存または既存設定ファイル
の有無で配布判定。

setup-tests.md に Vitest 採用基準と導入手順を追加。
setup-husky.md に commitlint.config.js テンプレート参照を追加。

eslint.config.mjs の ignores に templates/ を追加。本リポジトリ自身の
ESLint がテンプレート内の eslint.config.mjs を auto-discovery して
typescript-eslint 未インストールエラーを起こすのを防ぐ。

Refs: #724
@coderabbitai

coderabbitai Bot commented May 9, 2026

Copy link
Copy Markdown

Warning

Rate limit exceeded

@keito4 has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 12 minutes and 50 seconds before requesting another review.

You’ve run out of usage credits. Purchase more in the billing tab.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: d51a7266-c410-4bb3-ac70-5aa7b7e594f4

📥 Commits

Reviewing files that changed from the base of the PR and between 5c9ebaf and f225197.

📒 Files selected for processing (8)
  • .claude/commands/repo-maintenance.md
  • .claude/commands/setup-husky.md
  • .claude/commands/setup-tests.md
  • eslint.config.mjs
  • templates/biome.json
  • templates/commitlint.config.js
  • templates/eslint/eslint.config.mjs
  • templates/testing/vitest.config.ts
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/modern-tooling-templates

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 May 9, 2026

Copy link
Copy Markdown
Owner Author

(aside)
@claude PRがbaseにマージする際にCIが落ちています。
修正してください。

@claude

claude Bot commented May 9, 2026

Copy link
Copy Markdown
Contributor

Claude finished @keito4's task in 14m 12s —— View job


CI調査結果と修正報告

  • CI失敗の状況を確認
  • CIログを詳細分析(Lint & Format、Unit Tests)
  • ローカルで全品質ゲートを実行
  • 調査結果の報告

調査結果: CIは全チェック通過済み ✅

全ステータスチェックの確認結果:

チェック 結論
Lint & Format (ESLint + shellcheck + Prettier) ✅ SUCCESS
Unit Tests (95/95テスト) ✅ SUCCESS
Security Scans (Gitleaks + NPM Audit + License + Dependency Review) ✅ SUCCESS
Quality Gate (CI) ✅ SUCCESS
CI Fallback ✅ SUCCESS
CodeRabbit ✅ SUCCESS
GitGuardian ✅ SUCCESS
Integration Tests ⏭️ SKIPPED (スクリプト変更なし — 正常)
Workflow Lint ⏭️ SKIPPED (ワークフロー変更なし — 正常)

マージ可否: MERGEABLE (コンフリクトなし)

マージブロック状況: BLOCKEDclaude-review ジョブが IN_PROGRESS のため


ブロック原因の特定

PR オープン時に起動した claude-code-review.ymlclaude-review ジョブが実行中です。このジョブは CI が通過した後に Claude による自動コードレビューを行うものです。ワークフローに continue-on-error: true が設定されているため、CI 自体は失敗していません。

ユーザーが「CIが落ちている」と見た状態は、この claude-review が Pending 状態でマージがブロックされていた状況と考えられます。


コードレビュー(プロアクティブ確認)

CIログとソースを確認した上で、追加された4テンプレートと配布ロジックを検証しました。

templates/testing/vitest.config.ts

  • __dirname の使用は Vitest 設定ファイルでは正しい(Vite が CJS 互換シムを提供)
  • カバレッジ閾値 70% はリポジトリ標準と一致
  • 問題なし ✅

templates/eslint/eslint.config.mjs

  • typescript-eslint は templates/ 内のみで使用 → ESLint 除外設定済みで本リポジトリの lint に影響なし
  • 問題なし ✅

eslint.config.mjs (本リポジトリ設定)

  • 'templates/' を ignores に追加 → ESLint auto-discovery エラーを防止
  • CI ログで eslint . --ext .js が正常終了を確認済み ✅

templates/biome.json

  • Biome v2 スキーマ参照、lineWidth/quoteStyle の設定が適切
  • 問題なし ✅

templates/commitlint.config.js

  • シンプルなテンプレート(codex-release-type プラグインなし)— 汎用テンプレートとして意図的
  • test/commitlint-config.test.js はルートの commitlint.config.js をテストしており競合なし ✅

repo-maintenance.md の配布ロジック

  • MODERN_TOOLS 連想配列と採用判定ロジックは適切
  • 既存設定を上書きしない設計(欠落時のみ配置)✅

結論

コードに修正が必要な問題は見つかりませんでした。 CIは全チェック通過済みで、マージコンフリクトもありません。

PR がブロックされているのは claude-review ジョブの完了待ちのみです。本レビューが完了次第、PR のマージが可能になります。

@claude

claude Bot commented May 9, 2026

Copy link
Copy Markdown
Contributor

Claude finished @keito4's task in 3m 49s —— View job


CI確認 + コードレビュー

  • CI失敗の状況確認
  • 失敗原因の特定
  • ローカル品質ゲートの確認
  • コードレビュー実施

CI状況

現在のCIは全て green です。

ワークフロー 結果
CI ✅ success
CI Fallback ✅ success
Security Scans ✅ success
Dependabot Auto-merge ✅ success

ローカル確認でも lint / format:check / shellcheck / jest (95件) 全てパスしています。

eslint.config.mjs'templates/' を ignores 追加した修正が効いており、templates/eslint/eslint.config.mjs が ESLint v10 のオートディスカバリに拾われて typescript-eslint 未インストールエラーになる問題は解消されています。


コードレビュー

✅ 良い点

  • テンプレート 4 種とも使用手順がファイル先頭コメントに完備されており、コピーだけで即使える設計になっている
  • repo-maintenance.md の採用判定ロジック (package.json 依存チェック + 既存設定不在チェック) が的確で、誤配布リスクが低い
  • 既存設定のある repo はスキップ (continue) される安全設計

⚠️ 指摘事項 (minor)

1. templates/biome.json_comment フィールドの schema 違反リスク

"_comment": "Biome 統合フォーマッタ + リンタテンプレート..."

JSON に公式コメント構文はなく _comment はあくまでフィールド名です。Biome の config schema が additionalProperties: false を適用している場合、これをそのままコピーしたユーザーの biome check が失敗します。Biome v2 ではスキーマ検証が厳格化されている点に注意が必要です。

推奨修正: _comment フィールドを削除し、説明をファイル先頭の // 形式コメント (JSONC) に移すか、README に切り出す。
Fix this →

2. templates/biome.json — schema バージョンのハードコード

"$schema": "https://biomejs.dev/schemas/2.4.8/schema.json"

Biome アップデート時に利用者がここを手動更新しないと古い schema に縛られます。latest は Biome の schema URL では使えないため、テンプレートのコメントに「@biomejs/biome のバージョンに合わせて更新してください」と明記しておくと親切です。

3. templates/eslint/eslint.config.mjstseslint は未インストール時に明示エラー

テンプレートは typescript-eslint をデフォルト使用しており、使用手順に記載済みですが、tseslint.configs.recommended... (spread) で展開されるため、インストール漏れ時のエラーメッセージが分かりにくいです。現状で十分許容範囲ですが、インストール確認ステップをより目立たせると親切です。

💡 提案 (recommendation)

repo-maintenance.md のシェルスクリプト内で declare -A を使っていますが、bash の連想配列は bash 4.0+ が必要です。macOS のデフォルト bash は 3.2 系です。DevContainer 環境 (Linux) で実行する前提なら問題ないですが、README に「bash 4+ 必須」と一言あると利用者の混乱を防げます。


総評

新規テンプレートの品質は高く、配布ロジックも安全設計です。CI は現在 green であり、指摘事項は全て minor / recommendation です。biome.json_comment フィールドのみ、ユーザーが気づかずコピーした場合に実際の問題につながる可能性があるため対応を推奨します。

@chatgpt-codex-connector chatgpt-codex-connector 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: f225197a08

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

jq -e '.devDependencies.vitest // .dependencies.vitest' package.json >/dev/null 2>&1 || continue
;;
eslint.config.mjs)
ls eslint.config.{mjs,js,cjs,ts} .eslintrc{.js,.json,.cjs,.yml,.yaml} >/dev/null 2>&1 && continue

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Detect every ESLint config variant before copying template

The skip check for eslint.config.mjs is incomplete: ls eslint.config.{mjs,js,cjs,ts} .eslintrc{.js,.json,.cjs,.yml,.yaml} misses valid existing configs such as .eslintrc (no extension) and eslint.config.mts/cts. In repos using one of those files, /repo-maintenance will still add a new eslint.config.mjs, which can silently change which ruleset ESLint uses and break existing lint behavior despite this block being documented as “skip when equivalent config exists.”

Useful? React with 👍 / 👎.

jq -e '.devDependencies["@biomejs/biome"] // .dependencies["@biomejs/biome"]' package.json >/dev/null 2>&1 || continue
;;
commitlint.config.js)
ls commitlint.config.{js,ts,mjs,cjs} .commitlintrc{,.js,.json,.yml,.yaml} >/dev/null 2>&1 && continue

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Skip commitlint template when alternate rc files already exist

The commitlint guard only checks commitlint.config.{js,ts,mjs,cjs} and .commitlintrc{,.js,.json,.yml,.yaml}, but commitlint also supports .commitlintrc.cjs, .commitlintrc.mjs, .commitlintrc.ts, .commitlintrc.cts, and .commitlintrc.mts. Repos already configured with these filenames will be treated as “missing config,” and this step will inject a second config file, risking unexpected rule resolution changes in commit hooks.

Useful? React with 👍 / 👎.

@keito4 keito4 self-assigned this May 9, 2026
@keito4
keito4 merged commit 82c0708 into main May 9, 2026
21 checks passed
@keito4
keito4 deleted the feat/modern-tooling-templates branch May 9, 2026 03:15
@github-actions

github-actions Bot commented May 9, 2026

Copy link
Copy Markdown
Contributor

🎉 This PR is included in version 1.112.0 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

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.

feat: Add modern tooling templates (Vitest / Biome / ESLint flat config / commitlint)

1 participant