refactor: lint

This commit is contained in:
liyasthomas
2021-05-17 17:11:58 +05:30
parent f9821e5f80
commit e424d06026
7 changed files with 127 additions and 228 deletions

View File

@@ -1,8 +1,8 @@
import { pluck, distinctUntilChanged } from "rxjs/operators"
import has from "lodash/has"
import { Observable } from "rxjs"
import DispatchingStore from "./DispatchingStore"
import type { Dispatchers } from "./DispatchingStore"
import { Observable } from "rxjs"
import type { KeysMatching } from "~/types/ts-utils"
export const defaultSettings = {
@@ -32,9 +32,14 @@ const dispatchers: Dispatchers<SettingsType> = {
bulkApplySettings(_currentState, payload: Partial<SettingsType>) {
return payload
},
toggleSetting(currentState, { settingKey }: { settingKey: KeysMatching<SettingsType, boolean> }) {
toggleSetting(
currentState,
{ settingKey }: { settingKey: KeysMatching<SettingsType, boolean> }
) {
if (!has(currentState, settingKey)) {
console.log(`Toggling of a non-existent setting key '${settingKey}' ignored.`)
console.log(
`Toggling of a non-existent setting key '${settingKey}' ignored.`
)
return {}
}
@@ -48,7 +53,9 @@ const dispatchers: Dispatchers<SettingsType> = {
{ settingKey, value }: { settingKey: K; value: SettingsType[K] }
) {
if (!validKeys.includes(settingKey)) {
console.log(`Ignoring non-existent setting key '${settingKey}' assignment`)
console.log(
`Ignoring non-existent setting key '${settingKey}' assignment`
)
return {}
}
@@ -83,7 +90,10 @@ export function toggleSetting(settingKey: KeysMatching<SettingsType, boolean>) {
})
}
export function applySetting<K extends keyof SettingsType>(settingKey: K, value: SettingsType[K]) {
export function applySetting<K extends keyof SettingsType>(
settingKey: K,
value: SettingsType[K]
) {
settingsStore.dispatch({
dispatcher: "applySetting",
payload: {