summaryrefslogtreecommitdiffhomepage
path: root/gui/src/main
diff options
context:
space:
mode:
authorOskar Nyberg <oskar@mullvad.net>2024-06-14 11:41:11 +0200
committerOskar Nyberg <oskar@mullvad.net>2024-06-18 15:04:34 +0200
commit59f21bba30b22a627d77184275a67a4d09daed23 (patch)
tree0868fe15307d38ca85aec5a1369f33d4e680ff95 /gui/src/main
parent454df7dd6b0ff70c5eb63da5745e39e2b5c5897e (diff)
downloadmullvadvpn-59f21bba30b22a627d77184275a67a4d09daed23.tar.xz
mullvadvpn-59f21bba30b22a627d77184275a67a4d09daed23.zip
Fix eslint errors
All changes in this commit were produced by running `npm run lint -- --fix`.
Diffstat (limited to 'gui/src/main')
-rw-r--r--gui/src/main/command-line-options.ts5
-rw-r--r--gui/src/main/expectation.ts5
-rw-r--r--gui/src/main/index.ts3
-rw-r--r--gui/src/main/logging.ts5
-rw-r--r--gui/src/main/macos-split-tunneling.ts4
-rw-r--r--gui/src/main/user-interface.ts8
-rw-r--r--gui/src/main/window-controller.ts5
-rw-r--r--gui/src/main/windows-pe-parser.ts10
-rw-r--r--gui/src/main/windows-split-tunneling.ts55
9 files changed, 59 insertions, 41 deletions
diff --git a/gui/src/main/command-line-options.ts b/gui/src/main/command-line-options.ts
index 0cddf6b14a..5a7ca57762 100644
--- a/gui/src/main/command-line-options.ts
+++ b/gui/src/main/command-line-options.ts
@@ -1,7 +1,10 @@
class CommandLineOption {
private flags: string[];
- public constructor(private description: string, ...flags: string[]) {
+ public constructor(
+ private description: string,
+ ...flags: string[]
+ ) {
this.flags = flags;
}
diff --git a/gui/src/main/expectation.ts b/gui/src/main/expectation.ts
index 18fafb2836..4141b46ffb 100644
--- a/gui/src/main/expectation.ts
+++ b/gui/src/main/expectation.ts
@@ -2,7 +2,10 @@ export default class Expectation {
private fulfilled = false;
private timeout: NodeJS.Timeout;
- constructor(private handler: () => void, timeout = 2000) {
+ constructor(
+ private handler: () => void,
+ timeout = 2000,
+ ) {
this.timeout = global.setTimeout(() => {
this.fulfill();
}, timeout);
diff --git a/gui/src/main/index.ts b/gui/src/main/index.ts
index f48b73d838..ded7ea6ede 100644
--- a/gui/src/main/index.ts
+++ b/gui/src/main/index.ts
@@ -90,7 +90,8 @@ class ApplicationMain
UserInterfaceDelegate,
TunnelStateHandlerDelegate,
SettingsDelegate,
- AccountDelegate {
+ AccountDelegate
+{
private daemonRpc: DaemonRpc;
private notificationController = new NotificationController(this);
diff --git a/gui/src/main/logging.ts b/gui/src/main/logging.ts
index 8798b52066..f71e3a62f0 100644
--- a/gui/src/main/logging.ts
+++ b/gui/src/main/logging.ts
@@ -10,7 +10,10 @@ export const OLD_LOG_FILES = ['main.log', 'renderer.log', 'frontend.log'];
export class FileOutput implements ILogOutput {
private fileDescriptor: number;
- constructor(public level: LogLevel, filePath: string) {
+ constructor(
+ public level: LogLevel,
+ filePath: string,
+ ) {
this.fileDescriptor = fs.openSync(filePath, fs.constants.O_CREAT | fs.constants.O_WRONLY);
}
diff --git a/gui/src/main/macos-split-tunneling.ts b/gui/src/main/macos-split-tunneling.ts
index 024876d7fe..df144c1278 100644
--- a/gui/src/main/macos-split-tunneling.ts
+++ b/gui/src/main/macos-split-tunneling.ts
@@ -25,9 +25,7 @@ export class MacOsSplitTunnelingAppListRetriever implements ISplitTunnelingAppLi
*/
private additionalApplications = new AdditionalApplications();
- public async getApplications(
- updateCaches = false,
- ): Promise<{
+ public async getApplications(updateCaches = false): Promise<{
fromCache: boolean;
applications: ISplitTunnelingApplication[];
}> {
diff --git a/gui/src/main/user-interface.ts b/gui/src/main/user-interface.ts
index e3dd5a50ed..a0b4662c48 100644
--- a/gui/src/main/user-interface.ts
+++ b/gui/src/main/user-interface.ts
@@ -414,9 +414,11 @@ export default class UserInterface implements WindowControllerDelegate {
}
private async installDevTools() {
- const { default: installer, REACT_DEVELOPER_TOOLS, REDUX_DEVTOOLS } = await import(
- 'electron-devtools-installer'
- );
+ const {
+ default: installer,
+ REACT_DEVELOPER_TOOLS,
+ REDUX_DEVTOOLS,
+ } = await import('electron-devtools-installer');
const forceDownload = !!process.env.UPGRADE_EXTENSIONS;
const options = { forceDownload, loadExtensionOptions: { allowFileAccess: true } };
try {
diff --git a/gui/src/main/window-controller.ts b/gui/src/main/window-controller.ts
index b18775a8b5..553c798334 100644
--- a/gui/src/main/window-controller.ts
+++ b/gui/src/main/window-controller.ts
@@ -159,7 +159,10 @@ export default class WindowController {
return this.webContentsValue.isDestroyed() ? undefined : this.webContentsValue;
}
- constructor(private delegate: WindowControllerDelegate, windowValue: BrowserWindow) {
+ constructor(
+ private delegate: WindowControllerDelegate,
+ windowValue: BrowserWindow,
+ ) {
this.windowValue = windowValue;
this.webContentsValue = windowValue.webContents;
this.windowPositioning = delegate.isUnpinnedWindow()
diff --git a/gui/src/main/windows-pe-parser.ts b/gui/src/main/windows-pe-parser.ts
index 94221c1228..f4d6ebc852 100644
--- a/gui/src/main/windows-pe-parser.ts
+++ b/gui/src/main/windows-pe-parser.ts
@@ -16,10 +16,10 @@ export type Datatype = PrimitiveWrapper | StructWrapper | ArrayWrapper;
type ValueType<T extends Datatype> = T extends PrimitiveWrapper
? PrimitiveValue<T>
: T extends ArrayWrapper
- ? ArrayValue<T>
- : T extends StructWrapper
- ? StructValue<T>
- : never;
+ ? ArrayValue<T>
+ : T extends StructWrapper
+ ? StructValue<T>
+ : never;
// Represents any kind of parseable value within the PE headers. Value is extended by
// PrimitiveValue, ArrayValue and StructValue.
@@ -160,7 +160,7 @@ export class StructValue<T extends StructWrapper = StructWrapper> extends Value<
// Parses and returns the value for the specified key.
public get<
U extends ValueType<T['struct'][number]['datatype']>,
- V extends StructItem = T['struct'][number]
+ V extends StructItem = T['struct'][number],
>(name: V['name']): U {
const index = this.datatype.struct.findIndex((entry) => entry.name === name);
if (index === -1) {
diff --git a/gui/src/main/windows-split-tunneling.ts b/gui/src/main/windows-split-tunneling.ts
index c74623a1f7..5ba594f7cc 100644
--- a/gui/src/main/windows-split-tunneling.ts
+++ b/gui/src/main/windows-split-tunneling.ts
@@ -170,9 +170,8 @@ export class WindowsSplitTunnelingAppListRetriever implements ISplitTunnelingApp
shortcuts.map(async (shortcut) => {
const lowercaseTarget = shortcut.target.toLowerCase();
if (this.applicationCache[lowercaseTarget] === undefined) {
- this.applicationCache[lowercaseTarget] = await this.convertToSplitTunnelingApplication(
- shortcut,
- );
+ this.applicationCache[lowercaseTarget] =
+ await this.convertToSplitTunnelingApplication(shortcut);
}
return this.applicationCache[lowercaseTarget];
@@ -246,21 +245,24 @@ export class WindowsSplitTunnelingAppListRetriever implements ISplitTunnelingApp
// Removes all duplicate shortcuts.
private removeDuplicates(shortcuts: ShortcutDetails[]): ShortcutDetails[] {
- const unique = shortcuts.reduce((shortcuts, shortcut) => {
- const lowercaseTarget = shortcut.target.toLowerCase();
- if (shortcuts[lowercaseTarget]) {
- if (
- shortcuts[lowercaseTarget].args &&
- shortcuts[lowercaseTarget].args !== '' &&
- (!shortcut.args || shortcut.args === '')
- ) {
+ const unique = shortcuts.reduce(
+ (shortcuts, shortcut) => {
+ const lowercaseTarget = shortcut.target.toLowerCase();
+ if (shortcuts[lowercaseTarget]) {
+ if (
+ shortcuts[lowercaseTarget].args &&
+ shortcuts[lowercaseTarget].args !== '' &&
+ (!shortcut.args || shortcut.args === '')
+ ) {
+ shortcuts[lowercaseTarget] = shortcut;
+ }
+ } else {
shortcuts[lowercaseTarget] = shortcut;
}
- } else {
- shortcuts[lowercaseTarget] = shortcut;
- }
- return shortcuts;
- }, {} as Record<string, ShortcutDetails>);
+ return shortcuts;
+ },
+ {} as Record<string, ShortcutDetails>,
+ );
return Object.values(unique);
}
@@ -431,15 +433,18 @@ export class WindowsSplitTunnelingAppListRetriever implements ISplitTunnelingApp
[[16], [1], [0, 1033]],
);
- const productName = await leafOffsets.reduce(async (alreadyFoundValue, leafOffset) => {
- const value = await alreadyFoundValue;
- if (value) {
- return value;
- } else {
- const strings = await this.getVsVersionInfoStrings(fileHandle, leafOffset);
- return strings.get('FileDescription') ?? strings.get('ProductName');
- }
- }, Promise.resolve() as Promise<string | undefined>);
+ const productName = await leafOffsets.reduce(
+ async (alreadyFoundValue, leafOffset) => {
+ const value = await alreadyFoundValue;
+ if (value) {
+ return value;
+ } else {
+ const strings = await this.getVsVersionInfoStrings(fileHandle, leafOffset);
+ return strings.get('FileDescription') ?? strings.get('ProductName');
+ }
+ },
+ Promise.resolve() as Promise<string | undefined>,
+ );
return productName;
} else {