From a03f1dc2ac25579df30e8cb59d2703110c3e564d Mon Sep 17 00:00:00 2001 From: MohamedBassem Date: Wed, 13 Mar 2024 22:37:41 +0000 Subject: lint: Lint and format the entire repo with the new configs --- apps/web/components/ui/action-button.tsx | 3 ++- apps/web/components/ui/back-button.tsx | 4 +++- apps/web/components/ui/badge.tsx | 12 ++++++------ apps/web/components/ui/button.tsx | 10 +++++----- apps/web/components/ui/card.tsx | 6 +++--- apps/web/components/ui/dialog.tsx | 11 +++++------ apps/web/components/ui/dropdown-menu.tsx | 17 ++++++++--------- apps/web/components/ui/form.tsx | 31 ++++++++++++------------------- apps/web/components/ui/imageCard.tsx | 1 - apps/web/components/ui/input.tsx | 6 ++---- apps/web/components/ui/label.tsx | 6 +++--- apps/web/components/ui/popover.tsx | 5 ++--- apps/web/components/ui/scroll-area.tsx | 5 ++--- apps/web/components/ui/select.tsx | 11 +++++------ apps/web/components/ui/separator.tsx | 5 ++--- apps/web/components/ui/skeleton.tsx | 2 +- apps/web/components/ui/table.tsx | 9 ++++----- apps/web/components/ui/tabs.tsx | 9 ++++----- apps/web/components/ui/textarea.tsx | 6 ++---- apps/web/components/ui/toast.tsx | 16 ++++++++-------- apps/web/components/ui/use-toast.ts | 5 ++--- 21 files changed, 81 insertions(+), 99 deletions(-) (limited to 'apps/web/components/ui') diff --git a/apps/web/components/ui/action-button.tsx b/apps/web/components/ui/action-button.tsx index 42e16f65..11b02a5f 100644 --- a/apps/web/components/ui/action-button.tsx +++ b/apps/web/components/ui/action-button.tsx @@ -1,4 +1,5 @@ -import { Button, ButtonProps } from "./button"; +import type { ButtonProps } from "./button"; +import { Button } from "./button"; import LoadingSpinner from "./spinner"; export function ActionButton({ diff --git a/apps/web/components/ui/back-button.tsx b/apps/web/components/ui/back-button.tsx index 685930df..46c99f7c 100644 --- a/apps/web/components/ui/back-button.tsx +++ b/apps/web/components/ui/back-button.tsx @@ -1,7 +1,9 @@ "use client"; import { useRouter } from "next/navigation"; -import { Button, ButtonProps } from "./button"; + +import type { ButtonProps } from "./button"; +import { Button } from "./button"; export function BackButton({ ...props }: ButtonProps) { const router = useRouter(); diff --git a/apps/web/components/ui/badge.tsx b/apps/web/components/ui/badge.tsx index c30daca1..7950a5ee 100644 --- a/apps/web/components/ui/badge.tsx +++ b/apps/web/components/ui/badge.tsx @@ -1,19 +1,19 @@ +import type { VariantProps } from "class-variance-authority"; import * as React from "react"; -import { cva, type VariantProps } from "class-variance-authority"; - import { cn } from "@/lib/utils"; +import { cva } from "class-variance-authority"; const badgeVariants = cva( - "focus:ring-ring inline-flex items-center rounded-full border px-2.5 py-0.5 text-xs font-semibold transition-colors focus:outline-none focus:ring-2 focus:ring-offset-2", + "inline-flex items-center rounded-full border px-2.5 py-0.5 text-xs font-semibold transition-colors focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2", { variants: { variant: { default: - "bg-primary text-primary-foreground hover:bg-primary/80 border-transparent", + "border-transparent bg-primary text-primary-foreground hover:bg-primary/80", secondary: - "bg-secondary text-secondary-foreground hover:bg-secondary/80 border-transparent", + "border-transparent bg-secondary text-secondary-foreground hover:bg-secondary/80", destructive: - "bg-destructive text-destructive-foreground hover:bg-destructive/80 border-transparent", + "border-transparent bg-destructive text-destructive-foreground hover:bg-destructive/80", outline: "text-foreground", }, }, diff --git a/apps/web/components/ui/button.tsx b/apps/web/components/ui/button.tsx index 79b45fa0..5ed8df91 100644 --- a/apps/web/components/ui/button.tsx +++ b/apps/web/components/ui/button.tsx @@ -1,11 +1,11 @@ +import type { VariantProps } from "class-variance-authority"; import * as React from "react"; -import { Slot } from "@radix-ui/react-slot"; -import { cva, type VariantProps } from "class-variance-authority"; - import { cn } from "@/lib/utils"; +import { Slot } from "@radix-ui/react-slot"; +import { cva } from "class-variance-authority"; const buttonVariants = cva( - "ring-offset-background focus-visible:ring-ring inline-flex items-center justify-center whitespace-nowrap rounded-md text-sm font-medium transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50", + "inline-flex items-center justify-center whitespace-nowrap rounded-md text-sm font-medium ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50", { variants: { variant: { @@ -13,7 +13,7 @@ const buttonVariants = cva( destructive: "bg-destructive text-destructive-foreground hover:bg-destructive/90", outline: - "border-input bg-background hover:bg-accent hover:text-accent-foreground border", + "border border-input bg-background hover:bg-accent hover:text-accent-foreground", secondary: "bg-secondary text-secondary-foreground hover:bg-secondary/80", ghost: "hover:bg-accent hover:text-accent-foreground", diff --git a/apps/web/components/ui/card.tsx b/apps/web/components/ui/card.tsx index f4e57996..9df66460 100644 --- a/apps/web/components/ui/card.tsx +++ b/apps/web/components/ui/card.tsx @@ -1,5 +1,4 @@ import * as React from "react"; - import { cn } from "@/lib/utils"; const Card = React.forwardRef< @@ -9,7 +8,7 @@ const Card = React.forwardRef<
>(({ className, ...props }, ref) => ( + // eslint-disable-next-line jsx-a11y/heading-has-content

(({ className, ...props }, ref) => (

)); diff --git a/apps/web/components/ui/dialog.tsx b/apps/web/components/ui/dialog.tsx index 8fe3fe35..8e0c3c6c 100644 --- a/apps/web/components/ui/dialog.tsx +++ b/apps/web/components/ui/dialog.tsx @@ -1,11 +1,10 @@ "use client"; import * as React from "react"; +import { cn } from "@/lib/utils"; import * as DialogPrimitive from "@radix-ui/react-dialog"; import { X } from "lucide-react"; -import { cn } from "@/lib/utils"; - const Dialog = DialogPrimitive.Root; const DialogTrigger = DialogPrimitive.Trigger; @@ -21,7 +20,7 @@ const DialogOverlay = React.forwardRef< {children} - + Close @@ -102,7 +101,7 @@ const DialogDescription = React.forwardRef< >(({ className, ...props }, ref) => ( )); diff --git a/apps/web/components/ui/dropdown-menu.tsx b/apps/web/components/ui/dropdown-menu.tsx index 3a9a2ff7..2bab577e 100644 --- a/apps/web/components/ui/dropdown-menu.tsx +++ b/apps/web/components/ui/dropdown-menu.tsx @@ -1,11 +1,10 @@ "use client"; import * as React from "react"; +import { cn } from "@/lib/utils"; import * as DropdownMenuPrimitive from "@radix-ui/react-dropdown-menu"; import { Check, ChevronRight, Circle } from "lucide-react"; -import { cn } from "@/lib/utils"; - const DropdownMenu = DropdownMenuPrimitive.Root; const DropdownMenuTrigger = DropdownMenuPrimitive.Trigger; @@ -27,7 +26,7 @@ const DropdownMenuSubTrigger = React.forwardRef< (({ className, ...props }, ref) => ( )); diff --git a/apps/web/components/ui/form.tsx b/apps/web/components/ui/form.tsx index e62e10e9..20ce3c4b 100644 --- a/apps/web/components/ui/form.tsx +++ b/apps/web/components/ui/form.tsx @@ -1,26 +1,19 @@ +import type * as LabelPrimitive from "@radix-ui/react-label"; +import type { ControllerProps, FieldPath, FieldValues } from "react-hook-form"; import * as React from "react"; -import * as LabelPrimitive from "@radix-ui/react-label"; -import { Slot } from "@radix-ui/react-slot"; -import { - Controller, - ControllerProps, - FieldPath, - FieldValues, - FormProvider, - useFormContext, -} from "react-hook-form"; - -import { cn } from "@/lib/utils"; import { Label } from "@/components/ui/label"; +import { cn } from "@/lib/utils"; +import { Slot } from "@radix-ui/react-slot"; +import { Controller, FormProvider, useFormContext } from "react-hook-form"; const Form = FormProvider; -type FormFieldContextValue< +interface FormFieldContextValue< TFieldValues extends FieldValues = FieldValues, TName extends FieldPath = FieldPath, -> = { +> { name: TName; -}; +} const FormFieldContext = React.createContext( {} as FormFieldContextValue, @@ -62,9 +55,9 @@ const useFormField = () => { }; }; -type FormItemContextValue = { +interface FormItemContextValue { id: string; -}; +} const FormItemContext = React.createContext( {} as FormItemContextValue, @@ -134,7 +127,7 @@ const FormDescription = React.forwardRef<

); @@ -156,7 +149,7 @@ const FormMessage = React.forwardRef<

{body} diff --git a/apps/web/components/ui/imageCard.tsx b/apps/web/components/ui/imageCard.tsx index f10ebdb5..e4941733 100644 --- a/apps/web/components/ui/imageCard.tsx +++ b/apps/web/components/ui/imageCard.tsx @@ -1,5 +1,4 @@ import * as React from "react"; - import { cn } from "@/lib/utils"; export function ImageCard({ diff --git a/apps/web/components/ui/input.tsx b/apps/web/components/ui/input.tsx index 21aac7ad..5543446c 100644 --- a/apps/web/components/ui/input.tsx +++ b/apps/web/components/ui/input.tsx @@ -1,9 +1,7 @@ import * as React from "react"; - import { cn } from "@/lib/utils"; -export interface InputProps - extends React.InputHTMLAttributes {} +export type InputProps = React.InputHTMLAttributes; const Input = React.forwardRef( ({ className, type, ...props }, ref) => { @@ -11,7 +9,7 @@ const Input = React.forwardRef( , @@ -40,7 +39,7 @@ const ScrollBar = React.forwardRef< )} {...props} > - + )); ScrollBar.displayName = ScrollAreaPrimitive.ScrollAreaScrollbar.displayName; diff --git a/apps/web/components/ui/select.tsx b/apps/web/components/ui/select.tsx index efd4ff1e..9895e94a 100644 --- a/apps/web/components/ui/select.tsx +++ b/apps/web/components/ui/select.tsx @@ -1,11 +1,10 @@ "use client"; import * as React from "react"; +import { cn } from "@/lib/utils"; import * as SelectPrimitive from "@radix-ui/react-select"; import { Check, ChevronDown, ChevronUp } from "lucide-react"; -import { cn } from "@/lib/utils"; - const Select = SelectPrimitive.Root; const SelectGroup = SelectPrimitive.Group; @@ -19,7 +18,7 @@ const SelectTrigger = React.forwardRef< span]:line-clamp-1", + "flex h-10 w-full items-center justify-between rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background placeholder:text-muted-foreground focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 [&>span]:line-clamp-1", className, )} {...props} @@ -75,7 +74,7 @@ const SelectContent = React.forwardRef< (({ className, ...props }, ref) => ( )); diff --git a/apps/web/components/ui/separator.tsx b/apps/web/components/ui/separator.tsx index 3b9f2b84..09303128 100644 --- a/apps/web/components/ui/separator.tsx +++ b/apps/web/components/ui/separator.tsx @@ -1,9 +1,8 @@ "use client"; import * as React from "react"; -import * as SeparatorPrimitive from "@radix-ui/react-separator"; - import { cn } from "@/lib/utils"; +import * as SeparatorPrimitive from "@radix-ui/react-separator"; const Separator = React.forwardRef< React.ElementRef, @@ -18,7 +17,7 @@ const Separator = React.forwardRef< decorative={decorative} orientation={orientation} className={cn( - "bg-border shrink-0", + "shrink-0 bg-border", orientation === "horizontal" ? "h-[1px] w-full" : "h-full w-[1px]", className, )} diff --git a/apps/web/components/ui/skeleton.tsx b/apps/web/components/ui/skeleton.tsx index 5fab2023..2cdf440d 100644 --- a/apps/web/components/ui/skeleton.tsx +++ b/apps/web/components/ui/skeleton.tsx @@ -6,7 +6,7 @@ function Skeleton({ }: React.HTMLAttributes) { return (

); diff --git a/apps/web/components/ui/table.tsx b/apps/web/components/ui/table.tsx index 0fa9288e..95b43b8c 100644 --- a/apps/web/components/ui/table.tsx +++ b/apps/web/components/ui/table.tsx @@ -1,5 +1,4 @@ import * as React from "react"; - import { cn } from "@/lib/utils"; const Table = React.forwardRef< @@ -43,7 +42,7 @@ const TableFooter = React.forwardRef< tr]:last:border-b-0", + "border-t bg-muted/50 font-medium [&>tr]:last:border-b-0", className, )} {...props} @@ -58,7 +57,7 @@ const TableRow = React.forwardRef< (({ className, ...props }, ref) => ( )); diff --git a/apps/web/components/ui/tabs.tsx b/apps/web/components/ui/tabs.tsx index 990017db..4c1b0ab1 100644 --- a/apps/web/components/ui/tabs.tsx +++ b/apps/web/components/ui/tabs.tsx @@ -1,9 +1,8 @@ "use client"; import * as React from "react"; -import * as TabsPrimitive from "@radix-ui/react-tabs"; - import { cn } from "@/lib/utils"; +import * as TabsPrimitive from "@radix-ui/react-tabs"; const Tabs = TabsPrimitive.Root; @@ -14,7 +13,7 @@ const TabsList = React.forwardRef< {} +export type TextareaProps = React.TextareaHTMLAttributes; const Textarea = React.forwardRef( ({ className, ...props }, ref) => { return (