1
0
mirror of https://github.com/elk-zone/elk synced 2024-11-27 06:18:07 +09:00

fix: fix vue/no-ref-as-operand and vue/return-in-computed-property ESLint errors (#2679)

This commit is contained in:
TAKAHASHI Shuuji 2024-03-11 19:53:25 +09:00 committed by GitHub
parent ed8a1811cc
commit 3b1a66c93c
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
9 changed files with 14 additions and 10 deletions

View File

@ -22,7 +22,7 @@ onMounted(() => {
const commandMode = computed(() => input.value.startsWith('>')) const commandMode = computed(() => input.value.startsWith('>'))
const query = computed(() => commandMode ? '' : input.value.trim()) const query = computed(() => commandMode.value ? '' : input.value.trim())
const { accounts, hashtags, loading } = useSearch(query) const { accounts, hashtags, loading } = useSearch(query)
@ -61,7 +61,7 @@ const searchResult = computed<QueryResult>(() => {
} }
}) })
const result = computed<QueryResult>(() => commandMode const result = computed<QueryResult>(() => commandMode.value
? registry.query(scopes.value.map(s => s.id).join('.'), input.value.slice(1).trim()) ? registry.query(scopes.value.map(s => s.id).join('.'), input.value.slice(1).trim())
: searchResult.value, : searchResult.value,
) )

View File

@ -92,7 +92,7 @@ async function removeList() {
async function clearError() { async function clearError() {
actionError.value = undefined actionError.value = undefined
await nextTick() await nextTick()
if (isEditing) if (isEditing.value)
input.value?.focus() input.value?.focus()
else else
deleteBtn.value?.focus() deleteBtn.value?.focus()

View File

@ -17,7 +17,7 @@ const isMute = computed(() => props.extraOptionType === 'mute')
function handleChoice(choice: ConfirmDialogChoice['choice']) { function handleChoice(choice: ConfirmDialogChoice['choice']) {
const dialogChoice = { const dialogChoice = {
choice, choice,
...isMute && { ...isMute.value && {
extraOptions: { extraOptions: {
mute: { mute: {
duration: hasDuration.value ? duration.value : 0, duration: hasDuration.value ? duration.value : 0,

View File

@ -72,7 +72,7 @@ function onEnter(e: KeyboardEvent) {
} }
function escapeAutocomplete(evt: KeyboardEvent) { function escapeAutocomplete(evt: KeyboardEvent) {
if (!autocompleteShow) if (!autocompleteShow.value)
return return
autocompleteShow.value = false autocompleteShow.value = false
evt.stopPropagation() evt.stopPropagation()

View File

@ -59,7 +59,7 @@ export function useSearch(query: MaybeRefOrGetter<string>, options: UseSearchOpt
} }
watch(() => resolveUnref(query), () => { watch(() => resolveUnref(query), () => {
loading.value = !!(q && isHydrated.value) loading.value = !!(q.value && isHydrated.value)
}) })
debouncedWatch(() => resolveUnref(query), async () => { debouncedWatch(() => resolveUnref(query), async () => {
@ -87,7 +87,7 @@ export function useSearch(query: MaybeRefOrGetter<string>, options: UseSearchOpt
}, { debounce: 300 }) }, { debounce: 300 })
const next = async () => { const next = async () => {
if (!q || !isHydrated.value || !paginator) if (!q.value || !isHydrated.value || !paginator)
return return
loading.value = true loading.value = true

View File

@ -64,7 +64,7 @@ export function usePushManager() {
policy?: mastodon.v1.WebPushSubscriptionPolicy, policy?: mastodon.v1.WebPushSubscriptionPolicy,
force?: boolean, force?: boolean,
): Promise<SubscriptionResult> => { ): Promise<SubscriptionResult> => {
if (!isSupported) if (!isSupported.value)
return 'not-supported' return 'not-supported'
if (!currentUser.value) if (!currentUser.value)
@ -112,7 +112,7 @@ export function usePushManager() {
} }
const unsubscribe = async () => { const unsubscribe = async () => {
if (!isSupported || !isSubscribed || !currentUser.value) if (!isSupported.value || !isSubscribed.value || !currentUser.value)
return false return false
await removePushNotifications(currentUser.value) await removePushNotifications(currentUser.value)

View File

@ -21,7 +21,7 @@ const { data: status, pending, refresh: refreshStatus } = useAsyncData(
) )
const { client } = useMasto() const { client } = useMasto()
const { data: context, pending: pendingContext, refresh: refreshContext } = useAsyncData( const { data: context, pending: pendingContext, refresh: refreshContext } = useAsyncData(
`context:${id}`, `context:${id.value}`,
async () => client.value.v1.statuses.$select(id.value).context.fetch(), async () => client.value.v1.statuses.$select(id.value).context.fetch(),
{ watch: [isHydrated], immediate: isHydrated.value, lazy: true, default: () => shallowRef() }, { watch: [isHydrated], immediate: isHydrated.value, lazy: true, default: () => shallowRef() },
) )

View File

@ -32,6 +32,8 @@ const filter = computed<mastodon.v1.NotificationType | undefined>(() => {
const actualFilter = Array.isArray(rawFilter) ? rawFilter[0] : rawFilter const actualFilter = Array.isArray(rawFilter) ? rawFilter[0] : rawFilter
if (isNotificationFilter(actualFilter)) if (isNotificationFilter(actualFilter))
return actualFilter return actualFilter
return undefined
}) })
const filterIconMap: Record<mastodon.v1.NotificationType, string> = { const filterIconMap: Record<mastodon.v1.NotificationType, string> = {

View File

@ -12,6 +12,8 @@ const filter = computed<mastodon.v1.NotificationType | undefined>(() => {
const actualFilter = Array.isArray(rawFilter) ? rawFilter[0] : rawFilter const actualFilter = Array.isArray(rawFilter) ? rawFilter[0] : rawFilter
if (isNotification(actualFilter)) if (isNotification(actualFilter))
return actualFilter return actualFilter
return undefined
}) })
useHydratedHead({ useHydratedHead({