Skip to content

no-typename-prefix

Reports a field of an object or interface type that starts with the name of the type (type User { userId: ID }); case is ignored. No fix: renaming a field changes the schema.

The field is always read as user.userId, so the type name is said twice. It gets worse when a query is written with aliases or a field moves to another type.

To fix, drop the prefix (id).

Reported
type User {
userId: ID
id: ID
}
interface Node { nodeKind: String }
input UserInput { userName: String }
graphql:
lint:
rules:
no-typename-prefix: warn # off (default), warn, error

Enabled by the presets: graphql/graphql-eslint-recommended.

Suppress one line with sudsy-disable-next-line no-typename-prefix in a comment of the file’s language.

The same check in other tools; Sudsy reports what each upstream rule reports.

Tool Rule Match
graphql-eslint no-typename-prefix full