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) {
|
for (let i = 0; i < cookies.length; i += 1) {
|
||||||
const cookie = cookies[i]
|
const cookie = cookies[i]
|
||||||
if (!cookie) {
|
if (cookie) {
|
||||||
continue
|
|
||||||
}
|
|
||||||
const eqPos = cookie.indexOf('=')
|
const eqPos = cookie.indexOf('=')
|
||||||
const name = eqPos > -1 ? cookie.substring(0, eqPos).trim() : cookie.trim()
|
const name = eqPos > -1 ? cookie.substring(0, eqPos).trim() : cookie.trim()
|
||||||
|
|
||||||
if (!name) {
|
if (name) {
|
||||||
continue
|
|
||||||
}
|
|
||||||
|
|
||||||
// Delete cookie by setting it to expire in the past
|
// 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=/`
|
||||||
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}`
|
||||||
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) {
|
for (const key of sortedKeys) {
|
||||||
const value = obj[key]
|
const value = obj[key]
|
||||||
if (value === undefined || value === null) {
|
if (value !== undefined && value !== null) {
|
||||||
continue // Skip undefined/null values
|
|
||||||
}
|
|
||||||
if (typeof value === 'object' && !Array.isArray(value)) {
|
if (typeof value === 'object' && !Array.isArray(value)) {
|
||||||
// Recursively canonicalize nested objects
|
// Recursively canonicalize nested objects
|
||||||
parts.push(`${key}:${canonicalizeObject(value as Record<string, unknown>)}`)
|
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)}`)
|
parts.push(`${key}:${String(value)}`)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return `{${parts.join('|')}}`
|
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')
|
const lines = translationsText.split('\n')
|
||||||
for (const line of lines) {
|
for (const line of lines) {
|
||||||
const trimmed = line.trim()
|
const trimmed = line.trim()
|
||||||
if (!trimmed || trimmed.startsWith('#')) {
|
if (trimmed && !trimmed.startsWith('#')) {
|
||||||
continue
|
|
||||||
}
|
|
||||||
const equalIndex = trimmed.indexOf('=')
|
const equalIndex = trimmed.indexOf('=')
|
||||||
if (equalIndex === -1) {
|
if (equalIndex !== -1) {
|
||||||
continue
|
|
||||||
}
|
|
||||||
const key = trimmed.substring(0, equalIndex).trim()
|
const key = trimmed.substring(0, equalIndex).trim()
|
||||||
const value = trimmed.substring(equalIndex + 1).trim()
|
const value = trimmed.substring(equalIndex + 1).trim()
|
||||||
if (key && value) {
|
if (key && value) {
|
||||||
translationsMap[key] = value
|
translationsMap[key] = value
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
translations.set(locale, translationsMap)
|
translations.set(locale, translationsMap)
|
||||||
}
|
}
|
||||||
|
|||||||
@ -175,9 +175,7 @@ function renderLink(line: string, index: number, elements: React.ReactElement[])
|
|||||||
let match
|
let match
|
||||||
|
|
||||||
while ((match = linkRegex.exec(line)) !== null) {
|
while ((match = linkRegex.exec(line)) !== null) {
|
||||||
if (!match[2]) {
|
if (match[2]) {
|
||||||
continue
|
|
||||||
}
|
|
||||||
if (!match[1] || match.index > lastIndex) {
|
if (!match[1] || match.index > lastIndex) {
|
||||||
parts.push(line.substring(lastIndex, match.index))
|
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
|
lastIndex = match.index + match[0].length
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (lastIndex < line.length) {
|
if (lastIndex < line.length) {
|
||||||
parts.push(line.substring(lastIndex))
|
parts.push(line.substring(lastIndex))
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user