diff options
author | Kristóf Marussy <kristof@marussy.com> | 2022-01-08 21:36:43 +0100 |
---|---|---|
committer | Kristóf Marussy <kristof@marussy.com> | 2022-01-09 19:53:03 +0100 |
commit | d07e7b834831230b53860d0919a68edc2d36193d (patch) | |
tree | a1f2a021563ddff54f33341c475fc6c6eb787388 /packages/main/src/controllers | |
parent | New configurations based on review comments (WIP) (diff) | |
download | sophie-d07e7b834831230b53860d0919a68edc2d36193d.tar.gz sophie-d07e7b834831230b53860d0919a68edc2d36193d.tar.zst sophie-d07e7b834831230b53860d0919a68edc2d36193d.zip |
build: Eslint fixes for multi-module project
Signed-off-by: Kristóf Marussy <kristof@marussy.com>
Diffstat (limited to 'packages/main/src/controllers')
-rw-r--r-- | packages/main/src/controllers/__tests__/initConfig.spec.ts (renamed from packages/main/src/controllers/__tests__/config.spec.ts) | 18 | ||||
-rw-r--r-- | packages/main/src/controllers/__tests__/initNativeTheme.spec.ts (renamed from packages/main/src/controllers/__tests__/nativeTheme.spec.ts) | 4 | ||||
-rw-r--r-- | packages/main/src/controllers/initConfig.ts (renamed from packages/main/src/controllers/config.ts) | 12 | ||||
-rw-r--r-- | packages/main/src/controllers/initNativeTheme.ts (renamed from packages/main/src/controllers/nativeTheme.ts) | 8 |
4 files changed, 21 insertions, 21 deletions
diff --git a/packages/main/src/controllers/__tests__/config.spec.ts b/packages/main/src/controllers/__tests__/initConfig.spec.ts index eb67df0..e386a07 100644 --- a/packages/main/src/controllers/__tests__/config.spec.ts +++ b/packages/main/src/controllers/__tests__/initConfig.spec.ts | |||
@@ -22,20 +22,20 @@ import { jest } from '@jest/globals'; | |||
22 | import { mocked } from 'jest-mock'; | 22 | import { mocked } from 'jest-mock'; |
23 | import ms from 'ms'; | 23 | import ms from 'ms'; |
24 | 24 | ||
25 | import { initConfig } from '../config'; | 25 | import type ConfigPersistenceService from '../../services/ConfigPersistenceService'; |
26 | import type { ConfigPersistenceService } from '../../services/ConfigPersistenceService'; | ||
27 | import { Config, config as configModel } from '../../stores/Config'; | 26 | import { Config, config as configModel } from '../../stores/Config'; |
28 | import { Disposer } from '../../utils/disposer'; | 27 | import type Disposer from '../../utils/Disposer'; |
29 | import { silenceLogger } from '../../utils/logging'; | 28 | import { silenceLogger } from '../../utils/log'; |
29 | import initConfig from '../initConfig'; | ||
30 | 30 | ||
31 | let config: Config; | 31 | let config: Config; |
32 | let persistenceService: ConfigPersistenceService = { | 32 | const persistenceService: ConfigPersistenceService = { |
33 | readConfig: jest.fn(), | 33 | readConfig: jest.fn(), |
34 | writeConfig: jest.fn(), | 34 | writeConfig: jest.fn(), |
35 | watchConfig: jest.fn(), | 35 | watchConfig: jest.fn(), |
36 | }; | 36 | }; |
37 | let lessThanThrottleMs = ms('0.1s'); | 37 | const lessThanThrottleMs = ms('0.1s'); |
38 | let throttleMs = ms('1s'); | 38 | const throttleMs = ms('1s'); |
39 | 39 | ||
40 | beforeAll(() => { | 40 | beforeAll(() => { |
41 | jest.useFakeTimers(); | 41 | jest.useFakeTimers(); |
@@ -108,7 +108,7 @@ describe('when initializing', () => { | |||
108 | 108 | ||
109 | describe('when it has loaded the config', () => { | 109 | describe('when it has loaded the config', () => { |
110 | let sutDisposer: Disposer; | 110 | let sutDisposer: Disposer; |
111 | let watcherDisposer: Disposer = jest.fn(); | 111 | const watcherDisposer: Disposer = jest.fn(); |
112 | let configChangedCallback: () => Promise<void>; | 112 | let configChangedCallback: () => Promise<void>; |
113 | 113 | ||
114 | beforeEach(async () => { | 114 | beforeEach(async () => { |
@@ -118,7 +118,7 @@ describe('when it has loaded the config', () => { | |||
118 | }); | 118 | }); |
119 | mocked(persistenceService.watchConfig).mockReturnValueOnce(watcherDisposer); | 119 | mocked(persistenceService.watchConfig).mockReturnValueOnce(watcherDisposer); |
120 | sutDisposer = await initConfig(config, persistenceService, throttleMs); | 120 | sutDisposer = await initConfig(config, persistenceService, throttleMs); |
121 | configChangedCallback = mocked(persistenceService.watchConfig).mock.calls[0][0]; | 121 | [[configChangedCallback]] = mocked(persistenceService.watchConfig).mock.calls; |
122 | jest.resetAllMocks(); | 122 | jest.resetAllMocks(); |
123 | }); | 123 | }); |
124 | 124 | ||
diff --git a/packages/main/src/controllers/__tests__/nativeTheme.spec.ts b/packages/main/src/controllers/__tests__/initNativeTheme.spec.ts index 85d6dd2..bd33f48 100644 --- a/packages/main/src/controllers/__tests__/nativeTheme.spec.ts +++ b/packages/main/src/controllers/__tests__/initNativeTheme.spec.ts | |||
@@ -22,7 +22,7 @@ import { jest } from '@jest/globals'; | |||
22 | import { mocked } from 'jest-mock'; | 22 | import { mocked } from 'jest-mock'; |
23 | 23 | ||
24 | import { createMainStore, MainStore } from '../../stores/MainStore'; | 24 | import { createMainStore, MainStore } from '../../stores/MainStore'; |
25 | import { Disposer } from '../../utils/disposer'; | 25 | import type Disposer from '../../utils/Disposer'; |
26 | 26 | ||
27 | let shouldUseDarkColors = false; | 27 | let shouldUseDarkColors = false; |
28 | 28 | ||
@@ -38,7 +38,7 @@ jest.unstable_mockModule('electron', () => ({ | |||
38 | })); | 38 | })); |
39 | 39 | ||
40 | const { nativeTheme } = await import('electron'); | 40 | const { nativeTheme } = await import('electron'); |
41 | const { initNativeTheme } = await import('../nativeTheme'); | 41 | const { default: initNativeTheme } = await import('../initNativeTheme'); |
42 | 42 | ||
43 | let store: MainStore; | 43 | let store: MainStore; |
44 | let disposeSut: Disposer; | 44 | let disposeSut: Disposer; |
diff --git a/packages/main/src/controllers/config.ts b/packages/main/src/controllers/initConfig.ts index deaeac2..1d40762 100644 --- a/packages/main/src/controllers/config.ts +++ b/packages/main/src/controllers/initConfig.ts | |||
@@ -19,19 +19,19 @@ | |||
19 | */ | 19 | */ |
20 | 20 | ||
21 | import { debounce } from 'lodash-es'; | 21 | import { debounce } from 'lodash-es'; |
22 | import ms from 'ms'; | ||
23 | import { applySnapshot, getSnapshot, onSnapshot } from 'mobx-state-tree'; | 22 | import { applySnapshot, getSnapshot, onSnapshot } from 'mobx-state-tree'; |
23 | import ms from 'ms'; | ||
24 | 24 | ||
25 | import type { ConfigPersistenceService } from '../services/ConfigPersistenceService.js'; | 25 | import type ConfigPersistenceService from '../services/ConfigPersistenceService'; |
26 | import type { Config, ConfigSnapshotOut } from '../stores/Config.js'; | 26 | import type { Config, ConfigSnapshotOut } from '../stores/Config'; |
27 | import { Disposer } from '../utils/disposer'; | 27 | import type Disposer from '../utils/Disposer'; |
28 | import { getLogger } from '../utils/logging'; | 28 | import { getLogger } from '../utils/log'; |
29 | 29 | ||
30 | const DEFAULT_CONFIG_DEBOUNCE_TIME = ms('1s'); | 30 | const DEFAULT_CONFIG_DEBOUNCE_TIME = ms('1s'); |
31 | 31 | ||
32 | const log = getLogger('config'); | 32 | const log = getLogger('config'); |
33 | 33 | ||
34 | export async function initConfig( | 34 | export default async function initConfig( |
35 | config: Config, | 35 | config: Config, |
36 | persistenceService: ConfigPersistenceService, | 36 | persistenceService: ConfigPersistenceService, |
37 | debounceTime: number = DEFAULT_CONFIG_DEBOUNCE_TIME, | 37 | debounceTime: number = DEFAULT_CONFIG_DEBOUNCE_TIME, |
diff --git a/packages/main/src/controllers/nativeTheme.ts b/packages/main/src/controllers/initNativeTheme.ts index ccd12d8..d2074ab 100644 --- a/packages/main/src/controllers/nativeTheme.ts +++ b/packages/main/src/controllers/initNativeTheme.ts | |||
@@ -21,13 +21,13 @@ | |||
21 | import { nativeTheme } from 'electron'; | 21 | import { nativeTheme } from 'electron'; |
22 | import { autorun } from 'mobx'; | 22 | import { autorun } from 'mobx'; |
23 | 23 | ||
24 | import type { MainStore } from '../stores/MainStore.js'; | 24 | import type { MainStore } from '../stores/MainStore'; |
25 | import { Disposer } from '../utils/disposer'; | 25 | import type Disposer from '../utils/Disposer'; |
26 | import { getLogger } from '../utils/logging'; | 26 | import { getLogger } from '../utils/log'; |
27 | 27 | ||
28 | const log = getLogger('nativeTheme'); | 28 | const log = getLogger('nativeTheme'); |
29 | 29 | ||
30 | export function initNativeTheme(store: MainStore): Disposer { | 30 | export default function initNativeTheme(store: MainStore): Disposer { |
31 | log.trace('Initializing nativeTheme controller'); | 31 | log.trace('Initializing nativeTheme controller'); |
32 | 32 | ||
33 | const disposeThemeSourceReaction = autorun(() => { | 33 | const disposeThemeSourceReaction = autorun(() => { |