Apply repository-wide ESLint auto-fix formatting pass

Co-Authored-By: Codex <codex@openai.com>
This commit is contained in:
2026-03-08 12:11:57 +08:00
parent 7c48faaa3d
commit 847904c49b
172 changed files with 13629 additions and 9154 deletions

View File

@@ -13,7 +13,7 @@
*/
export function getCookie(name) {
const nameEqual = name + "=";
const cookieArr = document.cookie.split(';');
const cookieArr = document.cookie.split(";");
for (const cookie of cookieArr) {
let c = cookie.trim();
@@ -34,14 +34,15 @@ export function getCookie(name) {
* @param {string} value - The cookie value.
* @param {number} [days=1] - Number of days until the cookie expires.
*/
export function setCookie(name, value, days=1) {
export function setCookie(name, value, days = 1) {
let expires = "";
if (days) {
const date = new Date();
date.setTime(date.getTime() + (days * 24 * 60 * 60 * 1000));
date.setTime(date.getTime() + days * 24 * 60 * 60 * 1000);
expires = "; expires=" + date.toUTCString();
}
document.cookie = name + "=" + (value || "") + expires + "; path=/; Secure; SameSite=Lax";
document.cookie =
name + "=" + (value || "") + expires + "; path=/; Secure; SameSite=Lax";
}
/**
@@ -50,7 +51,8 @@ export function setCookie(name, value, days=1) {
* @param {string} value - The cookie value.
*/
export function setCookieWithoutExpiration(name, value) {
document.cookie = name + "=" + (value || "") + "; path=/; Secure; SameSite=Lax";
document.cookie =
name + "=" + (value || "") + "; path=/; Secure; SameSite=Lax";
}
/**
@@ -58,6 +60,7 @@ export function setCookieWithoutExpiration(name, value) {
* @param {string} name - The cookie name to delete.
* @param {string} [path='/'] - The path scope of the cookie.
*/
export function deleteCookie(name, path = '/') {
document.cookie = name + '=; Max-Age=-99999999; path=' + path + '; Secure; SameSite=Lax';
export function deleteCookie(name, path = "/") {
document.cookie =
name + "=; Max-Age=-99999999; path=" + path + "; Secure; SameSite=Lax";
}

View File

@@ -4,7 +4,7 @@
// imacat.yang@dsp.im (imacat), 2023/9/23
/** @module emitter Shared mitt event bus instance. */
import mitt from 'mitt';
import mitt from "mitt";
/** Global event emitter for cross-component communication. */
const emitter = mitt();

View File

@@ -12,9 +12,9 @@
*/
export function escapeHtml(str) {
return str
.replace(/&/g, '&amp;')
.replace(/</g, '&lt;')
.replace(/>/g, '&gt;')
.replace(/"/g, '&quot;')
.replace(/'/g, '&#039;');
.replace(/&/g, "&amp;")
.replace(/</g, "&lt;")
.replace(/>/g, "&gt;")
.replace(/"/g, "&quot;")
.replace(/'/g, "&#039;");
}

View File

@@ -12,20 +12,20 @@
* @param {number} [indent=0] - The current indentation level.
*/
export const printObject = (obj, indent = 0) => {
const padding = ' '.repeat(indent);
const padding = " ".repeat(indent);
for (const key in obj) {
if (obj.hasOwnProperty(key)) {
if (typeof obj[key] === 'object' && obj[key] !== null) {
console.log(`${padding}${key}: {`);
printObject(obj[key], indent + 2);
console.log(`${padding}}`);
} else {
console.log(`${padding}${key}: ${obj[key]}`);
}
for (const key in obj) {
if (obj.hasOwnProperty(key)) {
if (typeof obj[key] === "object" && obj[key] !== null) {
console.log(`${padding}${key}: {`);
printObject(obj[key], indent + 2);
console.log(`${padding}}`);
} else {
console.log(`${padding}${key}: ${obj[key]}`);
}
}
};
}
};
/**
* Returns a cryptographically random integer between 0 and max (inclusive).
@@ -35,5 +35,5 @@ export const printObject = (obj, indent = 0) => {
export const getRandomInt = (max) => {
const array = new Uint32Array(1);
window.crypto.getRandomValues(array);
return Math.floor(array[0] / (0xFFFFFFFF + 1) * (max + 1));
return Math.floor((array[0] / (0xffffffff + 1)) * (max + 1));
};

View File

@@ -18,23 +18,20 @@
* undefined if rawPageName is falsy.
*/
const mapPageNameToCapitalUnifiedName = (rawPageName) => {
if(rawPageName) {
switch (rawPageName.toUpperCase()) {
case 'CHECKMAP':
return 'MAP';
case 'CHECKCONFORMANCE':
return 'CONFORMANCE';
case 'CHECKPERFORMANCE':
return 'PERFORMANCE';
case 'COMPAREDASHBOARD':
return 'DASHBOARD';
default:
return rawPageName.toUpperCase();
}
if (rawPageName) {
switch (rawPageName.toUpperCase()) {
case "CHECKMAP":
return "MAP";
case "CHECKCONFORMANCE":
return "CONFORMANCE";
case "CHECKPERFORMANCE":
return "PERFORMANCE";
case "COMPAREDASHBOARD":
return "DASHBOARD";
default:
return rawPageName.toUpperCase();
}
}
};
export {
mapPageNameToCapitalUnifiedName,
};
export { mapPageNameToCapitalUnifiedName };

View File

@@ -11,7 +11,6 @@
* @param {number} [s=2.5] - The delay in seconds.
* @returns {Promise<void>} A promise that resolves after the delay.
*/
export const delaySecond = (s = 2.5) => {
return new Promise((resolve) =>
setTimeout(resolve, s * 1000)
);}
export const delaySecond = (s = 2.5) => {
return new Promise((resolve) => setTimeout(resolve, s * 1000));
};