From 32924e8ec8a709970f72c47c77fd797dfd289385 Mon Sep 17 00:00:00 2001 From: MickaelK Date: Sat, 14 Oct 2023 04:45:13 -0700 Subject: [PATCH] chore (eslint): lint frontend --- public/boot/ctrl_boot_backoffice.js | 5 +- public/components/breadcrumb.js | 21 +++-- public/components/form.js | 4 +- public/components/loader.js | 2 +- public/components/modal.js | 8 +- public/components/notification.js | 8 +- public/components/skeleton.js | 4 +- public/lib/skeleton/index.js | 2 +- public/package.json | 5 +- public/pages/adminpage/component_box-item.js | 4 +- public/pages/adminpage/ctrl_about.js | 2 +- public/pages/adminpage/ctrl_backend.js | 4 +- .../ctrl_backend_component_authentication.js | 94 +++++++++---------- .../ctrl_backend_component_storage.js | 33 +++---- public/pages/adminpage/ctrl_backend_state.js | 14 +-- public/pages/adminpage/ctrl_log.js | 2 +- public/pages/adminpage/ctrl_log_audit.js | 4 +- public/pages/adminpage/ctrl_log_form.js | 4 +- public/pages/adminpage/ctrl_login.js | 2 +- public/pages/adminpage/ctrl_settings.js | 8 +- public/pages/adminpage/ctrl_setup.js | 23 +++-- public/pages/adminpage/decorator.js | 6 +- public/pages/adminpage/helper_form.js | 10 +- public/pages/adminpage/model_backend.js | 1 - public/pages/adminpage/model_config.js | 2 +- public/pages/adminpage/model_log.js | 2 +- public/pages/adminpage/model_setup.js | 40 ++++---- public/pages/ctrl_error.js | 4 +- public/pages/ctrl_viewerpage.js | 10 -- public/pages/filespage/filesystem.js | 2 +- 30 files changed, 156 insertions(+), 174 deletions(-) diff --git a/public/boot/ctrl_boot_backoffice.js b/public/boot/ctrl_boot_backoffice.js index 47227fd4..3d4b4d36 100644 --- a/public/boot/ctrl_boot_backoffice.js +++ b/public/boot/ctrl_boot_backoffice.js @@ -1,5 +1,4 @@ -import rxjs, { ajax } from "../lib/rx.js"; -import { loadScript, init as initCSS } from "../helpers/loader.js"; +import { init as initCSS } from "../helpers/loader.js"; import { report } from "../helpers/log.js"; import { $error } from "./common.js"; @@ -45,5 +44,5 @@ async function setup_history() { } async function setup_css() { - return initCSS() + return initCSS(); } diff --git a/public/components/breadcrumb.js b/public/components/breadcrumb.js index d4e654d4..5540a026 100644 --- a/public/components/breadcrumb.js +++ b/public/components/breadcrumb.js @@ -8,7 +8,9 @@ class ComponentBreadcrumb extends HTMLDivElement { super(); if (new window.URL(location.href).searchParams.get("nav") === "false") return null; - const htmlLogout = isRunningFromAnIframe ? "" : ` + const htmlLogout = isRunningFromAnIframe + ? "" + : ` power @@ -18,18 +20,17 @@ class ComponentBreadcrumb extends HTMLDivElement { const htmlPathChunks = paths.map((chunk, idx) => { const label = idx === 0 ? "Filestash" : chunk; const link = paths.slice(0, idx + 1).join("/") + "/"; - const minify = function() { - if (idx === 0) return false; - else if (paths.length <= (document.body.clientWidth > 800 ? 5 : 4)) return false; - else if (idx > paths.length - (document.body.clientWidth > 1000 ? 4 : 3)) return false; - return true; - }(); + // const minify = (function() { + // if (idx === 0) return false; + // else if (paths.length <= (document.body.clientWidth > 800 ? 5 : 4)) return false; + // else if (idx > paths.length - (document.body.clientWidth > 1000 ? 4 : 3)) return false; + // return true; + // }()); const limitSize = (word, highlight = false) => { - if (highlight === true && word.length > 30) return word.substring(0, 12).trim() + "..." + - word.substring(word.length - 10, word.length).trim(); + if (highlight === true && word.length > 30) { return word.substring(0, 12).trim() + "..." + + word.substring(word.length - 10, word.length).trim(); } else if (word.length > 27) return word.substring(0, 20).trim() + "..."; return word; - }; const isLast = idx === paths.length - 1; if (isLast) return ` diff --git a/public/components/form.js b/public/components/form.js index 8a735ddb..88205d42 100644 --- a/public/components/form.js +++ b/public/components/form.js @@ -214,7 +214,7 @@ export function $renderInput(options = {}) { `); $select.value = value || props.default; attrs.map((setAttribute) => setAttribute($select)); - (options || []).map((name) => { + (options || []).forEach((name) => { const $option = createElement(` `); @@ -274,7 +274,7 @@ export function $renderInput(options = {}) { `); $input.value = `unknown element type ${type}`; $input.setAttribute("name", path.join(".")); - }} + } } }; } diff --git a/public/components/loader.js b/public/components/loader.js index cc3cb71e..2a09618a 100644 --- a/public/components/loader.js +++ b/public/components/loader.js @@ -20,7 +20,7 @@ class Loader extends window.HTMLElement { position: fixed; left: 0; right: 0; - top: calc(50% - 200px);` + top: calc(50% - 200px);`; return `
diff --git a/public/components/modal.js b/public/components/modal.js index f3becf05..fa6196da 100644 --- a/public/components/modal.js +++ b/public/components/modal.js @@ -2,7 +2,7 @@ import { createElement, nop } from "../lib/skeleton/index.js"; import rxjs, { applyMutation } from "../lib/rx.js"; import { animate } from "../lib/animate.js"; import { qs, qsa } from "../lib/dom.js"; - +import { ApplicationError } from "../lib/error.js"; import { CSS } from "../helpers/loader.js"; export default class Modal { @@ -11,7 +11,7 @@ export default class Modal { } } -const createModal = async () => createElement(` +const createModal = async() => createElement(`