# no-typename-prefix

Source: https://api-genie.dev/docs/linter/graphql/rules/no-typename-prefix

A rule of the GraphQL linter, which reads GraphQL schemas and operations. Since 0.9.0. In the rulesets: Recommended at warning, Strict at error, All at error.

This rule checks that field names don't start with the name of their type, as in `User.userId`.

## Rule details

The type already gives the context of a field: `user.id` reads better than `user.userId`. A field is reported when its name starts with the type name in camelCase followed by an upper-case letter, a digit or an underscore, so `User.users` is not reported.

The rule applies to definitions. An `# apigenie-lint-disable no-typename-prefix` comment on a node
turns it off for the node and everything nested in it; at the top of the file, separated from the
first definition by a blank line, the comment turns it off for the whole file.

## Examples

**Good**.

```graphql
type User { id: ID!, name: String }
```

**Bad**. The linter reports `Field 'userId' should not start with the name of its type 'User'`.

```graphql
type User { userId: ID! }
```
