-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[DOJO-45] フォルダ構成の整理 (修正1) #35
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ありがとうございます。importのパスについては、@/
による絶対パスと相対パスが混ざっているので、どちらかに統一するのが良いでしょう。(ちなみに、このインポートのパスについては、皆さん結構こだわりが強い)
src/app/api/problems/route.ts
Outdated
@@ -9,6 +9,7 @@ export async function GET() { | |||
try { | |||
const problems = await problemUseCase.getAllProblems(); | |||
return NextResponse.json(problems, { status: 200 }); | |||
// eslint-disable-next-line @typescript-eslint/no-unused-vars |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
} catch (_error) {
のように _
を変数名の先頭につけるのが一般的な方法のはずです。
https://johnnyreilly.com/typescript-eslint-no-unused-vars
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
修正しました
8aee38e
src/components/code-editor.tsx
Outdated
import Image from 'next/image'; | ||
import Spinner from '@/public/spinner.svg'; | ||
import Spinner from '@/../public/spinner.svg'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@/
にすることのメリットは、管理がしやすくなることです。
tsconfig.json
のpaths
に @lib/
や@public/
を定義するのが良いでしょう
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
修正しました
67f9ca9
src/components/code-tab.tsx
Outdated
@@ -2,7 +2,7 @@ import { Tabs, TabsContent, TabsList, TabsTrigger } from '@/components/ui/tabs'; | |||
import { cn } from '@/lib/utils'; | |||
import { Code } from 'lucide-react'; | |||
import { CodeEditor } from './code-editor'; | |||
import { Language, SupportedLanguage } from '@/lib/languages'; | |||
import { Language, SupportedLanguage } from '@/../lib/languages'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
tsconfig.json
の paths
に@lib/
を定義するのが良いでしょう
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
そもそも、Language
を /lib/languages.ts
で定義したほうがいい気がしてきました。
Strapi からの参照できるように、と思ってルートディレクトリの lib に配置していましたが、プロジェクトの構造としてあまり良くありませんね。
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
修正しました
932772b
src/components/code-tab.tsx
Outdated
@@ -15,7 +15,7 @@ import { Confirm } from '@/components/ui/alert-dialog'; | |||
import { OnMount } from '@monaco-editor/react'; | |||
import { DialogPortalProps } from '@radix-ui/react-dialog'; | |||
import { Button } from '@/components/ui/button'; | |||
import { RestartAltIcon } from './icons/material-symbols'; | |||
import { RestartAltIcon } from '@/components/ui/icons'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
tsconfig.jso
の paths
に @icons
を定義するか、
@components/
を定義するのが良いでしょう。
なぜこのようにするかといえば、iconはリソースであり、ソースコードではないので、src/
以下にある必要性がない(と考える人達が居る)からです。
コンポーネントを開発したエンジニアとしては、コンポーネントとそのリソースが近くにある方が良い、と考えるかもしれません。
でもデザイナーなら、コードじゃないなら src/
以下ではなくて、rootディレクトリ直下にあった方がやりやすいわけです。
そのような意見があるので、柔軟に対応できるように paths
で仮想パスを定義するのです
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
なるほど、そのような考え方もあるのですね。
勉強になります!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
修正しました
f95bfbe
やったこと
components.json
)pnpm dlx shadcn@latest add [xxx]
でコンポーネントを追加できないことがあったのが修正されたeslint.config.mjs
)src/*.{tsx,ts}
のファイルに対して全く動作していなかったpnpm i
を実行したら、pnpm-lock.yaml のlockfileVersion
が6.0
->9.0
になった