Fix some lint errors

This commit is contained in:
Fergal Moran
2024-09-29 18:18:39 +01:00
parent 3a184cf244
commit 47d5dad3df
8 changed files with 31 additions and 37 deletions

BIN
bun.lockb

Binary file not shown.

View File

@@ -112,7 +112,7 @@
"@typescript-eslint/eslint-plugin": "^8.7.0", "@typescript-eslint/eslint-plugin": "^8.7.0",
"@typescript-eslint/parser": "^8.7.0", "@typescript-eslint/parser": "^8.7.0",
"drizzle-kit": "^0.24.2", "drizzle-kit": "^0.24.2",
"eslint": "^9.11.1", "eslint": "8.57.0",
"eslint-config-next": "^14.2.13", "eslint-config-next": "^14.2.13",
"eslint-plugin-drizzle": "^0.2.3", "eslint-plugin-drizzle": "^0.2.3",
"jest": "^29.7.0", "jest": "^29.7.0",

View File

@@ -18,7 +18,7 @@ const PostActions: React.FC<PostActionsProps> = ({ post }) => {
title="Upvote" title="Upvote"
action={async () => { action={async () => {
await vote.mutateAsync({ slug: post.slug, up: true }); await vote.mutateAsync({ slug: post.slug, up: true });
voteCount.refetch(); await voteCount.refetch();
}} }}
icon={<Icons.up className="h-6 w-6" />} icon={<Icons.up className="h-6 w-6" />}
/> />

View File

@@ -1,5 +1,5 @@
"use client"; "use client";
import { Post } from "@/lib/models/post"; import { type Post } from "@/lib/models/post";
import { api } from "@/trpc/react"; import { api } from "@/trpc/react";
import React from "react"; import React from "react";
import { Icons } from "@/components/icons"; import { Icons } from "@/components/icons";
@@ -14,7 +14,7 @@ const VoteCount: React.FC<VoteCountProps> = ({ post }) => {
return ( return (
<span> <span>
{voteCount.data ? ( {voteCount.data ? (
voteCount.data.toString() `${voteCount.data.voteCount} votes`
) : ( ) : (
<Icons.spinner className="animate-spin" /> <Icons.spinner className="animate-spin" />
)} )}

View File

@@ -2,7 +2,7 @@ const clipboardImageToFile = (
data: DataTransfer, data: DataTransfer,
callback: (result: File | null | undefined) => void, callback: (result: File | null | undefined) => void,
) => { ) => {
var items = data.items; const items = data.items;
if (items == undefined || items.length == 0) { if (items == undefined || items.length == 0) {
if (typeof callback == "function") { if (typeof callback == "function") {
@@ -10,10 +10,9 @@ const clipboardImageToFile = (
} }
} }
for (var i = 0; i < items.length; i++) { for (const item of items) {
// Skip content if not image if (!item.type.includes("image")) continue;
if (items[i]?.type.indexOf("image") == -1) continue; const blob = item.getAsFile();
var blob = items[i]?.getAsFile();
if (typeof callback == "function") { if (typeof callback == "function") {
callback(blob); callback(blob);

View File

@@ -1,7 +1,4 @@
import { NextRequest, NextResponse, URLPattern } from "next/server"; import { NextRequest, NextResponse, URLPattern } from "next/server";
import { promises as fs } from "fs";
import mime from "mime-types";
import { env } from "./env";
export { default } from "next-auth/middleware"; export { default } from "next-auth/middleware";

View File

@@ -18,7 +18,7 @@ export const postRouter = createTRPCRouter({
.execute(sql`SELECT SUM(CASE WHEN up = TRUE THEN 1 ELSE -1 END) .execute(sql`SELECT SUM(CASE WHEN up = TRUE THEN 1 ELSE -1 END)
FROM public.votes v FROM public.votes v
WHERE v.post_id = (SELECT id FROM posts WHERE slug = ${input.slug})`); WHERE v.post_id = (SELECT id FROM posts WHERE slug = ${input.slug})`);
return count[0]?.sum ?? '0'; return { voteCount: count[0]?.sum ?? "0" };
}), }),
getBySlug: publicProcedure getBySlug: publicProcedure
.input(z.object({ slug: z.string() })) .input(z.object({ slug: z.string() }))
@@ -102,9 +102,9 @@ export const postRouter = createTRPCRouter({
}), }),
) )
.mutation(async ({ ctx, input }) => { .mutation(async ({ ctx, input }) => {
var slugify = slugifyWithCounter(); const slugify = slugifyWithCounter();
var found = false; let found = false;
var slug = ""; let slug = "";
do { do {
slug = slugify(input.title); slug = slugify(input.title);
const existing = await ctx.db const existing = await ctx.db

View File

@@ -150,7 +150,6 @@ body {
} }
@layer utilities { @layer utilities {
@variants responsive {
.masonry { .masonry {
column-gap: 1.5em; column-gap: 1.5em;
column-count: 1; column-count: 1;
@@ -170,5 +169,4 @@ body {
.break-inside { .break-inside {
break-inside: avoid; break-inside: avoid;
} }
}
} }