chore(deps): update lint (#2233)

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: Anthony Fu <anthonyfu117@hotmail.com>
zio/stable
renovate[bot] 2023-08-02 10:28:18 +00:00 committed by GitHub
parent 603e10b6ca
commit 67d5d5c00a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
18 changed files with 349 additions and 270 deletions

View File

@ -13,6 +13,7 @@
"vue/no-restricted-syntax":["error", { "vue/no-restricted-syntax":["error", {
"selector": "VElement[name='a']", "selector": "VElement[name='a']",
"message": "Use NuxtLink instead." "message": "Use NuxtLink instead."
}] }],
"n/prefer-global/process": "off"
} }
} }

View File

@ -39,7 +39,7 @@ defineSlots<{
number: number number: number
update: () => void update: () => void
}) => void }) => void
loading: (props: {}) => void loading: (props: object) => void
done: (props: { items: U[] }) => void done: (props: { items: U[] }) => void
}>() }>()

View File

@ -10,8 +10,8 @@ const props = withDefaults(defineProps<{
}) })
defineSlots<{ defineSlots<{
icon: (props: {}) => void icon: (props: object) => void
default: (props: {}) => void default: (props: object) => void
}>() }>()
const router = useRouter() const router = useRouter()

View File

@ -10,7 +10,7 @@ defineProps<{
defineEmits(['hide', 'subscribe']) defineEmits(['hide', 'subscribe'])
defineSlots<{ defineSlots<{
error: (props: {}) => void error: (props: object) => void
}>() }>()
const xl = useMediaQuery('(min-width: 1280px)') const xl = useMediaQuery('(min-width: 1280px)')

View File

@ -4,7 +4,7 @@ import type { FontSize } from '~/composables/settings'
const userSettings = useUserSettings() const userSettings = useUserSettings()
const sizes = (new Array(11)).fill(0).map((x, i) => `${10 + i}px`) as FontSize[] const sizes = (Array.from({ length: 11 })).fill(0).map((x, i) => `${10 + i}px`) as FontSize[]
function setFontSize(e: Event) { function setFontSize(e: Event) {
if (e.target && 'valueAsNumber' in e.target) if (e.target && 'valueAsNumber' in e.target)

View File

@ -18,7 +18,7 @@ const { as = 'button', command, disabled, content, icon } = defineProps<{
}>() }>()
defineSlots<{ defineSlots<{
text: (props: {}) => void text: (props: object) => void
}>() }>()
const el = ref<HTMLDivElement>() const el = ref<HTMLDivElement>()

View File

@ -1,13 +1,14 @@
<script setup lang="ts"> <script setup lang="ts">
import { getEmojiMatchesInText } from '@iconify/utils/lib/emoji/replace/find' import { getEmojiMatchesInText } from '@iconify/utils/lib/emoji/replace/find'
import CommonScrollIntoView from '../common/CommonScrollIntoView.vue' import CommonScrollIntoView from '../common/CommonScrollIntoView.vue'
import type { CustomEmoji, Emoji } from '~~/composables/tiptap/suggestion' import type { CustomEmoji, Emoji } from '~/composables/tiptap/suggestion'
import { isCustomEmoji } from '~~/composables/tiptap/suggestion' import { isCustomEmoji } from '~/composables/tiptap/suggestion'
import { emojiFilename, emojiPrefix, emojiRegEx } from '~~/config/emojis' import { emojiFilename, emojiPrefix, emojiRegEx } from '~~/config/emojis'
import type { CommandHandler } from '~/composables/command'
const { items, command } = defineProps<{ const { items, command } = defineProps<{
items: (CustomEmoji | Emoji)[] items: (CustomEmoji | Emoji)[]
command: Function command: CommandHandler<any>
isPending?: boolean isPending?: boolean
}>() }>()

View File

@ -1,10 +1,11 @@
<script setup lang="ts"> <script setup lang="ts">
import type { mastodon } from 'masto' import type { mastodon } from 'masto'
import CommonScrollIntoView from '../common/CommonScrollIntoView.vue' import CommonScrollIntoView from '../common/CommonScrollIntoView.vue'
import type { CommandHandler } from '~/composables/command'
const { items, command } = defineProps<{ const { items, command } = defineProps<{
items: mastodon.v1.Tag[] items: mastodon.v1.Tag[]
command: Function command: CommandHandler<{ id: string }>
isPending?: boolean isPending?: boolean
}>() }>()

View File

@ -1,10 +1,11 @@
<script setup lang="ts"> <script setup lang="ts">
import type { mastodon } from 'masto' import type { mastodon } from 'masto'
import CommonScrollIntoView from '../common/CommonScrollIntoView.vue' import CommonScrollIntoView from '../common/CommonScrollIntoView.vue'
import type { CommandHandler } from '~/composables/command'
const { items, command } = defineProps<{ const { items, command } = defineProps<{
items: mastodon.v1.Account[] items: mastodon.v1.Account[]
command: Function command: CommandHandler<{ id: string }>
isPending?: boolean isPending?: boolean
}>() }>()

View File

@ -52,6 +52,9 @@ export type ResolvedCommand = Exclude<CommandProvider, 'icon' | 'name' | 'descri
bindings: string[] | undefined bindings: string[] | undefined
} }
// TODO: define a type for command arg
export type CommandHandler<T = void> = (arg: T) => void
export interface BaseQueryResultItem { export interface BaseQueryResultItem {
index: number index: number
type: string type: string
@ -78,7 +81,7 @@ export interface QueryResult {
grouped: Map<CommandScopeNames, QueryResultItem[]> grouped: Map<CommandScopeNames, QueryResultItem[]>
} }
function r<T extends Object | undefined>(i: T | (() => T)): T { function resolveFunction<T>(i: T): T extends () => infer R ? R : T {
return typeof i === 'function' ? i() : i return typeof i === 'function' ? i() : i
} }
@ -90,10 +93,10 @@ export const useCommandRegistry = defineStore('command', () => {
.filter(command => command.visible ? command.visible() : true) .filter(command => command.visible ? command.visible() : true)
.map(provider => ({ .map(provider => ({
...provider, ...provider,
icon: r(provider.icon), icon: resolveFunction(provider.icon),
name: r(provider.name), name: resolveFunction(provider.name),
description: r(provider.description), description: resolveFunction(provider.description),
bindings: r(provider.bindings), bindings: resolveFunction(provider.bindings),
}))) })))
let lastScope = '' let lastScope = ''

View File

@ -33,7 +33,7 @@ export function useIsMac() {
?? navigator?.platform?.includes('Mac') ?? false) ?? navigator?.platform?.includes('Mac') ?? false)
} }
export function isEmptyObject(object: Object) { export function isEmptyObject(object: object) {
return Object.keys(object).length === 0 return Object.keys(object).length === 0
} }

