chore: migrate eslint and prettier to biome and fix all linting errors

This commit is contained in:
Samuel 2024-12-14 12:16:17 +01:00
parent 82413a8212
commit 9bcf233d2c
22 changed files with 397 additions and 481 deletions

View file

@ -4,6 +4,7 @@ import type { RouteSectionProps } from "@solidjs/router";
import { allThreadsOverviewQuery, overallSentMessagesQuery, SELF_ID } from "~/db";
import { OverviewTable, type RoomOverview } from "./overview-table";
import { getNameFromRecipient } from "~/lib/getNameFromRecipient";
export const Overview: Component<RouteSectionProps> = () => {
const [allSelfSentMessagesCount] = createResource(() => overallSentMessagesQuery(SELF_ID));
@ -12,14 +13,13 @@ export const Overview: Component<RouteSectionProps> = () => {
return (await allThreadsOverviewQuery()).rows.map((row) => {
const isGroup = row.title !== null;
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
const name = (
isGroup
? row.title
: /* seems possible that it is an empty string */ !row.system_joined_name
? row.profile_joined_name
: row.system_joined_name
)!;
let name = "";
if (row.title !== null) {
name = row.title;
} else {
name = getNameFromRecipient(row.nickname_joined_name, row.system_joined_name, row.profile_joined_name);
}
return {
threadId: row.thread_id,
@ -36,12 +36,8 @@ export const Overview: Component<RouteSectionProps> = () => {
return (
<div>
<p>All messages: {allSelfSentMessagesCount()?.messageCount as number}</p>
<Show
when={!roomOverview.loading}
fallback="Loading..."
>
{/* eslint-disable-next-line @typescript-eslint/no-non-null-assertion */}
<OverviewTable data={roomOverview()!} />;
<Show when={!roomOverview.loading && roomOverview()} fallback="Loading...">
{(currentRoomOverview) => <OverviewTable data={currentRoomOverview()} />}
</Show>
</div>
);