chore: bump to eslint-config v2.8.0
(#2651)
Co-authored-by: Anthony Fu <anthonyfu117@hotmail.com>
This commit is contained in:
parent
62f70250d5
commit
9da77637b2
48 changed files with 896 additions and 511 deletions
|
@ -170,7 +170,8 @@ export const useCommandRegistry = defineStore('command', () => {
|
|||
const indexed = cmds.map((cmd, index) => ({ ...cmd, index }))
|
||||
|
||||
const grouped = new Map<CommandScopeNames, CommandQueryResultItem[]>(
|
||||
scopes.map(scope => [scope, []]))
|
||||
scopes.map(scope => [scope, []]),
|
||||
)
|
||||
for (const cmd of indexed) {
|
||||
const scope = cmd.scope ?? ''
|
||||
grouped.get(scope)!.push({
|
||||
|
|
|
@ -494,7 +494,10 @@ function _markdownProcess(value: string) {
|
|||
|
||||
let start = 0
|
||||
while (true) {
|
||||
let found: { match: RegExpMatchArray; replacer: (c: (string | Node)[]) => Node } | undefined
|
||||
let found: {
|
||||
match: RegExpMatchArray
|
||||
replacer: (c: (string | Node)[]) => Node
|
||||
} | undefined
|
||||
|
||||
for (const [re, replacer] of _markdownReplacements) {
|
||||
re.lastIndex = start
|
||||
|
|
|
@ -29,8 +29,10 @@ export function useHumanReadableNumber() {
|
|||
}
|
||||
}
|
||||
|
||||
export function useFormattedDateTime(value: MaybeRefOrGetter<string | number | Date | undefined | null>,
|
||||
options: Intl.DateTimeFormatOptions = { dateStyle: 'long', timeStyle: 'medium' }) {
|
||||
export function useFormattedDateTime(
|
||||
value: MaybeRefOrGetter<string | number | Date | undefined | null>,
|
||||
options: Intl.DateTimeFormatOptions = { dateStyle: 'long', timeStyle: 'medium' },
|
||||
) {
|
||||
const { locale } = useI18n()
|
||||
const formatter = computed(() => Intl.DateTimeFormat(locale.value, options))
|
||||
return computed(() => {
|
||||
|
|
|
@ -36,9 +36,11 @@ export function useMagicSequence(keys: string[]): ComputedRef<boolean> {
|
|||
down = false
|
||||
success.value = true
|
||||
}
|
||||
}, {
|
||||
},
|
||||
{
|
||||
deep: true,
|
||||
})
|
||||
},
|
||||
)
|
||||
|
||||
return computed(() => success.value)
|
||||
}
|
||||
|
|
|
@ -36,23 +36,22 @@ export function usePublish(options: {
|
|||
const { params, attachments } = draft.value
|
||||
const firstEmptyInputIndex = params.poll?.options.findIndex(option => option.trim().length === 0)
|
||||
return isEmpty.value
|
||||
|| options.isUploading.value
|
||||
|| isSending.value
|
||||
|| (attachments.length === 0 && !params.status)
|
||||
|| 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
|
||||
)
|
||||
)
|
||||
)
|
||||
|| options.isUploading.value
|
||||
|| isSending.value
|
||||
|| (attachments.length === 0 && !params.status)
|
||||
|| 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
|
||||
)
|
||||
))
|
||||
})
|
||||
|
||||
watch(draft, () => {
|
||||
|
@ -164,7 +163,7 @@ export function useUploadMediaAttachment(draft: Ref<Draft>) {
|
|||
|
||||
const maxPixels = computed(() => {
|
||||
return currentInstance.value?.configuration?.mediaAttachments?.imageMatrixLimit
|
||||
?? 4096 ** 2
|
||||
?? 4096 ** 2
|
||||
})
|
||||
|
||||
const loadImage = (inputFile: Blob) => new Promise<HTMLImageElement>((resolve, reject) => {
|
||||
|
|
|
@ -20,7 +20,7 @@ function getDefaultVisibility(currentVisibility: mastodon.v1.StatusVisibility) {
|
|||
// the post more private than the replying to post
|
||||
const preferredVisibility = currentUser.value?.account.source.privacy || 'public'
|
||||
return ALL_VISIBILITY.indexOf(currentVisibility)
|
||||
> ALL_VISIBILITY.indexOf(preferredVisibility)
|
||||
> ALL_VISIBILITY.indexOf(preferredVisibility)
|
||||
? currentVisibility
|
||||
: preferredVisibility
|
||||
}
|
||||
|
|
|
@ -95,7 +95,12 @@ export async function translateText(text: string, from: string | null | undefine
|
|||
return status
|
||||
}
|
||||
|
||||
const translations = new WeakMap<mastodon.v1.Status | mastodon.v1.StatusEdit, { visible: boolean; text: string; success: boolean; error: string }>()
|
||||
const translations = new WeakMap<mastodon.v1.Status | mastodon.v1.StatusEdit, {
|
||||
visible: boolean
|
||||
text: string
|
||||
success: boolean
|
||||
error: string
|
||||
}>()
|
||||
|
||||
export function useTranslation(status: mastodon.v1.Status | mastodon.v1.StatusEdit, to: string) {
|
||||
if (!translations.has(status))
|
||||
|
|
|
@ -6,10 +6,12 @@ import type {
|
|||
} from '~/composables/push-notifications/types'
|
||||
import { PushSubscriptionError } from '~/composables/push-notifications/types'
|
||||
|
||||
export async function createPushSubscription(user: RequiredUserLogin,
|
||||
export async function createPushSubscription(
|
||||
user: RequiredUserLogin,
|
||||
notificationData: CreatePushNotification,
|
||||
policy: mastodon.v1.WebPushSubscriptionPolicy = 'all',
|
||||
force = false): Promise<mastodon.v1.WebPushSubscription | undefined> {
|
||||
force = false,
|
||||
): Promise<mastodon.v1.WebPushSubscription | undefined> {
|
||||
const { server: serverEndpoint, vapidKey } = user
|
||||
|
||||
return await getRegistration()
|
||||
|
|
|
@ -87,7 +87,10 @@ export function usePushManager() {
|
|||
|
||||
currentUser.value.pushSubscription = await createPushSubscription(
|
||||
{
|
||||
pushSubscription, server, token, vapidKey,
|
||||
pushSubscription,
|
||||
server,
|
||||
token,
|
||||
vapidKey,
|
||||
},
|
||||
notificationData ?? {
|
||||
alerts: {
|
||||
|
|
|
@ -5,7 +5,10 @@ const highlighter = ref<Highlighter>()
|
|||
const registeredLang = ref(new Map<string, boolean>())
|
||||
let shikiImport: Promise<void> | undefined
|
||||
|
||||
export function useHighlighter(lang: Lang): { promise?: Promise<void>; highlighter?: Highlighter } {
|
||||
export function useHighlighter(lang: Lang): {
|
||||
promise?: Promise<void>
|
||||
highlighter?: Highlighter
|
||||
} {
|
||||
if (!shikiImport) {
|
||||
shikiImport = import('shiki')
|
||||
.then(async ({ getHighlighter }) => {
|
||||
|
|
|
@ -16,7 +16,11 @@ declare module '@tiptap/core' {
|
|||
/**
|
||||
* Insert a custom emoji.
|
||||
*/
|
||||
insertCustomEmoji: (options: { src: string; alt?: string; title?: string }) => ReturnType
|
||||
insertCustomEmoji: (options: {
|
||||
src: string
|
||||
alt?: string
|
||||
title?: string
|
||||
}) => ReturnType
|
||||
/**
|
||||
* Insert a emoji.
|
||||
*/
|
||||
|
|
|
@ -20,8 +20,10 @@ function wrapHandler<T extends (...args: any[]) => any>(handler: T): T {
|
|||
})
|
||||
}
|
||||
|
||||
function createEmojiRule<NR extends typeof nodeInputRule | typeof nodePasteRule>(nodeRule: NR,
|
||||
type: Parameters<NR>[0]['type']): ReturnType<NR>[] {
|
||||
function createEmojiRule<NR extends typeof nodeInputRule | typeof nodePasteRule>(
|
||||
nodeRule: NR,
|
||||
type: Parameters<NR>[0]['type'],
|
||||
): ReturnType<NR>[] {
|
||||
const rule = nodeRule({
|
||||
find: emojiRegEx as RegExp,
|
||||
type,
|
||||
|
@ -86,10 +88,10 @@ export const TiptapPluginEmoji = Node.create({
|
|||
find: InputRuleFinder
|
||||
type: NodeType
|
||||
getAttributes?:
|
||||
| Record<string, any>
|
||||
| ((match: ExtendedRegExpMatchArray) => Record<string, any>)
|
||||
| false
|
||||
| null
|
||||
| Record<string, any>
|
||||
| ((match: ExtendedRegExpMatchArray) => Record<string, any>)
|
||||
| false
|
||||
| null
|
||||
}) {
|
||||
return new InputRule({
|
||||
find: config.find,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue