From 902931909653d82874370396c523a3317d2bc7ce Mon Sep 17 00:00:00 2001
From: Mahen
Date: Wed, 11 Feb 2026 08:46:28 +0700
Subject: [PATCH] fix: reformat eslint issues
---
src/app/api/product/route.ts | 12 ++++++---
src/app/api/review/route.ts | 15 +++++++----
src/app/layout.tsx | 13 +--------
src/components/dashboards/CustomLabel.tsx | 4 ++-
src/components/dashboards/DashboardClient.tsx | 11 +-------
src/components/dashboards/ReviewTable.tsx | 2 +-
.../dashboards/SentimentAnalyzer.tsx | 14 +++++-----
src/components/dashboards/TrendChart.tsx | 3 +--
.../dashboards/TrendChartToolTip.tsx | 9 +++----
src/components/dashboards/WordCloud.tsx | 3 ++-
src/hooks/useSentimentForm.ts | 11 +++++---
src/hooks/useTrendChart.ts | 16 +++++------
src/hooks/useWordCloud.ts | 25 ++++++++++++-----
src/types/index.ts | 27 ++++++++++++-------
src/utils/datas.ts | 2 +-
tailwind.config.ts | 3 ++-
16 files changed, 93 insertions(+), 77 deletions(-)
diff --git a/src/app/api/product/route.ts b/src/app/api/product/route.ts
index 11c965c..422f3e3 100644
--- a/src/app/api/product/route.ts
+++ b/src/app/api/product/route.ts
@@ -1,9 +1,10 @@
import prisma from "@/lib/prisma";
+import { Prisma } from "@prisma/client";
import { NextResponse } from "next/server";
export const dynamic = "force-dynamic";
-export async function POST(request: Request) {
+export async function POST(_request: Request) {
try {
const products = [
{ name: "ZenBook 14", brand: "ASUS" },
@@ -22,8 +23,13 @@ export async function POST(request: Request) {
},
{ status: 201 },
);
- } catch (error: any) {
- console.error("Create product Error:", error);
+ } catch (error: unknown) {
+ console.error("Create product error:", error);
+
+ if (error instanceof Prisma.PrismaClientKnownRequestError) {
+ return NextResponse.json({ error: error.message }, { status: 400 });
+ }
+
return NextResponse.json(
{ error: "Internal Server Error" },
{ status: 500 },
diff --git a/src/app/api/review/route.ts b/src/app/api/review/route.ts
index 15ef817..7b4ceef 100644
--- a/src/app/api/review/route.ts
+++ b/src/app/api/review/route.ts
@@ -1,10 +1,10 @@
import prisma from "@/lib/prisma";
-import { Sentiment } from "@prisma/client";
+import { Prisma, Sentiment } from "@prisma/client";
import { NextResponse } from "next/server";
export const dynamic = "force-dynamic";
-export async function POST(request: Request) {
+export async function POST(_request: Request) {
try {
const reviews = [
{
@@ -40,13 +40,18 @@ export async function POST(request: Request) {
return NextResponse.json(
{
- message: "Booking successful",
+ message: "Analysis successful",
data: result,
},
{ status: 201 },
);
- } catch (error: any) {
- console.error("Create product Error:", error);
+ } catch (error: unknown) {
+ console.error("Create analysis error:", error);
+
+ if (error instanceof Prisma.PrismaClientKnownRequestError) {
+ return NextResponse.json({ error: error.message }, { status: 400 });
+ }
+
return NextResponse.json(
{ error: "Internal Server Error" },
{ status: 500 },
diff --git a/src/app/layout.tsx b/src/app/layout.tsx
index 13509e1..b636f5d 100644
--- a/src/app/layout.tsx
+++ b/src/app/layout.tsx
@@ -1,25 +1,14 @@
import type { Metadata } from "next";
-import { Geist, Geist_Mono, Inter } from "next/font/google";
+import { Inter } from "next/font/google";
import "./globals.css";
import Providers from "./providers";
-const geistSans = Geist({
- variable: "--font-geist-sans",
- subsets: ["latin"],
-});
-
-const geistMono = Geist_Mono({
- variable: "--font-geist-mono",
- subsets: ["latin"],
-});
-
export const metadata: Metadata = {
title: "Create Next App",
description: "Generated by create next app",
};
const inter = Inter({ subsets: ["latin"], variable: "--font-inter" });
-// lalu di body:
export default function RootLayout({
children,
diff --git a/src/components/dashboards/CustomLabel.tsx b/src/components/dashboards/CustomLabel.tsx
index 824dc25..e8d30d9 100644
--- a/src/components/dashboards/CustomLabel.tsx
+++ b/src/components/dashboards/CustomLabel.tsx
@@ -1,3 +1,5 @@
+import { CLabelProps } from "@/src/types";
+
const renderCustomLabel = ({
cx,
cy,
@@ -5,7 +7,7 @@ const renderCustomLabel = ({
innerRadius,
outerRadius,
percent,
-}: any) => {
+}: CLabelProps) => {
if (percent < 0.05) return null;
const RADIAN = Math.PI / 180;
const radius = innerRadius + (outerRadius - innerRadius) * 0.5;
diff --git a/src/components/dashboards/DashboardClient.tsx b/src/components/dashboards/DashboardClient.tsx
index b96bd5c..a81d31c 100644
--- a/src/components/dashboards/DashboardClient.tsx
+++ b/src/components/dashboards/DashboardClient.tsx
@@ -1,16 +1,7 @@
"use client";
import { Header } from "./Header";
-import {
- Frown,
- Meh,
- MessageSquareText,
- Minus,
- Smile,
- ThumbsDown,
- ThumbsUp,
- TrendingUp,
-} from "lucide-react";
+import { Frown, Meh, MessageSquareText, Smile, TrendingUp } from "lucide-react";
import { StatCard } from "./StatCard";
import {
brandData,
diff --git a/src/components/dashboards/ReviewTable.tsx b/src/components/dashboards/ReviewTable.tsx
index e8ca630..38cb924 100644
--- a/src/components/dashboards/ReviewTable.tsx
+++ b/src/components/dashboards/ReviewTable.tsx
@@ -121,7 +121,7 @@ export function ReviewTable() {
- {getSentimentBadge(review.sentiment as any)}
+ {getSentimentBadge(review.sentiment ?? null)}
diff --git a/src/components/dashboards/SentimentAnalyzer.tsx b/src/components/dashboards/SentimentAnalyzer.tsx
index f2216ca..32d85e3 100644
--- a/src/components/dashboards/SentimentAnalyzer.tsx
+++ b/src/components/dashboards/SentimentAnalyzer.tsx
@@ -49,7 +49,7 @@ export default function SentimentForm() {
model XGBoost
-