Skip to content

Commit

Permalink
chore(cli): disable field-usage and colocated fragments for vue/svelte (
Browse files Browse the repository at this point in the history
#334)

Co-authored-by: Phil Pluckthun <phil@kitten.sh>
  • Loading branch information
JoviDeCroock and kitten committed Jul 3, 2024
1 parent 7566ea3 commit 010a4f3
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 0 deletions.
5 changes: 5 additions & 0 deletions .changeset/happy-cheetahs-provide.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@gql.tada/internal": patch
---

Add types for field-usage tracking and checking for co-located fragments
5 changes: 5 additions & 0 deletions .changeset/thin-cats-tell.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@gql.tada/cli-utils": minor
---

Disable field-usage tracking and the co-located fragment checking for vue/svelte
9 changes: 9 additions & 0 deletions packages/cli-utils/src/commands/check/thread.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,16 @@ async function* _runDiagnostics(
};

for (const sourceFile of sourceFiles) {
const isVueOrSvelte =
sourceFile.fileName.endsWith('.vue.ts') || sourceFile.fileName.endsWith('.svelte.ts');
let filePath = sourceFile.fileName;
pluginInfo.config = {
...pluginInfo.config,
shouldCheckForColocatedFragments: isVueOrSvelte
? false
: pluginInfo.config.shouldCheckForColocatedFragments ?? false,
trackFieldUsage: isVueOrSvelte ? false : pluginInfo.config.trackFieldUsage ?? false,
};
const diagnostics = getGraphQLDiagnostics(filePath, schemaRef, pluginInfo);
const messages: DiagnosticMessage[] = [];

Expand Down
2 changes: 2 additions & 0 deletions packages/internal/src/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ import type { SchemaOrigin } from './loaders';

export interface BaseConfig {
template?: string;
trackFieldUsage?: boolean;
shouldCheckForColocatedFragments?: boolean;
}

export interface SchemaConfig {
Expand Down

0 comments on commit 010a4f3

Please sign in to comment.