Skip to content

Commit

Permalink
Perawatan codebase berupa maintenance package (#73)
Browse files Browse the repository at this point in the history
* chore: update beberapa bagian

* fix: gimana kalau begini

* fix: gimana kalau begini

* fix: typescriptnya (semoga) dah bener

* fix: typescript minta jelasin semua kah?

* fix: perbaikan error eslint (masi ada warning)

* fix: memperbaiki lint yang warn

* fix: memperbaiki command drizzle

* fix: memperbaiki import path

* fix: framer-motion -> motion/react
  • Loading branch information
reacto11mecha authored Jan 23, 2025
1 parent f1918f4 commit 5b079ce
Show file tree
Hide file tree
Showing 53 changed files with 3,429 additions and 3,021 deletions.
6 changes: 0 additions & 6 deletions apps/clients/attendance/eslint.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,6 @@ export default tseslint.config(
plugins: {
"react-refresh": reactRefresh,
},
rules: {
"react-refresh/only-export-components": [
"warn",
{ allowConstantExport: true },
],
},
},
eslint.configs.recommended,
...tseslint.configs.recommended,
Expand Down
60 changes: 30 additions & 30 deletions apps/clients/attendance/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,45 +17,45 @@
"@sora-vp/api": "*",
"@sora-vp/ui": "*",
"@sora-vp/validators": "*",
"@t3-oss/env-core": "^0.10.1",
"@tanstack/react-query": "^5.35.1",
"@trpc/client": "11.0.0-rc.364",
"@trpc/react-query": "11.0.0-rc.364",
"@trpc/server": "11.0.0-rc.364",
"framer-motion": "^11.2.12",
"jotai": "^2.8.4",
"lucide-react": "^0.399.0",
"non.geist": "^1.0.3",
"@t3-oss/env-core": "^0.11.1",
"@tanstack/react-query": "^5.64.2",
"@trpc/client": "11.0.0-rc.477",
"@trpc/react-query": "11.0.0-rc.477",
"@trpc/server": "11.0.0-rc.477",
"jotai": "^2.11.1",
"lucide-react": "^0.473.0",
"motion": "^12.0.1",
"non.geist": "^1.0.4",
"qr-scanner": "^1.4.2",
"react": "^18.3.1",
"react-dom": "^18.3.1",
"react-router-dom": "^6.24.0",
"superjson": "2.2.1",
"zod": "^3.23.8"
"react-router-dom": "^7.1.3",
"superjson": "2.2.2",
"zod": "^3.24.1"
},
"devDependencies": {
"@eslint/js": "^9.6.0",
"@fontsource-variable/noto-sans-sundanese": "^5.0.18",
"@eslint/js": "^9.18.0",
"@fontsource-variable/noto-sans-sundanese": "^5.1.1",
"@sora-vp/eslint-config": "*",
"@sora-vp/prettier-config": "*",
"@sora-vp/tailwind-config": "*",
"@types/eslint__js": "^8.42.3",
"@types/react": "^18.3.3",
"@types/react-dom": "^18.3.0",
"@typescript-eslint/eslint-plugin": "^7.13.1",
"@typescript-eslint/parser": "^7.13.1",
"@vitejs/plugin-react-swc": "^3.5.0",
"autoprefixer": "^10.4.19",
"dotenv-cli": "^7.4.1",
"eslint": "^9.6.0",
"eslint-plugin-react-hooks": "^4.6.2",
"eslint-plugin-react-refresh": "^0.4.7",
"postcss": "^8.4.39",
"prettier": "^3.2.5",
"tailwindcss": "^3.4.4",
"typescript": "^5.4.5",
"typescript-eslint": "^7.14.1",
"vite": "^5.4.12"
"@types/react": "^18.3.18",
"@types/react-dom": "^18.3.5",
"@typescript-eslint/eslint-plugin": "^7.18.0",
"@typescript-eslint/parser": "^7.18.0",
"@vitejs/plugin-react-swc": "^3.7.2",
"autoprefixer": "^10.4.20",
"dotenv-cli": "^7.4.4",
"eslint": "^9.12.0",
"eslint-plugin-react-hooks": "^5.0.0",
"eslint-plugin-react-refresh": "^0.4.18",
"postcss": "^8.5.1",
"prettier": "^3.4.2",
"tailwindcss": "^3.4.17",
"typescript": "^5.6.3",
"typescript-eslint": "^8.15.0",
"vite": "^6.0.11"
},
"prettier": "@sora-vp/prettier-config"
}
2 changes: 1 addition & 1 deletion apps/clients/attendance/src/components/scanner/index.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { useCallback, useState } from "react";
import { api } from "@/utils/api";
import { successTimeoutAtom } from "@/utils/atom";
import { motion } from "framer-motion";
import { useAtomValue } from "jotai";
import { Loader, RotateCcw } from "lucide-react";
import { motion } from "motion/react";

