Add analyzer and frontend lint guardrails
This commit is contained in:
@@ -1,7 +1,12 @@
|
||||
import { t } from "./i18n.js";
|
||||
import { state } from "./state.js";
|
||||
import { $ } from "./dom.js";
|
||||
import { linkRootId, renderLinkBadge, escapeHtml, safeUrl } from "./ui-utils.js";
|
||||
import {
|
||||
linkRootId,
|
||||
renderLinkBadge,
|
||||
escapeHtml,
|
||||
safeUrl,
|
||||
} from "./ui-utils.js";
|
||||
import { scoreToEmoji } from "./votes-ui.js";
|
||||
import { openLightbox } from "./modals-ui.js";
|
||||
|
||||
@@ -35,9 +40,23 @@ export function renderResults() {
|
||||
rank = nextRank++;
|
||||
rankByRoot.set(root, rank);
|
||||
}
|
||||
const medal = rank === 1 ? "🥇" : rank === 2 ? "🥈" : rank === 3 ? "🥉" : `${rank}`;
|
||||
const medal =
|
||||
rank === 1
|
||||
? "🥇"
|
||||
: rank === 2
|
||||
? "🥈"
|
||||
: rank === 3
|
||||
? "🥉"
|
||||
: `${rank}`;
|
||||
const row = document.createElement("tr");
|
||||
const podiumClass = rank === 1 ? "podium podium-1" : rank === 2 ? "podium podium-2" : rank === 3 ? "podium podium-3" : "";
|
||||
const podiumClass =
|
||||
rank === 1
|
||||
? "podium podium-1"
|
||||
: rank === 2
|
||||
? "podium podium-2"
|
||||
: rank === 3
|
||||
? "podium podium-3"
|
||||
: "";
|
||||
row.className = podiumClass;
|
||||
const safeName = escapeHtml(r.name);
|
||||
const safeAuthor = escapeHtml(r.author ?? "—");
|
||||
@@ -79,9 +98,14 @@ export function renderResults() {
|
||||
function buildResultMeta(r) {
|
||||
const hasPlayers = r.minPlayers || r.maxPlayers;
|
||||
const players = hasPlayers
|
||||
? t("card.players", { min: r.minPlayers ?? "?", max: r.maxPlayers ?? "?" })
|
||||
? t("card.players", {
|
||||
min: r.minPlayers ?? "?",
|
||||
max: r.maxPlayers ?? "?",
|
||||
})
|
||||
: null;
|
||||
const bits = [r.genre ? escapeHtml(r.genre) : null, players].filter(Boolean);
|
||||
const bits = [r.genre ? escapeHtml(r.genre) : null, players].filter(
|
||||
Boolean,
|
||||
);
|
||||
if (bits.length === 0) return "";
|
||||
return `<div class="muted small">${bits.join(" • ")}</div>`;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user