chore: update lint

This commit is contained in:
Anthony Fu 2023-03-19 13:12:20 +01:00
parent c7558ee7c5
commit 9465c2fe89
20 changed files with 164 additions and 124 deletions

View file

@ -115,7 +115,7 @@ export const useCommandRegistry = defineStore('command', () => {
.filter(cmd => (cmd.parent ?? '') === scope)
if (query) {
const fuse = lastScope === scope && lastFuse
const fuse = (lastScope === scope && lastFuse)
? lastFuse
: new Fuse(cmds, {
keys: ['scope', 'name', 'description'],

View file

@ -10,7 +10,7 @@ import ContentCode from '~/components/content/ContentCode.vue'
import ContentMentionGroup from '~/components/content/ContentMentionGroup.vue'
import AccountHoverWrapper from '~/components/account/AccountHoverWrapper.vue'
function getTexualAstComponents(astChildren: Node[]): string {
function getTextualAstComponents(astChildren: Node[]): string {
return astChildren
.filter(({ type }) => type === TEXT_NODE)
.map(({ value }) => value)
@ -27,7 +27,7 @@ export function contentToVNode(
): VNode {
let tree = parseMastodonHTML(content, options)
const textContents = getTexualAstComponents(tree.children)
const textContents = getTextualAstComponents(tree.children)
// if the username only contains emojis, we should probably show the emojis anyway to avoid a blank name
if (options?.hideEmojis && textContents.length === 0)
@ -46,8 +46,8 @@ function nodeToVNode(node: Node): VNode | string | null {
if ('children' in node) {
if (node.name === 'a' && (node.attributes.href?.startsWith('/') || node.attributes.href?.startsWith('.'))) {
node.attributes.to = node.attributes.href
// eslint-disable-next-line @typescript-eslint/no-unused-vars
const { href, target, ...attrs } = node.attributes
const { href: _href, target: _target, ...attrs } = node.attributes
return h(
RouterLink as any,
attrs,
@ -107,7 +107,9 @@ function handleCodeBlock(el: Node) {
const codeEl = el.children[0] as Node
const classes = codeEl.attributes.class as string
const lang = classes?.split(/\s/g).find(i => i.startsWith('language-'))?.replace('language-', '')
const code = codeEl.children && codeEl.children.length > 0 ? recursiveTreeToText(codeEl) : ''
const code = (codeEl.children && codeEl.children.length > 0)
? recursiveTreeToText(codeEl)
: ''
return h(ContentCode, { lang, code: encodeURIComponent(code) })
}
}

View file

@ -4,7 +4,9 @@ import { STORAGE_KEY_DRAFTS } from '~/constants'
import type { Draft, DraftMap } from '~/types'
import type { Mutable } from '~/types/utils'
export const currentUserDrafts = process.server || process.test ? computed<DraftMap>(() => ({})) : useUserLocalStorage<DraftMap>(STORAGE_KEY_DRAFTS, () => ({}))
export const currentUserDrafts = (process.server || process.test)
? computed<DraftMap>(() => ({}))
: useUserLocalStorage<DraftMap>(STORAGE_KEY_DRAFTS, () => ({}))
export const builtinDraftKeys = [
'dialog',

View file

@ -52,7 +52,7 @@ export function setupPageHeader() {
return titleTemplate
},
link: process.client && useAppConfig().pwaEnabled
link: (process.client && useAppConfig().pwaEnabled)
? () => [{
key: 'webmanifest',
rel: 'manifest',