lint code
This commit is contained in:
@@ -65,7 +65,7 @@ export default {
|
||||
})
|
||||
|
||||
const menuClick = (item) => {
|
||||
if (item && item.disabled) return
|
||||
if (item?.disabled) return
|
||||
emit('menu-click', item)
|
||||
}
|
||||
|
||||
|
||||
@@ -28,7 +28,7 @@ const easeInOutQuad = (t, b, c, d) => {
|
||||
return (-c / 2) * (t * (t - 2) - 1) + b
|
||||
}
|
||||
const handleScroll = (element, to, duration = 300, callback = () => {}, onCancel = () => {}) => {
|
||||
if (!element) return callback()
|
||||
if (!element) { callback(); return }
|
||||
const start = element.scrollTop || element.scrollY || 0
|
||||
let cancel = false
|
||||
if (to > start) {
|
||||
@@ -36,10 +36,10 @@ const handleScroll = (element, to, duration = 300, callback = () => {}, onCancel
|
||||
if (to > maxScrollTop) to = maxScrollTop
|
||||
} else if (to < start) {
|
||||
if (to < 0) to = 0
|
||||
} else return callback()
|
||||
} else { callback(); return }
|
||||
const change = to - start
|
||||
const increment = 10
|
||||
if (!change) return callback()
|
||||
if (!change) { callback(); return }
|
||||
|
||||
let currentTime = 0
|
||||
let val
|
||||
@@ -145,7 +145,7 @@ export default {
|
||||
case 'down':
|
||||
break
|
||||
default:
|
||||
console.log(render(null, slots.default(list[0])[0]))
|
||||
render(null, slots.default(list[0])[0])
|
||||
break
|
||||
}
|
||||
}
|
||||
@@ -196,14 +196,14 @@ export default {
|
||||
emit('scroll', event)
|
||||
}
|
||||
|
||||
const scrollTo = (scrollTop, animate = false) => {
|
||||
const scrollTo = async(scrollTop, animate = false) => {
|
||||
return new Promise(resolve => {
|
||||
if (cancelScroll) {
|
||||
cancelScroll(resolve)
|
||||
} else {
|
||||
resolve()
|
||||
}
|
||||
}).then(() => {
|
||||
}).then(async() => {
|
||||
return new Promise((resolve, reject) => {
|
||||
if (animate) {
|
||||
isScrolling = true
|
||||
@@ -224,7 +224,7 @@ export default {
|
||||
})
|
||||
}
|
||||
|
||||
const scrollToIndex = (index, offset = 0, animate = false) => {
|
||||
const scrollToIndex = async(index, offset = 0, animate = false) => {
|
||||
return scrollTo(Math.max(index * props.itemHeight + offset, 0), animate)
|
||||
}
|
||||
|
||||
@@ -245,7 +245,7 @@ export default {
|
||||
cachedList = Array(list.length)
|
||||
startIndex = -1
|
||||
endIndex = -1
|
||||
nextTick(() => {
|
||||
void nextTick(() => {
|
||||
updateView(true)
|
||||
})
|
||||
}
|
||||
|
||||
@@ -22,13 +22,11 @@ import { ref, watch, onMounted, onBeforeUnmount, reactive } from '@common/utils/
|
||||
// https://github.com/vuejs/core/issues/2855#issuecomment-768388962
|
||||
import {
|
||||
Teleport as teleport_,
|
||||
TeleportProps,
|
||||
VNodeProps,
|
||||
type TeleportProps,
|
||||
type VNodeProps,
|
||||
} from 'vue'
|
||||
const Teleport = teleport_ as {
|
||||
new (): {
|
||||
$props: VNodeProps & TeleportProps
|
||||
}
|
||||
const Teleport = teleport_ as new () => {
|
||||
$props: VNodeProps & TeleportProps
|
||||
}
|
||||
|
||||
const props = defineProps<{
|
||||
|
||||
@@ -50,7 +50,7 @@ const easeInOutQuad = (t, b, c, d) => {
|
||||
return (-c / 2) * (t * (t - 2) - 1) + b
|
||||
}
|
||||
const handleScroll = (element, to, duration = 300, callback = () => {}, onCancel = () => {}) => {
|
||||
if (!element) return callback()
|
||||
if (!element) { callback(); return }
|
||||
const start = element.scrollTop || element.scrollY || 0
|
||||
let cancel = false
|
||||
if (to > start) {
|
||||
@@ -58,10 +58,10 @@ const handleScroll = (element, to, duration = 300, callback = () => {}, onCancel
|
||||
if (to > maxScrollTop) to = maxScrollTop
|
||||
} else if (to < start) {
|
||||
if (to < 0) to = 0
|
||||
} else return callback()
|
||||
} else { callback(); return }
|
||||
const change = to - start
|
||||
const increment = 10
|
||||
if (!change) return callback()
|
||||
if (!change) { callback(); return }
|
||||
|
||||
let currentTime = 0
|
||||
let val
|
||||
@@ -214,7 +214,7 @@ export default {
|
||||
|
||||
const scrollTo = (scrollTop, animate = false, onScrollEnd) => {
|
||||
if (onScrollEnd) {
|
||||
new Promise(resolve => {
|
||||
void new Promise(resolve => {
|
||||
if (cancelScroll) {
|
||||
cancelScroll(resolve)
|
||||
} else {
|
||||
@@ -270,7 +270,7 @@ export default {
|
||||
cachedList = Array(list.length)
|
||||
startIndex = -1
|
||||
endIndex = -1
|
||||
nextTick(() => {
|
||||
void nextTick(() => {
|
||||
updateView()
|
||||
})
|
||||
}
|
||||
|
||||
@@ -51,7 +51,7 @@ export default {
|
||||
},
|
||||
methods: {
|
||||
handleClick(quality) {
|
||||
createDownloadTasks([this.musicInfo], quality)
|
||||
void createDownloadTasks([this.musicInfo], quality)
|
||||
this.handleClose()
|
||||
},
|
||||
handleClose() {
|
||||
|
||||
@@ -37,7 +37,7 @@ export default {
|
||||
emits: ['update:show', 'confirm'],
|
||||
methods: {
|
||||
handleClick(quality) {
|
||||
createDownloadTasks(this.list.filter(item => item.source != 'local'), quality)
|
||||
void createDownloadTasks(this.list.filter(item => item.source != 'local'), quality)
|
||||
this.handleClose()
|
||||
this.$emit('confirm')
|
||||
},
|
||||
|
||||
@@ -71,7 +71,7 @@ export default {
|
||||
|
||||
const checkMusicExist = (musicInfo) => {
|
||||
const mid = musicInfo.id
|
||||
getMusicExistListIds(mid).then(ids => {
|
||||
void getMusicExistListIds(mid).then(ids => {
|
||||
if (mid != musicInfo.id) return
|
||||
for (const list of lists.value) {
|
||||
if (ids.includes(list.id)) list.isExist = true
|
||||
@@ -150,9 +150,8 @@ export default {
|
||||
: width < 3840 ? 5 : 6
|
||||
},
|
||||
handleClick(index) {
|
||||
this.isMove
|
||||
? moveListMusics(this.fromListId, this.lists[index].id, [this.currentMusicInfo])
|
||||
: addListMusics(this.lists[index].id, [this.currentMusicInfo])
|
||||
if (this.isMove) void moveListMusics(this.fromListId, this.lists[index].id, [this.currentMusicInfo])
|
||||
else void addListMusics(this.lists[index].id, [this.currentMusicInfo])
|
||||
|
||||
this.lists[index].isExist = true
|
||||
if (this.keyModDown && !this.isMove) return
|
||||
@@ -174,7 +173,7 @@ export default {
|
||||
this.newListName = event.target.value = ''
|
||||
this.isEditing = false
|
||||
if (!name) return
|
||||
createUserList({ name })
|
||||
void createUserList({ name })
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
@@ -111,9 +111,8 @@ export default {
|
||||
handleClick(index) {
|
||||
const list = 'progress' in this.musicList[0] ? this.musicList.map(t => t.metadata.musicInfo) : this.musicList
|
||||
|
||||
this.isMove
|
||||
? moveListMusics(this.fromListId, this.lists[index].id, list)
|
||||
: addListMusics(this.lists[index].id, list)
|
||||
if (this.isMove) void moveListMusics(this.fromListId, this.lists[index].id, list)
|
||||
else void addListMusics(this.lists[index].id, list)
|
||||
|
||||
if (this.keyModDown && !this.isMove) return
|
||||
this.$nextTick(() => {
|
||||
@@ -135,7 +134,7 @@ export default {
|
||||
this.newListName = event.target.value = ''
|
||||
this.isEditing = false
|
||||
if (!name) return
|
||||
createUserList({ name })
|
||||
void createUserList({ name })
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
@@ -25,7 +25,7 @@ const handleEditing = () => {
|
||||
if (isEditing.value) return
|
||||
// if (!this.newPresetName) this.newPresetName = this.listName
|
||||
isEditing.value = true
|
||||
nextTick(() => {
|
||||
void nextTick(() => {
|
||||
input.value.$el.focus()
|
||||
})
|
||||
}
|
||||
@@ -36,7 +36,7 @@ const handleSave = (event) => {
|
||||
isEditing.value = false
|
||||
if (!name) return
|
||||
if (name.length > 20) name = name.substring(0, 20)
|
||||
saveUserConvolutionPreset({
|
||||
void saveUserConvolutionPreset({
|
||||
id: Date.now().toString(),
|
||||
name,
|
||||
source: appSetting['player.soundEffect.convolution.fileName'],
|
||||
|
||||
@@ -18,7 +18,7 @@ const handleEditing = () => {
|
||||
if (isEditing.value) return
|
||||
// if (!this.newPresetName) this.newPresetName = this.listName
|
||||
isEditing.value = true
|
||||
nextTick(() => {
|
||||
void nextTick(() => {
|
||||
input.value.$el.focus()
|
||||
})
|
||||
}
|
||||
@@ -29,7 +29,7 @@ const handleSave = (event) => {
|
||||
isEditing.value = false
|
||||
if (!name) return
|
||||
if (name.length > 20) name = name.substring(0, 20)
|
||||
saveUserEQPreset({
|
||||
void saveUserEQPreset({
|
||||
id: Date.now().toString(),
|
||||
name,
|
||||
hz31: appSetting['player.soundEffect.biquadFilter.hz31'],
|
||||
|
||||
@@ -69,7 +69,7 @@ const handleSetPreset = (item) => {
|
||||
}
|
||||
const userPresetList = ref([])
|
||||
const handleRemovePreset = id => {
|
||||
removeUserConvolutionPreset(id)
|
||||
void removeUserConvolutionPreset(id)
|
||||
}
|
||||
|
||||
const disabledConvolution = computed(() => {
|
||||
@@ -77,7 +77,7 @@ const disabledConvolution = computed(() => {
|
||||
})
|
||||
|
||||
onMounted(() => {
|
||||
getUserConvolutionPresetList().then(list => {
|
||||
void getUserConvolutionPresetList().then(list => {
|
||||
userPresetList.value = list
|
||||
})
|
||||
})
|
||||
|
||||
@@ -65,11 +65,11 @@ const handleSetPreset = (item) => {
|
||||
const userPresetList = ref([])
|
||||
|
||||
const handleRemovePreset = id => {
|
||||
removeUserEQPreset(id)
|
||||
void removeUserEQPreset(id)
|
||||
}
|
||||
|
||||
onMounted(() => {
|
||||
getUserEQPresetList().then(list => {
|
||||
void getUserEQPresetList().then(list => {
|
||||
userPresetList.value = list
|
||||
})
|
||||
})
|
||||
|
||||
@@ -30,7 +30,7 @@ import { computed, ref } from '@common/utils/vueTools'
|
||||
export default {
|
||||
setup() {
|
||||
const lastStartVersion = ref(null)
|
||||
getLastStartInfo().then(version => {
|
||||
void getLastStartInfo().then(version => {
|
||||
lastStartVersion.value = version
|
||||
})
|
||||
|
||||
@@ -43,7 +43,7 @@ export default {
|
||||
history: [],
|
||||
isLatest: true,
|
||||
}
|
||||
if (!versionInfo.newVersion || !versionInfo.newVersion?.history) return info
|
||||
if (!versionInfo.newVersion?.history) return info
|
||||
info.isLatest = compareVer(currentVer, versionInfo.newVersion.version) >= 0
|
||||
|
||||
const history = [{ version: versionInfo.newVersion.version, desc: versionInfo.newVersion.desc }, ...versionInfo.newVersion.history]
|
||||
|
||||
@@ -81,11 +81,11 @@ export default {
|
||||
}, 2e3)
|
||||
},
|
||||
handleClose(isExit) {
|
||||
if (isExit) return quitApp(true)
|
||||
if (isExit) { quitApp(true); return }
|
||||
isShowPact.value = false
|
||||
},
|
||||
openUrl(url) {
|
||||
openUrl(url)
|
||||
void openUrl(url)
|
||||
},
|
||||
startTimeout() {
|
||||
window.setTimeout(() => {
|
||||
|
||||
@@ -101,7 +101,7 @@ export default {
|
||||
const listId = playMusicInfo.listId
|
||||
if (!listId || listId == LIST_IDS.DOWNLOAD || !playMusicInfo.musicInfo) return
|
||||
if (playInfo.playIndex == -1) return
|
||||
router.push({
|
||||
void router.push({
|
||||
path: '/list',
|
||||
query: {
|
||||
id: listId,
|
||||
|
||||
@@ -101,7 +101,7 @@ export default {
|
||||
const listId = playMusicInfo.listId
|
||||
if (!listId || listId == LIST_IDS.DOWNLOAD || !playMusicInfo.musicInfo) return
|
||||
if (playInfo.playIndex == -1) return
|
||||
router.push({
|
||||
void router.push({
|
||||
path: '/list',
|
||||
query: {
|
||||
id: listId,
|
||||
|
||||
@@ -103,7 +103,7 @@ export default {
|
||||
const listId = playMusicInfo.listId
|
||||
if (!listId || listId == LIST_IDS.DOWNLOAD || !playMusicInfo.musicInfo) return
|
||||
if (playInfo.playIndex == -1) return
|
||||
router.push({
|
||||
void router.push({
|
||||
path: '/list',
|
||||
query: {
|
||||
id: listId,
|
||||
|
||||
@@ -113,7 +113,7 @@ export default {
|
||||
lyricMenuXY.x = event.pageX
|
||||
lyricMenuXY.y = event.pageY
|
||||
if (lyricMenuVisible.value) return
|
||||
nextTick(() => {
|
||||
void nextTick(() => {
|
||||
lyricMenuVisible.value = true
|
||||
})
|
||||
}
|
||||
|
||||
@@ -55,10 +55,10 @@ const offsetTagRxp = /(?:^|\n)\s*\[offset:\s*(\S+(?:\d+)*)\s*\]/
|
||||
const offsetTagAllRxp = /(^|\n)\s*\[offset:\s*(\S+(?:\d+)*)\s*\]/g
|
||||
|
||||
const saveLyric = debounce((musicInfo, lyricInfo) => {
|
||||
saveLyricEdited(musicInfo, lyricInfo)
|
||||
void saveLyricEdited(musicInfo, lyricInfo)
|
||||
})
|
||||
const removeLyric = debounce(musicInfo => {
|
||||
removeLyricEdited(musicInfo)
|
||||
void removeLyricEdited(musicInfo)
|
||||
})
|
||||
|
||||
const getOffset = lrc => {
|
||||
|
||||
@@ -138,7 +138,7 @@ export default {
|
||||
visibled,
|
||||
isFullscreen,
|
||||
fullscreenExit() {
|
||||
setFullScreen(false).then((fullscreen) => {
|
||||
void setFullScreen(false).then((fullscreen) => {
|
||||
isFullscreen.value = fullscreen
|
||||
})
|
||||
},
|
||||
|
||||
@@ -61,7 +61,7 @@ export default {
|
||||
}
|
||||
const handleSelectMode = (mode) => {
|
||||
if (mode.startsWith('overwrite') && isOverwrite.value) mode += '_full'
|
||||
sendSyncAction({ action: 'select_mode', data: mode })
|
||||
void sendSyncAction({ action: 'select_mode', data: mode })
|
||||
handleClose()
|
||||
}
|
||||
return {
|
||||
|
||||
@@ -97,7 +97,7 @@ export default {
|
||||
break
|
||||
case 'listClick':
|
||||
searchText.value = tipList.value[data]
|
||||
nextTick(handleSearch)
|
||||
void nextTick(handleSearch)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -113,7 +113,7 @@ export default {
|
||||
},
|
||||
computed: {
|
||||
history() {
|
||||
if (!this.versionInfo.newVersion || !this.versionInfo.newVersion?.history) return []
|
||||
if (!this.versionInfo.newVersion?.history) return []
|
||||
let arr = []
|
||||
let currentVer = this.versionInfo.version
|
||||
this.versionInfo.newVersion?.history.forEach(ver => {
|
||||
@@ -134,7 +134,7 @@ export default {
|
||||
},
|
||||
},
|
||||
created() {
|
||||
getIgnoreVersion().then(version => {
|
||||
void getIgnoreVersion().then(version => {
|
||||
this.ignoreVersion = version
|
||||
})
|
||||
},
|
||||
@@ -143,7 +143,7 @@ export default {
|
||||
versionInfo.showModal = false
|
||||
},
|
||||
handleOpenUrl(url) {
|
||||
openUrl(url)
|
||||
void openUrl(url)
|
||||
},
|
||||
handleRestartClick(event) {
|
||||
this.handleClose()
|
||||
@@ -166,7 +166,7 @@ export default {
|
||||
confirmButtonText: window.i18n.t('update__ignore_confirm'),
|
||||
})) {
|
||||
setTimeout(() => {
|
||||
dialog({
|
||||
void dialog({
|
||||
message: window.i18n.t('update__ignore_confirm_tip'),
|
||||
confirmButtonText: window.i18n.t('update__ignore_confirm_tip_confirm'),
|
||||
})
|
||||
|
||||
@@ -161,7 +161,7 @@ export default {
|
||||
// }
|
||||
this.setRandomAnimation()
|
||||
this.showModal = true
|
||||
nextTick(() => {
|
||||
void nextTick(() => {
|
||||
this.$refs.dom_container.parentNode.classList.add('show-modal')
|
||||
this.showContent = true
|
||||
})
|
||||
|
||||
@@ -234,7 +234,7 @@ export default {
|
||||
handleShowDownloadModal(index, true)
|
||||
break
|
||||
case 'play':
|
||||
handlePlayMusic(index, true)
|
||||
void handlePlayMusic(index, true)
|
||||
break
|
||||
case 'search':
|
||||
handleSearch(index)
|
||||
|
||||
@@ -83,6 +83,7 @@ export default {
|
||||
if (this.maxPage <= this.btnLength) return Array.from({ length: this.maxPage }, (_, i) => i + 1)
|
||||
let start =
|
||||
this.page - this.pageEvg > 1
|
||||
// eslint-disable-next-line @typescript-eslint/restrict-plus-operands
|
||||
? this.maxPage - this.page < this.pageEvg + 1
|
||||
? this.maxPage - (this.btnLength - 1)
|
||||
: this.page - this.pageEvg
|
||||
|
||||
@@ -141,7 +141,7 @@ export default {
|
||||
},
|
||||
handleSearch() {
|
||||
this.hideList()
|
||||
if (this.selectIndex < 0) return this.sendEvent('submit')
|
||||
if (this.selectIndex < 0) { this.sendEvent('submit'); return }
|
||||
this.sendEvent('listClick', this.selectIndex)
|
||||
},
|
||||
showList() {
|
||||
|
||||
Reference in New Issue
Block a user