Skip to content
Closed
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
19 changes: 3 additions & 16 deletions packages/api/src/routes/index.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
import { $, OpenAPIHono } from '@hono/zod-openapi';
import { authMiddleware } from '@packrat/api/middleware';
import type { Env } from '@packrat/api/types/env';
import type { Variables } from '@packrat/api/types/variables';
import { adminRoutes } from './admin';
import { aiRoutes } from './ai';
import { authRoutes } from './auth';
Expand All @@ -19,14 +17,10 @@ import { userRoutes } from './user';
import { weatherRoutes } from './weather';
import { wildlifeRoutes } from './wildlife';

const publicRoutes = $(
new OpenAPIHono<{ Bindings: Env; Variables: Variables }>()
.route('/auth', authRoutes)
.route('/admin', adminRoutes),
);
const publicRoutes = $(new OpenAPIHono().route('/auth', authRoutes).route('/admin', adminRoutes));
Copy link

Copilot AI Apr 22, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This line is >100 chars (repo Biome lineWidth is 100) and will likely fail biome check formatting. Please reformat back to a multi-line chain (or run biome format) to keep it within the formatter’s wrapping rules.

Suggested change
const publicRoutes = $(new OpenAPIHono().route('/auth', authRoutes).route('/admin', adminRoutes));
const publicRoutes = $(
new OpenAPIHono()
.route('/auth', authRoutes)
.route('/admin', adminRoutes),
);

Copilot uses AI. Check for mistakes.

const protectedRoutes = $(
new OpenAPIHono<{ Bindings: Env; Variables: Variables }>()
new OpenAPIHono()
.use(authMiddleware)
.route('/catalog', catalogRoutes)
.route('/guides', guidesRoutes)
Expand All @@ -44,13 +38,6 @@ const protectedRoutes = $(
.route('/wildlife', wildlifeRoutes),
);

const routes = $(
new OpenAPIHono<{ Bindings: Env; Variables: Variables }>()
.route('/', publicRoutes)
.route('/', protectedRoutes),
);
const routes = $(new OpenAPIHono().route('/', publicRoutes).route('/', protectedRoutes));
Copy link

Copilot AI Apr 22, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This chained call is also over the 100-char formatter line width and is likely to trigger a formatting failure in biome check. Reformat to the multi-line style used elsewhere in this file (or run biome format).

Suggested change
const routes = $(new OpenAPIHono().route('/', publicRoutes).route('/', protectedRoutes));
const routes = $(
new OpenAPIHono().route('/', publicRoutes).route('/', protectedRoutes),
);

Copilot uses AI. Check for mistakes.

export { routes };

/** Full type of the PackRat Hono app — used by `hc<AppRoutes>()` in api-client. */
export type AppRoutes = typeof routes;
Loading