Skip to content

Commit 5157a0e

Browse files
chore: format
1 parent 03ba435 commit 5157a0e

File tree

144 files changed

+355
-323
lines changed

Some content is hidden

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

144 files changed

+355
-323
lines changed

_official-blog-tutorial/app/models/post.server.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ export async function getPost(slug: string) {
1111
}
1212

1313
export async function createPost(
14-
post: Pick<Post, "slug" | "title" | "markdown">
14+
post: Pick<Post, "slug" | "title" | "markdown">,
1515
) {
1616
return prisma.post.create({ data: post });
1717
}

_official-blog-tutorial/app/models/user.server.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ export async function deleteUserByEmail(email: User["email"]) {
3434

3535
export async function verifyLogin(
3636
email: User["email"],
37-
password: Password["hash"]
37+
password: Password["hash"],
3838
) {
3939
const userWithPassword = await prisma.user.findUnique({
4040
where: { email },
@@ -49,7 +49,7 @@ export async function verifyLogin(
4949

5050
const isValid = await bcrypt.compare(
5151
password,
52-
userWithPassword.password.hash
52+
userWithPassword.password.hash,
5353
);
5454

5555
if (!isValid) {

_official-blog-tutorial/app/routes/join.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,21 +22,21 @@ export const action = async ({ request }: ActionArgs) => {
2222
if (!validateEmail(email)) {
2323
return json(
2424
{ errors: { email: "Email is invalid", password: null } },
25-
{ status: 400 }
25+
{ status: 400 },
2626
);
2727
}
2828

2929
if (typeof password !== "string" || password.length === 0) {
3030
return json(
3131
{ errors: { email: null, password: "Password is required" } },
32-
{ status: 400 }
32+
{ status: 400 },
3333
);
3434
}
3535

3636
if (password.length < 8) {
3737
return json(
3838
{ errors: { email: null, password: "Password is too short" } },
39-
{ status: 400 }
39+
{ status: 400 },
4040
);
4141
}
4242

@@ -49,7 +49,7 @@ export const action = async ({ request }: ActionArgs) => {
4949
password: null,
5050
},
5151
},
52-
{ status: 400 }
52+
{ status: 400 },
5353
);
5454
}
5555

_official-blog-tutorial/app/routes/login.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,21 +23,21 @@ export const action = async ({ request }: ActionArgs) => {
2323
if (!validateEmail(email)) {
2424
return json(
2525
{ errors: { email: "Email is invalid", password: null } },
26-
{ status: 400 }
26+
{ status: 400 },
2727
);
2828
}
2929

3030
if (typeof password !== "string" || password.length === 0) {
3131
return json(
3232
{ errors: { email: null, password: "Password is required" } },
33-
{ status: 400 }
33+
{ status: 400 },
3434
);
3535
}
3636

3737
if (password.length < 8) {
3838
return json(
3939
{ errors: { email: null, password: "Password is too short" } },
40-
{ status: 400 }
40+
{ status: 400 },
4141
);
4242
}
4343

@@ -46,7 +46,7 @@ export const action = async ({ request }: ActionArgs) => {
4646
if (!user) {
4747
return json(
4848
{ errors: { email: "Invalid email or password", password: null } },
49-
{ status: 400 }
49+
{ status: 400 },
5050
);
5151
}
5252

_official-blog-tutorial/app/routes/notes.new.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,14 +16,14 @@ export const action = async ({ request }: ActionArgs) => {
1616
if (typeof title !== "string" || title.length === 0) {
1717
return json(
1818
{ errors: { body: null, title: "Title is required" } },
19-
{ status: 400 }
19+
{ status: 400 },
2020
);
2121
}
2222

2323
if (typeof body !== "string" || body.length === 0) {
2424
return json(
2525
{ errors: { body: "Body is required", title: null } },
26-
{ status: 400 }
26+
{ status: 400 },
2727
);
2828
}
2929

_official-blog-tutorial/app/session.server.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ export async function getSession(request: Request) {
2525
}
2626

2727
export async function getUserId(
28-
request: Request
28+
request: Request,
2929
): Promise<User["id"] | undefined> {
3030
const session = await getSession(request);
3131
const userId = session.get(USER_SESSION_KEY);
@@ -44,7 +44,7 @@ export async function getUser(request: Request) {
4444

4545
export async function requireUserId(
4646
request: Request,
47-
redirectTo: string = new URL(request.url).pathname
47+
redirectTo: string = new URL(request.url).pathname,
4848
) {
4949
const userId = await getUserId(request);
5050
if (!userId) {

_official-blog-tutorial/app/utils.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ const DEFAULT_REDIRECT = "/";
1414
*/
1515
export function safeRedirect(
1616
to: FormDataEntryValue | string | null | undefined,
17-
defaultRedirect: string = DEFAULT_REDIRECT
17+
defaultRedirect: string = DEFAULT_REDIRECT,
1818
) {
1919
if (!to || typeof to !== "string") {
2020
return defaultRedirect;
@@ -34,12 +34,12 @@ export function safeRedirect(
3434
* @returns {JSON|undefined} The router data or undefined if not found
3535
*/
3636
export function useMatchesData(
37-
id: string
37+
id: string,
3838
): Record<string, unknown> | undefined {
3939
const matchingRoutes = useMatches();
4040
const route = useMemo(
4141
() => matchingRoutes.find((route) => route.id === id),
42-
[matchingRoutes, id]
42+
[matchingRoutes, id],
4343
);
4444
return route?.data;
4545
}
@@ -60,7 +60,7 @@ export function useUser(): User {
6060
const maybeUser = useOptionalUser();
6161
if (!maybeUser) {
6262
throw new Error(
63-
"No user found in root loader, but user is required by useUser. If user is optional, try useOptionalUser instead."
63+
"No user found in root loader, but user is required by useUser. If user is optional, try useOptionalUser instead.",
6464
);
6565
}
6666
return maybeUser;

_official-blog-tutorial/cypress/support/commands.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ function login({
4949
} = {}) {
5050
cy.then(() => ({ email })).as("user");
5151
cy.exec(
52-
`npx ts-node --require tsconfig-paths/register ./cypress/support/create-user.ts "${email}"`
52+
`npx ts-node --require tsconfig-paths/register ./cypress/support/create-user.ts "${email}"`,
5353
).then(({ stdout }) => {
5454
const cookieValue = stdout
5555
.replace(/.*<cookie>(?<cookieValue>.*)<\/cookie>.*/s, "$<cookieValue>")
@@ -75,7 +75,7 @@ function cleanupUser({ email }: { email?: string } = {}) {
7575

7676
function deleteUserByEmail(email: string) {
7777
cy.exec(
78-
`npx ts-node --require tsconfig-paths/register ./cypress/support/delete-user.ts "${email}"`
78+
`npx ts-node --require tsconfig-paths/register ./cypress/support/delete-user.ts "${email}"`,
7979
);
8080
cy.clearCookie("__session");
8181
}

_official-blog-tutorial/cypress/support/create-user.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ async function createAndLogin(email: string) {
4141
<cookie>
4242
${parsedCookie.__session}
4343
</cookie>
44-
`.trim()
44+
`.trim(),
4545
);
4646
}
4747

_official-jokes/app/routes/jokes[.]rss.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -54,16 +54,16 @@ export const loader = async ({ request }: LoaderArgs) => {
5454
<item>
5555
<title><![CDATA[${escapeCdata(joke.name)}]]></title>
5656
<description><![CDATA[A funny joke called ${escapeHtml(
57-
joke.name
57+
joke.name,
5858
)}]]></description>
5959
<author><![CDATA[${escapeCdata(
60-
joke.jokester.username
60+
joke.jokester.username,
6161
)}]]></author>
6262
<pubDate>${joke.createdAt.toUTCString()}</pubDate>
6363
<link>${jokesUrl}/${joke.id}</link>
6464
<guid>${jokesUrl}/${joke.id}</guid>
6565
</item>
66-
`.trim()
66+
`.trim(),
6767
)
6868
.join("\n")}
6969
</channel>

0 commit comments

Comments
 (0)