From de156ef10a4606fa7391ea380d0f93446f685ded Mon Sep 17 00:00:00 2001 From: Thomas Basler Date: Fri, 12 Apr 2024 20:34:30 +0200 Subject: [PATCH] webapp: Fix lint errors --- webapp/src/components/BasePage.vue | 5 +- webapp/src/components/BootstrapAlert.vue | 4 +- webapp/src/components/FirmwareInfo.vue | 4 +- webapp/src/components/InputElement.vue | 4 +- webapp/src/components/InputSerial.vue | 2 + webapp/src/components/NavBar.vue | 24 +- webapp/src/components/PinInfo.vue | 2 + webapp/src/utils/authentication.ts | 2 +- webapp/src/views/ConfigAdminView.vue | 4 +- webapp/src/views/ConsoleInfoView.vue | 308 +++++++++++------------ webapp/src/views/HomeView.vue | 12 +- webapp/src/views/SystemInfoView.vue | 2 +- webapp/vite.config.ts | 1 + 13 files changed, 189 insertions(+), 185 deletions(-) diff --git a/webapp/src/components/BasePage.vue b/webapp/src/components/BasePage.vue index 0ec43d36f..3ca9c12b5 100644 --- a/webapp/src/components/BasePage.vue +++ b/webapp/src/components/BasePage.vue @@ -48,15 +48,14 @@ export default defineComponent({ showReload: { type: Boolean, required: false, default: false }, }, mounted() { - var self = this; console.log("init"); PullToRefresh.init({ mainElement: 'body', // above which element? instructionsPullToRefresh: this.$t('base.Pull'), instructionsReleaseToRefresh: this.$t('base.Release'), instructionsRefreshing: this.$t('base.Refreshing'), - onRefresh: function() { - self.$emit('reload'); + onRefresh: () => { + this.$emit('reload'); } }); }, diff --git a/webapp/src/components/BootstrapAlert.vue b/webapp/src/components/BootstrapAlert.vue index df96fb620..a629863db 100644 --- a/webapp/src/components/BootstrapAlert.vue +++ b/webapp/src/components/BootstrapAlert.vue @@ -52,7 +52,7 @@ export default defineComponent({ _countDownTimeout = undefined; }; - var countDown = ref(); + const countDown = ref(); watch(() => props.modelValue, () => { countDown.value = parseCountDown(props.modelValue); }); @@ -116,4 +116,4 @@ export default defineComponent({ }; }, }); - \ No newline at end of file + diff --git a/webapp/src/components/FirmwareInfo.vue b/webapp/src/components/FirmwareInfo.vue index 11aa25a96..7271004d6 100644 --- a/webapp/src/components/FirmwareInfo.vue +++ b/webapp/src/components/FirmwareInfo.vue @@ -83,10 +83,10 @@ export default defineComponent({ }, computed: { modelAllowVersionInfo: { - get(): any { + get(): boolean { return !!this.allowVersionInfo; }, - set(value: any) { + set(value: boolean) { this.$emit('update:allowVersionInfo', value); }, }, diff --git a/webapp/src/components/InputElement.vue b/webapp/src/components/InputElement.vue index eff8e9f66..f12a11720 100644 --- a/webapp/src/components/InputElement.vue +++ b/webapp/src/components/InputElement.vue @@ -83,10 +83,12 @@ export default defineComponent({ }, computed: { model: { + // eslint-disable-next-line @typescript-eslint/no-explicit-any get(): any { if (this.type === 'checkbox') return !!this.modelValue; return this.modelValue; }, + // eslint-disable-next-line @typescript-eslint/no-explicit-any set(value: any) { this.$emit('update:modelValue', value); }, @@ -112,4 +114,4 @@ export default defineComponent({ } }, }); - \ No newline at end of file + diff --git a/webapp/src/components/InputSerial.vue b/webapp/src/components/InputSerial.vue index 9f5ee343b..3669da622 100644 --- a/webapp/src/components/InputSerial.vue +++ b/webapp/src/components/InputSerial.vue @@ -28,9 +28,11 @@ export default defineComponent({ }, computed: { model: { + // eslint-disable-next-line @typescript-eslint/no-explicit-any get(): any { return this.modelValue; }, + // eslint-disable-next-line @typescript-eslint/no-explicit-any set(value: any) { this.$emit('update:modelValue', value); }, diff --git a/webapp/src/components/NavBar.vue b/webapp/src/components/NavBar.vue index 53995df73..e6eb58f27 100644 --- a/webapp/src/components/NavBar.vue +++ b/webapp/src/components/NavBar.vue @@ -146,8 +146,8 @@ export default defineComponent({ }, isEaster() { const easter = this.getEasterSunday(this.now.getFullYear()); - var easterStart = new Date(easter); - var easterEnd = new Date(easter); + const easterStart = new Date(easter); + const easterEnd = new Date(easter); easterStart.setDate(easterStart.getDate() - 2); easterEnd.setDate(easterEnd.getDate() + 1); return this.now >= easterStart && this.now < easterEnd; @@ -170,18 +170,18 @@ export default defineComponent({ this.$refs.navbarCollapse && (this.$refs.navbarCollapse as HTMLElement).classList.remove("show"); }, getEasterSunday(year: number): Date { - var f = Math.floor; - var G = year % 19; - var C = f(year / 100); - var H = (C - f(C / 4) - f((8 * C + 13) / 25) + 19 * G + 15) % 30; - var I = H - f(H / 28) * (1 - f(29 / (H + 1)) * f((21 - G) / 11)); - var J = (year + f(year / 4) + I + 2 - C + f(C / 4)) % 7; - var L = I - J; - var month = 3 + f((L + 40) / 44); - var day = L + 28 - 31 * f(month / 4); + const f = Math.floor; + const G = year % 19; + const C = f(year / 100); + const H = (C - f(C / 4) - f((8 * C + 13) / 25) + 19 * G + 15) % 30; + const I = H - f(H / 28) * (1 - f(29 / (H + 1)) * f((21 - G) / 11)); + const J = (year + f(year / 4) + I + 2 - C + f(C / 4)) % 7; + const L = I - J; + const month = 3 + f((L + 40) / 44); + const day = L + 28 - 31 * f(month / 4); return new Date(year, month - 1, day); } }, }); - \ No newline at end of file + diff --git a/webapp/src/components/PinInfo.vue b/webapp/src/components/PinInfo.vue index 3d4616adb..c1e84b810 100644 --- a/webapp/src/components/PinInfo.vue +++ b/webapp/src/components/PinInfo.vue @@ -84,9 +84,11 @@ export default defineComponent({ let comCur = 999999; if (this.selectedPinAssignment && category in this.selectedPinAssignment) { + // eslint-disable-next-line @typescript-eslint/no-explicit-any comSel = (this.selectedPinAssignment as any)[category][prop]; } if (this.currentPinAssignment && category in this.currentPinAssignment) { + // eslint-disable-next-line @typescript-eslint/no-explicit-any comCur = (this.currentPinAssignment as any)[category][prop]; } diff --git a/webapp/src/utils/authentication.ts b/webapp/src/utils/authentication.ts index 52d92fd98..f666c36be 100644 --- a/webapp/src/utils/authentication.ts +++ b/webapp/src/utils/authentication.ts @@ -41,7 +41,7 @@ export function isLoggedIn(): boolean { return (localStorage.getItem('user') != null); } -export function login(username: String, password: String) { +export function login(username: string, password: string) { const requestOptions = { method: 'GET', headers: { diff --git a/webapp/src/views/ConfigAdminView.vue b/webapp/src/views/ConfigAdminView.vue index c0954396e..e0bb66dc8 100644 --- a/webapp/src/views/ConfigAdminView.vue +++ b/webapp/src/views/ConfigAdminView.vue @@ -188,8 +188,8 @@ export default defineComponent({ fetch("/api/config/get?file=" + this.backupFileSelect, { headers: authHeader() }) .then(res => res.blob()) .then(blob => { - var file = window.URL.createObjectURL(blob); - var a = document.createElement('a'); + const file = window.URL.createObjectURL(blob); + const a = document.createElement('a'); a.href = file; a.download = this.backupFileSelect; document.body.appendChild(a); diff --git a/webapp/src/views/ConsoleInfoView.vue b/webapp/src/views/ConsoleInfoView.vue index fb17f62de..eba1d533f 100644 --- a/webapp/src/views/ConsoleInfoView.vue +++ b/webapp/src/views/ConsoleInfoView.vue @@ -1,154 +1,154 @@ - - - - - \ No newline at end of file + + + + + diff --git a/webapp/src/views/HomeView.vue b/webapp/src/views/HomeView.vue index f05c42974..d137b05a5 100644 --- a/webapp/src/views/HomeView.vue +++ b/webapp/src/views/HomeView.vue @@ -5,7 +5,7 @@