Skip to content

Commit 139ccca

Browse files
committed
more linting fixes
1 parent 7085ac9 commit 139ccca

File tree

2 files changed

+8
-7
lines changed

2 files changed

+8
-7
lines changed

app/renderer/js/main.ts

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@ import {Menu, app, dialog, session} from "@electron/remote";
77
import * as remote from "@electron/remote";
88
import * as Sentry from "@sentry/electron/renderer";
99

10+
import Sortable from "sortablejs";
11+
1012
import type {Config} from "../../common/config-util.js";
1113
import * as ConfigUtil from "../../common/config-util.js";
1214
import * as DNDUtil from "../../common/dnd-util.js";
@@ -28,7 +30,6 @@ import {initializeTray} from "./tray.js";
2830
import {ipcRenderer} from "./typed-ipc-renderer.js";
2931
import * as DomainUtil from "./utils/domain-util.js";
3032
import ReconnectUtil from "./utils/reconnect-util.js";
31-
import Sortable from "sortablejs";
3233

3334
Sentry.init({});
3435

@@ -242,11 +243,11 @@ export class ServerManagerView {
242243
animation: 150,
243244
onEnd: (event: Sortable.SortableEvent) => {
244245
// Update the domain order in the database
245-
DomainUtil.updateDomainOrder(event.oldIndex || 0, event.newIndex || 0);
246+
DomainUtil.updateDomainOrder(event.oldIndex ?? 0, event.newIndex ?? 0);
246247

247248
// Update the current active tab index
248-
this.activeTabIndex = event.newIndex || 0;
249-
ConfigUtil.setConfigItem("lastActiveTab", event.newIndex || 0);
249+
this.activeTabIndex = event.newIndex ?? 0;
250+
ConfigUtil.setConfigItem("lastActiveTab", event.newIndex ?? 0);
250251

251252
// Reload the app to give the tabs their new indexes
252253
ipcRenderer.send("reload-full-app");

app/renderer/js/utils/domain-util.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -73,17 +73,17 @@ export function updateDomain(index: number, server: ServerConf): void {
7373
}
7474

7575
export function updateDomainOrder(oldIndex: number, newIndex: number) {
76-
let domains = serverConfSchema
76+
const domains = serverConfSchema
7777
.array()
7878
.parse(db.getObject<unknown>("/domains"));
7979

8080
const [movedDomain] = domains.splice(oldIndex, 1);
8181
domains.splice(newIndex, 0, movedDomain);
8282

8383
// Update each domain in the database with its new order
84-
domains.forEach((domain, index) => {
84+
for (const [index, domain] of domains.entries()) {
8585
updateDomain(index, domain);
86-
});
86+
}
8787
}
8888

8989
export async function addDomain(server: {

0 commit comments

Comments
 (0)