lint fix wip

This commit is contained in:
Nicolas Cantu 2026-01-07 17:09:07 +01:00
parent 6d993bedc5
commit 24d30eb5d0
4 changed files with 38 additions and 45 deletions

View File

@ -15,19 +15,16 @@ export function deleteAllCookies(): void {
for (let i = 0; i < cookies.length; i += 1) {
const cookie = cookies[i]
if (!cookie) {
continue
}
const eqPos = cookie.indexOf('=')
const name = eqPos > -1 ? cookie.substring(0, eqPos).trim() : cookie.trim()
if (cookie) {
const eqPos = cookie.indexOf('=')
const name = eqPos > -1 ? cookie.substring(0, eqPos).trim() : cookie.trim()
if (!name) {
continue
if (name) {
// Delete cookie by setting it to expire in the past
document.cookie = `${name}=;expires=Thu, 01 Jan 1970 00:00:00 GMT;path=/`
document.cookie = `${name}=;expires=Thu, 01 Jan 1970 00:00:00 GMT;path=/;domain=${window.location.hostname}`
document.cookie = `${name}=;expires=Thu, 01 Jan 1970 00:00:00 GMT;path=/;domain=.${window.location.hostname}`
}
}
// Delete cookie by setting it to expire in the past
document.cookie = `${name}=;expires=Thu, 01 Jan 1970 00:00:00 GMT;path=/`
document.cookie = `${name}=;expires=Thu, 01 Jan 1970 00:00:00 GMT;path=/;domain=${window.location.hostname}`
document.cookie = `${name}=;expires=Thu, 01 Jan 1970 00:00:00 GMT;path=/;domain=.${window.location.hostname}`
}
}

View File

@ -14,17 +14,16 @@ function canonicalizeObject(obj: Record<string, unknown>): string {
for (const key of sortedKeys) {
const value = obj[key]
if (value === undefined || value === null) {
continue // Skip undefined/null values
}
if (typeof value === 'object' && !Array.isArray(value)) {
// Recursively canonicalize nested objects
parts.push(`${key}:${canonicalizeObject(value as Record<string, unknown>)}`)
} else if (Array.isArray(value)) {
// Arrays are serialized as comma-separated values
parts.push(`${key}:[${value.map((v) => (typeof v === 'object' ? JSON.stringify(v) : String(v))).join(',')}]`)
} else {
parts.push(`${key}:${String(value)}`)
if (value !== undefined && value !== null) {
if (typeof value === 'object' && !Array.isArray(value)) {
// Recursively canonicalize nested objects
parts.push(`${key}:${canonicalizeObject(value as Record<string, unknown>)}`)
} else if (Array.isArray(value)) {
// Arrays are serialized as comma-separated values
parts.push(`${key}:[${value.map((v) => (typeof v === 'object' ? JSON.stringify(v) : String(v))).join(',')}]`)
} else {
parts.push(`${key}:${String(value)}`)
}
}
}

View File

@ -36,17 +36,15 @@ export function loadTranslations(locale: Locale, translationsText: string): void
const lines = translationsText.split('\n')
for (const line of lines) {
const trimmed = line.trim()
if (!trimmed || trimmed.startsWith('#')) {
continue
}
const equalIndex = trimmed.indexOf('=')
if (equalIndex === -1) {
continue
}
const key = trimmed.substring(0, equalIndex).trim()
const value = trimmed.substring(equalIndex + 1).trim()
if (key && value) {
translationsMap[key] = value
if (trimmed && !trimmed.startsWith('#')) {
const equalIndex = trimmed.indexOf('=')
if (equalIndex !== -1) {
const key = trimmed.substring(0, equalIndex).trim()
const value = trimmed.substring(equalIndex + 1).trim()
if (key && value) {
translationsMap[key] = value
}
}
}
}

View File

@ -175,18 +175,17 @@ function renderLink(line: string, index: number, elements: React.ReactElement[])
let match
while ((match = linkRegex.exec(line)) !== null) {
if (!match[2]) {
continue
if (match[2]) {
if (!match[1] || match.index > lastIndex) {
parts.push(line.substring(lastIndex, match.index))
}
const href = match[2]
const isExternal = href.startsWith('http')
if (match[1]) {
parts.push(createLinkElement(match[1], href, `link-${index}-${match.index}`, isExternal))
}
lastIndex = match.index + match[0].length
}
if (!match[1] || match.index > lastIndex) {
parts.push(line.substring(lastIndex, match.index))
}
const href = match[2]
const isExternal = href.startsWith('http')
if (match[1]) {
parts.push(createLinkElement(match[1], href, `link-${index}-${match.index}`, isExternal))
}
lastIndex = match.index + match[0].length
}
if (lastIndex < line.length) {