Skip to Content
🚧 This is WIP documentation for v4 of the plugin. For v3 click here.
ESLGraphQL-ESLint
Documentation🚧 Parser Options

🚧 Parser Options

🚧
This page is under construction. Help us improve the content by submitting a PR.

skipGraphQLConfig

If you are using graphql-config in your project, the parser will automatically use that to load your default GraphQL schema.

You can disable this behaviour using skipGraphQLConfig: true in the parserOptions:

.eslintrc.json
{
  "parserOptions": {
    "skipGraphQLConfig": true
  }
}

schema

You can specify a schema key to load your GraphQL schema. The parser uses graphql-tools and its loaders, here are a few examples for a valid setup:

.graphqlrc
# a path to a local `.graphql` file
schema: './schema.graphql'
 
# a glob expression to load multiple files
schema: './src/**/*.graphql'
 
# paths to multiple `.graphql` files
schema: ['src/schema-a.graphql', 'src/schema-b.graphql', 'src/schema-c.graphql']
 
# a path to a local `.json` (introspection) file
schema: './schema.json'
 
# a URL endpoint
schema: 'https://my-server/graphql'

schemaOptions

If you wish to send additional configuration for the graphql-tools loaders that loads your schema, you can specify schemaOptions object:

.eslintrc.json
{
  "parserOptions": {
    "schema": "http://my-server/graphql",
    "schemaOptions": {
      "headers": {
        "Authorization": "Bearer MY_TOKEN"
      }
    }
  }
}
.eslintrc.json
{
  "parserOptions": {
    "schema": "./src/**/*.graphql",
    "schemaOptions": {
      "assumeValid": true
    }
  }
}
💡
Tip

The configuration here is flexible, and will be sent to graphql-tools and it’s loaders. So depends on the schema source, the options may vary.

You can read more about these loaders and their configuration here .

Last updated on