From 5a454e36479b3f368a63b0b3b66a12507231edb1 Mon Sep 17 00:00:00 2001 From: zhom <2717306+zhom@users.noreply.github.com> Date: Wed, 11 Jun 2025 04:17:07 +0400 Subject: [PATCH] chore: linting --- eslint.config.mjs | 44 +--------------------- nodecar/eslint.config.mjs | 41 -------------------- src/components/permission-dialog.tsx | 12 ------ src/components/profile-selector-dialog.tsx | 21 ++++------- src/components/theme-provider.tsx | 1 - src/components/update-notification.tsx | 1 - src/components/version-selector.tsx | 4 +- src/hooks/use-browser-download.ts | 20 +--------- src/hooks/use-version-updater.ts | 6 +-- src/lib/toast-utils.ts | 2 +- 10 files changed, 15 insertions(+), 137 deletions(-) diff --git a/eslint.config.mjs b/eslint.config.mjs index 41af948..fb2096f 100644 --- a/eslint.config.mjs +++ b/eslint.config.mjs @@ -68,48 +68,7 @@ const eslintConfig = tseslint.config( "react-hooks/exhaustive-deps": "off", "react-hooks/rules-of-hooks": "off", // typescript-eslint rules - some handled by TypeScript compiler or disabled for project needs - "@typescript-eslint/adjacent-overload-signatures": "off", - "@typescript-eslint/array-type": "off", - "@typescript-eslint/ban-types": "off", - "@typescript-eslint/consistent-type-exports": "off", - "@typescript-eslint/consistent-type-imports": "off", - "@typescript-eslint/default-param-last": "off", - "@typescript-eslint/dot-notation": "off", - "@typescript-eslint/explicit-function-return-type": "off", - "@typescript-eslint/explicit-member-accessibility": "off", - "@typescript-eslint/naming-convention": "off", - "@typescript-eslint/no-dupe-class-members": "off", - "@typescript-eslint/no-empty-function": "off", - "@typescript-eslint/no-empty-interface": "off", "@typescript-eslint/no-explicit-any": "off", - "@typescript-eslint/no-extra-non-null-assertion": "off", - "@typescript-eslint/no-extraneous-class": "off", - "@typescript-eslint/no-inferrable-types": "off", - "@typescript-eslint/no-invalid-void-type": "off", - "@typescript-eslint/no-loss-of-precision": "off", - "@typescript-eslint/no-misused-new": "off", - "@typescript-eslint/no-namespace": "off", - "@typescript-eslint/no-non-null-assertion": "off", - "@typescript-eslint/no-redeclare": "off", - "@typescript-eslint/no-require-imports": "off", - "@typescript-eslint/no-restricted-imports": "off", - "@typescript-eslint/no-restricted-types": "off", - "@typescript-eslint/no-this-alias": "off", - "@typescript-eslint/no-unnecessary-type-constraint": "off", - "@typescript-eslint/no-unsafe-declaration-merging": "off", - "@typescript-eslint/no-unused-vars": "off", - "@typescript-eslint/no-use-before-define": "off", - "@typescript-eslint/no-useless-constructor": "off", - "@typescript-eslint/no-useless-empty-export": "off", - "@typescript-eslint/only-throw-error": "off", - "@typescript-eslint/parameter-properties": "off", - "@typescript-eslint/prefer-as-const": "off", - "@typescript-eslint/prefer-enum-initializers": "off", - "@typescript-eslint/prefer-for-of": "off", - "@typescript-eslint/prefer-function-type": "off", - "@typescript-eslint/prefer-literal-enum-member": "off", - "@typescript-eslint/prefer-namespace-keyword": "off", - "@typescript-eslint/prefer-optional-chain": "off", "@typescript-eslint/require-await": "off", // Custom rules "@typescript-eslint/restrict-template-expressions": [ @@ -127,6 +86,7 @@ const eslintConfig = tseslint.config( tsconfigRootDir: import.meta.dirname, }, }, - }); + } +); export default eslintConfig; diff --git a/nodecar/eslint.config.mjs b/nodecar/eslint.config.mjs index b5f8cc0..76360f8 100644 --- a/nodecar/eslint.config.mjs +++ b/nodecar/eslint.config.mjs @@ -66,48 +66,7 @@ const eslintConfig = tseslint.config( "react-hooks/exhaustive-deps": "off", "react-hooks/rules-of-hooks": "off", // typescript-eslint rules - some handled by TypeScript compiler or disabled for project needs - "@typescript-eslint/adjacent-overload-signatures": "off", - "@typescript-eslint/array-type": "off", - "@typescript-eslint/ban-types": "off", - "@typescript-eslint/consistent-type-exports": "off", - "@typescript-eslint/consistent-type-imports": "off", - "@typescript-eslint/default-param-last": "off", - "@typescript-eslint/dot-notation": "off", - "@typescript-eslint/explicit-function-return-type": "off", - "@typescript-eslint/explicit-member-accessibility": "off", - "@typescript-eslint/naming-convention": "off", - "@typescript-eslint/no-dupe-class-members": "off", - "@typescript-eslint/no-empty-function": "off", - "@typescript-eslint/no-empty-interface": "off", "@typescript-eslint/no-explicit-any": "off", - "@typescript-eslint/no-extra-non-null-assertion": "off", - "@typescript-eslint/no-extraneous-class": "off", - "@typescript-eslint/no-inferrable-types": "off", - "@typescript-eslint/no-invalid-void-type": "off", - "@typescript-eslint/no-loss-of-precision": "off", - "@typescript-eslint/no-misused-new": "off", - "@typescript-eslint/no-namespace": "off", - "@typescript-eslint/no-non-null-assertion": "off", - "@typescript-eslint/no-redeclare": "off", - "@typescript-eslint/no-require-imports": "off", - "@typescript-eslint/no-restricted-imports": "off", - "@typescript-eslint/no-restricted-types": "off", - "@typescript-eslint/no-this-alias": "off", - "@typescript-eslint/no-unnecessary-type-constraint": "off", - "@typescript-eslint/no-unsafe-declaration-merging": "off", - "@typescript-eslint/no-unused-vars": "off", - "@typescript-eslint/no-use-before-define": "off", - "@typescript-eslint/no-useless-constructor": "off", - "@typescript-eslint/no-useless-empty-export": "off", - "@typescript-eslint/only-throw-error": "off", - "@typescript-eslint/parameter-properties": "off", - "@typescript-eslint/prefer-as-const": "off", - "@typescript-eslint/prefer-enum-initializers": "off", - "@typescript-eslint/prefer-for-of": "off", - "@typescript-eslint/prefer-function-type": "off", - "@typescript-eslint/prefer-literal-enum-member": "off", - "@typescript-eslint/prefer-namespace-keyword": "off", - "@typescript-eslint/prefer-optional-chain": "off", "@typescript-eslint/require-await": "off", // Custom rules "@typescript-eslint/restrict-template-expressions": [ diff --git a/src/components/permission-dialog.tsx b/src/components/permission-dialog.tsx index bb57d7c..225f829 100644 --- a/src/components/permission-dialog.tsx +++ b/src/components/permission-dialog.tsx @@ -1,7 +1,6 @@ "use client"; import { LoadingButton } from "@/components/loading-button"; -import { Badge } from "@/components/ui/badge"; import { Button } from "@/components/ui/button"; import { Dialog, @@ -90,17 +89,6 @@ export function PermissionDialog({ } }; - const getStatusBadge = (isGranted: boolean) => { - if (isGranted) { - return ( - - Granted - - ); - } - return Not Granted; - }; - const handleRequestPermission = async () => { setIsRequesting(true); try { diff --git a/src/components/profile-selector-dialog.tsx b/src/components/profile-selector-dialog.tsx index 3e7c5e4..a97e3fb 100644 --- a/src/components/profile-selector-dialog.tsx +++ b/src/components/profile-selector-dialog.tsx @@ -138,10 +138,6 @@ export function ProfileSelectorDialog({ const isRunning = runningProfiles.has(profile.name); if (profile.browser === "tor-browser") { - const runningTorProfiles = profiles.filter( - (p) => p.browser === "tor-browser" && runningProfiles.has(p.name), - ); - // If another TOR profile is running, this one is not available return "Only 1 instance can run at a time"; } @@ -195,9 +191,6 @@ export function ProfileSelectorDialog({ }; const selectedProfileData = profiles.find((p) => p.name === selectedProfile); - const isSelectedProfileRunning = selectedProfile - ? runningProfiles.has(selectedProfile) - : false; // Check if the selected profile can be used for opening links const canOpenWithSelectedProfile = () => { @@ -225,19 +218,19 @@ export function ProfileSelectorDialog({
{url && (
-
+
-
+
{url}
@@ -290,14 +283,14 @@ export function ProfileSelectorDialog({ !canUseForLinks ? "opacity-50" : "" }`} > -
-
+
+
{(() => { const IconComponent = getBrowserIcon( profile.browser, ); return IconComponent ? ( - + ) : null; })()}
diff --git a/src/components/theme-provider.tsx b/src/components/theme-provider.tsx index b65b35f..160a09b 100644 --- a/src/components/theme-provider.tsx +++ b/src/components/theme-provider.tsx @@ -103,7 +103,6 @@ export function CustomThemeProvider({ children }: CustomThemeProviderProps) { const currentSystemTheme = await getNativeSystemTheme(); // Force re-evaluation by toggling the theme const html = document.documentElement; - const currentClass = html.className; // Apply the system theme class if (currentSystemTheme === "dark") { diff --git a/src/components/update-notification.tsx b/src/components/update-notification.tsx index 3235e2d..7214f69 100644 --- a/src/components/update-notification.tsx +++ b/src/components/update-notification.tsx @@ -7,7 +7,6 @@ import { Button } from "@/components/ui/button"; import { getBrowserDisplayName } from "@/lib/browser-utils"; import React from "react"; import { FaDownload, FaTimes } from "react-icons/fa"; -import { LuDownload } from "react-icons/lu"; interface UpdateNotification { id: string; diff --git a/src/components/version-selector.tsx b/src/components/version-selector.tsx index 3f329a4..fec6df4 100644 --- a/src/components/version-selector.tsx +++ b/src/components/version-selector.tsx @@ -24,11 +24,11 @@ import { ScrollArea } from "./ui/scroll-area"; interface GithubRelease { tag_name: string; - assets: Array<{ + assets: { name: string; browser_download_url: string; hash?: string; - }>; + }[]; published_at: string; is_nightly: boolean; } diff --git a/src/hooks/use-browser-download.ts b/src/hooks/use-browser-download.ts index 34f68c3..9bc5fd9 100644 --- a/src/hooks/use-browser-download.ts +++ b/src/hooks/use-browser-download.ts @@ -13,11 +13,11 @@ import { toast } from "sonner"; interface GithubRelease { tag_name: string; - assets: Array<{ + assets: { name: string; browser_download_url: string; hash?: string; - }>; + }[]; published_at: string; is_nightly: boolean; } @@ -54,22 +54,6 @@ interface VersionUpdateProgress { status: string; } -const isAlphaVersion = (version: string): boolean => { - // Check for common alpha/beta/dev indicators - const lowerVersion = version.toLowerCase(); - return ( - lowerVersion.includes("a") || - lowerVersion.includes("b") || - lowerVersion.includes("alpha") || - lowerVersion.includes("beta") || - lowerVersion.includes("dev") || - lowerVersion.includes("rc") || - lowerVersion.includes("pre") || - // Check for patterns like "139.0b1" or "140.0a1" - /\d+\.\d+[ab]\d+/.test(lowerVersion) - ); -}; - export function useBrowserDownload() { const [availableVersions, setAvailableVersions] = useState( [], diff --git a/src/hooks/use-version-updater.ts b/src/hooks/use-version-updater.ts index ae69f9a..1a184ba 100644 --- a/src/hooks/use-version-updater.ts +++ b/src/hooks/use-version-updater.ts @@ -1,9 +1,5 @@ import { getBrowserDisplayName } from "@/lib/browser-utils"; -import { - dismissToast, - showLoadingToast, - showVersionUpdateToast, -} from "@/lib/toast-utils"; +import { showLoadingToast, showVersionUpdateToast } from "@/lib/toast-utils"; import { invoke } from "@tauri-apps/api/core"; import { listen } from "@tauri-apps/api/event"; import { useCallback, useEffect, useState } from "react"; diff --git a/src/lib/toast-utils.ts b/src/lib/toast-utils.ts index fce40d2..ad75cdc 100644 --- a/src/lib/toast-utils.ts +++ b/src/lib/toast-utils.ts @@ -134,7 +134,7 @@ export function showToast(props: ToastProps & { id?: string }) { }, }); } else { - sonnerToast.custom((id) => React.createElement(UnifiedToast, props), { + sonnerToast.custom(() => React.createElement(UnifiedToast, props), { id: toastId, duration, style: {