Skip to content

When and why is graphql-config or parserOption.schema required? #757

Answered by dimaMachina
JustinTRoss asked this question in Q&A
Discussion options

You must be logged in to vote

when you define files: ["*.graphql"] overrides object you tell for ESLint how to treat files with .graphql extension.

When you configure processor for code files:

{
    files: ['*.tsx', '*.ts', '*.jsx', '*.js'],
    processor: '@graphql-eslint/graphql'
}

graphql-eslint will extract GraphQL documents under a virtual filename that will end with .graphql extension, so your overrides section with files: ["*.graphql"] configuration will match for them.

For example, let's imagine you have get-users.ts code file:

// the following document will be extracted and will have get-users.ts/0_document.graphql filename
const USER_FIELDS = gql`
  fragment UserFields on User {
    id
    email
  }
`

// th…

Replies: 2 comments 6 replies

Comment options

You must be logged in to vote
1 reply
@JustinTRoss
Comment options

Comment options

You must be logged in to vote
5 replies
@JustinTRoss
Comment options

@JustinTRoss
Comment options

@dimaMachina
Comment options

@JustinTRoss
Comment options

@dimaMachina
Comment options

Answer selected by dimaMachina
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants