Skip to content

GraphQL Rules

Below the list of rules supported by Biome, divided by group. Here’s a legend of the emojis:

  • The icon indicates that the rule is part of the recommended rules.
  • The icon indicates that the rule provides a code action (fix) that is safe to apply.
  • The icon indicates that the rule provides a code action (fix) that is unsafe to apply.
  • The icon indicates that the rule has been implemented and scheduled for the next release.
Rule nameDescriptionProperties
noDuplicateArgumentNamesRequire all argument names for fields & directives to be unique.
noDuplicateEnumValueNamesRequire all enum value names to be unique.
noDuplicateInputFieldNamesRequire fields within an input object to be unique.
noDuplicateVariableNamesRequire all variable definitions to be unique.
useGraphqlNamedOperationsEnforce specifying the name of GraphQL operations.
useLoneAnonymousOperationDisallow anonymous operations when more than one operation specified in document.
Rule nameDescriptionProperties
noDuplicateFieldDefinitionNamesRequire all fields of a type to be unique.
Rule nameDescriptionProperties
noExcessiveLinesPerFileRestrict the number of lines in a file.
noRootTypeDisallow the usage of specified root types
useConsistentGraphqlDescriptionsRequire all descriptions to follow the same style (either block or inline) to maintain consistency and improve readability across the schema.
useDeprecatedReasonRequire specifying the reason argument when using @deprecated directive
useGraphqlNamingConventionValidates that all enum values are capitalized.
useInputNameRequire mutation argument to be always called “input”
useLoneExecutableDefinitionRequire queries, mutations, subscriptions or fragments each to be located in separate files.
Rule nameDescriptionProperties
noDuplicateFieldsNo duplicated fields in GraphQL operations.
noDuplicateGraphqlOperationNameEnforce unique operation names across a GraphQL document.
noEmptySourceDisallow empty sources.
useDeprecatedDateRequire the @deprecated directive to specify a deletion date.

Missing a rule? Help us by contributing to the analyzer or create a rule suggestion here.