Openstatus www.openstatus.dev

🧹 lint (#192)

authored by

Thibault Le Ouay and committed by
GitHub
f34d297d 89af59a1

+15 -36
+9 -9
apps/web/src/app/_components/input-search.tsx
··· 1 1 "use client"; 2 2 3 - import * as React from "react"; 3 + import React, { useEffect, useMemo, useRef, useState } from "react"; 4 4 import { Command as CommandPrimitive, useCommandState } from "cmdk"; 5 5 6 6 import type { Ping } from "@openstatus/tinybird"; ··· 21 21 onSearch(value: Record<string, string>): void; 22 22 events: Ping[]; 23 23 }) { 24 - const inputRef = React.useRef<HTMLInputElement>(null); 25 - const [open, setOpen] = React.useState<boolean>(false); 26 - const [inputValue, setInputValue] = React.useState<string>(""); 27 - const [currentWord, setCurrentWord] = React.useState(""); 24 + const inputRef = useRef<HTMLInputElement>(null); 25 + const [open, setOpen] = useState<boolean>(false); 26 + const [inputValue, setInputValue] = useState<string>(""); 27 + const [currentWord, setCurrentWord] = useState(""); 28 28 29 29 // TODO: check if there is a move efficient way 30 - React.useEffect(() => { 30 + useEffect(() => { 31 31 const searchparams = inputValue 32 32 .trim() 33 33 .split(" ") ··· 43 43 {} as Record<string, string>, 44 44 ); 45 45 onSearch(searchparams); 46 - }, [onSearch, inputValue]); 46 + }, [onSearch, inputValue, currentWord]); 47 47 48 48 // DEFINE YOUR SEARCH PARAMETERS 49 - const search = React.useMemo( 49 + const search = useMemo( 50 50 () => 51 51 events.reduce( 52 52 (prev, curr) => { ··· 71 71 return ( 72 72 <Command 73 73 className="overflow-visible bg-transparent" 74 - filter={(value, search) => { 74 + filter={(value) => { 75 75 if (value.includes(currentWord.toLowerCase())) return 1; 76 76 return 0; 77 77 }}
-10
apps/web/src/app/action.ts
··· 5 5 6 6 import { validateEmailNotDisposable, WaitingList } from "@openstatus/emails"; 7 7 8 - import { EmailTemplate } from "@/components/templates/email-template"; 9 8 import { env } from "@/env"; 10 9 11 10 const redis = Redis.fromEnv(); ··· 38 37 .zcard(key) 39 38 .exec(); 40 39 return res[1]; 41 - }; 42 - 43 - // MOCK 44 - const wait = (ms: number): Promise<void> => { 45 - return new Promise((resolve) => { 46 - setTimeout(() => { 47 - resolve(); 48 - }, ms); 49 - }); 50 40 }; 51 41 52 42 // Resend
-1
apps/web/src/app/api/checker/cron/_cron.ts
··· 5 5 import { 6 6 monitor, 7 7 monitorsToPages, 8 - RegionEnum, 9 8 selectMonitorSchema, 10 9 } from "@openstatus/db/src/schema"; 11 10 import { availableRegions } from "@openstatus/tinybird";
-3
apps/web/src/app/api/webhook/clerk/route.ts
··· 1 1 import type { NextRequest } from "next/server"; 2 2 import { NextResponse } from "next/server"; 3 - import { Webhook } from "svix"; 4 3 5 4 import { createTRPCContext } from "@openstatus/api"; 6 5 import { lambdaRouter } from "@openstatus/api/src/lambda"; 7 6 import { clerkEvent } from "@openstatus/api/src/router/clerk/type"; 8 - 9 - import { env } from "@/env"; 10 7 11 8 // import { clerkEvent } from "@openstatus/api/src/router/clerk"; 12 9
-1
apps/web/src/app/app/(dashboard)/[workspaceSlug]/incidents/_components/action-button.tsx
··· 9 9 import { 10 10 insertIncidentSchema, 11 11 // insertIncidentUpdateSchema, 12 - insertMonitorSchema, 13 12 } from "@openstatus/db/src/schema"; 14 13 15 14 import { LoadingAnimation } from "@/components/loading-animation";
-3
apps/web/src/app/app/(dashboard)/[workspaceSlug]/incidents/page.tsx
··· 8 8 import { AffectedMonitors } from "@/components/incidents/affected-monitors"; 9 9 import { Events } from "@/components/incidents/events"; 10 10 import { StatusBadge } from "@/components/incidents/status-badge"; 11 - import { Badge } from "@/components/ui/badge"; 12 11 import { Button } from "@/components/ui/button"; 13 12 import { statusDict } from "@/data/incidents-dictionary"; 14 - import { cn } from "@/lib/utils"; 15 13 import { api } from "@/trpc/server"; 16 14 import { ActionButton } from "./_components/action-button"; 17 15 import { EmptyState } from "./_components/empty-state"; ··· 37 35 {incidents?.map((incident, i) => { 38 36 const { label, icon } = 39 37 statusDict[incident.status as keyof typeof statusDict]; 40 - const Icon = Icons[icon]; 41 38 return ( 42 39 <li key={i} className="grid gap-2"> 43 40 <time className="text-muted-foreground pl-3 text-xs">
-1
apps/web/src/app/blog/[slug]/page.tsx
··· 1 1 import type { Metadata } from "next"; 2 - import Image from "next/image"; 3 2 import { notFound } from "next/navigation"; 4 3 import { allPosts } from "contentlayer/generated"; 5 4
-1
apps/web/src/app/legal/[slug]/page.tsx
··· 1 - import type { Metadata } from "next"; 2 1 import { notFound } from "next/navigation"; 3 2 import { allLegalPosts } from "contentlayer/generated"; 4 3
+1 -2
apps/web/src/components/data-table/data-table-column-header.tsx
··· 1 1 import type { Column } from "@tanstack/react-table"; 2 - import { ChevronsUpDown, EyeOff, SortAsc, SortDesc } from "lucide-react"; 2 + import { ChevronsUpDown, SortAsc, SortDesc } from "lucide-react"; 3 3 4 4 import { Button } from "@/components/ui/button"; 5 5 import { 6 6 DropdownMenu, 7 7 DropdownMenuContent, 8 8 DropdownMenuItem, 9 - DropdownMenuSeparator, 10 9 DropdownMenuTrigger, 11 10 } from "@/components/ui/dropdown-menu"; 12 11 import { cn } from "@/lib/utils";
+1 -1
apps/web/src/components/incidents/events.tsx
··· 41 41 42 42 return ( 43 43 <div className="grid gap-3"> 44 - {slicedArray?.map((update, i) => { 44 + {slicedArray?.map((update) => { 45 45 const { icon, label } = statusDict[update.status]; 46 46 const StatusIcon = Icons[icon]; 47 47 return (
+1 -1
apps/web/src/components/ui/radio-group.tsx
··· 23 23 const RadioGroupItem = React.forwardRef< 24 24 React.ElementRef<typeof RadioGroupPrimitive.Item>, 25 25 React.ComponentPropsWithoutRef<typeof RadioGroupPrimitive.Item> 26 - >(({ className, children, ...props }, ref) => { 26 + >(({ className, ...props }, ref) => { 27 27 return ( 28 28 <RadioGroupPrimitive.Item 29 29 ref={ref}
+3 -3
apps/web/src/middleware.ts
··· 1 - import type { NextFetchEvent, NextRequest } from "next/server"; 1 + import type { NextRequest } from "next/server"; 2 2 import { NextResponse } from "next/server"; 3 3 import { authMiddleware, redirectToSignIn } from "@clerk/nextjs"; 4 4 5 5 import { db, eq } from "@openstatus/db"; 6 6 import { user, usersToWorkspaces, workspace } from "@openstatus/db/src/schema"; 7 7 8 - const before = (req: NextRequest, ev: NextFetchEvent) => { 8 + const before = (req: NextRequest) => { 9 9 const url = req.nextUrl.clone(); 10 10 11 11 if (url.pathname.includes("api/trpc")) { ··· 61 61 ], 62 62 ignoredRoutes: ["/api/og", "/discord", "github"], // FIXME: we should check the `publicRoutes` 63 63 beforeAuth: before, 64 - async afterAuth(auth, req, evt) { 64 + async afterAuth(auth, req) { 65 65 // handle users who aren't authenticated 66 66 if (!auth.userId && !auth.isPublicRoute) { 67 67 return redirectToSignIn({ returnBackUrl: req.url });