Linter Rules - WunderGraph

Documentation Index

Fetch the complete documentation index at: /llms.txt

Use this file to discover all available pages before exploring further.

Naming Convention

These rules enforce naming conventions.

FIELD_NAMES_SHOULD_BE_CAMEL_CASE

Field names should always use camelCase.

Violation

 type User {
   First_Name: String
 }

Correct:

 type User {
   firstName: String
 }

TYPE_NAMES_SHOULD_BE_PASCAL_CASE

Type names should always use PascalCase.

Violation

 type userProject {
   id: ID!
 }

Correct:

 type UserProject {
   id: ID!
 }

SHOULD_NOT_HAVE_TYPE_PREFIX

A type’s name should never be prefixed with ‘Type’.

Violation

 type TypeUser {
   id: ID!
 }

Correct:

 type User {
   id: ID!
 }

SHOULD_NOT_HAVE_TYPE_SUFFIX

A type’s name should never be suffixed with ‘Type’.

Violation

 type UserType {
   id: ID!
 }

Correct:

 type User {
   id: ID!
 }

SHOULD_NOT_HAVE_INPUT_PREFIX

An input’s name should never be prefixed with ‘Input’.

Violation

 input InputUser {
   id: ID!
 }

Correct:

 input UserInput {
   id: ID!
 }

SHOULD_HAVE_INPUT_SUFFIX

An input’s name should always be suffixed with ‘Input’.

Violation

 input User {
   id: ID!
 }

Correct:

 input UserInput {
   id: ID!
 }

SHOULD_NOT_HAVE_ENUM_PREFIX

An enum’s name should never be prefixed with ‘Enum’.

Violation

 enum EnumUserStatus {
   ADMIN
   USER
 }

Correct:

 enum UserStatus {
   ADMIN
   USER
 }

SHOULD_NOT_HAVE_ENUM_SUFFIX

An enum’s name should never be suffixed with ‘Enum’.

Violation

 enum UserStatusEnum {
   ADMIN
   USER
 }

Correct:

 enum UserStatus {
   ADMIN
   USER
 }

SHOULD_NOT_HAVE_INTERFACE_PREFIX

An interface type’s name should never be prefixed with ‘Interface’.

Violation

 interface InterfaceUser {
   id: ID!
 }

Correct:

 interface User {
   id: ID!
 }

SHOULD_NOT_HAVE_INTERFACE_SUFFIX

An interface type’s name should never be suffixed with ‘Interface’.

Violation

 interface UserInterface {
   id: ID!
 }

Correct:

 interface User {
   id: ID!
 }

ENUM_VALUES_SHOULD_BE_UPPER_CASE

Enum values should always use UPPER_CASE.

Violation

 enum UserRole {
   admin
   user
 }

Correct:

 enum UserRole {
   ADMIN
   USER
 }

Alphabetical Sort

These rules enforce the arrangement of types, fields and so on in the schema.

ORDER_FIELDS

Ensures all fields are sorted in alphabetical order.

Violation

 type User {
   lastName: String
   firstName: String
 }

Correct:

 type User {
   firstName: String
   lastName: String
 }

ORDER_ENUM_VALUES

Ensures all enum values are sorted in alphabetical order.

Violation

 enum UserRole {
   USER
   ADMIN
 }

Correct:

 enum UserRole {
   ADMIN
   USER
 }

ORDER_DEFINITIONS

Ensures all definitions are sorted in alphabetical order.

Violation:

 type User{
   id: ID;
   name: String;
 }

type Member {
   id: ID;
   name: String;
 }

Correct:

 type Member {
   id: ID;
   name: String;
 }

type User{
   id: ID;
   name: String;
 }

Others

ALL_TYPES_REQUIRE_DESCRIPTION

Ensures all type definitions are accompanied by a description. The types include:

Violation

 type User {
   id: ID!
}

interface Member {
   id: ID!
}

Correct:

 # Represents a user in the system
 type User {
   id: ID!
 }

# Represents a member in the system
 interface Member {
   id: ID!
 }

DISALLOW_CASE_INSENSITIVE_ENUM_VALUES

Ensures enum values eliminate duplicates by disallowing case insensitivity.

Violation

 enum UserRole {
   ADMIN
   admin
 }

Correct:

 enum UserRole {
   ADMIN
 }

NO_TYPENAME_PREFIX_IN_TYPE_FIELDS

Ensures field names do not include their type’s name as a prefix.

Violation

 type User {
   userId: ID!
 }

Correct:

 type User {
   id: ID!
 }

REQUIRE_DEPRECATION_REASON

Requires providing a reason for the @deprecated directive.

Violation

 type User {
   id: ID! @deprecated
 }

Correct:

 type User {
   id: ID! @deprecated(reason: "No longer in use")
 }

REQUIRE_DEPRECATION_DATE

Requires providing a deletion date for the @deprecated directive.

Violation

 type User {
   id: ID! @deprecated(reason: "No longer in use")
 }

Correct:

 type User {
   id: ID! @deprecated(reason: "No longer in use", date: "2023-01-01")
 }