import { Button } from "@sora-vp/ui/button";
import { Separator } from "@sora-vp/ui/separator";
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { useEffect, useRef } from "react";
import { motion } from "framer-motion";
import { motion } from "motion/react";
import QrScanner from "qr-scanner";

import { validateId } from "@sora-vp/id-generator";
Expand Down Expand Up @@ -45,6 +45,8 @@ export function MainScanner({
return () => {
qrScanner.destroy();
};

// eslint-disable-next-line react-hooks/exhaustive-deps
}, []);

return (
Expand Down
2 changes: 1 addition & 1 deletion apps/clients/attendance/src/context/server-setting.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { createContext, useContext, useEffect, useMemo, useState } from "react";
import { api } from "@/utils/api";
import { motion } from "framer-motion";
import { Loader, RotateCcw } from "lucide-react";
import { motion } from "motion/react";

import { Button } from "@sora-vp/ui/button";

Expand Down
2 changes: 1 addition & 1 deletion apps/clients/attendance/src/main.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import "non.geist/mono";
import "@fontsource-variable/noto-sans-sundanese";
import "./index.css";

import { AnimatePresence } from "framer-motion";
import { AnimatePresence } from "motion/react";

import { Toaster } from "@sora-vp/ui/toast";

Expand Down
2 changes: 1 addition & 1 deletion apps/clients/attendance/src/routes/main-page.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { ScannerComponent } from "@/components/scanner";
import { useServerSetting } from "@/context/server-setting";
import { motion } from "framer-motion";
import { motion } from "motion/react";

export default function MainPage() {
const { canAttend } = useServerSetting();
Expand Down
6 changes: 0 additions & 6 deletions apps/clients/chooser/eslint.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,6 @@ export default tseslint.config(
plugins: {
"react-refresh": reactRefresh,
},
rules: {
"react-refresh/only-export-components": [
"warn",
{ allowConstantExport: true },
],
},
},
eslint.configs.recommended,
...tseslint.configs.recommended,
Expand Down
62 changes: 31 additions & 31 deletions apps/clients/chooser/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,46 +17,46 @@
"@sora-vp/api": "*",
"@sora-vp/ui": "*",
"@sora-vp/validators": "*",
"@t3-oss/env-core": "^0.10.1",
"@tanstack/react-query": "^5.35.1",
"@trpc/client": "11.0.0-rc.364",
"@trpc/react-query": "11.0.0-rc.364",
"@trpc/server": "11.0.0-rc.364",
"framer-motion": "^11.2.12",
"jotai": "^2.8.4",
"lucide-react": "^0.399.0",
"non.geist": "^1.0.3",
"@t3-oss/env-core": "^0.11.1",
"@tanstack/react-query": "^5.64.2",
"@trpc/client": "11.0.0-rc.477",
"@trpc/react-query": "11.0.0-rc.477",
"@trpc/server": "11.0.0-rc.477",
"jotai": "^2.11.1",
"lucide-react": "^0.473.0",
"motion": "^12.0.1",
"non.geist": "^1.0.4",
"qr-scanner": "^1.4.2",
"react": "^18.3.1",
"react-dom": "^18.3.1",
"react-router-dom": "^6.24.0",
"react-use-websocket": "^4.8.1",
"superjson": "2.2.1",
"zod": "^3.23.8"
"react-router-dom": "^7.1.3",
"react-use-websocket": "^4.11.1",
"superjson": "2.2.2",
"zod": "^3.24.1"
},
"devDependencies": {
"@eslint/js": "^9.6.0",
"@fontsource-variable/noto-sans-sundanese": "^5.0.18",
"@eslint/js": "^9.18.0",
"@fontsource-variable/noto-sans-sundanese": "^5.1.1",
"@sora-vp/eslint-config": "*",
"@sora-vp/prettier-config": "*",
"@sora-vp/tailwind-config": "*",
"@types/eslint__js": "^8.42.3",
"@types/react": "^18.3.3",
"@types/react-dom": "^18.3.0",
"@typescript-eslint/eslint-plugin": "^7.13.1",
"@typescript-eslint/parser": "^7.13.1",
"@vitejs/plugin-react-swc": "^3.5.0",
"autoprefixer": "^10.4.19",
"dotenv-cli": "^7.4.1",
"eslint": "^9.6.0",
"eslint-plugin-react-hooks": "^4.6.2",
"eslint-plugin-react-refresh": "^0.4.7",
"postcss": "^8.4.39",
"prettier": "^3.2.5",
"tailwindcss": "^3.4.4",
"typescript": "^5.4.5",
"typescript-eslint": "^7.14.1",
"vite": "^5.4.12"
"@types/react": "^18.3.18",
"@types/react-dom": "^18.3.5",
"@typescript-eslint/eslint-plugin": "^7.18.0",
"@typescript-eslint/parser": "^7.18.0",
"@vitejs/plugin-react-swc": "^3.7.2",
"autoprefixer": "^10.4.20",
"dotenv-cli": "^7.4.4",
"eslint": "^9.12.0",
"eslint-plugin-react-hooks": "^5.0.0",
"eslint-plugin-react-refresh": "^0.4.18",
"postcss": "^8.5.1",
"prettier": "^3.4.2",
"tailwindcss": "^3.4.17",
"typescript": "^5.6.3",
"typescript-eslint": "^8.15.0",
"vite": "^6.0.11"
},
"prettier": "@sora-vp/prettier-config"
}
2 changes: 2 additions & 0 deletions apps/clients/chooser/src/components/scanner/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,8 @@ export function ScannerComponent() {
return () => {
unsubHardware();
};

// eslint-disable-next-line react-hooks/exhaustive-deps
}, [isQrInvalid, participantAttended.isError]);

