Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 22 additions & 11 deletions bun.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

80 changes: 61 additions & 19 deletions eslint.config.mjs
Original file line number Diff line number Diff line change
@@ -1,46 +1,88 @@
import { dirname } from "path";
import { fileURLToPath } from "url";
import { FlatCompat } from "@eslint/eslintrc";
import js from "@eslint/js";
import nextPlugin from "@next/eslint-plugin-next";
import tsParser from "@typescript-eslint/parser";
import tsPlugin from "@typescript-eslint/eslint-plugin";
import reactHooksPlugin from "eslint-plugin-react-hooks";

const __filename = fileURLToPath(import.meta.url);
const __dirname = dirname(__filename);
const globals = {
React: "readonly",
process: "readonly",
global: "readonly",
};

const compat = new FlatCompat({
baseDirectory: __dirname,
});

const eslintConfig = [
...compat.extends("next/core-web-vitals", "next/typescript"),
export default [
{
ignores: [
"node_modules/**",
".next/**",
"out/**",
"build/**",
"dist/**",
"next-env.d.ts",
".env*",
],
},
js.configs.recommended,
{
files: ["**/*.{js,jsx,ts,tsx}"],
languageOptions: {
parser: tsParser,
parserOptions: {
ecmaVersion: "latest",
sourceType: "module",
ecmaFeatures: {
jsx: true,
},
},
globals: {
...globals,
document: "readonly",
window: "readonly",
navigator: "readonly",
HTMLElement: "readonly",
HTMLDivElement: "readonly",
HTMLButtonElement: "readonly",
HTMLFormElement: "readonly",
MouseEvent: "readonly",
Event: "readonly",
ResizeObserver: "readonly",
requestAnimationFrame: "readonly",
cancelAnimationFrame: "readonly",
setTimeout: "readonly",
Blob: "readonly",
URL: "readonly",
Navigator: "readonly",
Request: "readonly",
},
},
plugins: {
"@next/next": nextPlugin,
"@typescript-eslint": tsPlugin,
"react-hooks": reactHooksPlugin,
},
rules: {
"no-console": "error",
...nextPlugin.configs.recommended.rules,
...nextPlugin.configs["core-web-vitals"].rules,
...tsPlugin.configs.recommended.rules,
...reactHooksPlugin.configs.recommended.rules,
"no-console": "warn",
"no-var": "error",
"prefer-const": "error",
eqeqeq: ["error", "always"],
"no-unused-vars": [
"error",
"no-debugger": "error",
"@typescript-eslint/no-unused-vars": [
"warn",
{
argsIgnorePattern: "^_",
varsIgnorePattern: "^_",
},
],
"no-debugger": "error",
"no-alert": "error",
},
},
{
files: ["src/components/ui/**/*.{ts,tsx}"],
rules: {
"no-unused-vars": "off",
"@typescript-eslint/no-unused-vars": "off",
},
},
];

export default eslintConfig;
3 changes: 3 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,11 @@
"@types/node": "^20.19.26",
"@types/react": "19.2.7",
"@types/react-dom": "19.2.3",
"@typescript-eslint/eslint-plugin": "^8.54.0",
"@typescript-eslint/parser": "^8.54.0",
"eslint": "^9.39.1",
"eslint-config-next": "16.1.4",
"eslint-plugin-react-hooks": "^7.0.1",
"prisma": "^7.1.0",
"tailwindcss": "^4.1.18",
"tw-animate-css": "^1.4.0",
Expand Down
2 changes: 2 additions & 0 deletions src/app/admin/layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ function TopBar() {

useEffect(() => {
const initialBg = initAdminSimpleMode();
// eslint-disable-next-line react-hooks/set-state-in-effect
setSimpleBg(initialBg);
if (initialBg) {
setMode("low");
Expand Down Expand Up @@ -84,6 +85,7 @@ function AdminLayoutInner({ children }: { children: React.ReactNode }) {
const [silkColor, setSilkColor] = useState(darkThemeColor);

useEffect(() => {
// eslint-disable-next-line react-hooks/set-state-in-effect
setSilkColor(theme === "light" ? lightThemeColor : darkThemeColor);
}, [theme]);

Expand Down
22 changes: 22 additions & 0 deletions src/app/api/public/[...trpc]/route.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import { fetchRequestHandler } from "@trpc/server/adapters/fetch";
import { appRouter } from "@/server/routers/_app";
import { createContext } from "@/server/context";

const handler = async (req: Request) => {
console.log(`[PUBLIC TRPC] ${req.method} ${req.url}`);
return fetchRequestHandler({
endpoint: "/api/public/trpc",
req,
router: appRouter,
createContext: async () => {
const ctx = await createContext({ req });
console.log("[PUBLIC TRPC] Context created");
return ctx;
},
onError: ({ error, path }) => {
console.error(`[PUBLIC TRPC ERROR] path: ${path}, error:`, error);
},
});
};

export { handler as GET, handler as POST };
13 changes: 0 additions & 13 deletions src/app/api/public/[trpc]/route.ts

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import { auth } from "@/auth";
import { headers } from "next/headers";

const handler = async (req: Request) => {
console.log(`[AUTH TRPC] ${req.method} ${req.url}`);
const session = await auth.api.getSession({
headers: await headers(),
});
Expand All @@ -13,7 +14,16 @@ const handler = async (req: Request) => {
endpoint: "/api/trpc",
req,
router: appRouter,
createContext: () => createContext({ req, session }),
createContext: async () => {
const ctx = await createContext({ req, session });
console.log(
`[AUTH TRPC] Context created for user: ${session?.user?.email || "anonymous"}`,
);
return ctx;
},
onError: ({ error, path }) => {
console.error(`[AUTH TRPC ERROR] path: ${path}, error:`, error);
},
});
};

Expand Down
Loading
Loading