From ab87b8ab83123fda788c9383eeda7413b6d4844a Mon Sep 17 00:00:00 2001 From: SkateSpots Date: Sat, 26 Sep 2026 21:58:03 +0700 Subject: [PATCH] chore(lint): remove safely-detectable unused locals Position-based cleanup (no name collisions) of unused catch bindings and unused single-line pure consts across 12 files. Automated destructure/prop removals were proven unsafe (shadowed names + typed shorthand), so those remain. Warning backlog: 76 -> 60 (39 no-unused-vars, 14 exhaustive-deps, 7 react-refresh). Gate green: 101 tests, 0 errors, boot smoke passing. --- src/components/EditProfileForm.tsx | 1 - src/components/GearSwapItemCard.tsx | 2 -- src/components/RelatrSettings.tsx | 2 +- src/components/SasquatchGuide.tsx | 1 - src/hooks/useBatchTrustScores.ts | 2 +- src/hooks/useLoggedInAccounts.ts | 2 +- src/hooks/useSellerInfo.ts | 4 ++-- src/pages/CoachDetailPage.tsx | 3 --- src/pages/CreateListingPage.tsx | 2 -- src/pages/MapPage.tsx | 2 -- src/pages/RiderCardPage.tsx | 2 -- src/pages/SignersPage.tsx | 1 - 12 files changed, 5 insertions(+), 19 deletions(-) diff --git a/src/components/EditProfileForm.tsx b/src/components/EditProfileForm.tsx index 4b37d52..c9e2826 100644 --- a/src/components/EditProfileForm.tsx +++ b/src/components/EditProfileForm.tsx @@ -255,7 +255,6 @@ export const EditProfileForm: React.FC = () => { }); } catch (error) { console.error('Failed to update profile:', error); - const errorMessage = error instanceof Error ? error.message : 'Unknown error'; toast({ title: 'Error', description: 'Failed to publish profile. Check your relay connections in Settings > Relays', diff --git a/src/components/GearSwapItemCard.tsx b/src/components/GearSwapItemCard.tsx index 9a37850..4083977 100644 --- a/src/components/GearSwapItemCard.tsx +++ b/src/components/GearSwapItemCard.tsx @@ -89,7 +89,6 @@ export function GearSwapItemCard({ item, trustScore, salesCount, isFollowing }: : null; // Get price type label - const priceTypeLabel = item.priceType ? PRICE_TYPES[item.priceType]?.label : null; // Skateboard rating for seller const sellerRating = getSkateboardRating(salesCount); @@ -98,7 +97,6 @@ export function GearSwapItemCard({ item, trustScore, salesCount, isFollowing }: const trustLevel = getTrustLevel(trustScore); const trustBadge = SELLER_TRUST_BADGES[trustLevel]; - const isOwnListing = user?.pubkey === item.pubkey; const isSold = item.status === 'sold'; const handleMarkSold = async () => { diff --git a/src/components/RelatrSettings.tsx b/src/components/RelatrSettings.tsx index 2e2f256..2758157 100644 --- a/src/components/RelatrSettings.tsx +++ b/src/components/RelatrSettings.tsx @@ -63,7 +63,7 @@ export function RelatrSettings() { }); return; } - } catch (e) { + } catch { // Skip invalid JSON } } diff --git a/src/components/SasquatchGuide.tsx b/src/components/SasquatchGuide.tsx index 1fbfd4f..c1cbfe6 100644 --- a/src/components/SasquatchGuide.tsx +++ b/src/components/SasquatchGuide.tsx @@ -583,7 +583,6 @@ function CVMStatus({ connected }: { connected: boolean | null }) { function ChatText({ text }: { text: string }) { // Split on markdown links [label](url) and bare URLs - const parts = text.split(/(\[([^\]]+)\]\((https?:\/\/[^)]+)\)|https?:\/\/\S+)/g); const elements: React.ReactNode[] = []; let i = 0; // Use a regex to find all links in order diff --git a/src/hooks/useBatchTrustScores.ts b/src/hooks/useBatchTrustScores.ts index db2d82f..4a59cbd 100644 --- a/src/hooks/useBatchTrustScores.ts +++ b/src/hooks/useBatchTrustScores.ts @@ -101,7 +101,7 @@ export function useBatchTrustScores(pubkeys: string[]) { if (metadata.nip05) { scores.set(profileEvent.pubkey, 30); } - } catch (e) { + } catch { // Ignore JSON parse errors } } diff --git a/src/hooks/useLoggedInAccounts.ts b/src/hooks/useLoggedInAccounts.ts index 2690545..113a237 100644 --- a/src/hooks/useLoggedInAccounts.ts +++ b/src/hooks/useLoggedInAccounts.ts @@ -42,7 +42,7 @@ export function useLoggedInAccounts() { [{ kinds: [0], authors: loginPubkeys }], { signal: AbortSignal.any([signal, AbortSignal.timeout(5000)]) }, ); - } catch (error) { + } catch { console.warn('[useLoggedInAccounts] Primary relay query failed, trying fallback relays...'); } diff --git a/src/hooks/useSellerInfo.ts b/src/hooks/useSellerInfo.ts index 6a7ecd5..34a7b97 100644 --- a/src/hooks/useSellerInfo.ts +++ b/src/hooks/useSellerInfo.ts @@ -65,7 +65,7 @@ export function useSellerInfo(pubkey: string | undefined) { { signal } ).catch(() => []) ); - } catch (error) { + } catch { // Ignore individual relay errors } } @@ -93,7 +93,7 @@ export function useSellerInfo(pubkey: string | undefined) { const metadata = JSON.parse(profile.content); hasNip05 = !!metadata.nip05; nip05 = metadata.nip05; - } catch (e) { + } catch { // Ignore JSON parse errors } diff --git a/src/pages/CoachDetailPage.tsx b/src/pages/CoachDetailPage.tsx index e1fd88f..8af3ff2 100644 --- a/src/pages/CoachDetailPage.tsx +++ b/src/pages/CoachDetailPage.tsx @@ -96,10 +96,8 @@ export default function CoachDetailPage() { const isCoach = profile?.profileType === 'coach'; const isFilmer = profile?.profileType === 'filmer'; - const isEditor = profile?.profileType === 'editor'; const isPhotographer = profile?.profileType === 'photographer'; const isBuilder = profile?.profileType === 'builder'; - const isArtist = profile?.profileType === 'artist'; const isGraffiti = profile?.profileType === 'graffiti'; const isTattoo = profile?.profileType === 'tattoo'; const isTrainer = profile?.profileType === 'trainer'; @@ -111,7 +109,6 @@ export default function CoachDetailPage() { }); const metadata = author.data?.metadata; - const displayName = metadata?.name ?? genUserName(profile?.pubkey || ''); if (isLoading) { return ; diff --git a/src/pages/CreateListingPage.tsx b/src/pages/CreateListingPage.tsx index 562b154..f2fac34 100644 --- a/src/pages/CreateListingPage.tsx +++ b/src/pages/CreateListingPage.tsx @@ -57,7 +57,6 @@ export default function CreateListingPage() { const fromStash = searchParams.get('fromStash') === 'true'; // Where to return after publishing / when going back (e.g. /marketplace). const returnTo = searchParams.get('returnTo') || ''; - const stashId = searchParams.get('stashId'); // Form state - initialize from URL params if coming from stash const [listingType, setListingType] = useState<'selling' | 'wtb'>('selling'); @@ -96,7 +95,6 @@ export default function CreateListingPage() { }; // Check if user can proceed (fee paid or not required) - const canProceedWithListing = !restrictions.requiresFee || feePaid; // Get selected spot details const selectedSpot = useMemo(() => { diff --git a/src/pages/MapPage.tsx b/src/pages/MapPage.tsx index b1a5a1e..a02ad53 100644 --- a/src/pages/MapPage.tsx +++ b/src/pages/MapPage.tsx @@ -769,7 +769,6 @@ export default function MapPage() { } }; - const categoryKeys = Object.keys(SPOT_CATEGORIES); // Fetch BTC Map places when enabled const { data: btcMapPlaces, isLoading: btcMapLoading, error: btcMapError } = useBtcMapPlaces({ @@ -1021,7 +1020,6 @@ export default function MapPage() { const hasActiveFilters = searchQuery || selectedCategories.length > 0 || weatherFilter !== 'all' || trustFilter !== 'all' || sortBy !== 'recent'; // Count active layer filters for mobile badge - const activeLayerCount = [showSpots, showShops, showGear, showTours, showBtcMap].filter(Boolean).length; // Count of the primary layers active — shown as a badge on the Layers button const mobileLayerCount = [showSpots, showShops, showGear, showTours, showEvents, showCrews].filter(Boolean).length; const totalPrimaryLayers = 6; diff --git a/src/pages/RiderCardPage.tsx b/src/pages/RiderCardPage.tsx index 2ae49a6..bf004f5 100644 --- a/src/pages/RiderCardPage.tsx +++ b/src/pages/RiderCardPage.tsx @@ -629,7 +629,6 @@ function useWitnessName(pubkey: string) { // No flex-1 / flex-grow — every row has a fixed pixel height. function RiderFront({ d }: { d: CardData }) { const witnessedBadges = d.receivedBadges.slice(0, 2); - const qrUrl = verifyUrl(d.pubkey); return ( // absolute inset — fills the card exactly @@ -760,7 +759,6 @@ function RiderFront({ d }: { d: CardData }) { // ─── Card visual: Park Access front ────────────────────────────────────────── function ParkFront({ d }: { d: CardData }) { - const qrUrl = verifyUrl(d.pubkey); return (
diff --git a/src/pages/SignersPage.tsx b/src/pages/SignersPage.tsx index 35f7c9b..40572fa 100644 --- a/src/pages/SignersPage.tsx +++ b/src/pages/SignersPage.tsx @@ -273,7 +273,6 @@ export default function SignersPage() { {/* Signer Sections */}
{platformOrder.map((platform, index) => { - const isUserPlatform = index === 0 && isMobile; if (platform === 'android') { return (