Skip to content

Commit b1422ad

Browse files
authored
Merge pull request #40 from ICEPrey/prettier
feat(prettier): add prettier configuration and setup
2 parents 4aa0b33 + 4e95624 commit b1422ad

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

75 files changed

+5311
-1484
lines changed

.eslintrc.json

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
{
2+
"extends": ["next/core-web-vitals", "prettier"],
3+
"plugins": ["prettier"],
4+
"rules": {
5+
"prettier/prettier": [
6+
"error",
7+
{
8+
"bracketSpacing": true,
9+
"semi": true,
10+
"trailingComma": "all",
11+
"printWidth": 80,
12+
"tabWidth": 2
13+
}
14+
]
15+
}
16+
}

.prettierignore

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
# Node modules
2+
node_modules
3+
4+
# Next.js build output
5+
.next
6+
out
7+
8+
# Yarn lock file
9+
yarn.lock
10+
11+
# Configuration files
12+
package-lock.json
13+
14+
# Logs
15+
logs
16+
*.log
17+
18+
# Coverage directory used by testing tools
19+
coverage
20+
21+
# Miscellaneous
22+
.DS_Store
23+
Thumbs.db
24+
25+
# Public and static directories (if you want to keep them untouched)
26+
public
27+
static
28+
29+
# Specific file types (optional, if you don't want Prettier to format them)
30+
*.min.js
31+
*.min.css
32+
*.svg

.prettierrc

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
{
2+
"bracketSpacing": true,
3+
"semi": true,
4+
"trailingComma": "all",
5+
"printWidth": 80,
6+
"tabWidth": 2,
7+
"plugins": ["prettier-plugin-tailwindcss"]
8+
}

CHANGELOG.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,4 +40,4 @@ Replace Cruip CSS with Tailwind CSS
4040

4141
## [1.0.0] - 2020-04-07
4242

43-
First release
43+
First release

app/(about)/about/page.tsx

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,17 @@
1-
import AboutComponent from "@/components/about"
2-
import { constructMetadata } from "@/lib/utils"
3-
import { Metadata } from "next/types"
1+
import AboutComponent from "@/components/about";
2+
import { constructMetadata } from "@/lib/utils";
3+
import { Metadata } from "next/types";
44

55
export const metadata: Metadata = constructMetadata({
66
title: "About",
77
description: "About the team behind pear.ai",
88
canonical: "/about",
9-
})
9+
});
1010

1111
export default function About() {
1212
return (
1313
<>
1414
<AboutComponent />
1515
</>
16-
)
16+
);
1717
}

app/(auth)/actions.ts

Lines changed: 13 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ import { SignUpWithPasswordCredentials } from "@supabase/supabase-js";
99
const supabase = createClient();
1010

1111
export async function signin(formData: FormData) {
12-
1312
// type-casting here for convenience
1413
// in practice, you should validate your inputs
1514
const data = {
@@ -20,7 +19,7 @@ export async function signin(formData: FormData) {
2019
const { error } = await supabase.auth.signInWithPassword(data);
2120

2221
if (error) {
23-
return {error: error.message };
22+
return { error: error.message };
2423
}
2524

2625
revalidatePath("/", "layout");
@@ -37,14 +36,14 @@ export async function signup(formData: FormData) {
3736
data: {
3837
full_name: formData.get("full-name") as string,
3938
company_name: formData.get("company-name") as string,
40-
}
41-
}
39+
},
40+
},
4241
};
4342

4443
const { error } = await supabase.auth.signUp(data);
45-
44+
4645
if (error) {
47-
return {error: error.message };
46+
return { error: error.message };
4847
}
4948

