Skip to content

GraphQL anonymous operations have incorrect spacing after keyword #10655

@leebyron

Description

@leebyron

Formatting of GraphQL operations (eg a query) are formatted to incorrectly remove the space between the operation keyword and the variable body.

See this Prettier GraphQL playground for repro as of [email protected]:

Expect formatting:

# Expect space after query keyword in anonymous query
query ($unnamed: String) { 
  id 
}

Actual formatting:

# Expect space after query keyword in anonymous query
query($unnamed: String) {
  id
}

This grammar for named and unnamed queries is designed similarly to named and unnamed functions in programming languages, and should be formatted similarly. For a point of comparison, see this Javascript Prettier playground which shows consistent spacing after the function keyword.

Metadata

Metadata

Assignees

No one assigned

    Labels

    difficulty:easyIssues that should be easy to fix. Resolve me on the train to work!help wantedWe're a small group who can't get to every issue promptly. We’d appreciate help fixing this issue!lang:graphqlIssues affecting GraphQLlocked-due-to-inactivityPlease open a new issue and fill out the template instead of commenting.

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions