Shared Configs
Schema Configs
Name | Description |
---|---|
flat/schema-recommended | enables recommended rules for schema development |
flat/schema-all | enables all rules for schema development, except for those that require parserOptions.operations option |
flat/schema-relay | enables rules from Relay specification for schema development |
Operations Configs
Name | Description |
---|---|
flat/operations-recommended | enables recommended rules for consuming GraphQL (operations) development |
flat/operations-all | enables 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
+ }
]