From e81ed199ae0c94f1f420a24e601e150bfe47042f Mon Sep 17 00:00:00 2001 From: naskya Date: Sun, 22 Oct 2023 17:33:40 +0900 Subject: [PATCH] Revert "chore: upgrade biome + lint & format" This reverts commit a1cd9f73a1bf760198329d2c26eb3a37e82d16c7. --- package.json | 16 +- packages/backend/package.json | 2 +- packages/backend/src/const.ts | 2 +- packages/backend/src/global.d.ts | 2 +- packages/backend/test/ap-request.ts | 2 +- packages/backend/test/api-visibility.ts | 6 +- packages/backend/test/api.ts | 8 +- packages/backend/test/block.ts | 6 +- packages/backend/test/chart.ts | 8 +- packages/backend/test/fetch-resource.ts | 8 +- packages/backend/test/ff-visibility.ts | 10 +- packages/backend/test/get-file-info.ts | 2 +- packages/backend/test/mfm.ts | 2 +- packages/backend/test/mute.ts | 6 +- packages/backend/test/note.ts | 12 +- packages/backend/test/streaming.ts | 8 +- packages/backend/test/thread-mute.ts | 8 +- packages/backend/test/user-notes.ts | 8 +- packages/backend/test/utils.ts | 18 +- packages/client/package.json | 4 +- packages/client/src/account.ts | 10 +- packages/client/src/components/MkDialog.vue | 5 +- .../client/src/components/MkWaitingDialog.vue | 2 +- packages/client/src/i18n.ts | 2 +- packages/client/src/init.ts | 42 +- packages/client/src/instance.ts | 2 +- packages/client/src/navbar.ts | 12 +- packages/client/src/nirax.ts | 10 +- packages/client/src/os.ts | 20 +- packages/client/src/pages/admin/_header_.vue | 8 +- packages/client/src/plugin.ts | 8 +- packages/client/src/router.ts | 12 +- packages/client/src/scripts/autocomplete.ts | 6 +- packages/client/src/store.ts | 2 +- packages/client/src/stream.ts | 4 +- packages/client/src/theme-store.ts | 4 +- 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/megalodon/package.json | 12 +- packages/megalodon/src/index.ts | 16 +- packages/megalodon/src/megalodon.ts | 10 +- packages/megalodon/src/misskey.ts | 20 +- packages/sw/tsconfig.json | 9 +- pnpm-lock.yaml | 431 +++++++++++------- 46 files changed, 450 insertions(+), 365 deletions(-) diff --git a/package.json b/package.json index c0c0918f1..0203670c4 100644 --- a/package.json +++ b/package.json @@ -46,14 +46,14 @@ "seedrandom": "^3.0.5" }, "devDependencies": { - "@biomejs/biome": "1.3.0", - "@biomejs/cli-darwin-arm64": "^1.3.0", - "@biomejs/cli-darwin-x64": "^1.3.0", - "@biomejs/cli-linux-arm64": "^1.3.0", - "@biomejs/cli-linux-x64": "^1.3.0", - "@types/gulp": "4.0.16", - "@types/gulp-rename": "2.0.4", - "@types/node": "20.8.7", + "@biomejs/biome": "1.0.0", + "@biomejs/cli-darwin-arm64": "^1.0.0", + "@biomejs/cli-darwin-x64": "^1.0.0", + "@biomejs/cli-linux-arm64": "^1.0.0", + "@biomejs/cli-linux-x64": "^1.0.0", + "@types/gulp": "4.0.13", + "@types/gulp-rename": "2.0.2", + "@types/node": "20.5.8", "add": "2.0.6", "cross-env": "7.0.3", "cypress": "10.11.0", diff --git a/packages/backend/package.json b/packages/backend/package.json index 9e891fad8..110b8e14e 100644 --- a/packages/backend/package.json +++ b/packages/backend/package.json @@ -162,7 +162,7 @@ "@types/koa__multer": "2.0.4", "@types/koa__router": "8.0.11", "@types/mocha": "9.1.1", - "@types/node": "20.8.7", + "@types/node": "18.11.18", "@types/node-fetch": "3.0.3", "@types/nodemailer": "6.4.9", "@types/oauth": "0.9.1", diff --git a/packages/backend/src/const.ts b/packages/backend/src/const.ts index 8fc4bd25e..6dddf1fff 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_IMAGE_COMMENT_LENGTH, DB_MAX_NOTE_TEXT_LENGTH, + DB_MAX_IMAGE_COMMENT_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 6c5a22e4b..503e26eb6 100644 --- a/packages/backend/src/global.d.ts +++ b/packages/backend/src/global.d.ts @@ -1,2 +1,2 @@ -// biome-ignore lint/suspicious/noExplicitAny: i have no idea +// rome-ignore lint/suspicious/noExplicitAny: i have no idea type FIXME = any; diff --git a/packages/backend/test/ap-request.ts b/packages/backend/test/ap-request.ts index 722977fe1..bf77a3853 100644 --- a/packages/backend/test/ap-request.ts +++ b/packages/backend/test/ap-request.ts @@ -2,8 +2,8 @@ import * as assert from "assert"; import httpSignature from "@peertube/http-signature"; import { genRsaKeyPair } from "../src/misc/gen-key-pair.js"; import { - createSignedGet, createSignedPost, + createSignedGet, } from "../src/remote/activitypub/ap-request.js"; export const buildParsedSignature = ( diff --git a/packages/backend/test/api-visibility.ts b/packages/backend/test/api-visibility.ts index 49b1b5a06..0ee4a4d33 100644 --- a/packages/backend/test/api-visibility.ts +++ b/packages/backend/test/api-visibility.ts @@ -4,11 +4,11 @@ import * as assert from "assert"; import * as childProcess from "child_process"; import { async, - post, - request, - shutdownServer, signup, + request, + post, startServer, + shutdownServer, } from "./utils.js"; describe("API visibility", () => { diff --git a/packages/backend/test/api.ts b/packages/backend/test/api.ts index 0fc2f424e..19a754552 100644 --- a/packages/backend/test/api.ts +++ b/packages/backend/test/api.ts @@ -4,13 +4,13 @@ import * as assert from "assert"; import * as childProcess from "child_process"; import { async, + signup, + request, post, react, - request, - shutdownServer, - signup, - startServer, uploadFile, + startServer, + shutdownServer, } from "./utils.js"; describe("API", () => { diff --git a/packages/backend/test/block.ts b/packages/backend/test/block.ts index 100a4ab7d..08192e486 100644 --- a/packages/backend/test/block.ts +++ b/packages/backend/test/block.ts @@ -4,11 +4,11 @@ import * as assert from "assert"; import * as childProcess from "child_process"; import { async, - post, - request, - shutdownServer, signup, + request, + post, startServer, + shutdownServer, } from "./utils.js"; describe("Block", () => { diff --git a/packages/backend/test/chart.ts b/packages/backend/test/chart.ts index cd600f661..e194c6c19 100644 --- a/packages/backend/test/chart.ts +++ b/packages/backend/test/chart.ts @@ -2,11 +2,11 @@ process.env.NODE_ENV = "test"; import * as assert from "assert"; import * as lolex from "@sinonjs/fake-timers"; -import { initDb } from "../src/db/postgre.js"; -import TestGroupedChart from "../src/services/chart/charts/test-grouped.js"; -import TestIntersectionChart from "../src/services/chart/charts/test-intersection.js"; -import TestUniqueChart from "../src/services/chart/charts/test-unique.js"; import TestChart from "../src/services/chart/charts/test.js"; +import TestGroupedChart from "../src/services/chart/charts/test-grouped.js"; +import TestUniqueChart from "../src/services/chart/charts/test-unique.js"; +import TestIntersectionChart from "../src/services/chart/charts/test-intersection.js"; +import { initDb } from "../src/db/postgre.js"; describe("Chart", () => { let testChart: TestChart; diff --git a/packages/backend/test/fetch-resource.ts b/packages/backend/test/fetch-resource.ts index 00c0d736e..da3116f0e 100644 --- a/packages/backend/test/fetch-resource.ts +++ b/packages/backend/test/fetch-resource.ts @@ -5,13 +5,13 @@ import * as childProcess from "child_process"; import * as openapi from "@redocly/openapi-core"; import { async, - port, + startServer, + signup, post, request, - shutdownServer, - signup, simpleGet, - startServer, + port, + shutdownServer, } from "./utils.js"; // Request Accept diff --git a/packages/backend/test/ff-visibility.ts b/packages/backend/test/ff-visibility.ts index efdbe7f0f..f898926d9 100644 --- a/packages/backend/test/ff-visibility.ts +++ b/packages/backend/test/ff-visibility.ts @@ -4,14 +4,14 @@ import * as assert from "assert"; import * as childProcess from "child_process"; import { async, - connectStream, + signup, + request, post, react, - request, - shutdownServer, - signup, - simpleGet, + connectStream, startServer, + shutdownServer, + simpleGet, } from "./utils.js"; describe("FF visibility", () => { diff --git a/packages/backend/test/get-file-info.ts b/packages/backend/test/get-file-info.ts index b1092af27..22dc28c8e 100644 --- a/packages/backend/test/get-file-info.ts +++ b/packages/backend/test/get-file-info.ts @@ -1,6 +1,6 @@ import * as assert from "assert"; -import { dirname } from "node:path"; import { fileURLToPath } from "node:url"; +import { dirname } from "node:path"; import { getFileInfo } from "../src/misc/get-file-info.js"; import { async } from "./utils.js"; diff --git a/packages/backend/test/mfm.ts b/packages/backend/test/mfm.ts index 81ed95848..926bdd259 100644 --- a/packages/backend/test/mfm.ts +++ b/packages/backend/test/mfm.ts @@ -1,8 +1,8 @@ import * as assert from "assert"; import * as mfm from "mfm-js"; -import { fromHtml } from "../src/mfm/from-html.js"; import { toHtml } from "../src/mfm/to-html.js"; +import { fromHtml } from "../src/mfm/from-html.js"; describe("toHtml", () => { it("br", () => { diff --git a/packages/backend/test/mute.ts b/packages/backend/test/mute.ts index 831c2c1ee..c51162834 100644 --- a/packages/backend/test/mute.ts +++ b/packages/backend/test/mute.ts @@ -4,12 +4,12 @@ import * as assert from "assert"; import * as childProcess from "child_process"; import { async, + signup, + request, post, react, - request, - shutdownServer, - signup, startServer, + shutdownServer, waitFire, } from "./utils.js"; diff --git a/packages/backend/test/note.ts b/packages/backend/test/note.ts index b78138b1e..3af4b88d8 100644 --- a/packages/backend/test/note.ts +++ b/packages/backend/test/note.ts @@ -4,15 +4,15 @@ import * as assert from "assert"; import * as childProcess from "child_process"; import { Note } from "../src/models/entities/note.js"; import { - api, async, - initTestDb, - post, - request, - shutdownServer, signup, - startServer, + request, + post, uploadUrl, + startServer, + shutdownServer, + initTestDb, + api, } from "./utils.js"; describe("Note", () => { diff --git a/packages/backend/test/streaming.ts b/packages/backend/test/streaming.ts index 37171f418..3292c66e1 100644 --- a/packages/backend/test/streaming.ts +++ b/packages/backend/test/streaming.ts @@ -4,13 +4,13 @@ import * as assert from "assert"; import * as childProcess from "child_process"; import { Following } from "../src/models/entities/following.js"; import { - api, connectStream, - initTestDb, - post, - shutdownServer, signup, + api, + post, startServer, + shutdownServer, + initTestDb, waitFire, } from "./utils.js"; diff --git a/packages/backend/test/thread-mute.ts b/packages/backend/test/thread-mute.ts index 88483b51c..9b3bb8dfe 100644 --- a/packages/backend/test/thread-mute.ts +++ b/packages/backend/test/thread-mute.ts @@ -4,13 +4,13 @@ import * as assert from "assert"; import * as childProcess from "child_process"; import { async, - connectStream, + signup, + request, post, react, - request, - shutdownServer, - signup, + connectStream, startServer, + shutdownServer, } from "./utils.js"; describe("Note thread mute", () => { diff --git a/packages/backend/test/user-notes.ts b/packages/backend/test/user-notes.ts index cdf5e7dbb..86a541c10 100644 --- a/packages/backend/test/user-notes.ts +++ b/packages/backend/test/user-notes.ts @@ -4,12 +4,12 @@ import * as assert from "assert"; import * as childProcess from "child_process"; import { async, - post, - request, - shutdownServer, signup, - startServer, + request, + post, uploadUrl, + startServer, + shutdownServer, } from "./utils.js"; describe("users/notes", () => { diff --git a/packages/backend/test/utils.ts b/packages/backend/test/utils.ts index 3c8449fb5..ff2dd79de 100644 --- a/packages/backend/test/utils.ts +++ b/packages/backend/test/utils.ts @@ -1,18 +1,18 @@ -import * as childProcess from "child_process"; -import { SIGKILL } from "constants"; import * as fs from "node:fs"; -import * as http from "node:http"; import * as path from "node:path"; -import { dirname } from "node:path"; import { fileURLToPath } from "node:url"; -import * as firefish from "firefish-js"; -import FormData from "form-data"; -import got from "got"; -import fetch from "node-fetch"; -import { DataSource } from "typeorm"; +import { dirname } from "node:path"; +import * as childProcess from "child_process"; +import * as http from "node:http"; +import { SIGKILL } from "constants"; import WebSocket from "ws"; +import * as firefish from "firefish-js"; +import fetch from "node-fetch"; +import FormData from "form-data"; +import { DataSource } from "typeorm"; import loadConfig from "../src/config/load.js"; import { entities } from "../src/db/postgre.js"; +import got from "got"; const _filename = fileURLToPath(import.meta.url); const _dirname = dirname(_filename); diff --git a/packages/client/package.json b/packages/client/package.json index 022bde257..890aba4ab 100644 --- a/packages/client/package.json +++ b/packages/client/package.json @@ -20,8 +20,8 @@ "@syuilo/aiscript": "0.11.1", "@types/escape-regexp": "0.0.1", "@types/glob": "8.1.0", - "@types/gulp": "4.0.16", - "@types/gulp-rename": "2.0.4", + "@types/gulp": "4.0.13", + "@types/gulp-rename": "2.0.2", "@types/katex": "0.16.2", "@types/matter-js": "0.19.0", "@types/punycode": "2.1.0", diff --git a/packages/client/src/account.ts b/packages/client/src/account.ts index fd5b25514..761ebe5e0 100644 --- a/packages/client/src/account.ts +++ b/packages/client/src/account.ts @@ -1,11 +1,11 @@ +import { defineAsyncComponent, reactive } from "vue"; +import type * as firefish from "firefish-js"; +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 icon from "@/scripts/icon"; -import { del, get, set } from "@/scripts/idb-proxy"; import { reloadChannel, unisonReload } from "@/scripts/unison-reload"; -import type * as firefish from "firefish-js"; -import { defineAsyncComponent, reactive } from "vue"; -import { i18n } from "./i18n"; +import icon from "@/scripts/icon"; // TODO: 他のタブと永続化されたstateを同期 diff --git a/packages/client/src/components/MkDialog.vue b/packages/client/src/components/MkDialog.vue index 79439709e..216fb4500 100644 --- a/packages/client/src/components/MkDialog.vue +++ b/packages/client/src/components/MkDialog.vue @@ -19,10 +19,7 @@ > import { shallowRef, watch } from "vue"; import MkModal from "@/components/MkModal.vue"; -import iconClass from "@/scripts/icon"; +import iconClass from "@/scripts/icon" const modal = shallowRef>(); diff --git a/packages/client/src/i18n.ts b/packages/client/src/i18n.ts index 31a6686f1..5b0a7f9ed 100644 --- a/packages/client/src/i18n.ts +++ b/packages/client/src/i18n.ts @@ -1,6 +1,6 @@ +import { markRaw } from "vue"; import { locale } from "@/config"; import { I18n } from "@/scripts/i18n"; -import { markRaw } from "vue"; export const i18n = markRaw(new I18n(locale)); diff --git a/packages/client/src/init.ts b/packages/client/src/init.ts index 2888e5ebf..ddcdfc207 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/bold"; -import "@phosphor-icons/web/duotone"; import "@phosphor-icons/web/fill"; -import "@phosphor-icons/web/light"; +import "@phosphor-icons/web/bold"; import "@phosphor-icons/web/regular"; +import "@phosphor-icons/web/light"; +import "@phosphor-icons/web/duotone"; // #region account indexedDB migration import { set } from "@/scripts/idb-proxy"; @@ -23,7 +23,6 @@ if (accounts) { } // #endregion -import { compareVersions } from "compare-versions"; import { computed, createApp, @@ -32,28 +31,29 @@ import { version as vueVersion, watch, } from "vue"; +import { compareVersions } from "compare-versions"; -import { $i, login, refreshAccount, signout, updateAccount } from "@/account"; +import widgets from "@/widgets"; +import directives from "@/directives"; import components from "@/components"; import { host, lang, ui, version } from "@/config"; -import directives from "@/directives"; -import { i18n } from "@/i18n"; -import { fetchInstance, instance } from "@/instance"; -import { alert, api, confirm, popup, post, toast } from "@/os"; -import { deviceKind } from "@/scripts/device-kind"; -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 { isDeviceDarkmode } from "@/scripts/is-device-darkmode"; +import { i18n } from "@/i18n"; +import { alert, api, confirm, popup, post, toast } from "@/os"; import { stream } from "@/stream"; -import widgets from "@/widgets"; +import * as sound from "@/scripts/sound"; +import { $i, login, refreshAccount, signout, updateAccount } from "@/account"; +import { ColdDeviceStorage, defaultStore } from "@/store"; +import { fetchInstance, instance } from "@/instance"; +import { makeHotkey } from "@/scripts/hotkey"; +import { search } from "@/scripts/search"; +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"; function checkForSplash() { const splash = document.getElementById("splash"); diff --git a/packages/client/src/instance.ts b/packages/client/src/instance.ts index 493baeb94..783cb01ad 100644 --- a/packages/client/src/instance.ts +++ b/packages/client/src/instance.ts @@ -1,5 +1,5 @@ -import type * as firefish from "firefish-js"; import { computed, reactive } from "vue"; +import type * as firefish from "firefish-js"; import { api } from "./os"; // TODO: 他のタブと永続化されたstateを同期 diff --git a/packages/client/src/navbar.ts b/packages/client/src/navbar.ts index a917a5587..c2ab1d4d1 100644 --- a/packages/client/src/navbar.ts +++ b/packages/client/src/navbar.ts @@ -1,11 +1,11 @@ -import { ui } from "@/config"; -import { i18n } from "@/i18n"; -import * as os from "@/os"; -import icon from "@/scripts/icon"; -import { search } from "@/scripts/search"; -import { unisonReload } from "@/scripts/unison-reload"; import { computed, reactive } from "vue"; import { $i } from "./account"; +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 icon from "@/scripts/icon"; export const navbarItemDef = reactive({ notifications: { diff --git a/packages/client/src/nirax.ts b/packages/client/src/nirax.ts index 9f5477ea2..43e770ec3 100644 --- a/packages/client/src/nirax.ts +++ b/packages/client/src/nirax.ts @@ -1,10 +1,10 @@ // NIRAX --- A lightweight router -import { pleaseLogin } from "@/scripts/please-login"; -import { safeURIDecode } from "@/scripts/safe-uri-decode"; 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"; interface RouteDef { path: string; @@ -112,7 +112,7 @@ export class Router extends EventEmitter<{ let parts = [..._parts]; const props = new Map(); - for (const p of parsePath(route.path)) { + pathMatchLoop: 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; + break pathMatchLoop; } 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; + continue forEachRouteLoop; } } diff --git a/packages/client/src/os.ts b/packages/client/src/os.ts index a0f3d6e98..7a78e9553 100644 --- a/packages/client/src/os.ts +++ b/packages/client/src/os.ts @@ -1,18 +1,18 @@ // TODO: なんでもかんでもos.tsに突っ込むのやめたいのでよしなに分割する -import { $i } from "@/account"; -import MkDialog from "@/components/MkDialog.vue"; -import MkPostFormDialog from "@/components/MkPostFormDialog.vue"; -import MkToast from "@/components/MkToast.vue"; -import MkWaitingDialog from "@/components/MkWaitingDialog.vue"; -import { url, apiUrl } from "@/config"; -import type { MenuItem } from "@/types/menu"; -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 { $i } from "@/account"; export const pendingApiRequestsCount = ref(0); diff --git a/packages/client/src/pages/admin/_header_.vue b/packages/client/src/pages/admin/_header_.vue index 7b0b62708..6d2506a17 100644 --- a/packages/client/src/pages/admin/_header_.vue +++ b/packages/client/src/pages/admin/_header_.vue @@ -2,11 +2,7 @@