webapp: Fix eslint issues

This commit is contained in:
CommanderRedYT 2024-10-05 23:33:23 +02:00
parent 4cd5d79c73
commit d3d96b51ce
No known key found for this signature in database
GPG Key ID: 572F157519DC8A5E
6 changed files with 20 additions and 20 deletions

View File

@ -1,22 +1,12 @@
/* eslint-env node */ /* eslint-env node */
import path from "node:path";
import { fileURLToPath } from "node:url";
import { FlatCompat } from "@eslint/eslintrc";
import js from "@eslint/js"; import js from "@eslint/js";
import pluginVue from 'eslint-plugin-vue' import pluginVue from 'eslint-plugin-vue'
import vueTsEslintConfig from '@vue/eslint-config-typescript'
const __filename = fileURLToPath(import.meta.url);
const __dirname = path.dirname(__filename);
const compat = new FlatCompat({
baseDirectory: __dirname,
recommendedConfig: js.configs.recommended,
});
export default [ export default [
js.configs.recommended, js.configs.recommended,
...pluginVue.configs['flat/essential'], ...pluginVue.configs['flat/essential'],
...compat.extends("@vue/eslint-config-typescript/recommended"), ...vueTsEslintConfig(),
{ {
files: [ files: [
"**/*.vue", "**/*.vue",

View File

@ -216,7 +216,9 @@ export default defineComponent({
this.$router.push('/'); this.$router.push('/');
}, },
onClick() { onClick() {
this.$refs.navbarCollapse && (this.$refs.navbarCollapse as HTMLElement).classList.remove('show'); if (this.$refs.navbarCollapse) {
(this.$refs.navbarCollapse as HTMLElement).classList.remove('show');
}
}, },
getEasterSunday(year: number): Date { getEasterSunday(year: number): Date {
const f = Math.floor; const f = Math.floor;

View File

@ -48,4 +48,4 @@ export interface Device {
display: Display; display: Display;
} }
export interface PinMapping extends Array<Device> {} export type PinMapping = Array<Device>;

View File

@ -84,7 +84,7 @@ export default defineComponent({
this.socket.onmessage = (event) => { this.socket.onmessage = (event) => {
console.log(event); console.log(event);
let outstr = new String(event.data); let outstr = String(event.data);
let removedNewline = false; let removedNewline = false;
if (outstr.endsWith('\n')) { if (outstr.endsWith('\n')) {
outstr = outstr.substring(0, outstr.length - 1); outstr = outstr.substring(0, outstr.length - 1);
@ -108,7 +108,9 @@ export default defineComponent({
}, },
// Send heartbeat packets regularly * 59s Send a heartbeat // Send heartbeat packets regularly * 59s Send a heartbeat
heartCheck() { heartCheck() {
this.heartInterval && clearTimeout(this.heartInterval); if (this.heartInterval) {
clearTimeout(this.heartInterval);
}
this.heartInterval = setInterval(() => { this.heartInterval = setInterval(() => {
if (this.socket.readyState === 1) { if (this.socket.readyState === 1) {
// Connection status // Connection status
@ -126,7 +128,9 @@ export default defineComponent({
// continue regardless of error // continue regardless of error
} }
this.heartInterval && clearTimeout(this.heartInterval); if (this.heartInterval) {
clearTimeout(this.heartInterval);
}
}, },
getOutDate(): string { getOutDate(): string {
const u = new Date(); const u = new Date();

View File

@ -734,7 +734,9 @@ export default defineComponent({
}, },
// Send heartbeat packets regularly * 59s Send a heartbeat // Send heartbeat packets regularly * 59s Send a heartbeat
heartCheck(duration: number = 59) { heartCheck(duration: number = 59) {
this.heartInterval && clearTimeout(this.heartInterval); if (this.heartInterval) {
clearTimeout(this.heartInterval);
}
this.heartInterval = setInterval(() => { this.heartInterval = setInterval(() => {
if (this.socket.readyState === 1) { if (this.socket.readyState === 1) {
// Connection status // Connection status
@ -747,7 +749,9 @@ export default defineComponent({
/** To break off websocket Connect */ /** To break off websocket Connect */
closeSocket() { closeSocket() {
this.socket.close(); this.socket.close();
this.heartInterval && clearTimeout(this.heartInterval); if (this.heartInterval) {
clearTimeout(this.heartInterval);
}
this.isFirstFetchAfterConnect = true; this.isFirstFetchAfterConnect = true;
}, },
onShowEventlog(serial: string) { onShowEventlog(serial: string) {

View File

@ -14,7 +14,7 @@ let proxy_target;
try { try {
// eslint-disable-next-line // eslint-disable-next-line
proxy_target = require('./vite.user.ts').proxy_target; proxy_target = require('./vite.user.ts').proxy_target;
} catch (error) { } catch {
proxy_target = '192.168.20.110'; proxy_target = '192.168.20.110';
} }