From 42b835b85cb80dd8567c9fe4d6867835e97d22c5 Mon Sep 17 00:00:00 2001 From: mostlylikeable <453302+mostlylikeable@users.noreply.github.com> Date: Tue, 1 Apr 2025 13:44:18 -0500 Subject: [PATCH] cli: add blank after nocheck directive to indicate whole file If there's not a blank line between the topmost import and the `@ts-nocheck` directive, import sorting tools in formatters like biome.js may not be able to discern whether the directive is for the file or just the first import. For example, in _batcher.js_, we have these imports ```ts // @ts-nocheck import type { GraphqlOperation } from './generateGraphqlOperation'; import { GenqlError } from './error'; ``` When biomejs sorts this, it's not clear that the directive is for the file, so we end up with this (which has type errors): ```ts import { GenqlError } from './error'; // @ts-nocheck import type { GraphqlOperation } from './generateGraphqlOperation'; ``` --- cli/src/tasks/clientTasks.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/cli/src/tasks/clientTasks.ts b/cli/src/tasks/clientTasks.ts index 19689fa2..6c733db7 100644 --- a/cli/src/tasks/clientTasks.ts +++ b/cli/src/tasks/clientTasks.ts @@ -54,7 +54,8 @@ export const clientTasks = (config: Config): ListrTask[] => { path.resolve(runtimeFolderPath, file), 'utf-8', ) - contents = '// @ts-nocheck\n' + contents + // extra newline makes clear this is for the file + contents = '// @ts-nocheck\n\n' + contents await fsx.writeFile( path.resolve(output, 'runtime', file), contents,