From 7dc6f87dbfb30c7200ee8f686cc2fe6a34c1a136 Mon Sep 17 00:00:00 2001 From: codefactor-io Date: Fri, 29 Nov 2024 07:00:40 +0000 Subject: [PATCH] [CodeFactor] Apply fixes to commit 9b0a906 --- youi/src/lib/debug/chaosmonkey.ts | 2 +- youi/src/lib/debug/chaosmonkey/domscriptwindow.ts | 2 +- youi/src/lib/debug/choreograph.ts | 2 +- youi/src/lib/debug/codesmells.ts | 2 +- youi/src/lib/debug/debug.ts | 4 ++-- youi/src/lib/debug/twin.ts | 4 ++-- youi/src/lib/debug/xhr.ts | 2 +- youi/src/lib/mongo/utils.ts | 2 +- 8 files changed, 10 insertions(+), 10 deletions(-) diff --git a/youi/src/lib/debug/chaosmonkey.ts b/youi/src/lib/debug/chaosmonkey.ts index 813583f..08d2eb2 100644 --- a/youi/src/lib/debug/chaosmonkey.ts +++ b/youi/src/lib/debug/chaosmonkey.ts @@ -47,7 +47,7 @@ export const setupChaosMonkey = ({ addLog, overlay }: { addLog: Function; overla }; const chaosHistory: ChaosEvent[] = []; - let activeNetwork: Map = new Map(); + const activeNetwork: Map = new Map(); // Create container within the provided overlay const container = document.createElement('div'); diff --git a/youi/src/lib/debug/chaosmonkey/domscriptwindow.ts b/youi/src/lib/debug/chaosmonkey/domscriptwindow.ts index a3f5277..27c0cdd 100644 --- a/youi/src/lib/debug/chaosmonkey/domscriptwindow.ts +++ b/youi/src/lib/debug/chaosmonkey/domscriptwindow.ts @@ -242,7 +242,7 @@ export const setupScriptChaos = ({ logChaos, shouldCreateChaos, config }: { logC const interceptGlobals = () => { // Keep track of added globals const addedGlobals = new Set(); - let originalValues = new Map(); + const originalValues = new Map(); // Watch for new globals const globalProxy = new Proxy(window, { diff --git a/youi/src/lib/debug/choreograph.ts b/youi/src/lib/debug/choreograph.ts index 3ab9797..6e024d2 100644 --- a/youi/src/lib/debug/choreograph.ts +++ b/youi/src/lib/debug/choreograph.ts @@ -17,7 +17,7 @@ interface ChoreographyMove { export const setupDebugChoreographer = ({ addLog, overlay }: { addLog: Function; overlay: HTMLElement }) => { const dancers = new Map(); let isPerforming = false; - let musicContext: AudioContext | null = null; + const musicContext: AudioContext | null = null; let danceObserver: MutationObserver | null = null; const danceBook = new Map(); diff --git a/youi/src/lib/debug/codesmells.ts b/youi/src/lib/debug/codesmells.ts index 010710f..9b2c568 100644 --- a/youi/src/lib/debug/codesmells.ts +++ b/youi/src/lib/debug/codesmells.ts @@ -213,7 +213,7 @@ export const setupCodeSmellDetector = ({ addLog, overlay }: { addLog: Function; // Fallback if we still don't have any identifying information if (elementInfo === `<${tag}>`) { // Try to get some context from parent elements - let parent = element.parentElement; + const parent = element.parentElement; let parentInfo = ''; if (parent) { const parentId = parent.id ? `#${parent.id}` : ''; diff --git a/youi/src/lib/debug/debug.ts b/youi/src/lib/debug/debug.ts index 458e395..249f6a0 100644 --- a/youi/src/lib/debug/debug.ts +++ b/youi/src/lib/debug/debug.ts @@ -26,10 +26,10 @@ type ConsoleMethod = keyof Console; export const createDebugOverlay = () => { let logs: DebugEntry[] = []; - let expandedEntries = new Set(); + const expandedEntries = new Set(); let observer: MutationObserver; const originalConsole: Record = {}; - let isMinimized = false; + const isMinimized = false; const addLog = (entry: DebugEntry) => { logs.unshift(entry); diff --git a/youi/src/lib/debug/twin.ts b/youi/src/lib/debug/twin.ts index f48932c..fbdcd94 100644 --- a/youi/src/lib/debug/twin.ts +++ b/youi/src/lib/debug/twin.ts @@ -41,8 +41,8 @@ interface SerializableStateSnapshot { export const setupDigitalTwin = ({ addLog, overlay }: { addLog: Function; overlay: HTMLElement }) => { let isActive = false; - let userPatterns: Map = new Map(); - let predictedStates: Map = new Map(); + const userPatterns: Map = new Map(); + const predictedStates: Map = new Map(); let currentSimulation: Worker | null = null; // Create UI within the provided overlay diff --git a/youi/src/lib/debug/xhr.ts b/youi/src/lib/debug/xhr.ts index 800460d..a2db574 100644 --- a/youi/src/lib/debug/xhr.ts +++ b/youi/src/lib/debug/xhr.ts @@ -5,7 +5,7 @@ export const setupXHRTracking = ({ addLog }: { addLog: (entry: any) => void }) = const id = crypto.randomUUID(); // Track request details - let requestDetails = { + const requestDetails = { method: 'GET', url: '', startTime: 0, diff --git a/youi/src/lib/mongo/utils.ts b/youi/src/lib/mongo/utils.ts index 3f5be5d..5522f3e 100644 --- a/youi/src/lib/mongo/utils.ts +++ b/youi/src/lib/mongo/utils.ts @@ -24,7 +24,7 @@ export const ToBinary = (uuid: string) => { throw new Error("Invalid UUID format") } - let hex = uuid.replace(/[{}-]/g, "") + const hex = uuid.replace(/[{}-]/g, "") if (hex.length !== 32) { throw new Error("Invalid UUID format after stripping characters") }