apollographql / apollographql/apollo-tooling

VSCode: ignore flag to skip validation on a query

Open
#1,535 6 comments 6 reactions 0 assignees View on GitHub
:spiral_notepad: component - vscode
Dominant language
TypeScript
Stars
3k
Forks
460
PR merge metrics
No merged PRs in 30d

Description

Query validation on VSCode is a very nice feature. Though, sometimes it would be appreciable to disable validation on a specific query.
I was thinking of a flag like all linters have (eg. `/* tslint:disable-next-line */`) or something like that.

My use case:
I have a query where the query name itself is dynamic, so I'm replacing it in my template literal, like that:
```
const queryName = 'someQuery';
const query = gql`
${queryName} {
id
...
}
`;
```
It is totally valid and working at runtime, but the validation keeps complaining about a syntax error.

Thanks!

Contributor guide

Open the contributing guide

Research direction

Start at the VSCode query-validation entry point and trace how gql template literals are parsed and reported. Review the issue's proposed inline ignore flag and dynamic query-name example, then determine the supported syntax and validation behavior that would count as done.

Written by the indexing model from the issue text.

Assessment

Tech stack
graphql, typescript
Domain
tooling
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.