From 897062c7e12b3ecbee024558d9f1eb5fae710e36 Mon Sep 17 00:00:00 2001 From: vwh Date: Thu, 25 Jul 2024 09:02:14 +0300 Subject: [PATCH] formating, added prettierrc.json --- .prettierrc.json | 4 ++++ src/App.tsx | 2 +- src/components/dialog.tsx | 2 +- src/components/dropzone-helpers.tsx | 2 +- src/components/dropzone.tsx | 10 +++++----- src/components/error.tsx | 2 +- src/components/logo.tsx | 2 +- src/components/page-select.tsx | 2 +- src/components/settings.tsx | 18 +++++++++--------- src/components/table-data.tsx | 8 ++++---- src/components/table-select.tsx | 2 +- src/components/table.tsx | 4 ++-- src/components/ui/alert-dialog.tsx | 10 +++++----- src/components/ui/badge.tsx | 10 +++++----- src/components/ui/button.tsx | 2 +- src/components/ui/buttonVariants.ts | 12 ++++++------ src/components/ui/drawer.tsx | 6 +++--- src/components/ui/hover-card.tsx | 6 +++--- src/components/ui/input.tsx | 4 ++-- src/components/ui/select.tsx | 14 +++++++------- src/components/ui/separator.tsx | 6 +++--- src/components/ui/sonner.tsx | 4 ++-- src/components/ui/table.tsx | 12 ++++++------ src/lib/sqlite.ts | 16 ++++++++-------- src/main.tsx | 2 +- src/store/useSQLiteStore.ts | 8 ++++---- 26 files changed, 87 insertions(+), 83 deletions(-) create mode 100644 .prettierrc.json diff --git a/.prettierrc.json b/.prettierrc.json new file mode 100644 index 0000000..1cd58b0 --- /dev/null +++ b/.prettierrc.json @@ -0,0 +1,4 @@ + +{ + "trailingComma": "none" +} \ No newline at end of file diff --git a/src/App.tsx b/src/App.tsx index 610c8f1..f33343b 100644 --- a/src/App.tsx +++ b/src/App.tsx @@ -37,7 +37,7 @@ function App() { setShowDialog(true); } else { setFetchError( - `Error fetching database from URL (with proxy): ${url} - ${error.message}`, + `Error fetching database from URL (with proxy): ${url} - ${error.message}` ); } } diff --git a/src/components/dialog.tsx b/src/components/dialog.tsx index 3d729e3..7658ce5 100644 --- a/src/components/dialog.tsx +++ b/src/components/dialog.tsx @@ -6,7 +6,7 @@ import { AlertDialogDescription, AlertDialogFooter, AlertDialogHeader, - AlertDialogTitle, + AlertDialogTitle } from "@/components/ui/alert-dialog"; interface DialogProps { diff --git a/src/components/dropzone-helpers.tsx b/src/components/dropzone-helpers.tsx index 5cc5e85..4738dc3 100644 --- a/src/components/dropzone-helpers.tsx +++ b/src/components/dropzone-helpers.tsx @@ -19,7 +19,7 @@ export function FileStats({ errors }: { errors?: FileError[] }) { errors && ( <> {errors.map((error) => - toast(error.message, { position: "bottom-right" }), + toast(error.message, { position: "bottom-right" }) )} ); diff --git a/src/components/dropzone.tsx b/src/components/dropzone.tsx index 0265324..d9926d1 100644 --- a/src/components/dropzone.tsx +++ b/src/components/dropzone.tsx @@ -12,7 +12,7 @@ export default function UploadFile() { const onDrop = useCallback( async ( acceptedFiles: File[], - fileRejections: { file: File; errors: FileError[] }[], + fileRejections: { file: File; errors: FileError[] }[] ) => { setErrors([]); setTables([]); @@ -25,12 +25,12 @@ export default function UploadFile() { if (fileRejections.length > 0) { const rejectionErrors = fileRejections.flatMap( - (rejection) => rejection.errors, + (rejection) => rejection.errors ); setErrors(rejectionErrors); } }, - [loadDatabase, setTables, setSelectedTable], + [loadDatabase, setTables, setSelectedTable] ); const { getRootProps, getInputProps } = useDropzone({ @@ -40,8 +40,8 @@ export default function UploadFile() { "application/vnd.sqlite3": [".sqlite", ".sqlite3"], "application/x-sqlite3": [".sqlite", ".sqlite3"], "application/octet-stream": [".db"], - "application/sql": [".sql"], - }, + "application/sql": [".sql"] + } }); const renderDropzoneContent = (hasDatabase: boolean) => ( diff --git a/src/components/error.tsx b/src/components/error.tsx index 1795cdd..089c8f9 100644 --- a/src/components/error.tsx +++ b/src/components/error.tsx @@ -1,5 +1,5 @@ export default function ErrorMessage({ - children, + children }: { children: React.ReactNode; }) { diff --git a/src/components/logo.tsx b/src/components/logo.tsx index 9723c5d..b067167 100644 --- a/src/components/logo.tsx +++ b/src/components/logo.tsx @@ -21,7 +21,7 @@ export default function Logo() { const observer = new MutationObserver(updateLogoSrc); observer.observe(document.body, { attributes: true, - attributeFilter: ["class"], + attributeFilter: ["class"] }); return () => observer.disconnect(); diff --git a/src/components/page-select.tsx b/src/components/page-select.tsx index 80601e5..69d7e3f 100644 --- a/src/components/page-select.tsx +++ b/src/components/page-select.tsx @@ -12,7 +12,7 @@ export default function PageSelect({ page, setPage, rowsPerPage, - rowCount, + rowCount }: PageSelectProps) { const totalPages = Math.ceil(rowCount / rowsPerPage); const currentPage = Math.floor(page / rowsPerPage) + 1; diff --git a/src/components/settings.tsx b/src/components/settings.tsx index aaa88e5..93dbb06 100644 --- a/src/components/settings.tsx +++ b/src/components/settings.tsx @@ -6,7 +6,7 @@ import { toast } from "sonner"; import { exportTableAsCSV, exportAllTablesAsCSV, - downloadDatabase, + downloadDatabase } from "@/lib/sqlite"; import { Drawer, @@ -16,7 +16,7 @@ import { DrawerFooter, DrawerHeader, DrawerTitle, - DrawerTrigger, + DrawerTrigger } from "./ui/drawer"; import { Input } from "./ui/input"; import { Button } from "./ui/button"; @@ -27,7 +27,7 @@ export default function Settings() { useSQLiteStore(); const [selectedRowsPerPage, setSelectedRowsPerPage] = useState( - null, + null ); const [isAutoRowsPerPage, setIsAutoRowsPerPage] = useState(false); @@ -63,7 +63,7 @@ export default function Settings() { setIsCustomQuery(false); if (selectedRowsPerPage === null) { return toast.error( - "Please provide a number of rows per page or set it to auto.", + "Please provide a number of rows per page or set it to auto." ); } if (selectedRowsPerPage < 1) { @@ -71,7 +71,7 @@ export default function Settings() { } localStorage.setItem( "rowsPerPage", - isAutoRowsPerPage ? "auto" : selectedRowsPerPage.toString(), + isAutoRowsPerPage ? "auto" : selectedRowsPerPage.toString() ); setRowPerPageOrAuto(isAutoRowsPerPage ? "auto" : selectedRowsPerPage); }; @@ -79,7 +79,7 @@ export default function Settings() { const renderExportButton = ( onClick: () => void, label: string, - className?: string, + className?: string ) => (