Skip to content

Commit

Permalink
webapp: Fix eslint issues
Browse files Browse the repository at this point in the history
  • Loading branch information
CommanderRedYT committed Oct 5, 2024
1 parent 4cd5d79 commit d3d96b5
Show file tree
Hide file tree
Showing 6 changed files with 20 additions and 20 deletions.
14 changes: 2 additions & 12 deletions webapp/eslint.config.js
Original file line number Diff line number Diff line change
@@ -1,22 +1,12 @@
/* eslint-env node */
import path from "node:path";
import { fileURLToPath } from "node:url";

import { FlatCompat } from "@eslint/eslintrc";
import js from "@eslint/js";
import pluginVue from 'eslint-plugin-vue'

const __filename = fileURLToPath(import.meta.url);
const __dirname = path.dirname(__filename);
const compat = new FlatCompat({
baseDirectory: __dirname,
recommendedConfig: js.configs.recommended,
});
import vueTsEslintConfig from '@vue/eslint-config-typescript'

export default [
js.configs.recommended,
...pluginVue.configs['flat/essential'],
...compat.extends("@vue/eslint-config-typescript/recommended"),
...vueTsEslintConfig(),
{
files: [
"**/*.vue",
Expand Down
4 changes: 3 additions & 1 deletion webapp/src/components/NavBar.vue
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,9 @@ export default defineComponent({
this.$router.push('/');
},
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 {
const f = Math.floor;
Expand Down
2 changes: 1 addition & 1 deletion webapp/src/types/PinMapping.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,4 +48,4 @@ export interface Device {
display: Display;
}

export interface PinMapping extends Array<Device> {}
export type PinMapping = Array<Device>;
10 changes: 7 additions & 3 deletions webapp/src/views/ConsoleInfoView.vue
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ export default defineComponent({
this.socket.onmessage = (event) => {
console.log(event);
let outstr = new String(event.data);
let outstr = String(event.data);
let removedNewline = false;
if (outstr.endsWith('\n')) {
outstr = outstr.substring(0, outstr.length - 1);
Expand All @@ -108,7 +108,9 @@ export default defineComponent({
},
// Send heartbeat packets regularly * 59s Send a heartbeat
heartCheck() {
this.heartInterval && clearTimeout(this.heartInterval);
if (this.heartInterval) {
clearTimeout(this.heartInterval);
}
this.heartInterval = setInterval(() => {
if (this.socket.readyState === 1) {
// Connection status
Expand All @@ -126,7 +128,9 @@ export default defineComponent({
// continue regardless of error
}
this.heartInterval && clearTimeout(this.heartInterval);
if (this.heartInterval) {
clearTimeout(this.heartInterval);
}
},
getOutDate(): string {
const u = new Date();
Expand Down
8 changes: 6 additions & 2 deletions webapp/src/views/HomeView.vue
Original file line number Diff line number Diff line change
Expand Up @@ -734,7 +734,9 @@ export default defineComponent({
},
// Send heartbeat packets regularly * 59s Send a heartbeat
heartCheck(duration: number = 59) {
this.heartInterval && clearTimeout(this.heartInterval);
if (this.heartInterval) {
clearTimeout(this.heartInterval);
}
this.heartInterval = setInterval(() => {
if (this.socket.readyState === 1) {
// Connection status
Expand All @@ -747,7 +749,9 @@ export default defineComponent({
/** To break off websocket Connect */
closeSocket() {
this.socket.close();
this.heartInterval && clearTimeout(this.heartInterval);
if (this.heartInterval) {
clearTimeout(this.heartInterval);
}
this.isFirstFetchAfterConnect = true;
},
onShowEventlog(serial: string) {
Expand Down
2 changes: 1 addition & 1 deletion webapp/vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ let proxy_target;
try {
// eslint-disable-next-line
proxy_target = require('./vite.user.ts').proxy_target;
} catch (error) {
} catch {
proxy_target = '192.168.20.110';
}

Expand Down

0 comments on commit d3d96b5

Please sign in to comment.