🚧 This is WIP documentation for v4 of the plugin. For v3 click here.
DocumentationShared Configs

Shared Configs

Schema Configs

NameDescription
flat/schema-recommendedenables recommended rules for schema development
flat/schema-allenables all rules for schema development, except for those that require parserOptions.operations option
flat/schema-relayenables rules from Relay specification for schema development

Operations Configs

NameDescription
flat/operations-recommendedenables recommended rules for consuming GraphQL (operations) development
flat/operations-allenables all rules for consuming GraphQL (operations) development
⚠️

If you are in a project that develops the GraphQL schema, you’ll need schema rules.

If you are in a project that develops GraphQL operations (query/mutation/subscription), you’ll need operations rules.

If you are in a monorepo project, you probably need both sets of rules, see example of configuration.

Config Usage

For example, to enable the flat/schema-recommended config, in a new configuration object assign the rules field to the rules field from the associated config from graphqlPlugin.configs object.

eslint.config.js
import graphqlPlugin from '@graphql-eslint/eslint-plugin'
 
export default [
  // ... other config
  {
    files: ['**/*.graphql'],
    languageOptions: {
      parser: graphqlPlugin.parser
    },
    plugins: {
      '@graphql-eslint': graphqlPlugin
    }
  },
+ {
+   files: ['path-to-schema/**/*.graphql'],
+   rules: graphqlPlugin.configs['flat/schema-recommended'].rules
+ }
]