From fb7118ff1c8f0dcd61f15e51b193512283d83fa1 Mon Sep 17 00:00:00 2001 From: Kristóf Marussy Date: Sun, 9 Jan 2022 22:16:29 +0100 Subject: build: Add eslint-plugin-unicorn MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Kristóf Marussy --- packages/main/src/controllers/__tests__/initConfig.spec.ts | 2 +- packages/main/src/controllers/initConfig.ts | 14 +++++++------- 2 files changed, 8 insertions(+), 8 deletions(-) (limited to 'packages/main/src/controllers') diff --git a/packages/main/src/controllers/__tests__/initConfig.spec.ts b/packages/main/src/controllers/__tests__/initConfig.spec.ts index 9a5f85e..11e7690 100644 --- a/packages/main/src/controllers/__tests__/initConfig.spec.ts +++ b/packages/main/src/controllers/__tests__/initConfig.spec.ts @@ -133,7 +133,7 @@ describe('when it has loaded the config', () => { }); it('should throttle saving changes to the config file', () => { - mocked(persistenceService.writeConfig).mockResolvedValue(undefined); + mocked(persistenceService.writeConfig).mockResolvedValue(); config.setThemeSource('dark'); jest.advanceTimersByTime(lessThanThrottleMs); config.setThemeSource('light'); diff --git a/packages/main/src/controllers/initConfig.ts b/packages/main/src/controllers/initConfig.ts index e83b8da..915f451 100644 --- a/packages/main/src/controllers/initConfig.ts +++ b/packages/main/src/controllers/initConfig.ts @@ -38,7 +38,7 @@ export default async function initConfig( ): Promise { log.trace('Initializing config controller'); - let lastSnapshotOnDisk: ConfigSnapshotOut | null = null; + let lastSnapshotOnDisk: ConfigSnapshotOut | undefined; async function readConfig(): Promise { const result = await persistenceService.readConfig(); @@ -46,8 +46,8 @@ export default async function initConfig( try { applySnapshot(config, result.data); lastSnapshotOnDisk = getSnapshot(config); - } catch (err) { - log.error('Failed to apply config snapshot', result.data, err); + } catch (error) { + log.error('Failed to apply config snapshot', result.data, error); } } return result.found; @@ -70,8 +70,8 @@ export default async function initConfig( debounce((snapshot) => { // We can compare snapshots by reference, since it is only recreated on store changes. if (lastSnapshotOnDisk !== snapshot) { - writeConfig().catch((err) => { - log.error('Failed to write config on config change', err); + writeConfig().catch((error) => { + log.error('Failed to write config on config change', error); }); } }, debounceTime), @@ -80,8 +80,8 @@ export default async function initConfig( const disposeWatcher = persistenceService.watchConfig(async () => { try { await readConfig(); - } catch (err) { - log.error('Failed to read config', err); + } catch (error) { + log.error('Failed to read config', error); } }, debounceTime); -- cgit v1.2.3-70-g09d2