5049
revalidatePath("/", "layout");
@@ -53,19 +52,18 @@ export async function signup(formData: FormData) {
5352

5453
// Google OAuth sign-in
5554
export async function signinWithGoogle() {
56-
5755
const { data, error } = await supabase.auth.signInWithOAuth({
58-
provider: 'google',
56+
provider: "google",
5957
options: {
6058
redirectTo: `${process.env.NEXT_PUBLIC_REDIRECT_URL}/auth/callback`,
61-
}
59+
},
6260
});
6361
if (error) {
6462
redirect("/error");
6563
}
6664

6765
if (data.url) {
68-
redirect(data.url)
66+
redirect(data.url);
6967
}
7068

7169
revalidatePath("/", "layout");
@@ -74,13 +72,14 @@ export async function signinWithGoogle() {
7472

7573
// Reset password
7674
export async function resetPassword(formData: FormData) {
77-
78-
const { data, error } = await supabase.auth.resetPasswordForEmail(formData.get("email") as string);
75+
const { data, error } = await supabase.auth.resetPasswordForEmail(
76+
formData.get("email") as string,
77+
);
7978

8079
if (error) {
81-
return {error: error.message };
80+
return { error: error.message };
8281
}
8382

8483
revalidatePath("/", "layout");
8584
redirect("/");
86-
}
85+
}

app/(auth)/auth/callback/route.ts

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,38 +1,38 @@
1-
import { cookies } from 'next/headers'
2-
import { NextResponse } from 'next/server'
3-
import { type CookieOptions, createServerClient } from '@supabase/ssr'
1+
import { cookies } from "next/headers";
2+
import { NextResponse } from "next/server";
3+
import { type CookieOptions, createServerClient } from "@supabase/ssr";
44

55
export async function GET(request: Request) {
6-
const { searchParams, origin } = new URL(request.url)
7-
const code = searchParams.get('code')
6+
const { searchParams, origin } = new URL(request.url);
7+
const code = searchParams.get("code");
88
// if "next" is in param, use it as the redirect URL
9-
const next = searchParams.get('next') ?? '/'
9+
const next = searchParams.get("next") ?? "/";
1010

1111
if (code) {
12-
const cookieStore = cookies()
12+
const cookieStore = cookies();
1313
const supabase = createServerClient(
1414
process.env.NEXT_PUBLIC_SUPABASE_URL!,
1515
process.env.NEXT_PUBLIC_SUPABASE_ANON_KEY!,
1616
{
1717
cookies: {
1818
get(name: string) {
19-
return cookieStore.get(name)?.value
19+
return cookieStore.get(name)?.value;
2020
},
2121
set(name: string, value: string, options: CookieOptions) {
22-
cookieStore.set({ name, value, ...options })
22+
cookieStore.set({ name, value, ...options });
2323
},
2424
remove(name: string, options: CookieOptions) {
25-
cookieStore.delete({ name, ...options })
25+
cookieStore.delete({ name, ...options });
2626
},
2727
},
28-
}
29-
)
30-
const { error } = await supabase.auth.exchangeCodeForSession(code)
28+
},
29+
);
30+
const { error } = await supabase.auth.exchangeCodeForSession(code);
3131
if (!error) {
32-
return NextResponse.redirect(`${origin}${next}`)
32+
return NextResponse.redirect(`${origin}${next}`);
3333
}
3434
}
3535

3636
// return the user to an error page with instructions
37-
return NextResponse.redirect(`${origin}/auth/auth-code-error`)
38-
}
37+
return NextResponse.redirect(`${origin}/auth/auth-code-error`);
38+
}

app/(auth)/auth/confirm/route.ts

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,33 @@
1-
import { type EmailOtpType } from '@supabase/supabase-js'
2-
import { type NextRequest, NextResponse } from 'next/server'
1+
import { type EmailOtpType } from "@supabase/supabase-js";
2+
import { type NextRequest, NextResponse } from "next/server";
33

4-
import { createClient } from '@/utils/supabase/server'
4+
import { createClient } from "@/utils/supabase/server";
55

66
export async function GET(request: NextRequest) {
7-
const { searchParams } = new URL(request.url)
8-
const token_hash = searchParams.get('token_hash')
9-
const type = searchParams.get('type') as EmailOtpType | null
10-
const next = searchParams.get('next') ?? '/'
7+
const { searchParams } = new URL(request.url);
8+
const token_hash = searchParams.get("token_hash");
9+
const type = searchParams.get("type") as EmailOtpType | null;
10+
const next = searchParams.get("next") ?? "/";
1111

12-
const redirectTo = request.nextUrl.clone()
13-
redirectTo.pathname = next
14-
redirectTo.searchParams.delete('token_hash')
15-
redirectTo.searchParams.delete('type')
12+
const redirectTo = request.nextUrl.clone();
13+
redirectTo.pathname = next;
14+
redirectTo.searchParams.delete("token_hash");
15+
redirectTo.searchParams.delete("type");
1616

1717
if (token_hash && type) {
18-
const supabase = createClient()
18+
const supabase = createClient();
1919

2020
const { error } = await supabase.auth.verifyOtp({
2121
type,
2222
token_hash,
23-
})
23+
});
2424
if (!error) {
25-
redirectTo.searchParams.delete('next')
26-
return NextResponse.redirect(redirectTo)
25+
redirectTo.searchParams.delete("next");
26+
return NextResponse.redirect(redirectTo);
2727
}
2828
}
2929

3030
// return the user to an error page with some instructions
31-
redirectTo.pathname = '/auth/auth-code-error'
32-
return NextResponse.redirect(redirectTo)
33-
}
31+
redirectTo.pathname = "/auth/auth-code-error";
32+
return NextResponse.redirect(redirectTo);
33+
}

app/(auth)/layout.tsx

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,15 @@
1-
import PageIllustration from '@/components/page-illustration'
1+
import PageIllustration from "@/components/page-illustration";
22

33
export default function AuthLayout({
44
children,
55
}: {
6-
children: React.ReactNode
7-
}) {
6+
children: React.ReactNode;
7+
}) {
88
return (
99
<main className="grow">
10-
1110
<PageIllustration />
1211

1312
{children}
14-
1513
</main>
16-
)
14+
);
1715
}
Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
import Page from "./page";
2-
import { constructMetadata } from "@/lib/utils"
3-
import { Metadata } from "next/types"
2+
import { constructMetadata } from "@/lib/utils";
3+
import { Metadata } from "next/types";
44

55
export const metadata: Metadata = constructMetadata({
6-
title: 'Reset Password',
7-
description: 'Reset your password',
8-
canonical: '/reset-password',
9-
})
6+
title: "Reset Password",
7+
description: "Reset your password",
8+
canonical: "/reset-password",
9+
});
1010

11-
export default Page;
11+
export default Page;

0 commit comments

Comments
 (0)