- Install oxlint, add .oxlintrc.json with rules for TypeScript/React - Add npm run lint / lint:fix scripts - Add Claude PostToolUse hook to run oxlint on every edited file - Fix 101 errors: unused vars/imports, eqeqeq, prefer-const, no-new-array - Fix no-array-index-key (use stable keys or suppress positional cases) - Fix exhaustive-deps missing dependency in useEffect - Promote exhaustive-deps and no-array-index-key to errors - Fix Map.get() !== null bug in $leagueId.server.ts (should be !== undefined) Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
17 lines
411 B
TypeScript
17 lines
411 B
TypeScript
import { AsyncLocalStorage } from "node:async_hooks";
|
|
|
|
import type { PostgresJsDatabase } from "drizzle-orm/postgres-js";
|
|
|
|
import type * as schema from "./schema";
|
|
|
|
export const DatabaseContext = new AsyncLocalStorage<
|
|
PostgresJsDatabase<typeof schema>
|
|
>();
|
|
|
|
export function database() {
|
|
const db = DatabaseContext.getStore();
|
|
if (!db) {
|
|
throw new Error("DatabaseContext not set");
|
|
}
|
|
return db;
|
|
}
|