diff --git a/.eslintrc.cjs b/.eslintrc.cjs index 13f4d643..bcf55a7d 100644 --- a/.eslintrc.cjs +++ b/.eslintrc.cjs @@ -72,6 +72,12 @@ module.exports = { "plugin:import/recommended", "plugin:import/typescript", ], + rules: { + "@typescript-eslint/consistent-type-imports": [ + "warn", + { prefer: "type-imports", fixStyle: "inline-type-imports" }, + ], + }, }, // Node diff --git a/README.md b/README.md index 176058de..f4653eb3 100644 --- a/README.md +++ b/README.md @@ -1 +1,10 @@ # cafeore-2024 POSシステム + +## コマンド + +| コマンド | 説明 | +| ------------------------------- | ----------------------------------------------------------------- | +| `bun install --frozen-lockfile` | 依存パッケージのインストールには基本的にこれを使ってください | +| `bun dev` | 開発環境の立ち上げ。ホットリロードに対応しています | +| `bun lint` | ESLintの実行。`--fix`オプションをつけることで、自動修正もできます | +| `bun fmt` | Prettierの実行 | diff --git a/app/components/ui/alert-dialog.tsx b/app/components/ui/alert-dialog.tsx index d9c8bdf0..b5517625 100644 --- a/app/components/ui/alert-dialog.tsx +++ b/app/components/ui/alert-dialog.tsx @@ -1,8 +1,8 @@ -import * as React from "react"; import * as AlertDialogPrimitive from "@radix-ui/react-alert-dialog"; +import * as React from "react"; -import { cn } from "~/lib/utils"; import { buttonVariants } from "~/components/ui/button"; +import { cn } from "~/lib/utils"; const AlertDialog = AlertDialogPrimitive.Root; diff --git a/app/components/ui/label.tsx b/app/components/ui/label.tsx index 6249762d..5be2463e 100644 --- a/app/components/ui/label.tsx +++ b/app/components/ui/label.tsx @@ -1,6 +1,6 @@ -import * as React from "react"; import * as LabelPrimitive from "@radix-ui/react-label"; import { cva, type VariantProps } from "class-variance-authority"; +import * as React from "react"; import { cn } from "~/lib/utils"; diff --git a/app/components/ui/radio-group.tsx b/app/components/ui/radio-group.tsx index a89c13cc..d58becdb 100644 --- a/app/components/ui/radio-group.tsx +++ b/app/components/ui/radio-group.tsx @@ -1,6 +1,6 @@ -import * as React from "react"; import * as RadioGroupPrimitive from "@radix-ui/react-radio-group"; import { Circle } from "lucide-react"; +import * as React from "react"; import { cn } from "~/lib/utils"; diff --git a/app/firebase/converter.ts b/app/firebase/converter.ts index 5f41efbf..066d8bda 100644 --- a/app/firebase/converter.ts +++ b/app/firebase/converter.ts @@ -1,11 +1,11 @@ import { + Timestamp, type DocumentData, type QueryDocumentSnapshot, type SnapshotOptions, - Timestamp, } from "firebase/firestore"; import _ from "lodash"; -import type { ZodSchema } from "zod"; +import { type ZodSchema } from "zod"; export const converter = (schema: ZodSchema) => { return { diff --git a/app/firebase/subscription.ts b/app/firebase/subscription.ts index ed57e27b..9bdd8c7b 100644 --- a/app/firebase/subscription.ts +++ b/app/firebase/subscription.ts @@ -1,6 +1,7 @@ import { collection, onSnapshot, query } from "firebase/firestore"; -import type { SWRSubscription } from "swr/subscription"; +import { type SWRSubscription } from "swr/subscription"; import { type ZodSchema } from "zod"; + import { converter } from "./converter"; import { db } from "./firestore"; diff --git a/app/lib/utils.ts b/app/lib/utils.ts index 365058ce..a5ef1935 100644 --- a/app/lib/utils.ts +++ b/app/lib/utils.ts @@ -1,4 +1,4 @@ -import { type ClassValue, clsx } from "clsx"; +import { clsx, type ClassValue } from "clsx"; import { twMerge } from "tailwind-merge"; export function cn(...inputs: ClassValue[]) { diff --git a/app/models/order.test.ts b/app/models/order.test.ts index c7cd816b..822f9895 100644 --- a/app/models/order.test.ts +++ b/app/models/order.test.ts @@ -1,5 +1,6 @@ import { expect, test } from "vitest"; -import { ItemWithId } from "./item"; + +import { type ItemWithId } from "./item"; import { OrderEntity } from "./order"; test("order total auto calc", () => { diff --git a/app/models/order.ts b/app/models/order.ts index e34e8ee2..90bd56dd 100644 --- a/app/models/order.ts +++ b/app/models/order.ts @@ -1,5 +1,6 @@ import { z } from "zod"; -import { Item, itemSchema } from "./item"; + +import { itemSchema, type Item } from "./item"; export const orderSchema = z.object({ id: z.string().optional(), // Firestore のドキュメント ID diff --git a/app/repositories/item.ts b/app/repositories/item.ts index db48a539..0ece1b7a 100644 --- a/app/repositories/item.ts +++ b/app/repositories/item.ts @@ -7,11 +7,13 @@ import { getDocs, setDoc, } from "firebase/firestore"; + import { converter } from "~/firebase/converter"; import { db } from "~/firebase/firestore"; import { hasId } from "~/lib/typeguard"; import { itemSchema } from "~/models/item"; -import { ItemRepository } from "./type"; + +import { type ItemRepository } from "./type"; export const itemRepository: ItemRepository = { save: async (item) => { diff --git a/app/repositories/order.ts b/app/repositories/order.ts index cc1335f7..9dc2be69 100644 --- a/app/repositories/order.ts +++ b/app/repositories/order.ts @@ -7,11 +7,13 @@ import { getDocs, setDoc, } from "firebase/firestore"; + import { converter } from "~/firebase/converter"; import { db } from "~/firebase/firestore"; import { hasId } from "~/lib/typeguard"; -import { Order, orderSchema, OrderWithId } from "~/models/order"; -import { OrderRepository } from "./type"; +import { orderSchema, type Order, type OrderWithId } from "~/models/order"; + +import { type OrderRepository } from "./type"; export const orderRepository: OrderRepository = { save: async (order) => { diff --git a/app/repositories/type.ts b/app/repositories/type.ts index 2557a885..1aaeaa08 100644 --- a/app/repositories/type.ts +++ b/app/repositories/type.ts @@ -1,6 +1,6 @@ -import { WithId } from "~/lib/typeguard"; -import { Item } from "~/models/item"; -import { Order } from "~/models/order"; +import { type WithId } from "~/lib/typeguard"; +import { type Item } from "~/models/item"; +import { type Order } from "~/models/order"; export type BaseRepository = { save(data: T): Promise>; diff --git a/app/root.tsx b/app/root.tsx index 99ff8bcc..c65f3211 100644 --- a/app/root.tsx +++ b/app/root.tsx @@ -5,6 +5,7 @@ import { Scripts, ScrollRestoration, } from "@remix-run/react"; + import "./tailwind.css"; export function Layout({ children }: { children: React.ReactNode }) { diff --git a/app/routes/_header._index.tsx b/app/routes/_header._index.tsx index 1860ea0f..10f26d8b 100644 --- a/app/routes/_header._index.tsx +++ b/app/routes/_header._index.tsx @@ -1,6 +1,6 @@ -import type { MetaFunction } from "@remix-run/node"; -import { useLoaderData } from "@remix-run/react"; +import { useLoaderData, type MetaFunction } from "@remix-run/react"; import { collection, getDocs } from "firebase/firestore"; + import { Button } from "~/components/ui/button"; import { converter } from "~/firebase/converter"; import { db } from "~/firebase/firestore"; diff --git a/app/routes/_header.serve.tsx b/app/routes/_header.serve.tsx index 50a371f1..a4f0524a 100644 --- a/app/routes/_header.serve.tsx +++ b/app/routes/_header.serve.tsx @@ -1,5 +1,6 @@ -import type { MetaFunction } from "@remix-run/node"; +import { type MetaFunction } from "@remix-run/react"; import { typedjson, useTypedLoaderData } from "remix-typedjson"; + import { Button } from "~/components/ui/button"; import { Card, CardContent, CardHeader, CardTitle } from "~/components/ui/card"; import { orderRepository } from "~/repositories/order"; diff --git a/app/routes/_header.tsx b/app/routes/_header.tsx index c4e13756..91bd28e1 100644 --- a/app/routes/_header.tsx +++ b/app/routes/_header.tsx @@ -1,4 +1,5 @@ import { Outlet } from "@remix-run/react"; + import { OnlineStatus } from "~/components/online-status"; export default function BaseHeader() { diff --git a/app/routes/casher.tsx b/app/routes/casher.tsx index f3246494..fb6a3b80 100644 --- a/app/routes/casher.tsx +++ b/app/routes/casher.tsx @@ -1,5 +1,6 @@ import { AlertDialogCancel } from "@radix-ui/react-alert-dialog"; import { useState } from "react"; + import { AlertDialog, AlertDialogAction, @@ -12,7 +13,7 @@ import { } from "~/components/ui/alert-dialog"; import { Button } from "~/components/ui/button"; import { Input } from "~/components/ui/input"; -import { Order } from "~/models/order"; +import { type Order } from "~/models/order"; const mockOrder: Order = { orderId: 1, diff --git a/app/routes/items/action.ts b/app/routes/items/action.ts index fc205a43..919b3fe9 100644 --- a/app/routes/items/action.ts +++ b/app/routes/items/action.ts @@ -1,7 +1,7 @@ import { type ClientActionFunction } from "@remix-run/react"; -import { deleteItem } from "./actions/deleteItem"; import { addItem } from "./actions/addItem"; +import { deleteItem } from "./actions/deleteItem"; export const action: ClientActionFunction = async (args) => { const { request } = args; diff --git a/app/routes/items/actions/addItem.ts b/app/routes/items/actions/addItem.ts index e79f8233..8aa252ac 100644 --- a/app/routes/items/actions/addItem.ts +++ b/app/routes/items/actions/addItem.ts @@ -1,5 +1,5 @@ import { parseWithZod } from "@conform-to/zod"; -import { type ClientActionFunction, json } from "@remix-run/react"; +import { json, type ClientActionFunction } from "@remix-run/react"; import { itemSchema } from "~/models/item"; import { itemRepository } from "~/repositories/item"; diff --git a/app/routes/items/actions/deleteItem.ts b/app/routes/items/actions/deleteItem.ts index 0c0585d5..361f71e2 100644 --- a/app/routes/items/actions/deleteItem.ts +++ b/app/routes/items/actions/deleteItem.ts @@ -1,6 +1,7 @@ import { parseWithZod } from "@conform-to/zod"; import { json, type ClientActionFunction } from "@remix-run/react"; import { z } from "zod"; + import { itemRepository } from "~/repositories/item"; export const deleteItem: ClientActionFunction = async ({ request }) => { diff --git a/app/routes/items/route.tsx b/app/routes/items/route.tsx index c9ac42b2..6c8a64ce 100644 --- a/app/routes/items/route.tsx +++ b/app/routes/items/route.tsx @@ -1,7 +1,6 @@ import { useForm } from "@conform-to/react"; import { parseWithZod } from "@conform-to/zod"; -import type { MetaFunction } from "@remix-run/node"; -import { Form, useActionData } from "@remix-run/react"; +import { Form, useActionData, type MetaFunction } from "@remix-run/react"; import useSWRSubscription from "swr/subscription"; import { Button } from "~/components/ui/button"; @@ -11,7 +10,8 @@ import { RadioGroup, RadioGroupItem } from "~/components/ui/radio-group"; import { collectionSub } from "~/firebase/subscription"; import { itemSchema, itemtypes } from "~/models/item"; -import type { action as clientAction } from "./action"; +import { type action as clientAction } from "./action"; + export { action as clientAction } from "./action"; export const meta: MetaFunction = () => { diff --git a/app/routes/orders.tsx b/app/routes/orders.tsx index 67247f45..8ee3ba63 100644 --- a/app/routes/orders.tsx +++ b/app/routes/orders.tsx @@ -1,13 +1,14 @@ import { - ClientActionFunction, - ClientActionFunctionArgs, Form, - MetaFunction, + type ClientActionFunction, + type ClientActionFunctionArgs, + type MetaFunction, } from "@remix-run/react"; import { typedjson, useTypedLoaderData } from "remix-typedjson"; + import { Button } from "~/components/ui/button"; import { Input } from "~/components/ui/input"; -import { Order } from "~/models/order"; +import { type Order } from "~/models/order"; import { orderRepository } from "~/repositories/order"; export const meta: MetaFunction = () => { diff --git a/bun.lockb b/bun.lockb index f3b14c1a..827e7cd2 100755 Binary files a/bun.lockb and b/bun.lockb differ diff --git a/package.json b/package.json index f6d651a5..42411e91 100644 --- a/package.json +++ b/package.json @@ -19,44 +19,43 @@ "@radix-ui/react-label": "^2.1.0", "@radix-ui/react-radio-group": "^1.2.0", "@radix-ui/react-slot": "^1.1.0", - "@remix-run/node": "^2.11.0", - "@remix-run/react": "^2.11.0", + "@remix-run/react": "^2.11.2", "class-variance-authority": "^0.7.0", "clsx": "^2.1.1", - "firebase": "^10.7.2", + "firebase": "^10.13.1", "lodash": "^4.17.21", "lucide-react": "^0.424.0", - "react": "^18.2.0", - "react-dom": "^18.2.0", + "react": "^18.3.1", + "react-dom": "^18.3.1", "remix-typedjson": "^0.4.1", "swr": "^2.2.5", - "tailwind-merge": "^2.4.0", + "tailwind-merge": "^2.5.2", "tailwindcss-animate": "^1.0.7", "zod": "^3.23.8" }, "devDependencies": { "@ianvs/prettier-plugin-sort-imports": "^4.3.1", - "@remix-run/dev": "^2.11.0", + "@remix-run/dev": "^2.11.2", "@types/lodash": "^4.17.7", - "@types/react": "^18.2.20", - "@types/react-dom": "^18.2.7", - "@typescript-eslint/eslint-plugin": "^6.7.4", - "@typescript-eslint/parser": "^6.7.4", - "autoprefixer": "^10.4.19", - "eslint": "^8.38.0", + "@types/react": "^18.3.5", + "@types/react-dom": "^18.3.0", + "@typescript-eslint/eslint-plugin": "^6.21.0", + "@typescript-eslint/parser": "^6.21.0", + "autoprefixer": "^10.4.20", + "eslint": "^8.57.0", "eslint-config-prettier": "^9.1.0", - "eslint-import-resolver-typescript": "^3.6.1", - "eslint-plugin-import": "^2.28.1", - "eslint-plugin-jsx-a11y": "^6.7.1", - "eslint-plugin-react": "^7.33.2", - "eslint-plugin-react-hooks": "^4.6.0", - "postcss": "^8.4.38", + "eslint-import-resolver-typescript": "^3.6.3", + "eslint-plugin-import": "^2.30.0", + "eslint-plugin-jsx-a11y": "^6.10.0", + "eslint-plugin-react": "^7.35.2", + "eslint-plugin-react-hooks": "^4.6.2", + "postcss": "^8.4.45", "prettier": "^3.3.3", "prettier-plugin-tailwindcss": "^0.6.6", - "tailwindcss": "^3.4.4", - "typescript": "^5.1.6", - "vite": "^5.1.0", - "vite-tsconfig-paths": "^4.2.1", + "tailwindcss": "^3.4.10", + "typescript": "^5.5.4", + "vite": "^5.4.3", + "vite-tsconfig-paths": "^4.3.2", "vitest": "^2.0.5" }, "engines": {