Skip to content

useConsistentGraphqlDescriptions

¥Summary

¥How to configure

biome.json
{
"linter": {
"rules": {
"nursery": {
"useConsistentGraphqlDescriptions": "error"
}
}
}
}

¥Description

要求所有描述遵循相同的样式(块级或行内),以保持一致性并提高整个模式的可读性。

¥Require all descriptions to follow the same style (either block or inline) to maintain consistency and improve readability across the schema.

¥Examples

¥style: block

¥Invalid

enum EnumValue {
"this is a description"
DEFAULT
}
code-block.graphql:2:3 lint/nursery/useConsistentGraphqlDescriptions ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

Unexpected inline description style.

1 │ enum EnumValue {
> 2 │ “this is a description”
^^^^^^^^^^^^^^^^^^^^^^^
3 │ DEFAULT
4 │ }

To stay consistent within the project, write the description block style.

¥Valid

enum EnumValue {
"""
this is a description
"""
DEFAULT
}

¥Options

此选项将指定描述样式。

¥This option will specify the description style.

  • "block":要求代码块描述使用三引号 ("""...""")。

    ¥"block": Requires triple-quoted block descriptions ("""...""")

  • "inline":要求行内描述使用单引号 ("...")。

    ¥"inline": Requires single-quoted inline descriptions ("...")

默认 "block"

¥Default "block"

biome.json
{
"linter": {
"rules": {
"nursery": {
"useConsistentGraphqlDescriptions": {
"options": {
"style": "inline"
}
}
}
}
}
}
enum EnumValue {
"""
this is a description
"""
DEFAULT
}

¥Related links