diff --git a/.husky/pre-commit b/.husky/pre-commit index 0ae79894..f8471398 100755 --- a/.husky/pre-commit +++ b/.husky/pre-commit @@ -13,5 +13,6 @@ echo "$FILES" | xargs git add npm test npm run lint +npm run typecheck exit 0 diff --git a/app/analytics/collect.test.ts b/app/analytics/collect.test.ts index 4da192d6..329e8227 100644 --- a/app/analytics/collect.test.ts +++ b/app/analytics/collect.test.ts @@ -89,7 +89,7 @@ describe("collectRequestHandler", () => { [ 1, // new visitor 1, // new session - ], + ] ); }); @@ -100,13 +100,13 @@ describe("collectRequestHandler", () => { } as CFAnalyticsEngine, } as Environment; - // @ts-expect-error - we're mocking the request object const request = httpMocks.createRequest( + // @ts-expect-error - we're mocking the request object generateRequestParams({ "if-modified-since": new Date( - Date.now() - 5 * 60 * 1000, + Date.now() - 5 * 60 * 1000 ).toUTCString(), - }), + }) ); collectRequestHandler(request, env); @@ -117,7 +117,7 @@ describe("collectRequestHandler", () => { [ 0, // new visitor 0, // new session - ], + ] ); }); @@ -128,13 +128,13 @@ describe("collectRequestHandler", () => { } as CFAnalyticsEngine, } as Environment; - // @ts-expect-error - we're mocking the request object const request = httpMocks.createRequest( + // @ts-expect-error - we're mocking the request object generateRequestParams({ "if-modified-since": new Date( - Date.now() - 31 * 60 * 1000, + Date.now() - 31 * 60 * 1000 ).toUTCString(), - }), + }) ); collectRequestHandler(request, env); @@ -145,7 +145,7 @@ describe("collectRequestHandler", () => { [ 0, // new visitor 1, // new session - ], + ] ); }); @@ -156,13 +156,13 @@ describe("collectRequestHandler", () => { } as CFAnalyticsEngine, } as Environment; - // @ts-expect-error - we're mocking the request object const request = httpMocks.createRequest( + // @ts-expect-error - we're mocking the request object generateRequestParams({ "if-modified-since": new Date( - Date.now() - 60 * 24 * 60 * 1000, + Date.now() - 60 * 24 * 60 * 1000 ).toUTCString(), - }), + }) ); collectRequestHandler(request, env); @@ -173,7 +173,7 @@ describe("collectRequestHandler", () => { [ 1, // new visitor 1, // new session - ], + ] ); }); }); diff --git a/app/analytics/query.ts b/app/analytics/query.ts index 47e603c8..2524e2ae 100644 --- a/app/analytics/query.ts +++ b/app/analytics/query.ts @@ -370,6 +370,7 @@ export class AnalyticsEngineAPI { return this.getVisitorCountByColumn(siteId, "deviceModel", sinceDays); } + async getSitesOrderedByHits(sinceDays: number, limit?: number) { // defaults to 1 day if not specified const interval = sinceDays || 1; diff --git a/app/entry.server.tsx b/app/entry.server.tsx index 93f2a862..04f684de 100644 --- a/app/entry.server.tsx +++ b/app/entry.server.tsx @@ -19,9 +19,10 @@ export default async function handleRequest( // free to delete this parameter in your app if you're not using it! // eslint-disable-next-line @typescript-eslint/no-unused-vars - loadContext: AppLoadContext, + loadContext: AppLoadContext ) { const body = await renderToReadableStream( + // @ts-expect-error This is a mistake in the package types, resolved in @remix-run/react@2.5.1 , { signal: request.signal, @@ -30,7 +31,7 @@ export default async function handleRequest( console.error(error); responseStatusCode = 500; }, - }, + } ); if (isbot(request.headers.get("user-agent"))) { diff --git a/tsconfig.json b/tsconfig.json index 31b11403..69977a9b 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -16,6 +16,7 @@ "~/*": ["./app/*"] }, // Remix takes care of building everything in `remix build`. - "noEmit": true + "noEmit": true, + "skipLibCheck": true } }