src/content/docs/linter/rules/no-root-type.mdx
import { Tabs, TabItem } from '@astrojs/starlight/components';
<Tabs> <TabItem label="GraphQL" icon="seti:graphql"> :::caution This rule is part of the [nursery](/linter/#nursery) group. This means that it is experimental and the behavior can change at any time. ::: ## Summary - Rule available since: `v2.3.12` - Diagnostic Category: [`lint/nursery/noRootType`](/reference/diagnostics#diagnostic-category) - This rule doesn't have a fix. - The default severity of this rule is [**information**](/reference/diagnostics#information). - Sources: - Same as [`@graphql-eslint/no-root-type`](https://the-guild.dev/graphql/eslint/rules/no-root-type){
"linter": {
"rules": {
"nursery": {
"noRootType": "error"
}
}
}
}
Disallow the usage of specified root types
Prevent the usage of certain root types (e.g. mutation and/or subscription)
{
"linter": {
"rules": {
"nursery": {
"noRootType": {
"options": {
"disallow": [
"mutation"
]
}
}
}
}
}
}
type Mutation {
createUser(input: CreateUserInput!): User!
}
type Query {
users: [User!]!
}
disallowThis required option lists all disallowed root types (e.g. mutation and/or subscription).
The values of the list are case-insensitive.
Default []
{
"linter": {
"rules": {
"nursery": {
"noRootType": {
"options": {
"disallow": [
"subscription"
]
}
}
}
}
}
}
type Subscription {
user: User
}