Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Configure ts so it doesnt error on lib types, allowing it to be enabled precommit (or in ci) #37

Merged
merged 3 commits into from
Feb 5, 2024
Merged
Show file tree
Hide file tree
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
1 change: 1 addition & 0 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,6 @@ echo "$FILES" | xargs git add

npm test
npm run lint
npm run typecheck

exit 0
26 changes: 13 additions & 13 deletions app/analytics/collect.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ describe("collectRequestHandler", () => {
[
1, // new visitor
1, // new session
],
]
);
});

Expand All @@ -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);
Expand All @@ -117,7 +117,7 @@ describe("collectRequestHandler", () => {
[
0, // new visitor
0, // new session
],
]
);
});

Expand All @@ -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);
Expand All @@ -145,7 +145,7 @@ describe("collectRequestHandler", () => {
[
0, // new visitor
1, // new session
],
]
);
});

Expand All @@ -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);
Expand All @@ -173,7 +173,7 @@ describe("collectRequestHandler", () => {
[
1, // new visitor
1, // new session
],
]
);
});
});
1 change: 1 addition & 0 deletions app/analytics/query.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
5 changes: 3 additions & 2 deletions app/entry.server.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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/[email protected]
<RemixServer context={remixContext} url={request.url} />,
{
signal: request.signal,
Expand All @@ -30,7 +31,7 @@ export default async function handleRequest(
console.error(error);
responseStatusCode = 500;
},
},
}
);

if (isbot(request.headers.get("user-agent"))) {
Expand Down
3 changes: 2 additions & 1 deletion tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
"~/*": ["./app/*"]
},
// Remix takes care of building everything in `remix build`.
"noEmit": true
"noEmit": true,
"skipLibCheck": true
}
}
Loading