const setIsQrValid = useCallback(
Expand Down
4 changes: 3 additions & 1 deletion apps/clients/chooser/src/components/scanner/main-scanner.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { useEffect, useRef } from "react";
import { motion } from "framer-motion";
import { motion } from "motion/react";
import QrScanner from "qr-scanner";

import { validateId } from "@sora-vp/id-generator";
Expand Down Expand Up @@ -45,6 +45,8 @@ export function MainScanner({
return () => {
qrScanner.destroy();
};

// eslint-disable-next-line react-hooks/exhaustive-deps
}, []);

return (
Expand Down
2 changes: 1 addition & 1 deletion apps/clients/chooser/src/components/universal-error.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { motion } from "framer-motion";
import { RotateCcw } from "lucide-react";
import { motion } from "motion/react";

import { Button } from "@sora-vp/ui/button";

Expand Down
2 changes: 1 addition & 1 deletion apps/clients/chooser/src/components/universal-loading.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { motion } from "framer-motion";
import { Loader } from "lucide-react";
import { motion } from "motion/react";

export function UniversalLoading(props: {
title: string;
Expand Down
8 changes: 5 additions & 3 deletions apps/clients/chooser/src/context/participant-context.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import {
} from "react";
import { UniversalError } from "@/components/universal-error";
import { api } from "@/utils/api";
import { motion } from "framer-motion";
import { motion } from "motion/react";
import { Navigate } from "react-router-dom";

import { useHardwareWebsocket } from "./hardware-websocket";
Expand Down Expand Up @@ -43,7 +43,7 @@ export const ParticipantProvider = ({
},
);

const setQRCode = useCallback((qr: string | null) => setQrId(qr), []);
const setQRCode = useCallback((qr: string | null) => setQrId(qr), [setQrId]);
const setVotedSuccessfully = useCallback(
(success: boolean) => setVoted(success),
[],
Expand Down Expand Up @@ -73,6 +73,8 @@ export const ParticipantProvider = ({
unsubHardware();
};
});

// eslint-disable-next-line react-hooks/exhaustive-deps
}, [qrId, participantQuery.isFetched, participantQuery.data]);

const propsValue = useMemo(() => {
Expand All @@ -92,7 +94,7 @@ export const ParticipantProvider = ({
setQRCode,
setVotedSuccessfully,
};
}, [qrId, participantQuery.data]);
}, [setQRCode, setVotedSuccessfully, qrId, participantQuery.data]);

if (
!!qrId &&
Expand Down
6 changes: 4 additions & 2 deletions apps/clients/chooser/src/context/server-setting.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { createContext, useContext, useEffect, useMemo, useState } from "react";
import { UniversalError } from "@/components/universal-error";
import { api } from "@/utils/api";
import { motion } from "framer-motion";
import { Loader } from "lucide-react";
import { motion } from "motion/react";

import { useHardwareWebsocket } from "./hardware-websocket";
import { useParticipant } from "./participant-context";
Expand Down Expand Up @@ -48,6 +48,8 @@ export const ServerSettingProvider = ({
return () => {
unsubHardware();
};

// eslint-disable-next-line react-hooks/exhaustive-deps
}, [settingsQuery.errorUpdateCount]);

useEffect(() => {
Expand Down Expand Up @@ -77,7 +79,7 @@ export const ServerSettingProvider = ({
return {
canVote,
};
}, [settingsQuery.data]);
}, [setQRCode, qrId, settingsQuery.data]);

if (settingsQuery.errorUpdateCount > 0)
return (
Expand Down
2 changes: 1 addition & 1 deletion apps/clients/chooser/src/main.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import "non.geist/mono";
import "@fontsource-variable/noto-sans-sundanese";
import "./index.css";

import { AnimatePresence } from "framer-motion";
import { AnimatePresence } from "motion/react";

import { Toaster } from "@sora-vp/ui/toast";

Expand Down
2 changes: 1 addition & 1 deletion apps/clients/chooser/src/routes/main-page.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { ScannerComponent } from "@/components/scanner";
import { useServerSetting } from "@/context/server-setting";
import { motion } from "framer-motion";
import { motion } from "motion/react";

export default function MainPage() {
const { canVote } = useServerSetting();
Expand Down
7 changes: 5 additions & 2 deletions apps/clients/chooser/src/routes/vote-page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ import { ensureQRIDExist, useParticipant } from "@/context/participant-context";
import { env } from "@/env";
import { api } from "@/utils/api";
import { successTimeoutAtom } from "@/utils/atom";
import { motion } from "framer-motion";
import { useAtomValue } from "jotai";
import { Loader2 } from "lucide-react";
import { motion } from "motion/react";

import { cn } from "@sora-vp/ui";
import {
Expand Down Expand Up @@ -144,7 +144,7 @@ function VotePage() {
});
}
}
}, [currentID, qrId, alertOpen, cannotPushKey]);
}, [upvoteCandidate, currentID, qrId, alertOpen, cannotPushKey]);

const triggerOpen = useCallback(
(candidateIndex: number) => {
Expand Down Expand Up @@ -285,7 +285,10 @@ function VotePage() {
return () => {
unsubHardware();
};

// eslint-disable-next-line react-hooks/exhaustive-deps
}, [
upvoteCandidate.isError,
upvoteCandidate.isPending,
candidateList.errorUpdateCount,
alertOpen,
Expand Down
Loading

0 comments on commit 5b079ce

Please sign in to comment.