From c9252cfe6688cb80d26fefd4493cfb8fcdfc7b5c Mon Sep 17 00:00:00 2001 From: Drew Malzahn Date: Sun, 28 Jun 2026 12:57:01 -0400 Subject: [PATCH] chore: Fix linter errors --- src/CharacterSheet.tsx | 53 +++++++++++++++++++++++++----------------- 1 file changed, 32 insertions(+), 21 deletions(-) diff --git a/src/CharacterSheet.tsx b/src/CharacterSheet.tsx index 64d4d3d..a86809f 100644 --- a/src/CharacterSheet.tsx +++ b/src/CharacterSheet.tsx @@ -272,10 +272,10 @@ export default function CharacterSheet() { [], ); - const xp = parseInt(String(fields.xpCurrent)) || 0; + const xp = parseInt(String(fields.xpCurrent), 10) || 0; const xpPct = Math.min((xp % 10) * 10, 100); - const hpMax = parseInt(String(fields.hpMax)) || 0; - const hpCur = parseInt(String(fields.hpCur)) || 0; + const hpMax = parseInt(String(fields.hpMax), 10) || 0; + const hpCur = parseInt(String(fields.hpCur), 10) || 0; const inCrisis = hpMax > 0 && hpCur <= Math.floor(hpMax / 2); const fpTotal = Math.max(10, fp); @@ -463,7 +463,7 @@ export default function CharacterSheet() { const encoded = params.get("c"); if (shortId) { // Short link: fetch the sheet JSON from the share service. - fetch(apiURL("api/s/" + encodeURIComponent(shortId))) + fetch(apiURL(`api/s/${encodeURIComponent(shortId)}`)) .then((res) => { if (!res.ok) throw new Error(String(res.status)); return res.json(); @@ -489,9 +489,9 @@ export default function CharacterSheet() { if (raw) try { applyData(JSON.parse(raw)); - } catch (e) {} + } catch (_e) {} } - }, []); // eslint-disable-line react-hooks/exhaustive-deps + }, [applyData]); // Auto-save every 30s useEffect(() => { @@ -565,10 +565,10 @@ export default function CharacterSheet() { }); if (!res.ok) throw new Error(String(res.status)); const { id } = await res.json(); - shareURL = base + "?s=" + id; + shareURL = `${base}?s=${id}`; } catch { // Backend unreachable: fall back to a self-contained inline ?c= link. - shareURL = base + "?c=" + (await compressToBase64(json)); + shareURL = `${base}?c=${await compressToBase64(json)}`; } await copyToClipboard(shareURL); setCopyStatus(true); @@ -576,13 +576,13 @@ export default function CharacterSheet() { }, [collectData]); const calcHP = useCallback(() => { - const mig = parseInt(String(fields.migBase)) || 6; + const mig = parseInt(String(fields.migBase), 10) || 6; const max = mig * 5 + level; setFields((prev) => ({ ...prev, hpMax: max, hpCur: prev.hpCur || max })); }, [fields.migBase, level]); const calcMP = useCallback(() => { - const wlp = parseInt(String(fields.wlpBase)) || 6; + const wlp = parseInt(String(fields.wlpBase), 10) || 6; const max = wlp * 5 + level; setFields((prev) => ({ ...prev, mpMax: max, mpCur: prev.mpCur || max })); }, [fields.wlpBase, level]); @@ -663,8 +663,9 @@ export default function CharacterSheet() {
- + f("charName", e.target.value)} @@ -672,8 +673,9 @@ export default function CharacterSheet() { />
- + f("charPronouns", e.target.value)} @@ -682,8 +684,9 @@ export default function CharacterSheet() {
- + f("charIdentity", e.target.value)} @@ -692,8 +695,9 @@ export default function CharacterSheet() {
- + f("charTheme", e.target.value)} @@ -701,8 +705,9 @@ export default function CharacterSheet() { />
- + f("charOrigin", e.target.value)} @@ -711,8 +716,9 @@ export default function CharacterSheet() {
- +