Skip to content
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

[chore] fmt #62

Merged
merged 5 commits into from
Sep 8, 2024
Merged
Show file tree
Hide file tree
Changes from all 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
6 changes: 6 additions & 0 deletions .eslintrc.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
9 changes: 9 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1 +1,10 @@
# cafeore-2024 POSシステム

## コマンド

| コマンド | 説明 |
| ------------------------------- | ----------------------------------------------------------------- |
| `bun install --frozen-lockfile` | 依存パッケージのインストールには基本的にこれを使ってください |
| `bun dev` | 開発環境の立ち上げ。ホットリロードに対応しています |
| `bun lint` | ESLintの実行。`--fix`オプションをつけることで、自動修正もできます |
| `bun fmt` | Prettierの実行 |
4 changes: 2 additions & 2 deletions app/components/ui/alert-dialog.tsx
Original file line number Diff line number Diff line change
@@ -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;

Expand Down
2 changes: 1 addition & 1 deletion app/components/ui/label.tsx
Original file line number Diff line number Diff line change
@@ -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";

Expand Down
2 changes: 1 addition & 1 deletion app/components/ui/radio-group.tsx
Original file line number Diff line number Diff line change
@@ -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";

Expand Down
4 changes: 2 additions & 2 deletions app/firebase/converter.ts
Original file line number Diff line number Diff line change
@@ -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 = <T>(schema: ZodSchema<T>) => {
return {
Expand Down
3 changes: 2 additions & 1 deletion app/firebase/subscription.ts
Original file line number Diff line number Diff line change
@@ -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";

Expand Down
2 changes: 1 addition & 1 deletion app/lib/utils.ts
Original file line number Diff line number Diff line change
@@ -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[]) {
Expand Down
3 changes: 2 additions & 1 deletion app/models/order.test.ts
Original file line number Diff line number Diff line change
@@ -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", () => {
Expand Down
3 changes: 2 additions & 1 deletion app/models/order.ts
Original file line number Diff line number Diff line change
@@ -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
Expand Down
4 changes: 3 additions & 1 deletion app/repositories/item.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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) => {
Expand Down
6 changes: 4 additions & 2 deletions app/repositories/order.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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) => {
Expand Down
6 changes: 3 additions & 3 deletions app/repositories/type.ts
Original file line number Diff line number Diff line change
@@ -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<T extends { id?: unknown }> = {
save(data: T): Promise<WithId<T>>;
Expand Down
1 change: 1 addition & 0 deletions app/root.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import {
Scripts,
ScrollRestoration,
} from "@remix-run/react";

import "./tailwind.css";

export function Layout({ children }: { children: React.ReactNode }) {
Expand Down
4 changes: 2 additions & 2 deletions app/routes/_header._index.tsx
Original file line number Diff line number Diff line change
@@ -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";
Expand Down
3 changes: 2 additions & 1 deletion app/routes/_header.serve.tsx
Original file line number Diff line number Diff line change
@@ -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";
Expand Down
1 change: 1 addition & 0 deletions app/routes/_header.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { Outlet } from "@remix-run/react";

import { OnlineStatus } from "~/components/online-status";

export default function BaseHeader() {
Expand Down
3 changes: 2 additions & 1 deletion app/routes/casher.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { AlertDialogCancel } from "@radix-ui/react-alert-dialog";
import { useState } from "react";

import {
AlertDialog,
AlertDialogAction,
Expand All @@ -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,
Expand Down
2 changes: 1 addition & 1 deletion app/routes/items/action.ts
Original file line number Diff line number Diff line change
@@ -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;
Expand Down
2 changes: 1 addition & 1 deletion app/routes/items/actions/addItem.ts
Original file line number Diff line number Diff line change
@@ -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";
Expand Down
1 change: 1 addition & 0 deletions app/routes/items/actions/deleteItem.ts
Original file line number Diff line number Diff line change
@@ -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 }) => {
Expand Down
6 changes: 3 additions & 3 deletions app/routes/items/route.tsx
Original file line number Diff line number Diff line change
@@ -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";
Expand All @@ -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 = () => {
Expand Down
9 changes: 5 additions & 4 deletions app/routes/orders.tsx
Original file line number Diff line number Diff line change
@@ -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 = () => {
Expand Down
Binary file modified bun.lockb
Binary file not shown.
45 changes: 22 additions & 23 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": {
Expand Down