From 3c43a1cdd1a90bb56ec19bef899d89dcbb5fdaef Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Thu, 30 Mar 2023 19:01:24 +0000 Subject: [PATCH] chore(deps): update lint (#1928) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: 三咲智子 Kevin Deng --- components/account/AccountMoreButton.vue | 8 +- components/aria/AriaAnnouncer.vue | 2 +- components/command/CommandPanel.vue | 27 +- components/common/CommonCropImage.vue | 4 +- components/common/CommonInputImage.vue | 2 +- components/common/dropdown/Dropdown.vue | 4 +- components/common/dropdown/DropdownItem.vue | 2 +- components/list/ListEntry.vue | 4 +- components/modal/ModalContainer.vue | 8 +- components/modal/ModalDialog.vue | 6 +- components/nav/NavLogo.vue | 68 ++- components/nav/NavTitle.vue | 2 +- .../notification/NotificationPaginator.vue | 2 +- .../NotificationPreferences.client.vue | 8 +- components/publish/PublishAttachment.vue | 2 +- .../publish/PublishEmojiPicker.client.vue | 2 +- .../publish/PublishVisibilityPicker.vue | 2 +- components/search/SearchResult.vue | 2 +- components/search/SearchWidget.vue | 6 +- components/settings/SettingsFontSize.vue | 2 +- .../settings/SettingsProfileMetadata.vue | 2 +- components/status/StatusActions.vue | 2 +- components/status/StatusActionsMore.vue | 16 +- components/status/StatusTranslation.vue | 2 +- components/status/edit/StatusEditHistory.vue | 7 +- components/tag/TagActionButton.vue | 2 +- components/timeline/TimelineDomainBlocks.vue | 2 +- components/timeline/TimelineHome.vue | 4 +- components/timeline/TimelinePublic.vue | 4 +- components/user/UserPicker.vue | 2 +- components/user/UserSwitcher.vue | 4 +- composables/aria.ts | 6 +- composables/command.ts | 7 +- composables/masto/icons.ts | 2 +- composables/masto/masto.ts | 10 +- composables/masto/notification.ts | 2 +- composables/masto/routes.ts | 7 +- composables/masto/statusDrafts.ts | 2 +- composables/masto/translate.ts | 2 +- composables/misc.ts | 6 +- .../createPushSubscription.ts | 6 +- .../push-notifications/usePushManager.ts | 2 +- composables/sign-in.ts | 2 +- composables/tiptap/emoji.ts | 6 +- composables/tiptap/suggestion.ts | 4 +- composables/users.ts | 15 +- composables/vue.ts | 2 +- config/env.ts | 4 +- config/i18n.ts | 2 +- docs/components/global/TranslationState.vue | 4 +- error.vue | 2 +- modules/pwa/i18n.ts | 2 +- modules/tauri/runtime/storage.ts | 4 +- package.json | 6 +- pages/[[server]]/@[account]/[status].vue | 4 +- pages/[[server]]/@[account]/index/index.vue | 4 +- pages/settings/about/index.vue | 2 +- pages/settings/profile/appearance.vue | 2 +- pnpm-lock.yaml | 561 +++++++++--------- service-worker/notification.ts | 4 +- service-worker/share-target.ts | 2 +- service-worker/web-push-notifications.ts | 4 +- 62 files changed, 464 insertions(+), 434 deletions(-) diff --git a/components/account/AccountMoreButton.vue b/components/account/AccountMoreButton.vue index 6bf619a7..9545e8ee 100644 --- a/components/account/AccountMoreButton.vue +++ b/components/account/AccountMoreButton.vue @@ -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'), diff --git a/components/aria/AriaAnnouncer.vue b/components/aria/AriaAnnouncer.vue index c4543575..9f307a81 100644 --- a/components/aria/AriaAnnouncer.vue +++ b/components/aria/AriaAnnouncer.vue @@ -14,7 +14,7 @@ const localeMap = (locales.value as LocaleObject[]).reduce((acc, l) => { let ariaLive = $ref('polite') let ariaMessage = $ref('') -const onMessage = (event: AriaAnnounceType, message?: string) => { +function onMessage(event: AriaAnnounceType, message?: string) { if (event === 'announce') ariaMessage = message! else if (event === 'mute') diff --git a/components/command/CommandPanel.vue b/components/command/CommandPanel.vue index 1c955a15..19c97d61 100644 --- a/components/command/CommandPanel.vue +++ b/components/command/CommandPanel.vue @@ -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(() => { 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': { diff --git a/components/common/CommonCropImage.vue b/components/common/CommonCropImage.vue index a1eebba4..1a44ff2b 100644 --- a/components/common/CommonCropImage.vue +++ b/components/common/CommonCropImage.vue @@ -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 diff --git a/components/common/CommonInputImage.vue b/components/common/CommonInputImage.vue index 947cb284..d64756f3 100644 --- a/components/common/CommonInputImage.vue +++ b/components/common/CommonInputImage.vue @@ -34,7 +34,7 @@ const previewImage = ref('') /** The current images on display */ const imageSrc = computed(() => previewImage.value || defaultImage.value) -const pickImage = async () => { +async function pickImage() { if (process.server) return const image = await fileOpen({ diff --git a/components/common/dropdown/Dropdown.vue b/components/common/dropdown/Dropdown.vue index 805ba334..6b43f1d5 100644 --- a/components/common/dropdown/Dropdown.vue +++ b/components/common/dropdown/Dropdown.vue @@ -9,7 +9,9 @@ defineProps<{ const dropdown = $ref() const colorMode = useColorMode() -const hide = () => dropdown.hide() +function hide() { + return dropdown.hide() +} provide(InjectionKeyDropdownContext, { hide, }) diff --git a/components/common/dropdown/DropdownItem.vue b/components/common/dropdown/DropdownItem.vue index eb4af826..2a1abc33 100644 --- a/components/common/dropdown/DropdownItem.vue +++ b/components/common/dropdown/DropdownItem.vue @@ -15,7 +15,7 @@ const { hide } = useDropdownContext() || {} const el = ref() -const handleClick = (evt: MouseEvent) => { +function handleClick(evt: MouseEvent) { hide?.() emit('click', evt) } diff --git a/components/list/ListEntry.vue b/components/list/ListEntry.vue index d2b19e52..97ec6dcb 100644 --- a/components/list/ListEntry.vue +++ b/components/list/ListEntry.vue @@ -25,13 +25,13 @@ const input = ref() const editBtn = ref() const deleteBtn = ref() -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() diff --git a/components/modal/ModalContainer.vue b/components/modal/ModalContainer.vue index 6ad92622..e1b092bc 100644 --- a/components/modal/ModalContainer.vue +++ b/components/modal/ModalContainer.vue @@ -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 } diff --git a/components/modal/ModalDialog.vue b/components/modal/ModalDialog.vue index d1a791e7..6cc998f3 100644 --- a/components/modal/ModalDialog.vue +++ b/components/modal/ModalDialog.vue @@ -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()) } diff --git a/components/nav/NavLogo.vue b/components/nav/NavLogo.vue index c6b36676..f541f257 100644 --- a/components/nav/NavLogo.vue +++ b/components/nav/NavLogo.vue @@ -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" > - - - - - - - - - + + + + + + + + + diff --git a/components/nav/NavTitle.vue b/components/nav/NavTitle.vue index e4a7e7d9..50aea711 100644 --- a/components/nav/NavTitle.vue +++ b/components/nav/NavTitle.vue @@ -5,7 +5,7 @@ const back = ref('') const nuxtApp = useNuxtApp() -const onClickLogo = () => { +function onClickLogo() { nuxtApp.hooks.callHook('elk-logo:click') } diff --git a/components/notification/NotificationPaginator.vue b/components/notification/NotificationPaginator.vue index 83a7f80e..2385e043 100644 --- a/components/notification/NotificationPaginator.vue +++ b/components/notification/NotificationPaginator.vue @@ -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 ? { diff --git a/components/notification/NotificationPreferences.client.vue b/components/notification/NotificationPreferences.client.vue index df49f9ec..2d542b6c 100644 --- a/components/notification/NotificationPreferences.client.vue +++ b/components/notification/NotificationPreferences.client.vue @@ -24,7 +24,7 @@ let animateRemoveSubscription = $ref(false) let subscribeError = $ref('') let showSubscribeError = $ref(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 diff --git a/components/publish/PublishAttachment.vue b/components/publish/PublishAttachment.vue index e70ffe9c..bce12be1 100644 --- a/components/publish/PublishAttachment.vue +++ b/components/publish/PublishAttachment.vue @@ -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)) } diff --git a/components/publish/PublishEmojiPicker.client.vue b/components/publish/PublishEmojiPicker.client.vue index f79380a2..44d0bd67 100644 --- a/components/publish/PublishEmojiPicker.client.vue +++ b/components/publish/PublishEmojiPicker.client.vue @@ -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) } diff --git a/components/publish/PublishVisibilityPicker.vue b/components/publish/PublishVisibilityPicker.vue index 5d1cf82b..535c3dad 100644 --- a/components/publish/PublishVisibilityPicker.vue +++ b/components/publish/PublishVisibilityPicker.vue @@ -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 } diff --git a/components/search/SearchResult.vue b/components/search/SearchResult.vue index 3dd87895..fb7d339f 100644 --- a/components/search/SearchResult.vue +++ b/components/search/SearchResult.vue @@ -6,7 +6,7 @@ defineProps<{ active: boolean }>() -const onActivate = () => { +function onActivate() { (document.activeElement as HTMLElement).blur() } diff --git a/components/search/SearchWidget.vue b/components/search/SearchWidget.vue index f452a342..c6736134 100644 --- a/components/search/SearchWidget.vue +++ b/components/search/SearchWidget.vue @@ -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) diff --git a/components/settings/SettingsFontSize.vue b/components/settings/SettingsFontSize.vue index 8b8de08b..ad1cef54 100644 --- a/components/settings/SettingsFontSize.vue +++ b/components/settings/SettingsFontSize.vue @@ -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] } diff --git a/components/settings/SettingsProfileMetadata.vue b/components/settings/SettingsProfileMetadata.vue index ea821360..ba1df14c 100644 --- a/components/settings/SettingsProfileMetadata.vue +++ b/components/settings/SettingsProfileMetadata.vue @@ -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() } diff --git a/components/status/StatusActions.vue b/components/status/StatusActions.vue index 335ff064..15f6ee71 100644 --- a/components/status/StatusActions.vue +++ b/components/status/StatusActions.vue @@ -22,7 +22,7 @@ const { toggleReblog, } = $(useStatusActions(props)) -const reply = () => { +function reply() { if (!checkLogin()) return if (details) diff --git a/components/status/StatusActionsMore.vue b/components/status/StatusActionsMore.vue index d957dd7d..2f861b54 100644 --- a/components/status/StatusActionsMore.vue +++ b/components/status/StatusActionsMore.vue @@ -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) } diff --git a/components/status/StatusTranslation.vue b/components/status/StatusTranslation.vue index 67f2c84a..4334b084 100644 --- a/components/status/StatusTranslation.vue +++ b/components/status/StatusTranslation.vue @@ -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() diff --git a/components/status/edit/StatusEditHistory.vue b/components/status/edit/StatusEditHistory.vue index 8b20ed3a..8fb5efcf 100644 --- a/components/status/edit/StatusEditHistory.vue +++ b/components/status/edit/StatusEditHistory.vue @@ -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() +}