Following the same naming conventions in all your type definitions will make them easier to read and more predictable.
This rule enforces naming conventions patterns for your type definitions. It can control if the names should be in PascalCase, camelCase, snake_case or UPPER_CASE. It can also allow or disallow trailing and leading underscores.
Examples of incorrect code for this rule:
# eslint @graphql-eslint/naming-convention: ["error", { TypeDefinition: "PascalCase" }]
type someTypeName {
...
}
Examples of correct code for this rule:
# eslint @graphql-eslint/naming-convention: ["error", { FieldDefinition: "camelCase", TypeDefintion: "PascalCase" }]
type SomeTypeName {
someFieldName: String
}
This rule accepts configuration object with multiple options:
TypeDefintion: 'PascalCase'|'camelCase'|'snake_case'|'UPPER_CASE'
- Will affect names of types, input objects, enums and interfacesFieldDefintion: 'PascalCase'|'camelCase'|'snake_case'|'UPPER_CASE'
- Will affect names of type fieldsEnumValueDefinition: 'PascalCase'|'camelCase'|'snake_case'|'UPPER_CASE'
- Will affect names of enumeration valuesInputValueDefinition: 'PascalCase'|'camelCase'|'snake_case'|'UPPER_CASE'
- Will affect names of input propertiesFragmentDefinition: 'PascalCase'|'camelCase'|'snake_case'|'UPPER_CASE'
- Will affect names of fragmentsScalarTypeDefinition: 'PascalCase'|'camelCase'|'snake_case'|'UPPER_CASE'
- Will affect names of scalarsleadingUnderscore: 'allow'|'forbid'
- Will allow or forbid leading underscores in all names. Default value isforbid
.trailingUnderscore: 'allow'|'forbid'
- Will allow of forbid trailing underscores in all names. Default value isforbid
.