From b816f87ab5bd7e2a3fbdde2bbeb23ec9f17221c5 Mon Sep 17 00:00:00 2001 From: Jungmin Date: Fri, 25 Oct 2024 00:12:29 +0900 Subject: [PATCH] No ESLint warnings or errors --- package-lock.json | 12 +++++++----- package.json | 1 + src/api/noteAPI.ts | 5 +++-- src/app/(auth)/components/LoginPrompt.tsx | 3 ++- src/app/(auth)/components/SignupPrompt.tsx | 3 ++- src/app/dashboard/components/Sidebar.tsx | 1 + src/app/dashboard/components/TodoCard.tsx | 8 ++++---- src/app/dashboard/components/TodoItem.tsx | 4 +++- src/app/dashboard/goal/[goalId]/page.tsx | 2 +- src/app/dashboard/note/[noteId]/page.tsx | 2 ++ src/app/dashboard/page.tsx | 6 +++--- src/app/dashboard/todoboard/page.tsx | 2 +- src/components/CreateNewTodo.tsx | 2 +- 13 files changed, 31 insertions(+), 20 deletions(-) diff --git a/package-lock.json b/package-lock.json index 4e8d23d..f50a73e 100644 --- a/package-lock.json +++ b/package-lock.json @@ -48,6 +48,7 @@ "eslint": "^8.57.1", "eslint-config-next": "14.2.14", "eslint-config-prettier": "^9.1.0", + "eslint-plugin-import": "^2.31.0", "jsdom": "^25.0.1", "npm-run-all": "^4.1.5", "postcss": "^8", @@ -6763,9 +6764,9 @@ } }, "node_modules/eslint-plugin-import": { - "version": "2.30.0", - "resolved": "https://registry.npmjs.org/eslint-plugin-import/-/eslint-plugin-import-2.30.0.tgz", - "integrity": "sha512-/mHNE9jINJfiD2EKkg1BKyPyUk4zdnT54YgbOgfjSakWT5oyX/qQLVNTkehyfpcMxZXMy1zyonZ2v7hZTX43Yw==", + "version": "2.31.0", + "resolved": "https://registry.npmjs.org/eslint-plugin-import/-/eslint-plugin-import-2.31.0.tgz", + "integrity": "sha512-ixmkI62Rbc2/w8Vfxyh1jQRTdRTF52VxwRVHl/ykPAmqG+Nb7/kNn+byLP0LxPgI7zWA16Jt82SybJInmMia3A==", "dev": true, "license": "MIT", "dependencies": { @@ -6777,7 +6778,7 @@ "debug": "^3.2.7", "doctrine": "^2.1.0", "eslint-import-resolver-node": "^0.3.9", - "eslint-module-utils": "^2.9.0", + "eslint-module-utils": "^2.12.0", "hasown": "^2.0.2", "is-core-module": "^2.15.1", "is-glob": "^4.0.3", @@ -6786,13 +6787,14 @@ "object.groupby": "^1.0.3", "object.values": "^1.2.0", "semver": "^6.3.1", + "string.prototype.trimend": "^1.0.8", "tsconfig-paths": "^3.15.0" }, "engines": { "node": ">=4" }, "peerDependencies": { - "eslint": "^2 || ^3 || ^4 || ^5 || ^6 || ^7.2.0 || ^8" + "eslint": "^2 || ^3 || ^4 || ^5 || ^6 || ^7.2.0 || ^8 || ^9" } }, "node_modules/eslint-plugin-import/node_modules/debug": { diff --git a/package.json b/package.json index 2a12084..082e808 100644 --- a/package.json +++ b/package.json @@ -53,6 +53,7 @@ "eslint": "^8.57.1", "eslint-config-next": "14.2.14", "eslint-config-prettier": "^9.1.0", + "eslint-plugin-import": "^2.31.0", "jsdom": "^25.0.1", "npm-run-all": "^4.1.5", "postcss": "^8", diff --git a/src/api/noteAPI.ts b/src/api/noteAPI.ts index 37a126a..3eee07e 100644 --- a/src/api/noteAPI.ts +++ b/src/api/noteAPI.ts @@ -82,7 +82,8 @@ export default async function deleteNote(noteId: number) { try { const response = await api.delete(`notes/${noteId}`); return response.data; - } catch (e) { - const error = e as ErrorType; + } catch (error) { + const axiosError = error as AxiosError; + console.error(axiosError.message); } } diff --git a/src/app/(auth)/components/LoginPrompt.tsx b/src/app/(auth)/components/LoginPrompt.tsx index f1cdae4..4830ecc 100644 --- a/src/app/(auth)/components/LoginPrompt.tsx +++ b/src/app/(auth)/components/LoginPrompt.tsx @@ -1,6 +1,7 @@ -import AnimatedText from "@/utils/AnimatedText"; import Link from "next/link"; +import AnimatedText from "@/utils/AnimatedText"; + export default function LoginPrompt() { return (
diff --git a/src/app/(auth)/components/SignupPrompt.tsx b/src/app/(auth)/components/SignupPrompt.tsx index c97d7e7..2bb6625 100644 --- a/src/app/(auth)/components/SignupPrompt.tsx +++ b/src/app/(auth)/components/SignupPrompt.tsx @@ -1,6 +1,7 @@ -import AnimatedText from "@/utils/AnimatedText"; import Link from "next/link"; +import AnimatedText from "@/utils/AnimatedText"; + export default function SignupPrompt() { return (
diff --git a/src/app/dashboard/components/Sidebar.tsx b/src/app/dashboard/components/Sidebar.tsx index baa3310..72d6a3a 100644 --- a/src/app/dashboard/components/Sidebar.tsx +++ b/src/app/dashboard/components/Sidebar.tsx @@ -74,6 +74,7 @@ export default function SideBar() { queryClient.invalidateQueries({ queryKey: ["goals"] }); } catch (error) { + console.error(error); toast.error("새로운 목표가 추가되지 않았습니다."); } }; diff --git a/src/app/dashboard/components/TodoCard.tsx b/src/app/dashboard/components/TodoCard.tsx index 9a1563c..7534cb1 100644 --- a/src/app/dashboard/components/TodoCard.tsx +++ b/src/app/dashboard/components/TodoCard.tsx @@ -5,14 +5,14 @@ import { useEffect, useState } from "react"; import { useRouter } from "next/navigation"; import { getGoal } from "@/api/goalAPI"; -import useModal from "@/hook/useModal"; -import CreateNewTodo from "@/components/CreateNewTodo"; import { getTodos } from "@/api/todoAPI"; +import { useTodoStore } from "@/store/todoStore"; import { GoalType, TodoType } from "@/app/types/todoGoalType"; +import useModal from "@/hook/useModal"; +import CreateNewTodo from "@/components/CreateNewTodo"; -import ProgressBar from "./ProgressBar"; import TodoItem from "./TodoItem"; -import { useTodoStore } from "@/store/todoStore"; +import ProgressBar from "./ProgressBar"; export type TodoCardProps = { id: number; diff --git a/src/app/dashboard/components/TodoItem.tsx b/src/app/dashboard/components/TodoItem.tsx index 7d75830..77ed6f9 100644 --- a/src/app/dashboard/components/TodoItem.tsx +++ b/src/app/dashboard/components/TodoItem.tsx @@ -9,9 +9,9 @@ import CreateNewTodo from "@/components/CreateNewTodo"; import { getNotes } from "@/api/noteAPI"; import { NoteType, TodoType } from "@/app/types/todoGoalType"; import { deleteTodo, toggleTodo } from "@/api/todoAPI"; +import { useTodoStore } from "@/store/todoStore"; import NoteViewer from "./NoteViewer"; -import { useTodoStore } from "@/store/todoStore"; type TodoProps = { todo: TodoType; @@ -66,6 +66,8 @@ export default function TodoItem({ todo, isTodoCardRelated = true, inTodoCard }: useEffect(() => { loadNoteContent(); + + // eslint-disable-next-line react-hooks/exhaustive-deps }, []); return ( diff --git a/src/app/dashboard/goal/[goalId]/page.tsx b/src/app/dashboard/goal/[goalId]/page.tsx index a4d283a..f2c1917 100644 --- a/src/app/dashboard/goal/[goalId]/page.tsx +++ b/src/app/dashboard/goal/[goalId]/page.tsx @@ -8,6 +8,7 @@ import { AxiosError } from "axios"; import { deleteGoal, ErrorType, getGoal } from "@/api/goalAPI"; import { getTodos } from "@/api/todoAPI"; import useModal from "@/hook/useModal"; +import { useTodoStore } from "@/store/todoStore"; import CreateNewTodo from "@/components/CreateNewTodo"; import EditGoalTitleModal from "@/components/EditGoalTitleModal"; import { GoalType, TodoType } from "@/app/types/todoGoalType"; @@ -15,7 +16,6 @@ import { useGoalStore } from "@/store/goalStore"; import ProgressBar from "../../components/ProgressBar"; import TodoItem from "../../components/TodoItem"; -import { useTodoStore } from "@/store/todoStore"; type GoalPageProps = { params: { goalId: string; title: string }; diff --git a/src/app/dashboard/note/[noteId]/page.tsx b/src/app/dashboard/note/[noteId]/page.tsx index 5a92505..8c9ce1d 100644 --- a/src/app/dashboard/note/[noteId]/page.tsx +++ b/src/app/dashboard/note/[noteId]/page.tsx @@ -53,6 +53,8 @@ export default function NotePage() { useEffect(() => { loadNoteData(); + + // eslint-disable-next-line react-hooks/exhaustive-deps }, []); const handleTitleChange = (e: ChangeEvent) => { diff --git a/src/app/dashboard/page.tsx b/src/app/dashboard/page.tsx index 7c585c5..b05b7e4 100644 --- a/src/app/dashboard/page.tsx +++ b/src/app/dashboard/page.tsx @@ -6,17 +6,17 @@ import { useEffect, useState } from "react"; import { useInfiniteQuery } from "@tanstack/react-query"; import { useInView } from "react-intersection-observer"; -import LoadingSpinner from "@/components/LoadingSpinner"; -import LoadingScreen from "@/components/LoadingScreen"; import { getInfinityScrollGoals } from "@/api/goalAPI"; import { getAllTodos } from "@/api/todoAPI"; +import { useTodoStore } from "@/store/todoStore"; +import LoadingSpinner from "@/components/LoadingSpinner"; +import LoadingScreen from "@/components/LoadingScreen"; import { GoalType, TodoType } from "../types/todoGoalType"; import TodoCard from "./components/TodoCard"; import ProgressTracker from "./components/ProgressTracker"; import TodoItem from "./components/TodoItem"; -import { useTodoStore } from "@/store/todoStore"; export default function DashboardPage() { const { isUpdated } = useTodoStore(); diff --git a/src/app/dashboard/todoboard/page.tsx b/src/app/dashboard/todoboard/page.tsx index 2afdb49..d3cc3d6 100644 --- a/src/app/dashboard/todoboard/page.tsx +++ b/src/app/dashboard/todoboard/page.tsx @@ -2,13 +2,13 @@ import { useEffect, useState } from "react"; +import { useTodoStore } from "@/store/todoStore"; import CreateNewTodo from "@/components/CreateNewTodo"; import useModal from "@/hook/useModal"; import { getAllTodos } from "@/api/todoAPI"; import { TodoType } from "@/app/types/todoGoalType"; import TodoItem from "../components/TodoItem"; -import { useTodoStore } from "@/store/todoStore"; type StatusType = "All" | "Todo" | "Done"; diff --git a/src/components/CreateNewTodo.tsx b/src/components/CreateNewTodo.tsx index 4720013..f01c879 100644 --- a/src/components/CreateNewTodo.tsx +++ b/src/components/CreateNewTodo.tsx @@ -2,13 +2,13 @@ import React, { useState, useRef, useEffect } from "react"; import { toast } from "react-toastify"; import Image from "next/image"; +import { useTodoStore } from "@/store/todoStore"; import { createTodo, postFile, updateTodo } from "@/api/todoAPI"; import useModal from "@/hook/useModal"; import { GoalType, InitialTodoType, TodoType } from "@/app/types/todoGoalType"; import { getGoals } from "@/api/goalAPI"; import LinkUpload from "./LinkUpload"; -import { useTodoStore } from "@/store/todoStore"; type CreateNewTodoProps = { closeCreateNewTodo: () => void;