lint code

This commit is contained in:
lyswhut
2023-08-30 14:30:47 +08:00
parent 358142c1cc
commit 2fff8652ca
48 changed files with 123 additions and 106 deletions
+1 -1
View File
@@ -82,7 +82,7 @@ export const getListDetailAll = async(id: string, isRefresh = false): Promise<LX
}) ?? Promise.reject(new Error('source not found' + source))
}
// eslint-disable-next-line @typescript-eslint/promise-function-async
return await loadData(bangId, 1).then((result: ListDetailInfo) => {
return loadData(bangId, 1).then((result: ListDetailInfo) => {
if (result.total <= result.limit) return result.list
let maxPage = Math.ceil(result.total / result.limit)
@@ -155,7 +155,7 @@ export const overwriteListFull = async(data: LX.List.ListActionDataOverwrite) =>
* @param musicInfoId
*/
export const checkListExistMusic = async(listId: string, musicInfoId: string): Promise<boolean> => {
return await rendererInvoke<LX.List.ListActionCheckMusicExistList, boolean>(PLAYER_EVENT_NAME.list_music_check_exist, { listId, musicInfoId })
return rendererInvoke<LX.List.ListActionCheckMusicExistList, boolean>(PLAYER_EVENT_NAME.list_music_check_exist, { listId, musicInfoId })
}
/**
@@ -163,7 +163,7 @@ export const checkListExistMusic = async(listId: string, musicInfoId: string): P
* @param musicInfoId
*/
export const getMusicExistListIds = async(musicInfoId: string): Promise<string[]> => {
return await rendererInvoke<string, string[]>(PLAYER_EVENT_NAME.list_music_get_list_ids, musicInfoId)
return rendererInvoke<string, string[]>(PLAYER_EVENT_NAME.list_music_get_list_ids, musicInfoId)
}
+1 -1
View File
@@ -22,7 +22,7 @@ const saveSearchHistoryListThrottle = throttle((list: LX.List.SearchHistoryList)
export const getHistoryList = async() => {
if (isInitedSearchHistory || historyList.length) return
historyList.push(...(await getSearchHistoryList() ?? []))
isInitedSearchHistory = true
isInitedSearchHistory ||= true
}
export const addHistoryWord = async(word: string) => {
if (!appSetting['search.isShowHistorySearch']) return
+1 -1
View File
@@ -104,7 +104,7 @@ export const search = async(text: string, page: number, sourceId: LX.OnlineSourc
}
}))
}
return await Promise.all(task).then((results: SearchResult[]) => {
return Promise.all(task).then((results: SearchResult[]) => {
if (key != listInfo!.key) return []
return setLists(results, page, text)
})
+1 -1
View File
@@ -105,7 +105,7 @@ export const search = async(text: string, page: number, sourceId: LX.OnlineSourc
}
}))
}
return await Promise.all(task).then((results: SearchResult[]) => {
return Promise.all(task).then((results: SearchResult[]) => {
if (key != listInfo.key) return []
return setLists(results, page, text)
})
+1 -1
View File
@@ -161,7 +161,7 @@ export const getListDetailAll = async(id: string, source: LX.OnlineSource, isRef
}) ?? Promise.reject(new Error('source not found' + source))
}
// eslint-disable-next-line @typescript-eslint/promise-function-async
return await loadData(id, 1).then((result: ListDetailInfo) => {
return loadData(id, 1).then((result: ListDetailInfo) => {
if (result.total <= result.limit) return result.list
let maxPage = Math.ceil(result.total / result.limit)
+5
View File
@@ -12,12 +12,14 @@ let userEqPresetList: LX.SoundEffect.EQPreset[] | null = null
export const getUserEQPresetList = async() => {
if (userEqPresetList == null) {
// eslint-disable-next-line require-atomic-updates
userEqPresetList = reactive(await getUserSoundEffectEQPresetList())
}
return userEqPresetList
}
export const saveUserEQPreset = async(preset: LX.SoundEffect.EQPreset) => {
if (userEqPresetList == null) {
// eslint-disable-next-line require-atomic-updates
userEqPresetList = reactive(await getUserSoundEffectEQPresetList())
}
const target = userEqPresetList.find(p => p.id == preset.id)
@@ -27,6 +29,7 @@ export const saveUserEQPreset = async(preset: LX.SoundEffect.EQPreset) => {
}
export const removeUserEQPreset = async(id: string) => {
if (userEqPresetList == null) {
// eslint-disable-next-line require-atomic-updates
userEqPresetList = reactive(await getUserSoundEffectEQPresetList())
}
const index = userEqPresetList.findIndex(p => p.id == id)
@@ -45,6 +48,7 @@ export const getUserConvolutionPresetList = async() => {
}
export const saveUserConvolutionPreset = async(preset: LX.SoundEffect.ConvolutionPreset) => {
if (userConvolutionPresetList == null) {
// eslint-disable-next-line require-atomic-updates
userConvolutionPresetList = reactive(await getUserSoundEffectConvolutionPresetList())
}
const target = userConvolutionPresetList.find(p => p.id == preset.id)
@@ -54,6 +58,7 @@ export const saveUserConvolutionPreset = async(preset: LX.SoundEffect.Convolutio
}
export const removeUserConvolutionPreset = async(id: string) => {
if (userConvolutionPresetList == null) {
// eslint-disable-next-line require-atomic-updates
userConvolutionPresetList = reactive(await getUserSoundEffectConvolutionPresetList())
}
const index = userConvolutionPresetList.findIndex(p => p.id == id)