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/parser": "^8.7.0",
"drizzle-kit": "^0.24.2",
"eslint": "^9.11.1",
"eslint": "8.57.0",
"eslint-config-next": "^14.2.13",
"eslint-plugin-drizzle": "^0.2.3",
"jest": "^29.7.0",

View File

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

View File

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

View File

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

View File

@@ -1,7 +1,4 @@
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";

View File

@@ -18,7 +18,7 @@ export const postRouter = createTRPCRouter({
.execute(sql`SELECT SUM(CASE WHEN up = TRUE THEN 1 ELSE -1 END)
FROM public.votes v
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
.input(z.object({ slug: z.string() }))
@@ -102,9 +102,9 @@ export const postRouter = createTRPCRouter({
}),
)
.mutation(async ({ ctx, input }) => {
var slugify = slugifyWithCounter();
var found = false;
var slug = "";
const slugify = slugifyWithCounter();
let found = false;
let slug = "";
do {
slug = slugify(input.title);
const existing = await ctx.db

View File

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