style: fix no-unused-vars -- prefix unused catch bindings, remove dead code, suppress template-use false positives

This commit is contained in:
2026-06-25 15:10:07 +01:00
parent f3436ac37a
commit a099f84d1b
18 changed files with 121 additions and 206 deletions
@@ -48,7 +48,7 @@ import { SvelteDate, SvelteURLSearchParams } from 'svelte/reactivity';
let cardQuery = $state('');
let cards = $state<GiftCard[]>([]);
let balances = $state<UserBalance[]>([]);
let totalCards = $state(0);
let _totalCards = $state(0);
let totalBalanceRecords = $state(0);
let currentPage = $state(1);
let totalPages = $state(1);
@@ -137,17 +137,17 @@ import { SvelteDate, SvelteURLSearchParams } from 'svelte/reactivity';
// Page 3: Recipient email input
let generateEmail = $state('');
let tillGuestEmail = $state<string | undefined>(undefined);
let _tillGuestEmail = $state<string | undefined>(undefined);
// Payment Processing States
let cashAmount = $state('');
let cashTendered = $state(0);
let extraAsTip = $state(false);
let _cashTendered = $state(0);
let _extraAsTip = $state(false);
let ephemeralCardNumber = $state('');
let ephemeralCardExpiry = $state('');
let ephemeralCardCVC = $state('');
let ephemeralCardError = $state('');
let _ephemeralCardError = $state('');
let paymentError = $state('');
let paymentResult = $state<{
@@ -157,7 +157,7 @@ import { SvelteDate, SvelteURLSearchParams } from 'svelte/reactivity';
status?: string;
} | null>(null);
let cardMachineItemID = $state<string | null>(null);
let checkoutId = $state<string | null>(null);
let _checkoutId = $state<string | null>(null);
let processingMessage = $state('Processing payment...');
// Idempotency Key
@@ -242,12 +242,12 @@ import { SvelteDate, SvelteURLSearchParams } from 'svelte/reactivity';
);
// TillPayment state
const showTillPayment = $state(false);
const tillAmount = $state(0);
const tillAction = $state<'create' | 'topup'>('create');
const tillGiftCardId = $state<string | undefined>(undefined);
const tillUserId = $state<string | undefined>(undefined);
const tillDelivery = $state<'account' | 'code'>('code');
const _showTillPayment = $state(false);
const _tillAmount = $state(0);
const _tillAction = $state<'create' | 'topup'>('create');
const _tillGiftCardId = $state<string | undefined>(undefined);
const _tillUserId = $state<string | undefined>(undefined);
const _tillDelivery = $state<'account' | 'code'>('code');
async function fetchGiftCards(page: number = 1, search: string = '') {
loading = true;
@@ -270,14 +270,14 @@ import { SvelteDate, SvelteURLSearchParams } from 'svelte/reactivity';
summary.total_user_balances = data.total_user_balances;
cards = data.gift_cards;
balances = data.user_balances;
totalCards = data.total;
_totalCards = data.total;
totalBalanceRecords = data.ub_total ?? data.user_balances?.length ?? 0;
currentPage = data.page;
totalPages = data.totalPages;
} else {
toast.error('Failed to fetch gift cards');
}
} catch (err) {
} catch (_err) {
toast.error('Network error fetching gift cards');
} finally {
loading = false;
@@ -304,7 +304,7 @@ import { SvelteDate, SvelteURLSearchParams } from 'svelte/reactivity';
} else {
toast.error('Failed to fetch expired balances');
}
} catch (err) {
} catch (_err) {
toast.error('Network error fetching expired balances');
} finally {
loadingExpired = false;
@@ -329,7 +329,7 @@ import { SvelteDate, SvelteURLSearchParams } from 'svelte/reactivity';
const err = await res.json();
toast.error(err.error || 'Failed to claim balance');
}
} catch (err) {
} catch (_err) {
toast.error('Network error claiming balance');
} finally {
claimingId = null;
@@ -427,7 +427,7 @@ import { SvelteDate, SvelteURLSearchParams } from 'svelte/reactivity';
const errText = await res.text();
toast.error(errText || 'Failed to create inventory card');
}
} catch (err) {
} catch (_err) {
toast.error('Network error');
} finally {
creating = false;
@@ -470,7 +470,7 @@ import { SvelteDate, SvelteURLSearchParams } from 'svelte/reactivity';
const errText = await res.text();
toast.error(errText || 'Failed to transfer balance');
}
} catch (err) {
} catch (_err) {
toast.error('Network error transferring balance');
} finally {
transferring = false;
@@ -488,7 +488,7 @@ import { SvelteDate, SvelteURLSearchParams } from 'svelte/reactivity';
generateEmail = '';
generateUserQuery = '';
generateUsers = [];
tillGuestEmail = undefined;
_tillGuestEmail = undefined;
}
function resetTopUpModal() {
@@ -498,16 +498,16 @@ import { SvelteDate, SvelteURLSearchParams } from 'svelte/reactivity';
// Reset payment
cashAmount = '';
cashTendered = 0;
extraAsTip = false;
_cashTendered = 0;
_extraAsTip = false;
ephemeralCardNumber = '';
ephemeralCardExpiry = '';
ephemeralCardCVC = '';
ephemeralCardError = '';
_ephemeralCardError = '';
paymentError = '';
paymentResult = null;
cardMachineItemID = null;
checkoutId = null;
_checkoutId = null;
idempotencyKey = '';
}
@@ -622,7 +622,7 @@ import { SvelteDate, SvelteURLSearchParams } from 'svelte/reactivity';
const data = await res.json();
cardMachineItemID = data.item_id || null;
if (data.status === 'pending' && data.checkout_id) {
checkoutId = data.checkout_id;
_checkoutId = data.checkout_id;
setModalStep(actionType, 'processing');
pollEmbeddedCheckout(data.checkout_id, amt, actionType);
} else {