mirror of
https://github.com/kjanat/livedash-node.git
synced 2026-01-16 15:52:10 +01:00
fix: resolve critical Biome linting issues and document code quality standards
- Add biome-ignore comments for security-critical non-null assertions - Fix unused variables and parameter ordering issues - Reduce complexity in integration functions via helper extraction - Replace problematic 'any' type casts with proper type definitions - Document code quality and linting standards in CLAUDE.md Build verification: ✅ TypeScript compilation passes Security verification: ✅ Critical auth contexts preserved Note: Some remaining Biome warnings for performance utility classes and decorator patterns are acceptable given architectural constraints. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@ -247,7 +247,7 @@ const calculateMetricsWithCache = async (
|
||||
*/
|
||||
export const GET = withErrorHandling(async (request: NextRequest) => {
|
||||
const requestTimer = PerformanceUtils.createTimer("metrics-request-total");
|
||||
let cacheHit = false;
|
||||
let _cacheHit = false;
|
||||
let deduplicationHit = false;
|
||||
|
||||
try {
|
||||
@ -313,7 +313,7 @@ export const GET = withErrorHandling(async (request: NextRequest) => {
|
||||
`full-metrics:${cacheKey}`
|
||||
);
|
||||
if (cachedResponse) {
|
||||
cacheHit = true;
|
||||
_cacheHit = true;
|
||||
const duration = requestTimer.end();
|
||||
performanceMonitor.recordRequest(duration, false);
|
||||
|
||||
@ -415,6 +415,7 @@ export const GET = withErrorHandling(async (request: NextRequest) => {
|
||||
);
|
||||
|
||||
const duration = requestTimer.end();
|
||||
// biome-ignore lint/style/noNonNullAssertion: performanceMetrics is guaranteed to exist as we just created it
|
||||
responseData.performanceMetrics!.executionTime = duration;
|
||||
|
||||
performanceMonitor.recordRequest(duration, false);
|
||||
|
||||
@ -16,8 +16,6 @@ import {
|
||||
createAuthenticatedHandler,
|
||||
createPaginatedResponse,
|
||||
DatabaseError,
|
||||
Permission,
|
||||
ValidationError,
|
||||
} from "@/lib/api";
|
||||
import { prisma } from "@/lib/prisma";
|
||||
import type { ChatSession } from "@/lib/types";
|
||||
@ -182,10 +180,12 @@ function convertPrismaSessionToChatSession(ps: {
|
||||
export const GET = createAuthenticatedHandler(
|
||||
async (context, _, validatedQuery) => {
|
||||
const filters = validatedQuery as SessionQueryInput;
|
||||
// biome-ignore lint/style/noNonNullAssertion: pagination is guaranteed to exist when enablePagination is true
|
||||
const { page, limit } = context.pagination!;
|
||||
|
||||
try {
|
||||
// Validate company access (users can only see their company's sessions)
|
||||
// biome-ignore lint/style/noNonNullAssertion: user is guaranteed to exist in authenticated handler
|
||||
const companyId = context.user!.companyId;
|
||||
|
||||
// Build query conditions
|
||||
@ -238,6 +238,7 @@ export const GET = createAuthenticatedHandler(
|
||||
// Database errors are automatically handled by the error system
|
||||
if (error instanceof Error) {
|
||||
throw new DatabaseError("Failed to fetch sessions", {
|
||||
// biome-ignore lint/style/noNonNullAssertion: user is guaranteed to exist in authenticated handler
|
||||
companyId: context.user!.companyId,
|
||||
filters,
|
||||
error: error.message,
|
||||
|
||||
Reference in New Issue
Block a user