chore: lint

This commit is contained in:
naskya 2023-11-06 21:11:39 +09:00
parent 082cd3ac1d
commit 15e646c8b1
Signed by: naskya
GPG key ID: 164DFF24E2D40139
23 changed files with 85 additions and 88 deletions

View file

@ -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(

View file

@ -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;

View file

@ -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");

View file

@ -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を同期

View file

@ -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");

View file

@ -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を同期

View file

@ -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: {

View file

@ -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<string, string>();
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;
}
}

View file

@ -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);

View file

@ -5,7 +5,7 @@
/></template>
<MkSpacer :content-max="800">
<div class="attachments-timeline">
<XTimeline ref="tl" class="tl" src="file" :fileId="fileId" />
<XTimeline ref="tl" class="tl" src="file" :file-id="fileId" />
</div>
</MkSpacer>
</MkStickyContainer>

View file

@ -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<string>();

View file

@ -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");

View file

@ -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", {

View file

@ -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;

View file

@ -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 = {

View file

@ -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(

View file

@ -28,12 +28,12 @@
<script lang="ts" setup>
import { ref } from "vue";
import { Interpreter, Parser, utils } from "@syuilo/aiscript";
import {
useWidgetPropsManager,
import { useWidgetPropsManager } from "./widget";
import type {
WidgetComponentEmits,
WidgetComponentExpose,
WidgetComponentProps,
} from "./widget";
import type { WidgetComponentExpose } from "./widget";
import type { GetFormResultType } from "@/scripts/form";
import * as os from "@/os";
import MkContainer from "@/components/MkContainer.vue";

View file

@ -9,13 +9,13 @@
<script lang="ts" setup>
import { onMounted, onUnmounted, ref, watch } from "vue";
import { Interpreter, Parser } from "@syuilo/aiscript";
import { createAiScriptEnv } from "@/scripts/aiscript/api";
import {
useWidgetPropsManager,
import { useWidgetPropsManager } from "./widget";
import type {
WidgetComponentEmits,
WidgetComponentExpose,
WidgetComponentProps,
} from "./widget";
import type { WidgetComponentExpose } from "./widget";
import { createAiScriptEnv } from "@/scripts/aiscript/api";
import type { GetFormResultType } from "@/scripts/form";
import * as os from "@/os";
import { $i } from "@/reactiveAccount";

View file

@ -32,15 +32,9 @@
"types": [
"vite/client",
],
"lib": [
"esnext",
"dom"
],
"lib": ["esnext", "dom"],
"jsx": "preserve"
},
"compileOnSave": false,
"include": [
"./**/*.ts",
"./**/*.vue"
]
"include": ["./**/*.ts", "./**/*.vue"]
}

View file

@ -11,30 +11,30 @@ import {
DetailedInstanceMetadata,
DriveFile,
DriveFolder,
FollowRequest,
Following,
FollowingFolloweePopulated,
FollowingFollowerPopulated,
FollowRequest,
GalleryPost,
Instance,
InstanceMetadata,
LiteInstanceMetadata,
MeDetailed,
MessagingMessage,
Note,
NoteFavorite,
NoteReaction,
Notification,
OriginType,
Page,
ServerInfo,
Signin,
Stats,
User,
UserDetailed,
UserGroup,
UserList,
UserSorting,
Notification,
NoteReaction,
Signin,
MessagingMessage,
} from "./entities";
type TODO = Record<string, any> | null;

View file

@ -1,8 +1,8 @@
import { Acct } from "./acct";
import { Endpoints } from "./api.types";
import * as consts from "./consts";
import Stream, { Connection } from "./streaming";
import { Channels } from "./streaming.types";
import { Acct } from "./acct";
import * as consts from "./consts";
export { Endpoints, Stream, Connection as ChannelConnection, Channels, Acct };

View file

@ -27,9 +27,9 @@ export function urlQuery(
const params = Object.entries(obj)
.filter(([, v]) => (Array.isArray(v) ? v.length : v !== undefined))
.reduce(
// rome-ignore lint/suspicious/noAssignInExpressions: <Used for key assigning>
// rome-ignore lint/style/noNonNullAssertion: <>
// rome-ignore lint/style/noCommaOperator: <>
// biome-ignore lint/suspicious/noAssignInExpressions: <Used for key assigning>
// biome-ignore lint/style/noNonNullAssertion: <>
// biome-ignore lint/style/noCommaOperator: <>
(a, [k, v]) => ((a[k] = v!), a),
{} as Record<string, string | number | boolean>,
);

View file

@ -27,13 +27,8 @@
"node_modules/@types",
"@types",
],
"lib": [
"esnext",
"webworker"
]
"lib": ["esnext", "webworker"]
},
"compileOnSave": false,
"include": [
"./**/*.ts", "./**/*.d.ts", "./**/*.tsx", "./**/*.vue"
]
"include": ["./**/*.ts", "./**/*.d.ts", "./**/*.tsx", "./**/*.vue"]
}