Prettier for the schema #7651
-
Our schema is getting pretty big. We have indentation and spacing inconsistency. Full code here: https://www.apollographql.com/docs/apollo-server/getting-started/#step-3-define-your-graphql-schema
|
Beta Was this translation helpful? Give feedback.
Replies: 2 comments
-
Interesting predicament, hadn't considered it when we started pushing this recommendation. Prettier recognizes the const gql = String.raw;
const typeDefs = gql`
...
`; |
Beta Was this translation helpful? Give feedback.
-
Alternatively (perhaps preferably), keep it in its own .graphql file (and load it with fs.readFileSync or something). |
Beta Was this translation helpful? Give feedback.
Interesting predicament, hadn't considered it when we started pushing this recommendation. Prettier recognizes the
gql
tag though, so you can either use the real thing (and pass aDocumentNode
to Apollo Server instead of astring
) or fake it like so: