diff --git a/.changeset/happy-cheetahs-provide.md b/.changeset/happy-cheetahs-provide.md new file mode 100644 index 00000000..7026ade6 --- /dev/null +++ b/.changeset/happy-cheetahs-provide.md @@ -0,0 +1,5 @@ +--- +"@gql.tada/internal": patch +--- + +Add types for field-usage tracking and checking for co-located fragments diff --git a/.changeset/thin-cats-tell.md b/.changeset/thin-cats-tell.md new file mode 100644 index 00000000..e8a7e00d --- /dev/null +++ b/.changeset/thin-cats-tell.md @@ -0,0 +1,5 @@ +--- +"@gql.tada/cli-utils": minor +--- + +Disable field-usage tracking and the co-located fragment checking for vue/svelte diff --git a/packages/cli-utils/src/commands/check/thread.ts b/packages/cli-utils/src/commands/check/thread.ts index 2f67d56a..d555ded0 100644 --- a/packages/cli-utils/src/commands/check/thread.ts +++ b/packages/cli-utils/src/commands/check/thread.ts @@ -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[] = []; diff --git a/packages/internal/src/config.ts b/packages/internal/src/config.ts index d8a9f941..451fd08e 100644 --- a/packages/internal/src/config.ts +++ b/packages/internal/src/config.ts @@ -5,6 +5,8 @@ import type { SchemaOrigin } from './loaders'; export interface BaseConfig { template?: string; + trackFieldUsage?: boolean; + shouldCheckForColocatedFragments?: boolean; } export interface SchemaConfig {