lint errors

This commit is contained in:
dal 2025-09-22 08:59:25 -06:00
parent 83aca9300e
commit e68032ab8d
No known key found for this signature in database
GPG Key ID: 16F4B0E1E9F61122
9 changed files with 41 additions and 27 deletions

View File

@ -2,7 +2,8 @@
"$schema": "https://biomejs.dev/schemas/1.9.4/schema.json",
"extends": ["../../biome.json"],
"files": {
"include": ["src/**/*", "scripts/**/*"]
"include": ["src/**/*"],
"ignore": ["scripts/**/*"]
},
"overrides": [
{

View File

@ -11,12 +11,14 @@ if (!connectionString) {
}
// Disable SSL for local development
const isDevelopment = process.env.ENVIRONMENT === 'development' || process.env.NODE_ENV === 'development';
const isDevelopment =
process.env.ENVIRONMENT === 'development' || process.env.NODE_ENV === 'development';
// Append sslmode=disable for local development if not already present
const dbUrl = isDevelopment && !connectionString.includes('sslmode=')
? `${connectionString}?sslmode=disable`
: connectionString;
const dbUrl =
isDevelopment && !connectionString.includes('sslmode=')
? `${connectionString}?sslmode=disable`
: connectionString;
export default defineConfig({
schema: './src/schema.ts',

View File

@ -1,6 +1,6 @@
import * as path from 'node:path';
import { fileURLToPath } from 'node:url';
import { config } from 'dotenv';
import * as path from 'path';
import { fileURLToPath } from 'url';
// Get the directory name for ES modules
const __filename = fileURLToPath(import.meta.url);
@ -61,18 +61,28 @@ export function initializePool<T extends Record<string, postgres.PostgresType>>(
// Create postgres client with pool configuration
// Disable SSL for local development
const isDevelopment = process.env.ENVIRONMENT === 'development' || process.env.NODE_ENV === 'development';
console.log('Database connection - ENVIRONMENT:', process.env.ENVIRONMENT, 'NODE_ENV:', process.env.NODE_ENV, 'isDevelopment:', isDevelopment);
const isDevelopment =
process.env.ENVIRONMENT === 'development' || process.env.NODE_ENV === 'development';
console.log(
'Database connection - ENVIRONMENT:',
process.env.ENVIRONMENT,
'NODE_ENV:',
process.env.NODE_ENV,
'isDevelopment:',
isDevelopment
);
globalPool = postgres(connectionString, {
max: poolSize,
idle_timeout: 30,
connect_timeout: 30,
prepare: true,
ssl: isDevelopment ? false : {
rejectUnauthorized: false, // Allow self-signed certificates
},
ssl: isDevelopment
? false
: {
rejectUnauthorized: false, // Allow self-signed certificates
},
...config,
});

View File

@ -10,7 +10,7 @@ vi.mock('../../connection', () => ({
// Mock drizzle-orm
vi.mock('drizzle-orm', async (importOriginal) => {
const actual = (await importOriginal()) as any;
const actual = (await importOriginal()) as Record<string, unknown>;
return {
...actual,
sql: actual.sql,

View File

@ -10,7 +10,7 @@ vi.mock('../../connection', () => ({
// Mock drizzle-orm
vi.mock('drizzle-orm', async (importOriginal) => {
const actual = (await importOriginal()) as any;
const actual = (await importOriginal()) as Record<string, unknown>;
return {
...actual,
sql: actual.sql,

View File

@ -82,10 +82,10 @@ describe('getOrganizationDocs', () => {
organizationId: '123e4567-e89b-12d3-a456-426614174000',
};
let mockSelect: any;
let mockFrom: any;
let mockWhere: any;
let mockOrderBy: any;
let mockSelect: ReturnType<typeof vi.fn>;
let mockFrom: ReturnType<typeof vi.fn>;
let mockWhere: ReturnType<typeof vi.fn>;
let mockOrderBy: ReturnType<typeof vi.fn>;
beforeEach(() => {
vi.clearAllMocks();

View File

@ -124,10 +124,10 @@ describe('upsertDoc', () => {
organizationId: '123e4567-e89b-12d3-a456-426614174000',
};
let mockInsert: any;
let mockValues: any;
let mockOnConflictDoUpdate: any;
let mockReturning: any;
let mockInsert: ReturnType<typeof vi.fn>;
let mockValues: ReturnType<typeof vi.fn>;
let mockOnConflictDoUpdate: ReturnType<typeof vi.fn>;
let mockReturning: ReturnType<typeof vi.fn>;
beforeEach(() => {
vi.clearAllMocks();

View File

@ -87,9 +87,10 @@ export async function createShortcut(input: CreateShortcutInput) {
.returning();
return created;
} catch (error: any) {
} catch (error: unknown) {
// Handle unique constraint violation
if (error?.code === '23505' && error?.constraint?.includes('unique')) {
const dbError = error as { code?: string; constraint?: string };
if (dbError?.code === '23505' && dbError?.constraint?.includes('unique')) {
throw new Error(`Shortcut with name '${validated.name}' already exists`);
}
throw error;

View File

@ -16,7 +16,7 @@ export type UpdateShortcutInput = z.infer<typeof UpdateShortcutInputSchema>;
export async function updateShortcut(input: UpdateShortcutInput) {
const validated = UpdateShortcutInputSchema.parse(input);
const updateData: Record<string, any> = {
const updateData: Record<string, unknown> = {
updatedBy: validated.updatedBy,
updatedAt: new Date().toISOString(),
};