Skip to content
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

namespaced gql should trigger graphql formatting #11392

Closed
onichandame opened this issue Aug 23, 2021 · 4 comments
Closed

namespaced gql should trigger graphql formatting #11392

onichandame opened this issue Aug 23, 2021 · 4 comments
Labels
lang:graphql Issues affecting GraphQL status:needs investigation Issues that need additional investigation, e.g. to understand whether the reported behavior is a bug

Comments

@onichandame
Copy link

onichandame commented Aug 23, 2021

Prettier 2.3.2
Playground link

--parser typescript

Input:

const SCHEMA = ApolloClient.gql`
  query api {api {
      id
    }
  }
`;

Output:

const SCHEMA = ApolloClient.gql`
  query api {api {
      id
    }
  }
`;

Expected behavior:

const SCHEMA = ApolloClient.gql`
  query api {
    api {
      id
    }
  }
`;
@sosukesuzuki
Copy link
Member

To enable formatting for embedded GraphQL, you should use gql instead of AplloClient.gql.

Prettier 2.3.2
Playground link

--parser typescript

Input:

const SCHEMA = gql`
  query api {api {
      id
    }
  }
`;

Output:

const SCHEMA = gql`
  query api {
    api {
      id
    }
  }
`;

@sosukesuzuki sosukesuzuki added the lang:graphql Issues affecting GraphQL label Aug 24, 2021
@onichandame
Copy link
Author

@sosukesuzuki Why so? Was there any discussion about the decision here? I mean from a user's perspective, whether calling a function by its name only or as part of a namespace makes no actual difference and prettier as the formatter should also treat them equally.

@sosukesuzuki sosukesuzuki reopened this Aug 24, 2021
@sosukesuzuki sosukesuzuki added the status:needs investigation Issues that need additional investigation, e.g. to understand whether the reported behavior is a bug label Aug 24, 2021
@sosukesuzuki
Copy link
Member

I don't remember exactly, but I think there was some discussion about that. I'll look into it.

@fisker
Copy link
Member

fisker commented Aug 24, 2021

See #7573 #7576 #6626

@fisker fisker closed this as completed Aug 24, 2021
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Mar 31, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
lang:graphql Issues affecting GraphQL status:needs investigation Issues that need additional investigation, e.g. to understand whether the reported behavior is a bug
Projects
None yet
Development

No branches or pull requests

3 participants