Conversation
packages/* をワークスペースとして管理するための設定を追加
strict な TypeScript 設定を共有パッケージとして提供 - ベース設定: 厳格な型チェックオプションを網羅 - React 設定: JSX と DOM lib を追加した React 向け設定
|
Important Review skippedReview was skipped due to path filters ⛔ Files ignored due to path filters (1)
CodeRabbit blocks several paths by default. You can override this behavior by explicitly including those paths in the path filters. For example, including You can disable this status message by setting the Use the checkbox below for a quick retry:
Walkthroughplainbrew向けの厳格な TypeScript 設定を提供する新パッケージ Changes
Sequence Diagram(s)(該当なし) Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Tip Try Coding Plans. Let us write the prompt for your AI agent so you can ship faster (with fewer bugs). 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. Comment |
| "allowUnreachableCode": false, | ||
| "isolatedModules": true, | ||
| "verbatimModuleSyntax": true, | ||
| "esModuleInterop": true, |
There was a problem hiding this comment.
Claudeより: verbatimModuleSyntax と esModuleInterop の併用は冗長。verbatimModuleSyntax: true を採用しているなら esModuleInteropは削除を検討。
There was a problem hiding this comment.
There was a problem hiding this comment.
これら問題は、verbatimModuleSyntaxを有効化しなくても、ESLint で@typescript-eslint/consistent-type-imports と @typescript-eslint/no-import-type-side-effects を有効化することでほとんど解決できる。auto-fix も効くし、どの環境でも特にデメリットはない?と思うのでとりあえずこれらを有効化しておくのが良さそう。
There was a problem hiding this comment.
Next.js は SWC を使用して構文を最適化するため、このオプションを true にして構文をそのまま渡すことが推奨されます。
https://zenn.dev/hayato94087/books/b174f8b1cd80db/viewer/v00-05-16-kj8s5o8gppf5#next.js-%E3%81%AB%E3%81%8A%E3%81%91%E3%82%8B%E8%A8%AD%E5%AE%9A
は〜〜
There was a problem hiding this comment.
Actionable comments posted: 1
🧹 Nitpick comments (1)
packages/tsconfig/tsconfig.json (1)
20-25: shareable基本設定から出力関連オプションを分離してください。
@plainbrew/tsconfigは他プロジェクトに継承される基本設定です。moduleResolution: "bundler"とdeclarationの組み合わせは、Node.js ESM環境での互換性問題を引き起こす可能性があります。bundler解決戦略は拡張子なしのインポート(export * from "./utils")を許可しますが、生成される.d.tsファイルはNode.jsコンシューマーで無効になります。出力戦略(
declaration、declarationMap、sourceMap)はプロジェクトの用途(アプリ vs ライブラリ)に応じて異なるため、基本設定では削除し、各プロジェクトで明示的に設定させることを推奨します。♻️ 提案差分
"compilerOptions": { @@ - "resolveJsonModule": true, - "declaration": true, - "declarationMap": true, - "sourceMap": true + "resolveJsonModule": true }🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@packages/tsconfig/tsconfig.json` around lines 20 - 25, The shared tsconfig currently mixes moduleResolution: "bundler" and output-related flags (declaration, declarationMap, sourceMap) into the base config which can break Node ESM consumers; remove the output flags (declaration, declarationMap, sourceMap) from the base `@plainbrew/tsconfig` and keep only resolution and module semantics, so projects must opt-in to declarations and source maps in their own tsconfig overrides; specifically remove "declaration", "declarationMap", and "sourceMap" entries and document that projects should set these per-package while leaving "moduleResolution" and "module" as-is.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@packages/tsconfig/package.json`:
- Around line 1-21: Add a peerDependencies entry to the package.json of the
`@plainbrew/tsconfig` package declaring a minimum TypeScript version to prevent
consumers with older compilers from failing; specifically add a
"peerDependencies" object with "typescript": ">=5.4.0" (since tsconfig.json uses
"module": "preserve" and other options like "moduleResolution": "bundler" that
require TS >=5.4.0) so package consumers are informed of the required TypeScript
version.
---
Nitpick comments:
In `@packages/tsconfig/tsconfig.json`:
- Around line 20-25: The shared tsconfig currently mixes moduleResolution:
"bundler" and output-related flags (declaration, declarationMap, sourceMap) into
the base config which can break Node ESM consumers; remove the output flags
(declaration, declarationMap, sourceMap) from the base `@plainbrew/tsconfig` and
keep only resolution and module semantics, so projects must opt-in to
declarations and source maps in their own tsconfig overrides; specifically
remove "declaration", "declarationMap", and "sourceMap" entries and document
that projects should set these per-package while leaving "moduleResolution" and
"module" as-is.
ℹ️ Review info
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
⛔ Files ignored due to path filters (1)
pnpm-lock.yamlis excluded by!**/pnpm-lock.yaml
📒 Files selected for processing (4)
packages/tsconfig/package.jsonpackages/tsconfig/react.jsonpackages/tsconfig/tsconfig.jsonpnpm-workspace.yaml
CJS 環境との互換性問題があるため削除。 型 import の強制は ESLint ルールで対応する方が安全。 ref: https://zenn.dev/teppeis/articles/2023-04-typescript-5_0-verbatim-module-syntax
There was a problem hiding this comment.
Actionable comments posted: 1
🧹 Nitpick comments (1)
packages/tsconfig/tsconfig.json (1)
19-20:moduleResolution: "bundler"とmodule: "preserve"はベース設定としては強すぎます。Line [19]〜Line [20] は環境依存のため、ベース (
@plainbrew/tsconfig) では外し、必要な派生設定(例:./react)側で付与する構成の方が再利用性が高いです。差分案
- "moduleResolution": "bundler", - "module": "preserve",🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@packages/tsconfig/tsconfig.json` around lines 19 - 20, ベース tsconfig にある設定キー "moduleResolution": "bundler" と "module": "preserve" は環境依存で強すぎるため、ベース設定からこれらのキーを削除して再利用性を高めてください;代わりに、React 等の派生構成ファイル(例: a derived tsconfig for React)で "moduleResolution" と "module" を必要に応じて明示的に追加するように変更し、既存の参照先やビルドスクリプトが新しい派生ファイルを使うように更新してください。
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@packages/tsconfig/tsconfig.json`:
- Around line 22-24: Remove the emit-related compiler options from the base
config: delete "declaration", "declarationMap", and "sourceMap" from the
tsconfig JSON so the `@plainbrew/tsconfig` package no longer forces emit behavior
on consumers; leave strict/type-checking settings intact and update any README
or docs to instruct library projects to enable these emit options (or set
noEmit) in their own tsconfig overrides.
---
Nitpick comments:
In `@packages/tsconfig/tsconfig.json`:
- Around line 19-20: ベース tsconfig にある設定キー "moduleResolution": "bundler" と
"module": "preserve" は環境依存で強すぎるため、ベース設定からこれらのキーを削除して再利用性を高めてください;代わりに、React
等の派生構成ファイル(例: a derived tsconfig for React)で "moduleResolution" と "module"
を必要に応じて明示的に追加するように変更し、既存の参照先やビルドスクリプトが新しい派生ファイルを使うように更新してください。
大規模 OSS (@tsconfig/strictest, @sindresorhus/tsconfig, @total-typescript/tsconfig) との 比較レビューに基づく改善: - add: noUncheckedSideEffectImports (TS 5.6+, 副作用 import の存在チェック) - add: erasableSyntaxOnly (TS 5.8+, enum/namespace を禁止) - add: moduleDetection: "force" (全ファイルをモジュールとして扱う) - remove: declaration, declarationMap, sourceMap (output 系は拡張先に委ねる) - remove: forceConsistentCasingInFileNames (TS 5.0 以降デフォルト true)
各オプションの採用理由と不採用理由を OSS の参考元とともに記載
各オプションに公式ドキュメントへのリンクを追加
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@packages/tsconfig/README.md`:
- Around line 5-13: Add a clear TypeScript minimum version note at the top of
the README usage section stating that this config requires TypeScript >=5.8
(because erasableSyntaxOnly needs TS 5.8 and noUncheckedSideEffectImports needs
TS 5.6), and update package.json peerDependencies entry for "typescript" from
">=5.4.0" to ">=5.8.0"; specifically edit the README usage block near the top
(the usage examples around the extends lines) to include the version requirement
and change the peerDependencies in package.json to reflect the new minimum.
ℹ️ Review info
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (3)
packages/tsconfig/README.mdpackages/tsconfig/package.jsonpackages/tsconfig/tsconfig.json
🚧 Files skipped from review as they are similar to previous changes (2)
- packages/tsconfig/tsconfig.json
- packages/tsconfig/package.json
| ## 使い方 | ||
|
|
||
| ```jsonc | ||
| // ベース | ||
| { "extends": "@plainbrew/tsconfig" } | ||
|
|
||
| // React | ||
| { "extends": "@plainbrew/tsconfig/react" } | ||
| ``` |
There was a problem hiding this comment.
🧩 Analysis chain
🌐 Web query:
TypeScript erasableSyntaxOnly compiler option introduced version
💡 Result:
The --erasableSyntaxOnly compiler option was introduced in TypeScript 5.8 (first available in the 5.8 Beta released January 29, 2025). [1] It’s also documented in the TypeScript 5.8 release notes. [2]
Sources:
[1] TypeScript 5.8 Beta announcement (Jan 29, 2025)
[2] TypeScript 5.8 release notes
🌐 Web query:
TypeScript noUncheckedSideEffectImports compiler option introduced version
💡 Result:
The noUncheckedSideEffectImports compiler option was introduced in TypeScript 5.6. [1]
Sources:
[1] TypeScript blog – Announcing TypeScript 5.6 (section “The --noUncheckedSideEffectImports Option”) https://devblogs.microsoft.com/typescript/announcing-typescript-5-6/
🏁 Script executed:
# Check the actual README file content
cat packages/tsconfig/README.mdRepository: plainbrew/configs
Length of output: 8748
🏁 Script executed:
# Check the tsconfig configurations being used
find packages/tsconfig -name "*.json" -type f | head -20Repository: plainbrew/configs
Length of output: 152
🏁 Script executed:
# Check package.json to see peerDependencies
cat packages/tsconfig/package.json 2>/dev/null || echo "File not found"Repository: plainbrew/configs
Length of output: 505
TypeScript の最小要件を冒頭で明示し、peerDependencies も修正してください。
設計判断テーブル(Line 30 / Line 33)の通り、erasableSyntaxOnly は TS 5.8+、noUncheckedSideEffectImports は TS 5.6+ が必須です。現状では使い方セクション(Lines 5-13)に版要件がないため、TS 5.4~5.7 のユーザーが extends 後に unknown compiler option エラーに直面します。
併せて、package.json の peerDependencies を typescript: >=5.4.0 から typescript: >=5.8.0 に修正してください。
✍️ 提案差分(README 追記)
# `@plainbrew/tsconfig`
plainbrew プロジェクト向けの strict な TypeScript 設定。
+## 必要要件
+
+- TypeScript: `>= 5.8`(`erasableSyntaxOnly` を利用するため)
+ - `noUncheckedSideEffectImports` は TypeScript 5.6+ が必要です
+
## 使い方📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| ## 使い方 | |
| ```jsonc | |
| // ベース | |
| { "extends": "@plainbrew/tsconfig" } | |
| // React | |
| { "extends": "@plainbrew/tsconfig/react" } | |
| ``` | |
| ## 必要要件 | |
| - TypeScript: `>= 5.8`(`erasableSyntaxOnly` を利用するため) | |
| - `noUncheckedSideEffectImports` は TypeScript 5.6+ が必要です | |
| ## 使い方 | |
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In `@packages/tsconfig/README.md` around lines 5 - 13, Add a clear TypeScript
minimum version note at the top of the README usage section stating that this
config requires TypeScript >=5.8 (because erasableSyntaxOnly needs TS 5.8 and
noUncheckedSideEffectImports needs TS 5.6), and update package.json
peerDependencies entry for "typescript" from ">=5.4.0" to ">=5.8.0";
specifically edit the README usage block near the top (the usage examples around
the extends lines) to include the version requirement and change the
peerDependencies in package.json to reflect the new minimum.
Update peerDependencies minimum from >=5.4.0 to >=5.8.0 and add version requirement note to README usage section.
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@packages/tsconfig/package.json`:
- Around line 21-23: The CI failure is caused by a mismatch between
peerDependencies.typescript in package.json (now ">=5.8.0") and the specifier
recorded in pnpm-lock.yaml (still ">=5.4.0"); fix it by running the repository
root command `pnpm install` to regenerate pnpm-lock.yaml so its specifiers match
package.json, then commit the updated pnpm-lock.yaml alongside your package.json
change.
ℹ️ Review info
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
⛔ Files ignored due to path filters (1)
pnpm-lock.yamlis excluded by!**/pnpm-lock.yaml
📒 Files selected for processing (2)
packages/tsconfig/README.mdpackages/tsconfig/package.json
🚧 Files skipped from review as they are similar to previous changes (1)
- packages/tsconfig/README.md
🤖 Claude's Review:
|
| オプション | 値 | 説明 |
|---|---|---|
noUncheckedSideEffectImports |
true |
副作用importのチェック (TS 5.6+) |
erasableSyntaxOnly |
true |
enum/namespace禁止 (TS 5.8+) |
moduleDetection |
"force" |
全ファイルをモジュール化 |
moduleResolution |
"bundler" |
バンドラー向け解決 |
module |
"preserve" |
import/exportをそのまま保持 |
resolveJsonModule |
true |
JSON importの型安全化 |
スタンドアロンを推す理由
- 追従の遅さ:
@tsconfig/strictestはnoUncheckedSideEffectImports(TS 5.6) やerasableSyntaxOnly(TS 5.8) といった最新オプションを未収録。自前管理の方が最新追従しやすい - 可視性: 全20個のオプションが1ファイルで見渡せる。
extendsすると暗黙の設定が生まれる - 依存ゼロ: strict設定という基盤に外部依存を持ち込むリスクを回避
- 管理コストの低さ: オプション数が少なく、TypeScriptのリリースノートで差分確認すれば十分
仮に extends する場合でも、追加の6オプションを上書きする必要があり、メリットが薄いです。
このコメントは Claude (AI) によるレビューです
🤖 Claude's Follow-up:
|
概要
fix #6
strict な TypeScript 設定を共有パッケージ
@plainbrew/tsconfigとして提供します。変更内容
@plainbrew/tsconfigパッケージの作成@plainbrew/tsconfig): 厳格な型チェックオプションを網羅@plainbrew/tsconfig/react): JSX と DOM lib を追加した React 向け設定使用方法
含まれる strict 設定
strict: trueexactOptionalPropertyTypesnoUncheckedIndexedAccessnoUncheckedSideEffectImports(TS 5.6+)noPropertyAccessFromIndexSignaturenoImplicitOverridenoImplicitReturnsnoFallthroughCasesInSwitchnoUnusedLocals/noUnusedParametersallowUnusedLabels: false/allowUnreachableCode: falseerasableSyntaxOnly(TS 5.8+)isolatedModulesmoduleDetection: "force"moduleResolution: "bundler"/module: "preserve"設計判断ドキュメント
packages/tsconfig/README.mdに各オプションの採用理由を記載。@tsconfig/strictest,@sindresorhus/tsconfig,@total-typescript/tsconfig等を参考に設計。動作確認方法
pnpm run format:checkがパスすることextendsして TypeScript の strict チェックが有効になることSummary by CodeRabbit
リリースノート
New Features
Documentation