# no-typename-prefix

Source: https://apigenie.pl/docs/linter/graphql/rules/no-typename-prefix

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.

## Configuration

This rule has no options.

```yaml
version: "1.0"
commands:
  lint:
    graphql:
      rules:
        no-typename-prefix: warning
```

The rule can be disabled for a node and everything nested in it with an `# apigenie-lint-disable no-typename-prefix` 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**.

```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! }
```
