require-sql-access-class
Keep SQL reads and writes inside a class that receives its database dependency.
Why
An injected repository class is the preferred ownership boundary for database access under this architectural policy; free functions can also express explicit dependencies.
Fix
Move the query into a repository or store class and inject the pool, connection, transaction, or typed database binding through its constructor.
Examples
export function find(database: Database.Database, id: string) { return database.prepare("SELECT id FROM user WHERE id = ?").get(id);}export class UserRepository { constructor(private readonly db: Database.Database) {} find(id: string) { return this.db.prepare("SELECT id FROM user WHERE id = ?").get(id); }}