Skip to content
Open
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 21 additions & 0 deletions packages/tsconfig/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{
"name": "@plainbrew/tsconfig",
"version": "0.1.0",
"description": "Strict TypeScript configuration for plainbrew projects",
"keywords": [
"react",
"strict",
"tsconfig",
"typescript"
],
"license": "MIT",
"files": [
"tsconfig.json",
"react.json"
],
"type": "module",
"exports": {
".": "./tsconfig.json",
"./react": "./react.json"
}
Comment thread
coderabbitai[bot] marked this conversation as resolved.
}
Comment thread
coderabbitai[bot] marked this conversation as resolved.
8 changes: 8 additions & 0 deletions packages/tsconfig/react.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"$schema": "https://json.schemastore.org/tsconfig",
"extends": "./tsconfig.json",
"compilerOptions": {
"jsx": "react-jsx",
"lib": ["dom", "dom.iterable", "esnext"]
}
}
26 changes: 26 additions & 0 deletions packages/tsconfig/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
{
"$schema": "https://json.schemastore.org/tsconfig",
"compilerOptions": {
"strict": true,
"exactOptionalPropertyTypes": true,
"noFallthroughCasesInSwitch": true,
"noImplicitOverride": true,
"noImplicitReturns": true,
"noPropertyAccessFromIndexSignature": true,
"noUncheckedIndexedAccess": true,
"noUnusedLocals": true,
"noUnusedParameters": true,
"allowUnusedLabels": false,
"allowUnreachableCode": false,
"isolatedModules": true,
"esModuleInterop": true,

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Claudeより: verbatimModuleSyntax と esModuleInterop の併用は冗長。verbatimModuleSyntax: true を採用しているなら esModuleInteropは削除を検討。

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

これら問題は、verbatimModuleSyntaxを有効化しなくても、ESLint で@typescript-eslint/consistent-type-imports と @typescript-eslint/no-import-type-side-effects を有効化することでほとんど解決できる。auto-fix も効くし、どの環境でも特にデメリットはない?と思うのでとりあえずこれらを有効化しておくのが良さそう。

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

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

は〜〜

"skipLibCheck": true,
"forceConsistentCasingInFileNames": true,
"moduleResolution": "bundler",
"module": "preserve",
"resolveJsonModule": true,
"declaration": true,
"declarationMap": true,
"sourceMap": true
Comment thread
coderabbitai[bot] marked this conversation as resolved.
Outdated
}
}
2 changes: 2 additions & 0 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions pnpm-workspace.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
packages:
- "packages/*"