diff --git a/src/electron/Settings.ts b/src/electron/Settings.ts index de010b9a3a..d09ac7fb62 100644 --- a/src/electron/Settings.ts +++ b/src/electron/Settings.ts @@ -5,11 +5,11 @@ import { userDataPath } from '../environment-remote'; const debug = require('../preload-safe-debug')('Ferdium:Settings'); export default class Settings { - type = ''; + type: string = ''; - defaultState: {}; + defaultState: object; - @observable store = {}; + @observable store: object = {}; constructor(type: string, defaultState = {}) { this.type = type; @@ -23,41 +23,41 @@ export default class Settings { } } - set(settings) { + set(settings: object): void { this.store = this._merge(settings); this._writeFile(); } - get all() { + get all(): object { return this.store; } - get allSerialized() { + get allSerialized(): object { return toJS(this.store); } - get(key: string | number) { + get(key: string | number): any { return this.store[key]; } - _merge(settings) { + _merge(settings: object): object { return Object.assign(this.defaultState, this.store, settings); } - _hydrate() { + _hydrate(): void { this.store = this._merge(readJsonSync(this.settingsFile)); debug('Hydrate store', this.type, this.allSerialized); } - _writeFile() { + _writeFile(): void { outputJsonSync(this.settingsFile, this.store, { spaces: 2, }); debug('Write settings file', this.type, this.allSerialized); } - get settingsFile() { + get settingsFile(): string { return userDataPath( 'config', `${this.type === 'app' ? 'settings' : this.type}.json`, diff --git a/src/electron/deepLinking.ts b/src/electron/deepLinking.ts index 532bdd6fb0..36de1b1436 100644 --- a/src/electron/deepLinking.ts +++ b/src/electron/deepLinking.ts @@ -1,4 +1,9 @@ -export default function handleDeepLink(window, rawUrl) { +import { BrowserWindow } from 'electron'; + +export default function handleDeepLink( + window: BrowserWindow, + rawUrl: string, +): void { const url = rawUrl.replace('ferdium://', ''); if (!url) return; diff --git a/src/electron/macOSPermissions.ts b/src/electron/macOSPermissions.ts index 2415534e56..c9f22aecbd 100644 --- a/src/electron/macOSPermissions.ts +++ b/src/electron/macOSPermissions.ts @@ -35,7 +35,7 @@ function hasScreenCapturePermissionAlreadyBeenGranted(): boolean { return screenCaptureStatus === 'granted'; } -function createStatusFile() { +function createStatusFile(): void { try { writeFileSync(filePath, ''); } catch (error) { @@ -48,7 +48,9 @@ function createStatusFile() { } } -export const askFormacOSPermissions = async (mainWindow: BrowserWindow) => { +export const askFormacOSPermissions = async ( + mainWindow: BrowserWindow, +): Promise => { debug('Checking camera & microphone permissions'); systemPreferences.askForMediaAccess('camera'); systemPreferences.askForMediaAccess('microphone'); diff --git a/src/electron/windowUtils.ts b/src/electron/windowUtils.ts index 1db1ff2464..9c9fd1b77c 100644 --- a/src/electron/windowUtils.ts +++ b/src/electron/windowUtils.ts @@ -1,6 +1,6 @@ import { screen } from 'electron'; -export function isPositionValid(position: { x: number; y: number }) { +export function isPositionValid(position: { x: number; y: number }): boolean { const displays = screen.getAllDisplays(); const { x, y } = position; return displays.some(