summaryrefslogtreecommitdiff
path: root/packages/integrations/node/src
diff options
context:
space:
mode:
authorGravatar Emanuele Stoppa <my.burning@gmail.com> 2025-02-07 14:59:13 +0000
committerGravatar GitHub <noreply@github.com> 2025-02-07 14:59:13 +0000
commit74c0bbeb390a68b3a345c96f62bc3e540e94ca27 (patch)
treec054354ba8170a746e037ffb171aec92c19b1ed0 /packages/integrations/node/src
parentc0be893bcff547fd50f05b62bd462237baa3c103 (diff)
downloadastro-74c0bbeb390a68b3a345c96f62bc3e540e94ca27.tar.gz
astro-74c0bbeb390a68b3a345c96f62bc3e540e94ca27.tar.zst
astro-74c0bbeb390a68b3a345c96f62bc3e540e94ca27.zip
chore: fix linting issues, integration tests (#13187)
* chore: fix linting issues * chore: update packages and directories * apply suggestions Co-authored-by: florian-lefebvre <69633530+florian-lefebvre@users.noreply.github.com>
Diffstat (limited to 'packages/integrations/node/src')
-rw-r--r--packages/integrations/node/src/middleware.ts2
-rw-r--r--packages/integrations/node/src/preview.ts4
-rw-r--r--packages/integrations/node/src/serve-static.ts5
-rw-r--r--packages/integrations/node/src/standalone.ts1
4 files changed, 0 insertions, 12 deletions
diff --git a/packages/integrations/node/src/middleware.ts b/packages/integrations/node/src/middleware.ts
index 5bb104914..f374c7d41 100644
--- a/packages/integrations/node/src/middleware.ts
+++ b/packages/integrations/node/src/middleware.ts
@@ -23,7 +23,6 @@ export default function createMiddleware(app: NodeApp): RequestHandler {
const error = req;
if (next) {
return next(error);
- // biome-ignore lint/style/noUselessElse: <explanation>
} else {
throw error;
}
@@ -34,7 +33,6 @@ export default function createMiddleware(app: NodeApp): RequestHandler {
logger.error(`Could not render ${req.url}`);
console.error(err);
if (!res.headersSent) {
- // biome-ignore lint/style/noUnusedTemplateLiteral: <explanation>
res.writeHead(500, `Server error`);
res.end();
}
diff --git a/packages/integrations/node/src/preview.ts b/packages/integrations/node/src/preview.ts
index 1da579e1e..6a7ce7eba 100644
--- a/packages/integrations/node/src/preview.ts
+++ b/packages/integrations/node/src/preview.ts
@@ -10,14 +10,11 @@ type MaybeServerModule = Partial<ServerModule>;
const createPreviewServer: CreatePreviewServer = async (preview) => {
let ssrHandler: ServerModule['handler'];
- let options: ServerModule['options'];
try {
process.env.ASTRO_NODE_AUTOSTART = 'disabled';
const ssrModule: MaybeServerModule = await import(preview.serverEntrypoint.toString());
if (typeof ssrModule.handler === 'function') {
ssrHandler = ssrModule.handler;
- // biome-ignore lint/style/noNonNullAssertion: <explanation>
- options = ssrModule.options!;
} else {
throw new AstroError(
`The server entrypoint doesn't have a handler. Are you sure this is the right file?`,
@@ -30,7 +27,6 @@ const createPreviewServer: CreatePreviewServer = async (preview) => {
preview.serverEntrypoint,
)} does not exist. Have you ran a build yet?`,
);
- // biome-ignore lint/style/noUselessElse: <explanation>
} else {
throw err;
}
diff --git a/packages/integrations/node/src/serve-static.ts b/packages/integrations/node/src/serve-static.ts
index c9839ea8b..c7ec56aae 100644
--- a/packages/integrations/node/src/serve-static.ts
+++ b/packages/integrations/node/src/serve-static.ts
@@ -38,7 +38,6 @@ export function createStaticHandler(app: NodeApp, options: Options) {
switch (trailingSlash) {
case 'never': {
if (isDirectory && urlPath !== '/' && hasSlash) {
- // biome-ignore lint/style/useTemplate: more readable like this
pathname = urlPath.slice(0, -1) + (urlQuery ? '?' + urlQuery : '');
res.statusCode = 301;
res.setHeader('Location', pathname);
@@ -58,7 +57,6 @@ export function createStaticHandler(app: NodeApp, options: Options) {
case 'always': {
// trailing slash is not added to "subresources"
if (!hasSlash && !isSubresourceRegex.test(urlPath)) {
- // biome-ignore lint/style/useTemplate: more readable like this
pathname = urlPath + '/' + (urlQuery ? '?' + urlQuery : '');
res.statusCode = 301;
res.setHeader('Location', pathname);
@@ -117,7 +115,6 @@ function resolveClientDir(options: Options) {
while (!serverEntryFolderURL.endsWith(serverFolder)) {
serverEntryFolderURL = path.dirname(serverEntryFolderURL);
}
- // biome-ignore lint/style/useTemplate: <explanation>
const serverEntryURL = serverEntryFolderURL + '/entry.mjs';
const clientURL = new URL(appendForwardSlash(rel), serverEntryURL);
const client = url.fileURLToPath(clientURL);
@@ -125,11 +122,9 @@ function resolveClientDir(options: Options) {
}
function prependForwardSlash(pth: string) {
- // biome-ignore lint/style/useTemplate: <explanation>
return pth.startsWith('/') ? pth : '/' + pth;
}
function appendForwardSlash(pth: string) {
- // biome-ignore lint/style/useTemplate: <explanation>
return pth.endsWith('/') ? pth : pth + '/';
}
diff --git a/packages/integrations/node/src/standalone.ts b/packages/integrations/node/src/standalone.ts
index a630c1c12..8ef4227a1 100644
--- a/packages/integrations/node/src/standalone.ts
+++ b/packages/integrations/node/src/standalone.ts
@@ -39,7 +39,6 @@ export function createStandaloneHandler(app: NodeApp, options: Options) {
return (req: http.IncomingMessage, res: http.ServerResponse) => {
try {
// validate request path
- // biome-ignore lint/style/noNonNullAssertion: <explanation>
decodeURI(req.url!);
} catch {
res.writeHead(400);