Skip to content

Commit

Permalink
formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
HugeLetters committed Aug 15, 2023
1 parent 6fefc6e commit 94e3ed0
Show file tree
Hide file tree
Showing 9 changed files with 19 additions and 42 deletions.
3 changes: 0 additions & 3 deletions .github/workflows/code-quality.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,6 @@ jobs:
cache-dependency-path: "pnpm-lock.yaml"
- run: pnpm install
name: Setup node_modules
- run: pnpm typecheck
name: Typecheck
if: steps.node.outcome=='success'
- run: pnpm lint
name: Lint
if: steps.node.outcome=='success'
Expand Down
2 changes: 2 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
.next
pnpm-lock.yaml
7 changes: 5 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,13 @@
"private": true,
"packageManager": "[email protected]",
"scripts": {
"build": "next build",
"dev": "next dev",
"build": "next build",
"start": "next start",
"lint": "next lint",
"start": "next start"
"typecheck": "nuxt typecheck",
"check-format": "prettier . -c",
"format": "pnpm check-format -w"
},
"dependencies": {
"@t3-oss/env-nextjs": "^0.3.1",
Expand Down
4 changes: 1 addition & 3 deletions src/env.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,7 @@ export const env = createEnv({
server: {
NODE_ENV: z.enum(["development", "test", "production"]),
NEXTAUTH_SECRET:
process.env.NODE_ENV === "production"
? z.string().min(1)
: z.string().min(1).optional(),
process.env.NODE_ENV === "production" ? z.string().min(1) : z.string().min(1).optional(),
NEXTAUTH_URL: z.preprocess(
// This makes Vercel deployments not fail if you don't set NEXTAUTH_URL
// Since NextAuth.js automatically uses the VERCEL_URL if present.
Expand Down
4 changes: 1 addition & 3 deletions src/pages/api/trpc/[trpc].ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,7 @@ export default createNextApiHandler({
onError:
env.NODE_ENV === "development"
? ({ path, error }) => {
console.error(
`❌ tRPC failed on ${path ?? "<no-path>"}: ${error.message}`
);
console.error(`❌ tRPC failed on ${path ?? "<no-path>"}: ${error.message}`);
}
: undefined,
});
18 changes: 6 additions & 12 deletions src/server/api/routers/example.ts
Original file line number Diff line number Diff line change
@@ -1,18 +1,12 @@
import {
createTRPCRouter,
protectedProcedure,
publicProcedure,
} from "@/server/api/trpc";
import { createTRPCRouter, protectedProcedure, publicProcedure } from "@/server/api/trpc";
import { z } from "zod";

export const exampleRouter = createTRPCRouter({
hello: publicProcedure
.input(z.object({ text: z.string() }))
.query(({ input }) => {
return {
greeting: `Hello ${input.text}`,
};
}),
hello: publicProcedure.input(z.object({ text: z.string() })).query(({ input }) => {
return {
greeting: `Hello ${input.text}`,
};
}),

getSecretMessage: protectedProcedure.query(() => {
return "you can now see this secret message!";
Expand Down
8 changes: 2 additions & 6 deletions src/server/api/trpc.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,10 +47,7 @@ const createInnerTRPCContext = ({ session }: CreateContextOptions) => {
*
* @see https://trpc.io/docs/context
*/
export const createTRPCContext = async ({
req,
res,
}: CreateNextContextOptions) => {
export const createTRPCContext = async ({ req, res }: CreateNextContextOptions) => {
// Get the session from the server using the getServerSession wrapper function
const session = await getServerAuthSession({ req, res });

Expand All @@ -74,8 +71,7 @@ const t = initTRPC.context<typeof createTRPCContext>().create({
...shape,
data: {
...shape.data,
zodError:
error.cause instanceof ZodError ? error.cause.flatten() : null,
zodError: error.cause instanceof ZodError ? error.cause.flatten() : null,
},
};
},
Expand Down
6 changes: 1 addition & 5 deletions src/server/auth.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,5 @@
import { type GetServerSidePropsContext } from "next";
import {
getServerSession,
type NextAuthOptions,
type DefaultSession,
} from "next-auth";
import { getServerSession, type NextAuthOptions, type DefaultSession } from "next-auth";
import DiscordProvider from "next-auth/providers/discord";
import { env } from "@/env.mjs";

Expand Down
9 changes: 1 addition & 8 deletions tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,6 @@
"@/*": ["./src/*"]
}
},
"include": [
".eslintrc.cjs",
"next-env.d.ts",
"**/*.ts",
"**/*.tsx",
"**/*.cjs",
"**/*.mjs"
],
"include": [".eslintrc.cjs", "next-env.d.ts", "**/*.ts", "**/*.tsx", "**/*.cjs", "**/*.mjs"],
"exclude": ["node_modules"]
}

0 comments on commit 94e3ed0

Please sign in to comment.