Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(deps): update dependency @antfu/eslint-config to v3 #2984

Merged
merged 3 commits into from
Sep 30, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion components/command/CommandPanel.vue
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<script setup lang="ts">
import type { SearchResult as SearchResultType } from '~/composables/masto/search'
import type { CommandScope, QueryResult, QueryResultItem } from '~/composables/command'
import type { SearchResult as SearchResultType } from '~/composables/masto/search'

const emit = defineEmits<{
(event: 'close'): void
Expand Down
2 changes: 1 addition & 1 deletion components/common/CommonInputImage.vue
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<script setup lang="ts">
import { fileOpen } from 'browser-fs-access'
import type { FileWithHandle } from 'browser-fs-access'
import { fileOpen } from 'browser-fs-access'

const props = withDefaults(defineProps<{
/** The image src before change */
Expand Down
2 changes: 1 addition & 1 deletion components/common/CommonPaginator.vue
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<script setup lang="ts" generic="T, O, U = T">
import type { mastodon } from 'masto'
// @ts-expect-error missing types
import { DynamicScroller } from 'vue-virtual-scroller'
import 'vue-virtual-scroller/dist/vue-virtual-scroller.css'
import type { mastodon } from 'masto'

const {
paginator,
Expand Down
2 changes: 1 addition & 1 deletion components/modal/ModalContainer.vue
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
<script setup lang="ts">
import type { mastodon } from 'masto'
import type { ConfirmDialogChoice } from '~/types'
import {
isCommandPanelOpen,
isConfirmDialogOpen,
Expand All @@ -14,6 +13,7 @@ import {
isReportDialogOpen,
isSigninDialogOpen,
} from '~/composables/dialog'
import type { ConfirmDialogChoice } from '~/types'

const isMac = useIsMac()

Expand Down
2 changes: 1 addition & 1 deletion components/modal/ModalMediaPreviewCarousel.vue
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<script setup lang="ts">
import type { Vector2 } from '@vueuse/gesture'
import type { mastodon } from 'masto'
import { useGesture } from '@vueuse/gesture'
import { useReducedMotion } from '@vueuse/motion'
import type { mastodon } from 'masto'

const { media = [] } = defineProps<{
media?: mastodon.v1.MediaAttachment[]
Expand Down
4 changes: 2 additions & 2 deletions components/nav/NavBottom.vue
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@
import type { Component } from 'vue'
import type { NavButtonName } from '../../composables/settings'

import { STORAGE_KEY_BOTTOM_NAV_BUTTONS } from '~/constants'

import { NavButtonExplore, NavButtonFederated, NavButtonHome, NavButtonLocal, NavButtonMention, NavButtonMoreMenu, NavButtonNotification, NavButtonSearch } from '#components'

import { STORAGE_KEY_BOTTOM_NAV_BUTTONS } from '~/constants'

interface NavButton {
name: string
component: Component
Expand Down
2 changes: 1 addition & 1 deletion components/notification/NotificationPaginator.vue
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<script setup lang="ts">
import type { mastodon } from 'masto'
// @ts-expect-error missing types
import { DynamicScrollerItem } from 'vue-virtual-scroller'
import type { mastodon } from 'masto'
import type { GroupedAccountLike, NotificationSlot } from '~/types'

const { paginator, stream } = defineProps<{
Expand Down
2 changes: 1 addition & 1 deletion components/publish/PublishEmojiPicker.client.vue
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<script setup lang="ts">
import importEmojiLang from 'virtual:emoji-mart-lang-importer'
import type { Picker } from 'emoji-mart'
import importEmojiLang from 'virtual:emoji-mart-lang-importer'

const emit = defineEmits<{
(e: 'select', code: string): void
Expand Down
13 changes: 6 additions & 7 deletions components/publish/PublishLanguagePicker.vue
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,13 @@ const fuse = new Fuse(languagesNameList, {
const languages = computed(() =>
languageKeyword.value.trim()
? fuse.search(languageKeyword.value).map(r => r.item)
: [...languagesNameList].filter(entry => !userSettings.value.disabledTranslationLanguages.includes(entry.code))
.sort(({ code: a }, { code: b }) => {
// Put English on the top
if (a === 'en')
return -1
: [...languagesNameList].filter(entry => !userSettings.value.disabledTranslationLanguages.includes(entry.code)).sort(({ code: a }, { code: b }) => {
// Put English on the top
if (a === 'en')
return -1

return a === modelValue.value ? -1 : b === modelValue.value ? 1 : a.localeCompare(b)
}),
return a === modelValue.value ? -1 : b === modelValue.value ? 1 : a.localeCompare(b)
}),
)

const preferredLanguages = computed(() => {
Expand Down
2 changes: 1 addition & 1 deletion components/publish/PublishWidget.vue
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<script setup lang="ts">
import type { mastodon } from 'masto'
import { EditorContent } from '@tiptap/vue-3'
import stringLength from 'string-length'
import type { mastodon } from 'masto'
import type { DraftItem } from '~/types'

const {
Expand Down
2 changes: 1 addition & 1 deletion components/settings/SettingsFontSize.vue
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<script setup lang="ts">
import { DEFAULT_FONT_SIZE } from '~/constants'
import type { FontSize } from '~/composables/settings'
import { DEFAULT_FONT_SIZE } from '~/constants'

const userSettings = useUserSettings()

Expand Down
12 changes: 6 additions & 6 deletions components/settings/SettingsItem.vue
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,12 @@ useCommand({
scope: 'Settings',

name: () => props.text
?? (props.to
? typeof props.to === 'string'
? props.to
: props.to.name
: ''
),
?? (props.to
? typeof props.to === 'string'
? props.to
: props.to.name
: ''
),
description: () => props.description,
icon: () => props.icon || '',
visible: () => props.command && props.to,
Expand Down
2 changes: 1 addition & 1 deletion components/settings/SettingsLanguage.vue
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<script setup lang="ts">
import type { ComputedRef } from 'vue'
import type { LocaleObject } from '@nuxtjs/i18n'
import type { ComputedRef } from 'vue'

const userSettings = useUserSettings()

Expand Down
2 changes: 1 addition & 1 deletion components/status/StatusAttachment.vue
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<script setup lang="ts">
import { clamp } from '@vueuse/core'
import type { mastodon } from 'masto'
import { clamp } from '@vueuse/core'
import { decode } from 'blurhash'

const {
Expand Down
2 changes: 1 addition & 1 deletion components/status/StatusSpoiler.vue
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ const expandSpoilers = computed(() => {

return !props.filter // always prevent expansion if filtered
&& ((props.sensitiveNonSpoiler && expandMedia)
|| (!props.sensitiveNonSpoiler && expandCW))
|| (!props.sensitiveNonSpoiler && expandCW))
})

const hideContent = props.enabled || props.sensitiveNonSpoiler
Expand Down
2 changes: 1 addition & 1 deletion components/timeline/TimelinePaginator.vue
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<script setup lang="ts">
import type { mastodon } from 'masto'
// @ts-expect-error missing types
import { DynamicScrollerItem } from 'vue-virtual-scroller'
import 'vue-virtual-scroller/dist/vue-virtual-scroller.css'
import type { mastodon } from 'masto'

const { paginator, stream, account, buffer = 10, endMessage = true } = defineProps<{
paginator: mastodon.Paginator<mastodon.v1.Status[], mastodon.rest.v1.ListAccountStatusesParams>
Expand Down
2 changes: 1 addition & 1 deletion components/tiptap/TiptapCodeBlock.vue
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<script setup lang="ts">
import { NodeViewContent, NodeViewWrapper, nodeViewProps } from '@tiptap/vue-3'
import { NodeViewContent, nodeViewProps, NodeViewWrapper } from '@tiptap/vue-3'

const props = defineProps(nodeViewProps)

Expand Down
4 changes: 2 additions & 2 deletions components/tiptap/TiptapEmojiList.vue
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
<script setup lang="ts">
import { getEmojiMatchesInText } from '@iconify/utils/lib/emoji/replace/find'
import type { CustomEmoji, Emoji } from '~/composables/tiptap/suggestion'
import { isCustomEmoji } from '~/composables/tiptap/suggestion'
import { emojiFilename, emojiPrefix, emojiRegEx } from '~~/config/emojis'
import type { CommandHandler } from '~/composables/command'
import type { CustomEmoji, Emoji } from '~/composables/tiptap/suggestion'
import { isCustomEmoji } from '~/composables/tiptap/suggestion'

const { items, command } = defineProps<{
items: (CustomEmoji | Emoji)[]
Expand Down
33 changes: 15 additions & 18 deletions composables/cache.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { LRUCache } from 'lru-cache'
import type { mastodon } from 'masto'
import { LRUCache } from 'lru-cache'

const cache = new LRUCache<string, any>({
max: 1000,
Expand All @@ -25,11 +25,10 @@ export function fetchStatus(id: string, force = false): Promise<mastodon.v1.Stat
if (cached && !force)
return Promise.resolve(cached)

const promise = useMastoClient().v1.statuses.$select(id).fetch()
.then((status) => {
cacheStatus(status)
return status
})
const promise = useMastoClient().v1.statuses.$select(id).fetch().then((status) => {
cacheStatus(status)
return status
})
cache.set(key, promise)
return promise
}
Expand All @@ -46,14 +45,13 @@ export function fetchAccountById(id?: string | null): Promise<mastodon.v1.Accoun
return Promise.resolve(cached)

const domain = getInstanceDomainFromServer(server)
const promise = useMastoClient().v1.accounts.$select(id).fetch()
.then((r) => {
if (r.acct && !r.acct.includes('@') && domain)
r.acct = `${r.acct}@${domain}`
const promise = useMastoClient().v1.accounts.$select(id).fetch().then((r) => {
if (r.acct && !r.acct.includes('@') && domain)
r.acct = `${r.acct}@${domain}`

cacheAccount(r, server, true)
return r
})
cacheAccount(r, server, true)
return r
})
cache.set(key, promise)
return promise
}
Expand Down Expand Up @@ -101,11 +99,10 @@ export function fetchTag(tagName: string, force = false): Promise<mastodon.v1.Ta
if (cached && !force)
return Promise.resolve(cached)

const promise = useMastoClient().v1.tags.$select(tagName).fetch()
.then((tag) => {
cacheTag(tag)
return tag
})
const promise = useMastoClient().v1.tags.$select(tagName).fetch().then((tag) => {
cacheTag(tag)
return tag
})
cache.set(key, promise)
return promise
}
Expand Down
4 changes: 2 additions & 2 deletions composables/command.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import type { LocaleObject } from '@nuxtjs/i18n'
import type { ComputedRef } from 'vue'
import { defineStore } from 'pinia'
import Fuse from 'fuse.js'
import type { LocaleObject } from '@nuxtjs/i18n'
import { defineStore } from 'pinia'
import type { SearchResult } from '~/composables/masto/search'

// @unocss-include
Expand Down
2 changes: 1 addition & 1 deletion composables/content-parse.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
// @unimport-disable
import type { mastodon } from 'masto'
import type { Node } from 'ultrahtml'
import { DOCUMENT_NODE, ELEMENT_NODE, TEXT_NODE, h, parse, render } from 'ultrahtml'
import { findAndReplaceEmojisInText } from '@iconify/utils'
import { decode } from 'tiny-decode'
import { DOCUMENT_NODE, ELEMENT_NODE, h, parse, render, TEXT_NODE } from 'ultrahtml'
import { emojiRegEx, getEmojiAttributes } from '../config/emojis'

export interface ContentParseOptions {
Expand Down
16 changes: 8 additions & 8 deletions composables/content-render.ts
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
import { ELEMENT_NODE, TEXT_NODE } from 'ultrahtml'
import type { ElementNode, Node } from 'ultrahtml'
import { Fragment, h, isVNode } from 'vue'
import type { VNode } from 'vue'
import { RouterLink } from 'vue-router'
import { decode } from 'tiny-decode'
import type { ContentParseOptions } from './content-parse'
import { parseMastodonHTML } from './content-parse'
import Emoji from '~/components/emoji/Emoji.vue'
import ContentCode from '~/components/content/ContentCode.vue'
import ContentMentionGroup from '~/components/content/ContentMentionGroup.vue'
import { decode } from 'tiny-decode'
import { ELEMENT_NODE, TEXT_NODE } from 'ultrahtml'
import { Fragment, h, isVNode } from 'vue'
import { RouterLink } from 'vue-router'
import AccountHoverWrapper from '~/components/account/AccountHoverWrapper.vue'
import TagHoverWrapper from '~/components/account/TagHoverWrapper.vue'
import ContentCode from '~/components/content/ContentCode.vue'
import ContentMentionGroup from '~/components/content/ContentMentionGroup.vue'
import Emoji from '~/components/emoji/Emoji.vue'
import { parseMastodonHTML } from './content-parse'

function getTextualAstComponents(astChildren: Node[]): string {
return astChildren
Expand Down
2 changes: 1 addition & 1 deletion composables/dialog.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import type { mastodon } from 'masto'
import type { ConfirmDialogChoice, ConfirmDialogOptions, DraftItem, ErrorDialogData } from '~/types'
import { STORAGE_KEY_FIRST_VISIT } from '~/constants'
import type { ConfirmDialogChoice, ConfirmDialogOptions, DraftItem, ErrorDialogData } from '~/types'

export const confirmDialogChoice = ref<ConfirmDialogChoice>()
export const confirmDialogLabel = ref<ConfirmDialogOptions>()
Expand Down
2 changes: 1 addition & 1 deletion composables/masto/masto.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import type { Pausable } from '@vueuse/core'
import type { mastodon } from 'masto'
import { createRestAPIClient, createStreamingAPIClient } from 'masto'
import type { Ref } from 'vue'
import type { ElkInstance } from '../users'
import { createRestAPIClient, createStreamingAPIClient } from 'masto'
import type { UserLogin } from '~/types'

export function createMasto() {
Expand Down
26 changes: 13 additions & 13 deletions composables/masto/publish.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { fileOpen } from 'browser-fs-access'
import type { Ref } from 'vue'
import type { mastodon } from 'masto'
import type { DraftItem } from '~~/types'
import type { mastodon } from 'masto'
import type { Ref } from 'vue'
import { fileOpen } from 'browser-fs-access'

export function usePublish(options: {
draftItem: Ref<DraftItem>
Expand Down Expand Up @@ -45,16 +45,16 @@ export function usePublish(options: {
|| failedMessages.value.length > 0
|| (attachments.length > 0 && params.poll !== null && params.poll !== undefined)
|| ((params.poll !== null && params.poll !== undefined)
&& (
(firstEmptyInputIndex !== -1
&& firstEmptyInputIndex !== params.poll.options.length - 1
)
|| params.poll.options.findLastIndex(option => option.trim().length > 0) + 1 < 2
|| (new Set(params.poll.options).size !== params.poll.options.length)
|| (currentInstance.value?.configuration?.polls.maxCharactersPerOption !== undefined
&& params.poll.options.find(option => option.length > currentInstance.value!.configuration!.polls.maxCharactersPerOption) !== undefined
)
))
&& (
(firstEmptyInputIndex !== -1
&& firstEmptyInputIndex !== params.poll.options.length - 1
)
|| params.poll.options.findLastIndex(option => option.trim().length > 0) + 1 < 2
|| (new Set(params.poll.options).size !== params.poll.options.length)
|| (currentInstance.value?.configuration?.polls.maxCharactersPerOption !== undefined
&& params.poll.options.find(option => option.length > currentInstance.value!.configuration!.polls.maxCharactersPerOption) !== undefined
)
))
})

watch(draftItem, () => {
Expand Down
2 changes: 1 addition & 1 deletion composables/masto/routes.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { withoutProtocol } from 'ufo'
import type { mastodon } from 'masto'
import { withoutProtocol } from 'ufo'

export function getAccountRoute(account: mastodon.v1.Account) {
return useRouter().resolve({
Expand Down
2 changes: 1 addition & 1 deletion composables/settings/metadata.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import type { Node } from 'ultrahtml'
import { decode } from 'tiny-decode'
import { TEXT_NODE, parse } from 'ultrahtml'
import { parse, TEXT_NODE } from 'ultrahtml'

export const maxAccountFieldCount = computed(() => isGlitchEdition.value ? 16 : 4)

Expand Down
4 changes: 2 additions & 2 deletions composables/settings/storage.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import type { Ref } from 'vue'
import type { LocaleObject } from '@nuxtjs/i18n'
import type { Ref } from 'vue'
import type { FontSize, OldFontSize, PreferencesSettings, UserSettings } from './definition'
import { STORAGE_KEY_SETTINGS } from '~/constants'
import { oldFontSizeMap } from '~~/constants/options'
import { STORAGE_KEY_SETTINGS } from '~/constants'

export function useUserSettings() {
const { locales } = useNuxtApp().$i18n
Expand Down
Loading