-
Notifications
You must be signed in to change notification settings - Fork 10.3k
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
[1.0] Question: why can you use graphql in templates? #1143
Comments
The sources are processed with Babylon in file-parser.js and the queries are extracted from the AST in query-compiler.js |
yeah the down and dirty reason it works is that the queries are removed from the source code before they are run. |
Several people have asked about this — perhaps we just need to make sure this is covered in the tutorial + GraphQL docs so people aren't confused? I remember being confused for similar reasons back in the day when I first used Relay :-) |
Seems like what you really need is an eslint plugin so people aren't having to make a bunch of comments or remove their linting to support Gatsby without a bunch of errors everywhere. |
I just ran into this question while setting up ESLint, so I took a crack at expanding the tutorial to explain why this doesn't explode in #2965. Someone who understands this better should probably review pretty closely, though, because I only sorta get how this works. 😅 |
Closing this as there's another issue about including a custom gatsby eslint plugin #2446 (comment) |
The 1.0 boilerplate has this in template pages:
But linters will complain here:
True enough, when you try to do see what
graphql
is, it's not defined:How does this sorcery work?
The text was updated successfully, but these errors were encountered: