Harden workflow warning cleanup#770
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
Claude finished @blove's task in 2m 31s —— View job PR Review: Harden workflow warning cleanup
Overall this is a clean, focused PR. The three goals (Next.js Specific observations (see inline comments):
Rest of the changes look good:
|
| const CANONICAL_NEXT_ENV = `/// <reference types="next" /> | ||
| /// <reference types="next/image-types/global" /> | ||
| import "./../../dist/apps/website/.next/types/routes.d.ts"; | ||
|
|
||
| // NOTE: This file should not be edited | ||
| // see https://nextjs.org/docs/app/api-reference/config/typescript for more information. | ||
| `; | ||
|
|
||
| async function restoreNextEnv(): Promise<void> { | ||
| await writeFile(new URL('../next-env.d.ts', import.meta.url), CANONICAL_NEXT_ENV); |
There was a problem hiding this comment.
The hardcoded constant works today, but will silently restore stale content if next-env.d.ts is legitimately updated (e.g., a Next.js upgrade regenerates the routes import path). A snapshot-then-restore pattern is more resilient:
| const CANONICAL_NEXT_ENV = `/// <reference types="next" /> | |
| /// <reference types="next/image-types/global" /> | |
| import "./../../dist/apps/website/.next/types/routes.d.ts"; | |
| // NOTE: This file should not be edited | |
| // see https://nextjs.org/docs/app/api-reference/config/typescript for more information. | |
| `; | |
| async function restoreNextEnv(): Promise<void> { | |
| await writeFile(new URL('../next-env.d.ts', import.meta.url), CANONICAL_NEXT_ENV); | |
| async function restoreNextEnv(): Promise<void> { | |
| await writeFile(new URL('../next-env.d.ts', import.meta.url), CANONICAL_NEXT_ENV); | |
| } |
Suggested alternative for the full file — read then restore:
import { readFile, writeFile } from 'node:fs/promises';
async function main(): Promise<void> {
const nextEnvUrl = new URL('../next-env.d.ts', import.meta.url);
const originalContent = await readFile(nextEnvUrl, 'utf8');
// ... run ...
try {
exitCode = await run(command, args);
} finally {
await writeFile(nextEnvUrl, originalContent);
}
}This would automatically track whatever git-committed content the file had at test start. Minor maintainability note, not a blocker.
| bindTools(tools: unknown[]) { this.bound = tools; return this; } | ||
| async invoke(_messages: unknown[]) { | ||
| async invoke(messages: unknown[]) { | ||
| void messages; |
There was a problem hiding this comment.
Unconventional suppression: void messages evaluates the expression and discards the result to satisfy the linter, but it's surprising to readers. The idiomatic TypeScript convention is the _ prefix:
| void messages; | |
| async invoke(_messages: unknown[]) { |
If the project's ESLint rule triggers on _-prefixed params specifically, adding // eslint-disable-next-line @typescript-eslint/no-unused-vars would be more explicit. Using void as a statement may also conflict with a no-void rule in other files. Nit only.
Summary
Verification