From 52d3750acc7420b87e323b247d413a4a77ebc0f8 Mon Sep 17 00:00:00 2001 From: Moyasee Date: Fri, 3 Oct 2025 16:20:32 +0300 Subject: [PATCH] fix: multiple imports and other minor issues --- .../src/pages/game-details/game-details-content.tsx | 3 +-- src/shared/html-sanitizer.ts | 10 ++++------ 2 files changed, 5 insertions(+), 8 deletions(-) diff --git a/src/renderer/src/pages/game-details/game-details-content.tsx b/src/renderer/src/pages/game-details/game-details-content.tsx index 07ffcd10..28321f1e 100644 --- a/src/renderer/src/pages/game-details/game-details-content.tsx +++ b/src/renderer/src/pages/game-details/game-details-content.tsx @@ -15,10 +15,9 @@ import { EditGameModal, DeleteReviewModal } from "./modals"; import { ReviewSortOptions } from "./review-sort-options"; import { ReviewPromptBanner } from "./review-prompt-banner"; -import { sanitizeHtml } from "@shared"; +import { sanitizeHtml, AuthPage } from "@shared"; import { useTranslation } from "react-i18next"; import { cloudSyncContext, gameDetailsContext } from "@renderer/context"; -import { AuthPage } from "@shared"; import cloudIconAnimated from "@renderer/assets/icons/cloud-animated.gif"; import { useUserDetails, useLibrary, useDate } from "@renderer/hooks"; diff --git a/src/shared/html-sanitizer.ts b/src/shared/html-sanitizer.ts index d2127635..d8391d88 100644 --- a/src/shared/html-sanitizer.ts +++ b/src/shared/html-sanitizer.ts @@ -3,7 +3,7 @@ function removeZalgoText(text: string): string { // eslint-disable-next-line no-misleading-character-class /[\u0300-\u036F\u1AB0-\u1AFF\u1DC0-\u1DFF\u20D0-\u20FF\uFE20-\uFE2F]/g; - return text.replace(zalgoRegex, ""); + return text.replaceAll(zalgoRegex, ""); } function decodeHtmlEntities(text: string): string { @@ -16,7 +16,7 @@ function decodeHtmlEntities(text: string): string { " ": " ", }; - return text.replace(/&[#\w]+;/g, (entity) => { + return text.replaceAll(/&[#\w]+;/g, (entity) => { return entityMap[entity] || entity; }); } @@ -25,9 +25,7 @@ function removeHtmlTags(html: string): string { let result = ""; let inTag = false; - for (let i = 0; i < html.length; i++) { - const char = html[i]; - + for (const char of html) { if (char === "<") { inTag = true; } else if (char === ">") { @@ -51,7 +49,7 @@ export function sanitizeHtml(html: string): string { cleanText = removeZalgoText(cleanText); - cleanText = cleanText.replace(/\s+/g, " ").trim(); + cleanText = cleanText.replaceAll(/\s+/g, " ").trim(); if (!cleanText || cleanText.length === 0) { return "";