Skip to content

noRootType

biome.json
{
"linter": {
"rules": {
"style": {
"noRootType": "error"
}
}
}
}

Disallow the usage of specified root types

Prevent the usage of certain root types (e.g. mutation and/or subscription)

biome.json
{
"linter": {
"rules": {
"style": {
"noRootType": {
"level": "on",
"options": {
"disallow": [
"mutation"
]
}
}
}
}
}
}
type Mutation {
createUser(input: CreateUserInput!): User!
}
code-block.graphql:1:6 lint/style/noRootType ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

This schema defines the disallowed root type Mutation.

> 1 │ type Mutation {
^^^^^^^^
2 │ createUser(input: CreateUserInput!): User!
3 │ }

This project forbids that root type to enforce a specific schema design.

Use a different root type, or update the rule configuration if this root type should be allowed.

type Query {
users: [User!]!
}

This required option lists all disallowed root types (e.g. mutation and/or subscription). The values of the list are case-insensitive.

Default []

biome.json
{
"linter": {
"rules": {
"style": {
"noRootType": {
"level": "on",
"options": {
"disallow": [
"subscription"
]
}
}
}
}
}
}
type Subscription {
user: User
}
code-block.graphql:1:6 lint/style/noRootType ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

This schema defines the disallowed root type Subscription.

> 1 │ type Subscription {
^^^^^^^^^^^^
2 │ user: User
3 │ }

This project forbids that root type to enforce a specific schema design.

Use a different root type, or update the rule configuration if this root type should be allowed.