Skip to content

Conversation

@mostlylikeable
Copy link

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.ts we have these imports:

// @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):

import { GenqlError } from './error';
// @ts-nocheck
import type { GraphqlOperation } from './generateGraphqlOperation';

This change will add an extra blank line, so the result is this (directive position will be preserved):

// @ts-nocheck

import type { GraphqlOperation } from './generateGraphqlOperation';
import { GenqlError } from './error';

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';
```
@vercel
Copy link

vercel bot commented Apr 1, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
genql ✅ Ready (Inspect) Visit Preview 💬 Add feedback Apr 1, 2025 6:48pm

@mostlylikeable
Copy link
Author

No urgency to this, but I noticed the issue and figured I'd submit a fix. I'm happy to make any necessary adjustments as well.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant