Documentation
Configs

Available Configs

NameDescription
schema-recommendedenables recommended rules for schema (SDL) development
schema-allenables all rules for schema (SDL) development, except for those that require parserOptions.operations option
operations-recommendedenables recommended rules for consuming GraphQL (operations) development
operations-allenables all rules for consuming GraphQL (operations) development
schema-relayenables rules from Relay specification for schema (SDL) 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 schema-recommended config, enable it in your .eslintrc file with the extends option:

.eslintrc.json
{
  "overrides": [
    {
      "files": ["*.js"],
      "processor": "@graphql-eslint/graphql"
    },
    {
      "files": ["*.graphql"],
-     "parser": "@graphql-eslint/eslint-plugin",
-     "plugins": ["@graphql-eslint"],
+     "extends": "plugin:@graphql-eslint/schema-recommended"
    }
  ]
}
💡

All configs under the hood set parser as @graphql-eslint/eslint-plugin and add @graphql-eslint to plugins array, so you don’t need to specify them.