From 15e646c8b1e834ad45903860c5b7b007f945cf28 Mon Sep 17 00:00:00 2001 From: naskya Date: Mon, 6 Nov 2023 21:11:39 +0900 Subject: [PATCH] chore: lint --- packages/backend/src/const.ts | 2 +- packages/backend/src/global.d.ts | 2 +- .../src/server/file/send-drive-file.ts | 3 +- packages/client/src/account.ts | 8 ++-- packages/client/src/init.ts | 38 +++++++++---------- packages/client/src/instance.ts | 2 +- packages/client/src/navbar.ts | 10 ++--- packages/client/src/nirax.ts | 8 ++-- packages/client/src/os.ts | 16 ++++---- packages/client/src/pages/attached-files.vue | 2 +- .../src/pages/settings/plugin.install.vue | 2 +- packages/client/src/plugin.ts | 7 +++- packages/client/src/router.ts | 10 ++--- packages/client/src/scripts/autocomplete.ts | 6 ++- packages/client/src/store.ts | 2 +- packages/client/src/stream.ts | 2 +- packages/client/src/widgets/aiscript.vue | 6 +-- packages/client/src/widgets/button.vue | 8 ++-- packages/client/tsconfig.json | 10 +---- packages/firefish-js/src/api.types.ts | 10 ++--- packages/firefish-js/src/index.ts | 4 +- packages/firefish-js/src/streaming.ts | 6 +-- packages/sw/tsconfig.json | 9 +---- 23 files changed, 85 insertions(+), 88 deletions(-) diff --git a/packages/backend/src/const.ts b/packages/backend/src/const.ts index 6dddf1fff..8fc4bd25e 100644 --- a/packages/backend/src/const.ts +++ b/packages/backend/src/const.ts @@ -1,7 +1,7 @@ import config from "@/config/index.js"; import { - DB_MAX_NOTE_TEXT_LENGTH, DB_MAX_IMAGE_COMMENT_LENGTH, + DB_MAX_NOTE_TEXT_LENGTH, } from "@/misc/hard-limits.js"; export const MAX_NOTE_TEXT_LENGTH = Math.min( diff --git a/packages/backend/src/global.d.ts b/packages/backend/src/global.d.ts index 503e26eb6..6c5a22e4b 100644 --- a/packages/backend/src/global.d.ts +++ b/packages/backend/src/global.d.ts @@ -1,2 +1,2 @@ -// rome-ignore lint/suspicious/noExplicitAny: i have no idea +// biome-ignore lint/suspicious/noExplicitAny: i have no idea type FIXME = any; diff --git a/packages/backend/src/server/file/send-drive-file.ts b/packages/backend/src/server/file/send-drive-file.ts index 1c4d4136b..cb2993491 100644 --- a/packages/backend/src/server/file/send-drive-file.ts +++ b/packages/backend/src/server/file/send-drive-file.ts @@ -25,7 +25,8 @@ const assets = `${_dirname}/../../server/file/assets/`; const MAX_BYTE_RANGES = 10; const commonReadableHandlerGenerator = - (ctx: Koa.Context) => (e: Error): void => { + (ctx: Koa.Context) => + (e: Error): void => { serverLogger.error(e); ctx.status = 500; ctx.set("Cache-Control", "max-age=300"); diff --git a/packages/client/src/account.ts b/packages/client/src/account.ts index d4018c721..9bfeb1cf4 100644 --- a/packages/client/src/account.ts +++ b/packages/client/src/account.ts @@ -1,12 +1,12 @@ -import { defineAsyncComponent, reactive } from "vue"; import type * as firefish from "firefish-js"; +import { defineAsyncComponent, reactive } from "vue"; import { i18n } from "./i18n"; -import { del, get, set } from "@/scripts/idb-proxy"; import { apiUrl } from "@/config"; import { alert, api, popup, popupMenu, waiting } from "@/os"; -import { reloadChannel, unisonReload } from "@/scripts/unison-reload"; -import icon from "@/scripts/icon"; import { $i } from "@/reactiveAccount"; +import icon from "@/scripts/icon"; +import { del, get, set } from "@/scripts/idb-proxy"; +import { reloadChannel, unisonReload } from "@/scripts/unison-reload"; // TODO: 他のタブと永続化されたstateを同期 diff --git a/packages/client/src/init.ts b/packages/client/src/init.ts index 41d7eabcf..ba6c9c6a2 100644 --- a/packages/client/src/init.ts +++ b/packages/client/src/init.ts @@ -7,11 +7,11 @@ import "vite/modulepreload-polyfill"; import "@/style.scss"; -import "@phosphor-icons/web/fill"; import "@phosphor-icons/web/bold"; -import "@phosphor-icons/web/regular"; -import "@phosphor-icons/web/light"; import "@phosphor-icons/web/duotone"; +import "@phosphor-icons/web/fill"; +import "@phosphor-icons/web/light"; +import "@phosphor-icons/web/regular"; // #region account indexedDB migration @@ -32,28 +32,28 @@ import { } from "vue"; import { set } from "@/scripts/idb-proxy"; -import widgets from "@/widgets"; -import directives from "@/directives"; +import { login, refreshAccount, signout, updateAccount } from "@/account"; import components from "@/components"; import { host, lang, ui, version } from "@/config"; -import { applyTheme } from "@/scripts/theme"; -import { isDeviceDarkmode } from "@/scripts/is-device-darkmode"; +import directives from "@/directives"; import { i18n } from "@/i18n"; -import { alert, api, confirm, popup, post, toast } from "@/os"; -import { stream } from "@/stream"; -import * as sound from "@/scripts/sound"; -import { login, refreshAccount, signout, updateAccount } from "@/account"; -import { $i } from "@/reactiveAccount"; -import { ColdDeviceStorage, defaultStore } from "@/store"; import { fetchInstance, instance } from "@/instance"; -import { makeHotkey } from "@/scripts/hotkey"; -import { search } from "@/scripts/search"; +import { alert, api, confirm, popup, post, toast } from "@/os"; +import { $i } from "@/reactiveAccount"; import { deviceKind } from "@/scripts/device-kind"; -import { initializeSw } from "@/scripts/initialize-sw"; -import { reloadChannel } from "@/scripts/unison-reload"; -import { reactionPicker } from "@/scripts/reaction-picker"; -import { getUrlWithoutLoginId } from "@/scripts/login-id"; import { getAccountFromId } from "@/scripts/get-account-from-id"; +import { makeHotkey } from "@/scripts/hotkey"; +import { initializeSw } from "@/scripts/initialize-sw"; +import { isDeviceDarkmode } from "@/scripts/is-device-darkmode"; +import { getUrlWithoutLoginId } from "@/scripts/login-id"; +import { reactionPicker } from "@/scripts/reaction-picker"; +import { search } from "@/scripts/search"; +import * as sound from "@/scripts/sound"; +import { applyTheme } from "@/scripts/theme"; +import { reloadChannel } from "@/scripts/unison-reload"; +import { ColdDeviceStorage, defaultStore } from "@/store"; +import { stream } from "@/stream"; +import widgets from "@/widgets"; function checkForSplash() { const splash = document.getElementById("splash"); diff --git a/packages/client/src/instance.ts b/packages/client/src/instance.ts index 783cb01ad..493baeb94 100644 --- a/packages/client/src/instance.ts +++ b/packages/client/src/instance.ts @@ -1,5 +1,5 @@ -import { computed, reactive } from "vue"; import type * as firefish from "firefish-js"; +import { computed, reactive } from "vue"; import { api } from "./os"; // TODO: 他のタブと永続化されたstateを同期 diff --git a/packages/client/src/navbar.ts b/packages/client/src/navbar.ts index 3021359e4..55cfab5bb 100644 --- a/packages/client/src/navbar.ts +++ b/packages/client/src/navbar.ts @@ -1,11 +1,11 @@ import { computed, reactive } from "vue"; -import { $i } from "@/reactiveAccount"; -import { search } from "@/scripts/search"; -import * as os from "@/os"; -import { i18n } from "@/i18n"; import { ui } from "@/config"; -import { unisonReload } from "@/scripts/unison-reload"; +import { i18n } from "@/i18n"; +import * as os from "@/os"; +import { $i } from "@/reactiveAccount"; import icon from "@/scripts/icon"; +import { search } from "@/scripts/search"; +import { unisonReload } from "@/scripts/unison-reload"; export const navbarItemDef = reactive({ notifications: { diff --git a/packages/client/src/nirax.ts b/packages/client/src/nirax.ts index 43e770ec3..e5f591719 100644 --- a/packages/client/src/nirax.ts +++ b/packages/client/src/nirax.ts @@ -3,8 +3,8 @@ import { EventEmitter } from "eventemitter3"; import type { Component, ShallowRef } from "vue"; import { Ref, ref, shallowRef } from "vue"; -import { pleaseLogin } from "@/scripts/please-login"; import { safeURIDecode } from "@/scripts/safe-uri-decode"; +import { pleaseLogin } from "@/scripts/please-login"; interface RouteDef { path: string; @@ -112,7 +112,7 @@ export class Router extends EventEmitter<{ let parts = [..._parts]; const props = new Map(); - pathMatchLoop: for (const p of parsePath(route.path)) { + for (const p of parsePath(route.path)) { if (typeof p === "string") { if (p === parts[0]) { parts.shift(); @@ -128,7 +128,7 @@ export class Router extends EventEmitter<{ props.set(p.name, safeURIDecode(parts.join("/"))); parts = []; } - break pathMatchLoop; + break; } else { if (p.startsWith) { if (parts[0] == null || !parts[0].startsWith(p.startsWith)) @@ -159,7 +159,7 @@ export class Router extends EventEmitter<{ child, }; } else { - continue forEachRouteLoop; + continue; } } diff --git a/packages/client/src/os.ts b/packages/client/src/os.ts index 0baefc68a..d367dc2fc 100644 --- a/packages/client/src/os.ts +++ b/packages/client/src/os.ts @@ -1,18 +1,18 @@ // TODO: なんでもかんでもos.tsに突っ込むのやめたいのでよしなに分割する +import { EventEmitter } from "eventemitter3"; +import * as firefish from "firefish-js"; +import insertTextAtCursor from "insert-text-at-cursor"; import type { Component, Ref } from "vue"; import { defineAsyncComponent, markRaw, ref } from "vue"; -import { EventEmitter } from "eventemitter3"; -import insertTextAtCursor from "insert-text-at-cursor"; -import * as firefish from "firefish-js"; import { i18n } from "./i18n"; -import { apiUrl, url } from "@/config"; -import MkPostFormDialog from "@/components/MkPostFormDialog.vue"; -import MkWaitingDialog from "@/components/MkWaitingDialog.vue"; -import MkToast from "@/components/MkToast.vue"; import MkDialog from "@/components/MkDialog.vue"; -import type { MenuItem } from "@/types/menu"; +import MkPostFormDialog from "@/components/MkPostFormDialog.vue"; +import MkToast from "@/components/MkToast.vue"; +import MkWaitingDialog from "@/components/MkWaitingDialog.vue"; +import { apiUrl, url } from "@/config"; import { $i } from "@/reactiveAccount"; +import type { MenuItem } from "@/types/menu"; export const pendingApiRequestsCount = ref(0); diff --git a/packages/client/src/pages/attached-files.vue b/packages/client/src/pages/attached-files.vue index e0fd09d41..91528b981 100644 --- a/packages/client/src/pages/attached-files.vue +++ b/packages/client/src/pages/attached-files.vue @@ -5,7 +5,7 @@ />
- +
diff --git a/packages/client/src/pages/settings/plugin.install.vue b/packages/client/src/pages/settings/plugin.install.vue index 59d5a9534..3b736d39e 100644 --- a/packages/client/src/pages/settings/plugin.install.vue +++ b/packages/client/src/pages/settings/plugin.install.vue @@ -21,6 +21,7 @@ import { defineAsyncComponent, nextTick, ref } from "vue"; import { Interpreter, Parser, utils } from "@syuilo/aiscript"; import { v4 as uuid } from "uuid"; +import { compareVersions } from "compare-versions"; import FormTextarea from "@/components/form/textarea.vue"; import FormButton from "@/components/MkButton.vue"; import FormInfo from "@/components/MkInfo.vue"; @@ -29,7 +30,6 @@ import { ColdDeviceStorage } from "@/store"; import { unisonReload } from "@/scripts/unison-reload"; import { i18n } from "@/i18n"; import { definePageMetadata } from "@/scripts/page-metadata"; -import { compareVersions } from "compare-versions"; import icon from "@/scripts/icon"; const code = ref(); diff --git a/packages/client/src/plugin.ts b/packages/client/src/plugin.ts index 44df90ff0..c38aaa365 100644 --- a/packages/client/src/plugin.ts +++ b/packages/client/src/plugin.ts @@ -1,6 +1,6 @@ import { Interpreter, Parser, utils, values } from "@syuilo/aiscript"; -import { createAiScriptEnv } from "@/scripts/aiscript/api"; import { inputText } from "@/os"; +import { createAiScriptEnv } from "@/scripts/aiscript/api"; import { noteActions, notePostInterruptors, @@ -114,7 +114,10 @@ function createPluginEnv(opts) { }); }), "Plugin:register_page_view_interruptor": values.FN_NATIVE(([handler]) => { - registerPageViewInterruptor({ pluginId: opts.plugin.id, handler }); + registerPageViewInterruptor({ + pluginId: opts.plugin.id, + handler, + }); }), "Plugin:open_url": values.FN_NATIVE(([url]) => { window.open(url.value, "_blank"); diff --git a/packages/client/src/router.ts b/packages/client/src/router.ts index f69cf2a22..c851de893 100644 --- a/packages/client/src/router.ts +++ b/packages/client/src/router.ts @@ -1,12 +1,12 @@ import type { AsyncComponentLoader } from "vue"; import { defineAsyncComponent, inject } from "vue"; -import { Router } from "@/nirax"; import { iAmEmojiMod, iAmModerator } from "@/account"; -import { $i } from "@/reactiveAccount"; -import MkLoading from "@/pages/_loading_.vue"; -import MkError from "@/pages/_error_.vue"; -import { api } from "@/os"; import { ui } from "@/config"; +import { Router } from "@/nirax"; +import { api } from "@/os"; +import MkError from "@/pages/_error_.vue"; +import MkLoading from "@/pages/_loading_.vue"; +import { $i } from "@/reactiveAccount"; function getGuestTimelineStatus() { api("meta", { diff --git a/packages/client/src/scripts/autocomplete.ts b/packages/client/src/scripts/autocomplete.ts index 0d5d16f18..18e56ba38 100644 --- a/packages/client/src/scripts/autocomplete.ts +++ b/packages/client/src/scripts/autocomplete.ts @@ -88,7 +88,11 @@ export class Autocomplete { const isHashtag = hashtagIndex !== -1; const isMfmTag = mfmTagIndex !== -1; const isEmoji = - emojiIndex !== -1 && text.split(/:[a-z0-9_+\-]+:/).pop()!.includes(":"); + emojiIndex !== -1 && + text + .split(/:[a-z0-9_+\-]+:/) + .pop()! + .includes(":"); let opened = false; diff --git a/packages/client/src/store.ts b/packages/client/src/store.ts index f347d3687..dfdde1b34 100644 --- a/packages/client/src/store.ts +++ b/packages/client/src/store.ts @@ -430,11 +430,11 @@ interface Plugin { ast: any[]; } +import darkTheme from "@/themes/d-rosepine.json5"; /** * Storage for configuration information that does not need to be constantly loaded into memory (non-reactive) */ import lightTheme from "@/themes/l-rosepinedawn.json5"; -import darkTheme from "@/themes/d-rosepine.json5"; export class ColdDeviceStorage { public static default = { diff --git a/packages/client/src/stream.ts b/packages/client/src/stream.ts index 28a8a2665..f0dd1879a 100644 --- a/packages/client/src/stream.ts +++ b/packages/client/src/stream.ts @@ -1,7 +1,7 @@ import * as firefish from "firefish-js"; import { markRaw } from "vue"; -import { $i } from "@/reactiveAccount"; import { url } from "@/config"; +import { $i } from "@/reactiveAccount"; export const stream = markRaw( new firefish.Stream( diff --git a/packages/client/src/widgets/aiscript.vue b/packages/client/src/widgets/aiscript.vue index 0f1469a0c..a00f143d8 100644 --- a/packages/client/src/widgets/aiscript.vue +++ b/packages/client/src/widgets/aiscript.vue @@ -28,12 +28,12 @@