Skip to content

Commit 8a5474e

Browse files
committed
Revert "Correcting linting issues"
This reverts commit 3a38ff3.
1 parent 0d7d5c4 commit 8a5474e

File tree

2 files changed

+7
-15
lines changed

2 files changed

+7
-15
lines changed

app/api/llms-txt/[...path]/route.ts

Lines changed: 5 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -198,11 +198,7 @@ For the complete content with full formatting, code examples, and interactive el
198198

199199
return createResponse(pageTitle, cleanContent, `/${pathSegments.join('/')}`);
200200
} catch (error) {
201-
// Log error to stderr in server environments, avoid console in production
202-
if (process.env.NODE_ENV === 'development') {
203-
// eslint-disable-next-line no-console
204-
console.error('Error generating llms.txt:', error);
205-
}
201+
console.error('Error generating llms.txt:', error);
206202
return new NextResponse('Internal server error', {status: 500});
207203
}
208204
}
@@ -313,7 +309,7 @@ async function cleanupMarkdown(
313309
);
314310
}
315311

316-
function resolvePlatformIncludes(
312+
async function resolvePlatformIncludes(
317313
content: string,
318314
pathSegments: string[]
319315
): Promise<string> {
@@ -340,8 +336,7 @@ function resolvePlatformIncludes(
340336
let result = content;
341337
let match = includePattern.exec(content);
342338

343-
// Fix assignment in while condition by using a separate variable
344-
while (match !== null) {
339+
while ((match = includePattern.exec(content)) !== null) {
345340
const includePath = match[1];
346341
const fullMatch = match[0];
347342

@@ -375,11 +370,7 @@ function resolvePlatformIncludes(
375370
);
376371
}
377372
} catch (error) {
378-
// Log error conditionally to avoid console warnings in production
379-
if (process.env.NODE_ENV === 'development') {
380-
// eslint-disable-next-line no-console
381-
console.error(`Error loading include ${includePath}:`, error);
382-
}
373+
console.error(`Error loading include ${includePath}:`, error);
383374
const sectionName = includePath.split('/').pop() || 'content';
384375
result = result.replace(
385376
fullMatch,
@@ -391,5 +382,5 @@ function resolvePlatformIncludes(
391382
match = includePattern.exec(content);
392383
}
393384

394-
return Promise.resolve(result);
385+
return result;
395386
}

src/middleware.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ const handleRedirects = (request: NextRequest) => {
6767
return undefined;
6868
};
6969

70-
const handleLlmsTxt = (request: NextRequest) => {
70+
const handleLlmsTxt = async (request: NextRequest) => {
7171
try {
7272
// Get the original path by removing llms.txt
7373
const originalPath = request.nextUrl.pathname.replace(/\/llms\.txt$/, '') || '/';
@@ -83,6 +83,7 @@ const handleLlmsTxt = (request: NextRequest) => {
8383

8484
return NextResponse.rewrite(apiUrl);
8585
} catch (error) {
86+
console.error('Error handling llms.txt rewrite:', error);
8687
return new Response('Error processing request', {
8788
status: 500,
8889
headers: {

0 commit comments

Comments
 (0)