no-typename-prefix
What it does
Section titled “What it does”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.
Why it matters
Section titled “Why it matters”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).
Example
Section titled “Example”type User { userId: ID id: ID}interface Node { nodeKind: String }input UserInput { userName: String }Configuration
Section titled “Configuration”graphql: lint: rules: no-typename-prefix: warn # off (default), warn, errorEnabled 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.
Upstream equivalents
Section titled “Upstream equivalents”The same check in other tools; Sudsy reports what each upstream rule reports.
| Tool | Rule | Match |
|---|---|---|
| graphql-eslint | no-typename-prefix |
full |