chore(deps): update lint (#1928)

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: 三咲智子 Kevin Deng <sxzz@sxzz.moe>
This commit is contained in:
renovate[bot] 2023-03-30 19:01:24 +00:00 committed by GitHub
parent 2838e18ff7
commit 3c43a1cdd1
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
62 changed files with 464 additions and 434 deletions

View file

@ -12,7 +12,7 @@ const isSelf = $(useSelfAccount(() => account))
const { t } = useI18n()
const { client } = $(useMasto())
const toggleMute = async () => {
async function toggleMute() {
if (!relationship!.muting && await openConfirmDialog({
title: t('confirm.mute_account.title', [account.acct]),
confirm: t('confirm.mute_account.confirm'),
@ -28,7 +28,7 @@ const toggleMute = async () => {
: await client.v1.accounts.unmute(account.id)
}
const toggleBlockUser = async () => {
async function toggleBlockUser() {
if (!relationship!.blocking && await openConfirmDialog({
title: t('confirm.block_account.title', [account.acct]),
confirm: t('confirm.block_account.confirm'),
@ -40,7 +40,7 @@ const toggleBlockUser = async () => {
relationship = await client.v1.accounts[relationship!.blocking ? 'block' : 'unblock'](account.id)
}
const toggleBlockDomain = async () => {
async function toggleBlockDomain() {
if (!relationship!.domainBlocking && await openConfirmDialog({
title: t('confirm.block_domain.title', [getServerName(account)]),
confirm: t('confirm.block_domain.confirm'),
@ -52,7 +52,7 @@ const toggleBlockDomain = async () => {
await client.v1.domainBlocks[relationship!.domainBlocking ? 'block' : 'unblock'](getServerName(account))
}
const toggleReblogs = async () => {
async function toggleReblogs() {
if (!relationship!.showingReblogs && await openConfirmDialog({
title: t('confirm.show_reblogs.title', [account.acct]),
confirm: t('confirm.show_reblogs.confirm'),

View file

@ -14,7 +14,7 @@ const localeMap = (locales.value as LocaleObject[]).reduce((acc, l) => {
let ariaLive = $ref<AriaLive>('polite')
let ariaMessage = $ref<string>('')
const onMessage = (event: AriaAnnounceType, message?: string) => {
function onMessage(event: AriaAnnounceType, message?: string) {
if (event === 'announce')
ariaMessage = message!
else if (event === 'mute')

View file

@ -26,12 +26,14 @@ const query = $computed(() => commandMode ? '' : input.trim())
const { accounts, hashtags, loading } = useSearch($$(query))
const toSearchQueryResultItem = (search: SearchResultType): QueryResultItem => ({
index: 0,
type: 'search',
search,
onActivate: () => router.push(search.to),
})
function toSearchQueryResultItem(search: SearchResultType): QueryResultItem {
return {
index: 0,
type: 'search',
search,
onActivate: () => router.push(search.to),
}
}
const searchResult = $computed<QueryResult>(() => {
if (query.length === 0 || loading.value)
@ -73,9 +75,10 @@ watch($$(result), (n, o) => {
active = 0
})
const findItemEl = (index: number) =>
resultEl?.querySelector(`[data-index="${index}"]`) as HTMLDivElement | null
const onCommandActivate = (item: QueryResultItem) => {
function findItemEl(index: number) {
return resultEl?.querySelector(`[data-index="${index}"]`) as HTMLDivElement | null
}
function onCommandActivate(item: QueryResultItem) {
if (item.onActivate) {
item.onActivate()
emit('close')
@ -85,7 +88,7 @@ const onCommandActivate = (item: QueryResultItem) => {
input = '> '
}
}
const onCommandComplete = (item: QueryResultItem) => {
function onCommandComplete(item: QueryResultItem) {
if (item.onComplete) {
scopes.push(item.onComplete())
input = '> '
@ -95,7 +98,7 @@ const onCommandComplete = (item: QueryResultItem) => {
emit('close')
}
}
const intoView = (index: number) => {
function intoView(index: number) {
const el = findItemEl(index)
if (el)
el.scrollIntoView({ block: 'nearest' })
@ -107,7 +110,7 @@ function setActive(index: number) {
intoView(active)
}
const onKeyDown = (e: KeyboardEvent) => {
function onKeyDown(e: KeyboardEvent) {
switch (e.key) {
case 'p':
case 'ArrowUp': {

View file

@ -30,7 +30,7 @@ const cropperImage = reactive({
type: 'image/jpg',
})
const stencilSize = ({ boundaries }: { boundaries: Boundaries }) => {
function stencilSize({ boundaries }: { boundaries: Boundaries }) {
return {
width: boundaries.width * props.stencilSizePercentage,
height: boundaries.height * props.stencilSizePercentage,
@ -55,7 +55,7 @@ watch(file, (file, _, onCleanup) => {
cropperFlag.value = false
})
const cropImage = () => {
function cropImage() {
if (cropper.value && file.value) {
cropperFlag.value = true
cropperDialog.value = false

View file

@ -34,7 +34,7 @@ const previewImage = ref('')
/** The current images on display */
const imageSrc = computed<string>(() => previewImage.value || defaultImage.value)
const pickImage = async () => {
async function pickImage() {
if (process.server)
return
const image = await fileOpen({

View file

@ -9,7 +9,9 @@ defineProps<{
const dropdown = $ref<any>()
const colorMode = useColorMode()
const hide = () => dropdown.hide()
function hide() {
return dropdown.hide()
}
provide(InjectionKeyDropdownContext, {
hide,
})

View file

@ -15,7 +15,7 @@ const { hide } = useDropdownContext() || {}
const el = ref<HTMLDivElement>()
const handleClick = (evt: MouseEvent) => {
function handleClick(evt: MouseEvent) {
hide?.()
emit('click', evt)
}

View file

@ -25,13 +25,13 @@ const input = ref<HTMLInputElement>()
const editBtn = ref<HTMLButtonElement>()
const deleteBtn = ref<HTMLButtonElement>()
const prepareEdit = async () => {
async function prepareEdit() {
isEditing = true
actionError = undefined
await nextTick()
input.value?.focus()
}
const cancelEdit = async () => {
async function cancelEdit() {
isEditing = false
actionError = undefined
reset()

View file

@ -33,21 +33,21 @@ useEventListener('keydown', (e: KeyboardEvent) => {
}
})
const handlePublished = (status: mastodon.v1.Status) => {
function handlePublished(status: mastodon.v1.Status) {
lastPublishDialogStatus.value = status
isPublishDialogOpen.value = false
}
const handlePublishClose = () => {
function handlePublishClose() {
lastPublishDialogStatus.value = null
}
const handleConfirmChoice = (choice: ConfirmDialogChoice) => {
function handleConfirmChoice(choice: ConfirmDialogChoice) {
confirmDialogChoice.value = choice
isConfirmDialogOpen.value = false
}
const handleFavouritedBoostedByClose = () => {
function handleFavouritedBoostedByClose() {
isFavouritedBoostedByDialogOpen.value = false
}
</script>

View file

@ -119,9 +119,11 @@ const isVShow = computed(() => {
: true
})
const bindTypeToAny = ($attrs: any) => $attrs as any
function bindTypeToAny($attrs: any) {
return $attrs as any
}
const trapFocusDialog = () => {
function trapFocusDialog() {
if (isVShow.value)
nextTick().then(() => activate())
}

View file

@ -3,37 +3,43 @@
xmlns="http://www.w3.org/2000/svg" w-full
aspect="1/1" sm:h-8 xl:h-10 sm:w-8 xl:w-10 viewBox="0 0 250 250" fill="none"
>
<mask
id="a"
width="240"
height="234"
x="4"
y="1"
maskUnits="userSpaceOnUse"
style="mask-type:alpha">
<path
fill="#D9D9D9"
d="M244 123c0 64.617-38.383 112-103 112-64.617 0-103-30.883-103-95.5C38 111.194-8.729 36.236 8 16 29.46-9.959 88.689 6 125 6c64.617 0 119 52.383 119 117Z"
id="path19" />
</mask>
<g
mask="url(#a)"
id="g28"
transform="matrix(0.90923731,0,0,1.0049564,13.520015,-3.1040835)">
<path
class="body"
d="m 116.94,88.1 c -13.344,1.552 -20.436,-2.019 -24.706,10.71 0,0 14.336,21.655 52.54,21.112 -2.135,8.848 -1.144,15.368 -1.144,23.207 0,26.079 -20.589,48.821 -65.961,48.821 -23.03,0 -51.015,4.191 -72.367,15.911 -15.175,8.305 -27.048,20.336 -32.302,37.023 l 5.956,8.461 11.4,0.155 v 47.889 l -13.91,21.966 3.998,63.645 H -6.364 L -5.22,335.773 C 1.338,331.892 16.36,321.802 29.171,306.279 46.557,285.4 59.902,255.052 44.193,217.486 l 11.744,-5.045 c 12.887,30.814 8.388,57.514 -2.898,79.013 21.58,-0.698 40.11,-2.095 55.819,-4.734 l -3.584,-43.698 12.659,-1.087 L 129.98,387 h 13.116 l 2.212,-94.459 c 10.447,-4.502 34.239,-21.034 45.372,-78.47 1.372,-6.986 2.135,-12.885 2.516,-17.93 1.754,-12.806 2.745,-27.243 3.051,-43.698 l -18.683,-5.976 h 57.42 l 5.567,-12.807 c -5.414,0.233 -11.896,-2.639 -11.896,-2.639 l 1.297,-6.209 H 242 L 176.801,90.428 c -7.244,2.794 -14.87,6.442 -20.208,10.866 -4.27,-3.105 -19.063,-12.807 -39.653,-13.195 z"
id="path22" />
<path
class="wood"
d="M 6.217,24.493 18.494,21 c 5.948,21.577 13.345,33.375 22.648,39.352 8.388,5.099 19.75,5.239 31.799,4.579 C 69.433,63.767 66.154,62.137 63.104,59.886 56.317,54.841 50.522,46.458 46.175,31.246 l 12.201,-3.649 c 3.279,11.488 7.092,18.085 12.201,21.888 5.11,3.726 11.286,4.657 18.606,5.433 13.726,1.553 30.884,2.174 52.312,12.264 2.898,1.086 5.872,2.483 8.769,4.036 -0.381,-0.776 -0.762,-1.553 -1.296,-2.406 -3.66,-5.822 -10.828,-11.953 -24.097,-16.92 l 4.27,-12.109 c 21.581,7.917 30.121,19.171 33.553,28.097 3.965,10.168 1.525,18.124 1.525,18.124 -3.05,1.009 -6.1,2.406 -9.608,3.492 -6.634,-4.579 -12.887,-8.033 -18.835,-10.75 C 113.814,70.442 92.31,76.108 73.246,77.893 58.91,79.213 45.794,78.591 34.432,71.295 23.222,64.155 13.385,50.495 6.217,24.493 Z"
id="path24" />
<path
class="wood"
d="M 90.098,45.294 C 87.582,39.55 86.057,32.487 86.743,23.794 l 12.659,0.932 c -0.763,10.555 2.897,17.696 7.015,22.353 -5.338,-0.931 -10.447,-1.04 -16.319,-1.785 z m 80.069,-1.32 8.312,-9.702 c 21.58,19.094 8.159,46.415 8.159,46.415 l -11.819,-1.32 c -0.382,-6.24 -1.144,-17.836 -6.635,-24.371 3.584,1.84 6.635,3.865 9.99,6.908 0,-5.666 -1.754,-12.341 -8.007,-17.93 z"
id="path26" />
</g>
</svg>
<mask
id="a"
width="240"
height="234"
x="4"
y="1"
maskUnits="userSpaceOnUse"
style="mask-type:alpha"
>
<path
id="path19"
fill="#D9D9D9"
d="M244 123c0 64.617-38.383 112-103 112-64.617 0-103-30.883-103-95.5C38 111.194-8.729 36.236 8 16 29.46-9.959 88.689 6 125 6c64.617 0 119 52.383 119 117Z"
/>
</mask>
<g
id="g28"
mask="url(#a)"
transform="matrix(0.90923731,0,0,1.0049564,13.520015,-3.1040835)"
>
<path
id="path22"
class="body"
d="m 116.94,88.1 c -13.344,1.552 -20.436,-2.019 -24.706,10.71 0,0 14.336,21.655 52.54,21.112 -2.135,8.848 -1.144,15.368 -1.144,23.207 0,26.079 -20.589,48.821 -65.961,48.821 -23.03,0 -51.015,4.191 -72.367,15.911 -15.175,8.305 -27.048,20.336 -32.302,37.023 l 5.956,8.461 11.4,0.155 v 47.889 l -13.91,21.966 3.998,63.645 H -6.364 L -5.22,335.773 C 1.338,331.892 16.36,321.802 29.171,306.279 46.557,285.4 59.902,255.052 44.193,217.486 l 11.744,-5.045 c 12.887,30.814 8.388,57.514 -2.898,79.013 21.58,-0.698 40.11,-2.095 55.819,-4.734 l -3.584,-43.698 12.659,-1.087 L 129.98,387 h 13.116 l 2.212,-94.459 c 10.447,-4.502 34.239,-21.034 45.372,-78.47 1.372,-6.986 2.135,-12.885 2.516,-17.93 1.754,-12.806 2.745,-27.243 3.051,-43.698 l -18.683,-5.976 h 57.42 l 5.567,-12.807 c -5.414,0.233 -11.896,-2.639 -11.896,-2.639 l 1.297,-6.209 H 242 L 176.801,90.428 c -7.244,2.794 -14.87,6.442 -20.208,10.866 -4.27,-3.105 -19.063,-12.807 -39.653,-13.195 z"
/>
<path
id="path24"
class="wood"
d="M 6.217,24.493 18.494,21 c 5.948,21.577 13.345,33.375 22.648,39.352 8.388,5.099 19.75,5.239 31.799,4.579 C 69.433,63.767 66.154,62.137 63.104,59.886 56.317,54.841 50.522,46.458 46.175,31.246 l 12.201,-3.649 c 3.279,11.488 7.092,18.085 12.201,21.888 5.11,3.726 11.286,4.657 18.606,5.433 13.726,1.553 30.884,2.174 52.312,12.264 2.898,1.086 5.872,2.483 8.769,4.036 -0.381,-0.776 -0.762,-1.553 -1.296,-2.406 -3.66,-5.822 -10.828,-11.953 -24.097,-16.92 l 4.27,-12.109 c 21.581,7.917 30.121,19.171 33.553,28.097 3.965,10.168 1.525,18.124 1.525,18.124 -3.05,1.009 -6.1,2.406 -9.608,3.492 -6.634,-4.579 -12.887,-8.033 -18.835,-10.75 C 113.814,70.442 92.31,76.108 73.246,77.893 58.91,79.213 45.794,78.591 34.432,71.295 23.222,64.155 13.385,50.495 6.217,24.493 Z"
/>
<path
id="path26"
class="wood"
d="M 90.098,45.294 C 87.582,39.55 86.057,32.487 86.743,23.794 l 12.659,0.932 c -0.763,10.555 2.897,17.696 7.015,22.353 -5.338,-0.931 -10.447,-1.04 -16.319,-1.785 z m 80.069,-1.32 8.312,-9.702 c 21.58,19.094 8.159,46.415 8.159,46.415 l -11.819,-1.32 c -0.382,-6.24 -1.144,-17.836 -6.635,-24.371 3.584,1.84 6.635,3.865 9.99,6.908 0,-5.666 -1.754,-12.341 -8.007,-17.93 z"
/>
</g>
</svg>
</span>
</template>

View file

@ -5,7 +5,7 @@ const back = ref<any>('')
const nuxtApp = useNuxtApp()
const onClickLogo = () => {
function onClickLogo() {
nuxtApp.hooks.callHook('elk-logo:click')
}

View file

@ -14,7 +14,7 @@ const virtualScroller = false // TODO: fix flickering issue with virtual scroll
const groupCapacity = Number.MAX_VALUE // No limit
// Group by type (and status when applicable)
const groupId = (item: mastodon.v1.Notification): string => {
function groupId(item: mastodon.v1.Notification): string {
// If the update is related to an status, group notifications from the same account (boost + favorite the same status)
const id = item.status
? {

View file

@ -24,7 +24,7 @@ let animateRemoveSubscription = $ref<boolean>(false)
let subscribeError = $ref<string>('')
let showSubscribeError = $ref<boolean>(false)
const hideNotification = () => {
function hideNotification() {
const key = currentUser.value?.account?.acct
if (key)
hiddenNotification.value[key] = true
@ -39,7 +39,7 @@ const showWarning = $computed(() => {
&& !(hiddenNotification.value[currentUser.value?.account?.acct ?? ''] === true)
})
const saveSettings = async () => {
async function saveSettings() {
if (busy)
return
@ -60,7 +60,7 @@ const saveSettings = async () => {
}
}
const doSubscribe = async () => {
async function doSubscribe() {
if (busy)
return
@ -90,7 +90,7 @@ const doSubscribe = async () => {
animateSubscription = false
}
}
const removeSubscription = async () => {
async function removeSubscription() {
if (busy)
return

View file

@ -20,7 +20,7 @@ const maxDescriptionLength = 1500
const isEditDialogOpen = ref(false)
const description = ref(props.attachment.description ?? '')
const toggleApply = () => {
function toggleApply() {
isEditDialogOpen.value = false
emit('setDescription', unref(description))
}

View file

@ -47,7 +47,7 @@ async function openEmojiPicker() {
el?.appendChild(picker as any as HTMLElement)
}
const hideEmojiPicker = () => {
function hideEmojiPicker() {
if (picker)
el?.removeChild(picker as any as HTMLElement)
}

View file

@ -11,7 +11,7 @@ const currentVisibility = $computed(() =>
statusVisibilities.find(v => v.value === modelValue) || statusVisibilities[0],
)
const chooseVisibility = (visibility: string) => {
function chooseVisibility(visibility: string) {
modelValue = visibility
}
</script>

View file

@ -6,7 +6,7 @@ defineProps<{
active: boolean
}>()
const onActivate = () => {
function onActivate() {
(document.activeElement as HTMLElement).blur()
}
</script>

View file

@ -38,9 +38,11 @@ const results = computed(() => {
// Reset index when results change
watch([results, focused], () => index.value = -1)
const shift = (delta: number) => index.value = (index.value + delta % results.value.length + results.value.length) % results.value.length
function shift(delta: number) {
return index.value = (index.value + delta % results.value.length + results.value.length) % results.value.length
}
const activate = () => {
function activate() {
const currentIndex = index.value
if (query.value.length === 0)

View file

@ -6,7 +6,7 @@ const userSettings = useUserSettings()
const sizes = (new Array(11)).fill(0).map((x, i) => `${10 + i}px`) as FontSize[]
const setFontSize = (e: Event) => {
function setFontSize(e: Event) {
if (e.target && 'valueAsNumber' in e.target)
userSettings.value.fontSize = sizes[e.target.valueAsNumber as number]
}

View file

@ -25,7 +25,7 @@ const fieldCount = $computed(() => {
)
})
const chooseIcon = (i: number, text: string) => {
function chooseIcon(i: number, text: string) {
form.value.fieldsAttributes[i].name = text
dropdown[i]?.hide()
}

View file

@ -22,7 +22,7 @@ const {
toggleReblog,
} = $(useStatusActions(props))
const reply = () => {
function reply() {
if (!checkLogin())
return
if (details)

View file

@ -29,33 +29,33 @@ const isAuthor = $computed(() => status.account.id === currentUser.value?.accoun
const { client } = $(useMasto())
const getPermalinkUrl = (status: mastodon.v1.Status) => {
function getPermalinkUrl(status: mastodon.v1.Status) {
const url = getStatusPermalinkRoute(status)
if (url)
return `${location.origin}/${url}`
return null
}
const copyLink = async (status: mastodon.v1.Status) => {
async function copyLink(status: mastodon.v1.Status) {
const url = getPermalinkUrl(status)
if (url)
await clipboard.copy(url)
}
const copyOriginalLink = async (status: mastodon.v1.Status) => {
async function copyOriginalLink(status: mastodon.v1.Status) {
const url = status.url
if (url)
await clipboard.copy(url)
}
const { share, isSupported: isShareSupported } = useShare()
const shareLink = async (status: mastodon.v1.Status) => {
async function shareLink(status: mastodon.v1.Status) {
const url = getPermalinkUrl(status)
if (url)
await share({ url })
}
const deleteStatus = async () => {
async function deleteStatus() {
if (await openConfirmDialog({
title: t('confirm.delete_posts.title'),
confirm: t('confirm.delete_posts.confirm'),
@ -72,7 +72,7 @@ const deleteStatus = async () => {
// TODO when timeline, remove this item
}
const deleteAndRedraft = async () => {
async function deleteAndRedraft() {
// TODO confirm to delete
if (process.dev) {
// eslint-disable-next-line no-alert
@ -90,7 +90,7 @@ const deleteAndRedraft = async () => {
router.push(getStatusRoute(lastPublishDialogStatus.value))
}
const reply = () => {
function reply() {
if (details) {
// TODO focus to editor
}
@ -107,7 +107,7 @@ async function editStatus() {
}, true)
}
const showFavoritedAndBoostedBy = () => {
function showFavoritedAndBoostedBy() {
openFavoridedBoostedByDialog(status.id)
}
</script>

View file

@ -15,7 +15,7 @@ const preferenceHideTranslation = usePreferences('hideTranslation')
const showButton = computed(() => !preferenceHideTranslation.value && isTranslationEnabled)
let translating = $ref(false)
const toggleTranslation = async () => {
async function toggleTranslation() {
translating = true
try {
await _toggleTranslation()

View file

@ -8,14 +8,15 @@ const { status } = defineProps<{
const paginator = useMastoClient().v1.statuses.listHistory(status.id)
const showHistory = (edit: mastodon.v1.StatusEdit) => {
function showHistory(edit: mastodon.v1.StatusEdit) {
openEditHistoryDialog(edit)
}
const timeAgoOptions = useTimeAgoOptions()
// TODO: rework, this is only reversing the first page of edits
const reverseHistory = (items: mastodon.v1.StatusEdit[]) =>
[...items].reverse()
function reverseHistory(items: mastodon.v1.StatusEdit[]) {
return [...items].reverse()
}
</script>
<template>

View file

@ -11,7 +11,7 @@ const emit = defineEmits<{
const { client } = $(useMasto())
const toggleFollowTag = async () => {
async function toggleFollowTag() {
// We save the state so be can do an optimistic UI update, but fallback to the previous state if the API call fails
const previousFollowingState = tag.following

View file

@ -2,7 +2,7 @@
const { client } = $(useMasto())
const paginator = client.v1.domainBlocks.list()
const unblock = async (domain: string) => {
async function unblock(domain: string) {
await client.v1.domainBlocks.unblock(domain)
}
</script>

View file

@ -3,7 +3,9 @@ import type { mastodon } from 'masto'
const paginator = useMastoClient().v1.timelines.listHome({ limit: 30 })
const stream = $(useStreaming(client => client.v1.stream.streamUser()))
const reorderAndFilter = (items: mastodon.v1.Status[]) => reorderedTimeline(items, 'home')
function reorderAndFilter(items: mastodon.v1.Status[]) {
return reorderedTimeline(items, 'home')
}
</script>
<template>

View file

@ -3,7 +3,9 @@ import type { mastodon } from 'masto'
const paginator = useMastoClient().v1.timelines.listPublic({ limit: 30 })
const stream = useStreaming(client => client.v1.stream.streamPublicTimeline())
const reorderAndFilter = (items: mastodon.v1.Status[]) => reorderedTimeline(items, 'public')
function reorderAndFilter(items: mastodon.v1.Status[]) {
return reorderedTimeline(items, 'public')
}
</script>
<template>

View file

@ -4,7 +4,7 @@ import type { UserLogin } from '~/types'
const all = useUsers()
const router = useRouter()
const clickUser = (user: UserLogin) => {
function clickUser(user: UserLogin) {
if (user.account.acct === currentUser.value?.account.acct)
router.push(getAccountRoute(user.account))
else

View file

@ -16,13 +16,13 @@ const sorted = computed(() => {
})
const router = useRouter()
const clickUser = (user: UserLogin) => {
function clickUser(user: UserLogin) {
if (user.account.id === currentUser.value?.account.id)
router.push(getAccountRoute(user.account))
else
switchUser(user)
}
const processSignIn = () => {
function processSignIn() {
if (singleInstanceServer)
oauth()
else