View File

@ -27,7 +27,7 @@ export function useDeactivated() {
* *
* for handling problems caused by the keepalive function * for handling problems caused by the keepalive function
*/ */
export function onReactivated(hook: Function, target?: ComponentInternalInstance | null): void { export function onReactivated(hook: () => void, target?: ComponentInternalInstance | null): void {
const initial = ref(true) const initial = ref(true)
onActivated(() => { onActivated(() => {
if (initial.value) if (initial.value)

View File

@ -103,7 +103,7 @@
"workbox-window": "^7.0.0" "workbox-window": "^7.0.0"
}, },
"devDependencies": { "devDependencies": {
"@antfu/eslint-config": "^0.39.6", "@antfu/eslint-config": "^0.40.0",
"@antfu/ni": "^0.21.5", "@antfu/ni": "^0.21.5",
"@types/chroma-js": "^2.4.0", "@types/chroma-js": "^2.4.0",
"@types/file-saver": "^2.0.5", "@types/file-saver": "^2.0.5",
@ -116,7 +116,7 @@
"@unlazy/nuxt": "^0.9.2", "@unlazy/nuxt": "^0.9.2",
"bumpp": "^9.1.1", "bumpp": "^9.1.1",
"consola": "^3.2.3", "consola": "^3.2.3",
"eslint": "^8.44.0", "eslint": "^8.46.0",
"flat": "^5.0.2", "flat": "^5.0.2",
"fs-extra": "^11.1.1", "fs-extra": "^11.1.1",
"lint-staged": "^13.2.3", "lint-staged": "^13.2.3",

File diff suppressed because it is too large Load Diff

View File

@ -1,4 +1,5 @@
import { rm, writeFile } from 'node:fs/promises' import { rm, writeFile } from 'node:fs/promises'
import process from 'node:process'
import { resolve } from 'pathe' import { resolve } from 'pathe'
import type { PngOptions, ResizeOptions } from 'sharp' import type { PngOptions, ResizeOptions } from 'sharp'
import sharp from 'sharp' import sharp from 'sharp'

View File

@ -1,3 +1,4 @@
import process from 'node:process'
import fs from 'fs-extra' import fs from 'fs-extra'
import { emojiPrefix, iconifyEmojiPackage } from '../config/emojis' import { emojiPrefix, iconifyEmojiPackage } from '../config/emojis'
import { colorsMap } from './generate-themes' import { colorsMap } from './generate-themes'

View File

@ -1,7 +1,7 @@
/// <reference lib="WebWorker" /> /// <reference lib="WebWorker" />
declare const self: ServiceWorkerGlobalScope declare const self: ServiceWorkerGlobalScope
const clientResolves: { [key: string]: Function } = {} const clientResolves: { [key: string]: () => void } = {}
self.addEventListener('message', (event) => { self.addEventListener('message', (event) => {
if (event.data.action !== 'ready-to-receive') if (event.data.action !== 'ready-to-receive')

View File

@ -1,3 +1,4 @@
import process from 'node:process'
import type { Variant } from 'unocss' import type { Variant } from 'unocss'
import { import {
defineConfig, defineConfig,