fix(lint): fix pre-existing unused vars in 5 generators

- EmojiGenerator: remove unused clickToCopyLabel, CopyFeedback import, forEach i
- FontPairGenerator: prefer-const loadedFonts, remove unused headingFamily, bodyFamily, copyIconSvg
- HashGenerator: remove unused copyIcon, checkIcon, copyLabel
- Magic8BallGenerator: remove unused getTypeLabel
- TeamsGenerator: remove unused teamPrefix, errAddTwo, errTeamsMin, errTeamsMax, errMorePlayers
This commit is contained in:
emil
2026-05-13 21:29:57 +03:00
parent 8a0e2b5e0f
commit 75038780d5
7 changed files with 29 additions and 47 deletions
@@ -14,7 +14,7 @@ const travelLabel = isRu ? "Путешествия" : "Travel";
const activitiesLabel = isRu ? "Активности" : "Activities";
const objectsLabel = isRu ? "Предметы" : "Objects";
const symbolsLabel = isRu ? "Символы" : "Symbols";
const clickToCopyLabel = isRu ? "Нажмите, чтобы скопировать" : "Click to copy";
---
<div id="emoji-generator" class="mt-8">
@@ -137,7 +137,6 @@ const clickToCopyLabel = isRu ? "Нажмите, чтобы скопироват
<script>
import { createErrorDisplay } from "@/lib/client/validation";
import { CopyFeedback } from "@/lib/client/clipboard";
import { popElement } from "@/lib/client/animations";
import { shuffleArray } from "@/lib/client/random";
import { getClientLang, getClientT } from "@/lib/client/i18n";
@@ -617,7 +616,7 @@ const clickToCopyLabel = isRu ? "Нажмите, чтобы скопироват
const emojis = getRandomEmojis(countVal, category);
resultEl.innerHTML = "";
emojis.forEach((emoji, i) => {
emojis.forEach((emoji) => {
const card = createEmojiCard(emoji);
resultEl.appendChild(card);
// Stagger pop animation
@@ -309,15 +309,13 @@ const i18n = {
let currentBody: Font | null = null;
let headingLocked = false;
let bodyLocked = false;
let loadedFonts = new Set<string>();
const loadedFonts = new Set<string>();
function randomItem<T>(arr: T[]): T {
return arr[randomInt(0, arr.length - 1)];
}
function getGoogleFontsUrl(heading: Font, body: Font): string {
const headingFamily = heading.apiName.split(":")[0];
const bodyFamily = body.apiName.split(":")[0];
return `https://fonts.googleapis.com/css2?family=${heading.apiName}&family=${body.apiName}&display=swap`;
}
@@ -340,7 +338,6 @@ const i18n = {
const lockedIconSvg = `<svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="text-accent"><rect width="18" height="11" x="3" y="11" rx="2" ry="2"/><path d="M7 11V7a5 5 0 0 1 9.9-1"/><circle cx="12" cy="16" r="1"/></svg>`;
const unlockedIconSvg = `<svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="text-zinc-500"><rect width="18" height="11" x="3" y="11" rx="2" ry="2"/><path d="M7 11V7a5 5 0 0 1 10 0v4"/><circle cx="12" cy="16" r="1"/></svg>`;
const copyIconSvg = `<svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><rect width="14" height="14" x="8" y="8" rx="2" ry="2"/><path d="M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2"/></svg>`;
const checkIconSvg = `<svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round" class="text-accent"><path d="M20 6 9 17l-5-5"/></svg>`;
function render() {
@@ -525,9 +525,6 @@ const isRu = Astro.url.pathname.startsWith("/ru");
const result = currentResults[i];
if (!result) return;
const copyBtn = card.querySelector(".hash-copy-btn") as HTMLButtonElement;
const copyIcon = card.querySelector(".hash-copy-icon") as HTMLSpanElement;
const checkIcon = card.querySelector(".hash-check-icon") as HTMLSpanElement;
const copyLabel = card.querySelector(".hash-copy-label") as HTMLSpanElement;
if (copyBtn) {
const formatted = formatHash(result.hash);
// Clone to remove old listeners
@@ -341,12 +341,6 @@ const copiedLabel = isRu ? "Скопировано" : "Copied";
sessionStorage.setItem(HISTORY_KEY, JSON.stringify(h.slice(0, 5)));
}
function getTypeLabel(type: AnswerType): string {
if (type === "positive") return isRu ? "Положительный" : "Positive";
if (type === "neutral") return isRu ? "Нейтральный" : "Neutral";
return isRu ? "Отрицательный" : "Negative";
}
function getTypeDotClass(type: AnswerType): string {
if (type === "positive") return "bg-blue-500";
if (type === "neutral") return "bg-yellow-500";
@@ -7,19 +7,6 @@ const itemsPlaceholder = isRu
? "Алиса\nБоб\nКарол\nДэвид"
: "Alice\nBob\nCarol\nDavid";
const teamCountLabel = isRu ? "Количество команд" : "Number of teams";
const teamPrefix = isRu ? "Команда" : "Team";
const errAddTwo = isRu
? "Добавьте хотя бы 2 участника."
: "Add at least 2 participants.";
const errTeamsMin = isRu
? "Минимум 2 команды."
: "Minimum 2 teams.";
const errTeamsMax = isRu
? "Максимум 20 команд."
: "Maximum 20 teams.";
const errMorePlayers = isRu
? "Участников должно быть больше, чем команд."
: "Participants must outnumber teams.";
---
<div id="teams-generator" class="mt-8">