Linter rulesGraphQLno-get-prefix-on-query-fields
no-get-prefix-on-query-fields
Since 0.9.0
This rule checks that the fields of the query root type are not named getSomething.
Rule Details
Query fields are nouns: the operation type already says that they read data. user(id:) is the convention, getUser(id:) comes from RPC APIs.
Configuration
This rule has no options.
version: "1.0"
commands:
lint:
graphql:
rules:
no-get-prefix-on-query-fields: warning
The rule can be disabled for a node and everything nested in it with an # apigenie-lint-disable no-get-prefix-on-query-fields comment on the node, or for a whole file with the comment at the top of the file, separated from the first definition by a blank line. It applies to definitions.
Examples
Good.
type Query { user(id: ID!): User }
Bad. The linter reports Query field 'getUser' should not start with 'get', e.g. 'user'.
type Query { getUser(id: ID!): User }