Skip to content

cli: add blank after nocheck directive to indicate whole file #191

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

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';
```
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