Skip to content

Commit e38a50e

Browse files
committed
refactor: improve code formatting and consistency across multiple files
1 parent cccba26 commit e38a50e

17 files changed

Lines changed: 101 additions & 107 deletions

.github/workflows/pr-checks.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,5 +19,6 @@ jobs:
1919
node-version: ${{ matrix.node-version }}
2020
cache: "npm"
2121
- run: npm ci
22+
- run: npm run format:check
2223
- run: npm run lint
2324
- run: npm test

.vscode/settings.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
{
2-
"git.ignoreLimitWarning": true,
3-
"typescript.tsdk": "node_modules\\typescript\\lib"
4-
}
2+
"git.ignoreLimitWarning": true,
3+
"typescript.tsdk": "node_modules\\typescript\\lib"
4+
}

firebase.json

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,7 @@
44
},
55
"hosting": {
66
"public": "dist",
7-
"ignore": [
8-
"firebase.json",
9-
"**/.*",
10-
"**/node_modules/**"
11-
],
7+
"ignore": ["firebase.json", "**/.*", "**/node_modules/**"],
128
"rewrites": [
139
{
1410
"source": "**",

index.html

Lines changed: 15 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,17 @@
1-
<!DOCTYPE html>
1+
<!doctype html>
22
<html lang="en">
3+
<head>
4+
<meta charset="utf-8" />
5+
<link rel="icon" href="/favicon.ico" />
6+
<meta name="viewport" content="width=device-width, initial-scale=1" />
7+
<meta name="theme-color" content="#000000" />
8+
<meta name="description" content="Web site with selected dishes recipes" />
9+
<link rel="manifest" href="/manifest.json" />
10+
<title>Dev Cooking</title>
11+
</head>
312

4-
<head>
5-
<meta charset="utf-8" />
6-
<link rel="icon" href="/favicon.ico" />
7-
<meta name="viewport" content="width=device-width, initial-scale=1" />
8-
<meta name="theme-color" content="#000000" />
9-
<meta name="description" content="Web site with selected dishes recipes" />
10-
<link rel="manifest" href="/manifest.json" />
11-
<title>Dev Cooking</title>
12-
</head>
13-
14-
<body>
15-
<div id="root"></div>
16-
<script type="module" src="/src/index.tsx"></script>
17-
</body>
18-
19-
</html>
13+
<body>
14+
<div id="root"></div>
15+
<script type="module" src="/src/index.tsx"></script>
16+
</body>
17+
</html>

package.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,8 @@
2828
"dev": "vite",
2929
"build": "tsc -b && vite build",
3030
"lint": "eslint .",
31+
"format:check": "prettier --check .",
32+
"format": "prettier --write .",
3133
"preview": "vite preview",
3234
"test": "vitest",
3335
"test:coverage": "vitest run --coverage --watch=false"

src/components/fragments/userBadge.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ const UserBadge = () => {
2626
<div className="flex flex-row items-center gap-2 justify-baseline mt-3">
2727
<span className="">{username}</span>
2828
<Tooltip>
29-
<TooltipTrigger>
29+
<TooltipTrigger asChild>
3030
<Button
3131
size="xs"
3232
variant="ghost"

src/components/ui/button.tsx

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
import * as React from "react"
2-
import { Slot } from "@radix-ui/react-slot"
3-
import { cva, type VariantProps } from "class-variance-authority"
1+
import * as React from "react";
2+
import { Slot } from "@radix-ui/react-slot";
3+
import { cva, type VariantProps } from "class-variance-authority";
44

5-
import { cn } from "@/lib/utils"
5+
import { cn } from "@/lib/utils";
66

77
const buttonVariants = cva(
88
"inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium transition-all disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4 shrink-0 [&_svg]:shrink-0 outline-none focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive",
@@ -35,8 +35,8 @@ const buttonVariants = cva(
3535
variant: "default",
3636
size: "default",
3737
},
38-
}
39-
)
38+
},
39+
);
4040

4141
function Button({
4242
className,
@@ -46,9 +46,9 @@ function Button({
4646
...props
4747
}: React.ComponentProps<"button"> &
4848
VariantProps<typeof buttonVariants> & {
49-
asChild?: boolean
49+
asChild?: boolean;
5050
}) {
51-
const Comp = asChild ? Slot : "button"
51+
const Comp = asChild ? Slot : "button";
5252

5353
return (
5454
<Comp
@@ -58,7 +58,7 @@ function Button({
5858
className={cn(buttonVariants({ variant, size, className }))}
5959
{...props}
6060
/>
61-
)
61+
);
6262
}
6363

64-
export { Button, buttonVariants }
64+
export { Button, buttonVariants };

src/components/ui/input-group.tsx

Lines changed: 23 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
import * as React from "react"
2-
import { cva, type VariantProps } from "class-variance-authority"
1+
import * as React from "react";
2+
import { cva, type VariantProps } from "class-variance-authority";
33

4-
import { cn } from "@/lib/utils"
5-
import { Button } from "@/components/ui/button"
6-
import { Input } from "@/components/ui/input"
7-
import { Textarea } from "@/components/ui/textarea"
4+
import { cn } from "@/lib/utils";
5+
import { Button } from "@/components/ui/button";
6+
import { Input } from "@/components/ui/input";
7+
import { Textarea } from "@/components/ui/textarea";
88

99
function InputGroup({ className, ...props }: React.ComponentProps<"div">) {
1010
return (
@@ -27,11 +27,11 @@ function InputGroup({ className, ...props }: React.ComponentProps<"div">) {
2727
// Error state.
2828
"has-[[data-slot][aria-invalid=true]]:ring-destructive/20 has-[[data-slot][aria-invalid=true]]:border-destructive dark:has-[[data-slot][aria-invalid=true]]:ring-destructive/40",
2929

30-
className
30+
className,
3131
)}
3232
{...props}
3333
/>
34-
)
34+
);
3535
}
3636

3737
const inputGroupAddonVariants = cva(
@@ -52,8 +52,8 @@ const inputGroupAddonVariants = cva(
5252
defaultVariants: {
5353
align: "inline-start",
5454
},
55-
}
56-
)
55+
},
56+
);
5757

5858
function InputGroupAddon({
5959
className,
@@ -68,13 +68,13 @@ function InputGroupAddon({
6868
className={cn(inputGroupAddonVariants({ align }), className)}
6969
onClick={(e) => {
7070
if ((e.target as HTMLElement).closest("button")) {
71-
return
71+
return;
7272
}
73-
e.currentTarget.parentElement?.querySelector("input")?.focus()
73+
e.currentTarget.parentElement?.querySelector("input")?.focus();
7474
}}
7575
{...props}
7676
/>
77-
)
77+
);
7878
}
7979

8080
const inputGroupButtonVariants = cva(
@@ -92,8 +92,8 @@ const inputGroupButtonVariants = cva(
9292
defaultVariants: {
9393
size: "xs",
9494
},
95-
}
96-
)
95+
},
96+
);
9797

9898
function InputGroupButton({
9999
className,
@@ -111,19 +111,19 @@ function InputGroupButton({
111111
className={cn(inputGroupButtonVariants({ size }), className)}
112112
{...props}
113113
/>
114-
)
114+
);
115115
}
116116

117117
function InputGroupText({ className, ...props }: React.ComponentProps<"span">) {
118118
return (
119119
<span
120120
className={cn(
121121
"text-muted-foreground flex items-center gap-2 text-sm [&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4",
122-
className
122+
className,
123123
)}
124124
{...props}
125125
/>
126-
)
126+
);
127127
}
128128

129129
function InputGroupInput({
@@ -135,11 +135,11 @@ function InputGroupInput({
135135
data-slot="input-group-control"
136136
className={cn(
137137
"flex-1 rounded-none border-0 bg-transparent shadow-none focus-visible:ring-0 dark:bg-transparent",
138-
className
138+
className,
139139
)}
140140
{...props}
141141
/>
142-
)
142+
);
143143
}
144144

145145
function InputGroupTextarea({
@@ -151,11 +151,11 @@ function InputGroupTextarea({
151151
data-slot="input-group-control"
152152
className={cn(
153153
"flex-1 resize-none rounded-none border-0 bg-transparent py-3 shadow-none focus-visible:ring-0 dark:bg-transparent",
154-
className
154+
className,
155155
)}
156156
{...props}
157157
/>
158-
)
158+
);
159159
}
160160

161161
export {
@@ -165,4 +165,4 @@ export {
165165
InputGroupText,
166166
InputGroupInput,
167167
InputGroupTextarea,
168-
}
168+
};

src/components/ui/input.tsx

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
import * as React from "react"
1+
import * as React from "react";
22

3-
import { cn } from "@/lib/utils"
3+
import { cn } from "@/lib/utils";
44

55
function Input({ className, type, ...props }: React.ComponentProps<"input">) {
66
return (
@@ -11,11 +11,11 @@ function Input({ className, type, ...props }: React.ComponentProps<"input">) {
1111
"file:text-foreground placeholder:text-muted-foreground selection:bg-primary selection:text-primary-foreground dark:bg-input/30 border-input h-9 w-full min-w-0 rounded-md border bg-transparent px-3 py-1 text-base shadow-xs transition-[color,box-shadow] outline-none file:inline-flex file:h-7 file:border-0 file:bg-transparent file:text-sm file:font-medium disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50 md:text-sm",
1212
"focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px]",
1313
"aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive",
14-
className
14+
className,
1515
)}
1616
{...props}
1717
/>
18-
)
18+
);
1919
}
2020

21-
export { Input }
21+
export { Input };

src/components/ui/spinner.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
import { Loader2Icon } from "lucide-react"
1+
import { Loader2Icon } from "lucide-react";
22

3-
import { cn } from "@/lib/utils"
3+
import { cn } from "@/lib/utils";
44

55
function Spinner({ className, ...props }: React.ComponentProps<"svg">) {
66
return (
@@ -10,7 +10,7 @@ function Spinner({ className, ...props }: React.ComponentProps<"svg">) {
1010
className={cn("size-4 animate-spin", className)}
1111
{...props}
1212
/>
13-
)
13+
);
1414
}
1515

16-
export { Spinner }
16+
export { Spinner };

0 commit comments

Comments
 (0)