lint fix wip
This commit is contained in:
parent
6d993bedc5
commit
24d30eb5d0
@ -15,19 +15,16 @@ export function deleteAllCookies(): void {
|
||||
|
||||
for (let i = 0; i < cookies.length; i += 1) {
|
||||
const cookie = cookies[i]
|
||||
if (!cookie) {
|
||||
continue
|
||||
}
|
||||
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}`
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -14,9 +14,7 @@ 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 (value !== undefined && value !== null) {
|
||||
if (typeof value === 'object' && !Array.isArray(value)) {
|
||||
// Recursively canonicalize nested objects
|
||||
parts.push(`${key}:${canonicalizeObject(value as Record<string, unknown>)}`)
|
||||
@ -27,6 +25,7 @@ function canonicalizeObject(obj: Record<string, unknown>): string {
|
||||
parts.push(`${key}:${String(value)}`)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return `{${parts.join('|')}}`
|
||||
}
|
||||
|
||||
10
lib/i18n.ts
10
lib/i18n.ts
@ -36,19 +36,17 @@ 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
|
||||
}
|
||||
if (trimmed && !trimmed.startsWith('#')) {
|
||||
const equalIndex = trimmed.indexOf('=')
|
||||
if (equalIndex === -1) {
|
||||
continue
|
||||
}
|
||||
if (equalIndex !== -1) {
|
||||
const key = trimmed.substring(0, equalIndex).trim()
|
||||
const value = trimmed.substring(equalIndex + 1).trim()
|
||||
if (key && value) {
|
||||
translationsMap[key] = value
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
translations.set(locale, translationsMap)
|
||||
}
|
||||
|
||||
@ -175,9 +175,7 @@ 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))
|
||||
}
|
||||
@ -188,6 +186,7 @@ function renderLink(line: string, index: number, elements: React.ReactElement[])
|
||||
}
|
||||
lastIndex = match.index + match[0].length
|
||||
}
|
||||
}
|
||||
|
||||
if (lastIndex < line.length) {
|
||||
parts.push(line.substring(lastIndex))
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user