How to lint gql string literals in TS files #2940
Unanswered
HHristovIV
asked this question in
Q&A
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Hello Everyone,
I want to utilize eslint with the graphql-eslint plugin to lint all my .ts files for
gql'{ query { bla } }'graphql queries. We really have to use string literals as we already have them in lots of places and creating separate graphql files is not an option currently.From the docs, it seems like this should be possible, but I just cannot get it to work properly. I have tried all kinds of combinations, with this being the last eslint config I have attempted:
It seems like the I cannot get the .ts files to be processed properly so that the gql string literals are extracted and validated from them. I do have the graphql schema.json included inside the project as well.
I currently get the following error when running lint:
error Parsing error: The keyword 'import' is reservedIt definitely is a parsing error, but I feel a bit frustrated and out of ideas on how to configure this. If anyone has an example minimal working solution for linting gql string literals in .ts files, I would highly appreciate seeing it.
Thanks in advance!
Beta Was this translation helpful? Give feedback.
All reactions