Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[naming-convention] Update property schema to accept objects. Add prefix and suffix option #201

Merged
5 changes: 5 additions & 0 deletions .changeset/fuzzy-mice-return.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@graphql-eslint/eslint-plugin': minor
---

[naming-convention] Allow each definition to take either a strng or object. Object can take the following keys: style (naming style), prefix (value must have prefix) and suffix (value must have suffix)
139 changes: 72 additions & 67 deletions docs/rules/naming-convention.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,104 +37,82 @@ The schema defines an array with all elements of the type `object`.

The array object has the following properties:

#### `FieldDefinition` (string, enum)
#### `FieldDefinition`

This element must be one of the following enum values:
The object must be one of the following types:

* `camelCase`
* `PascalCase`
* `snake_case`
* `UPPER_CASE`
* `asString`
* `asObject`

#### `InputObjectTypeDefinition` (string, enum)
#### `InputObjectTypeDefinition`

This element must be one of the following enum values:
The object must be one of the following types:

* `camelCase`
* `PascalCase`
* `snake_case`
* `UPPER_CASE`
* `asString`
* `asObject`

#### `EnumValueDefinition` (string, enum)
#### `EnumValueDefinition`

This element must be one of the following enum values:
The object must be one of the following types:

* `camelCase`
* `PascalCase`
* `snake_case`
* `UPPER_CASE`
* `asString`
* `asObject`

#### `InputValueDefinition` (string, enum)
#### `InputValueDefinition`

This element must be one of the following enum values:
The object must be one of the following types:

* `camelCase`
* `PascalCase`
* `snake_case`
* `UPPER_CASE`
* `asString`
* `asObject`

#### `ObjectTypeDefinition` (string, enum)
#### `ObjectTypeDefinition`

This element must be one of the following enum values:
The object must be one of the following types:

* `camelCase`
* `PascalCase`
* `snake_case`
* `UPPER_CASE`
* `asString`
* `asObject`

#### `InterfaceTypeDefinition` (string, enum)
#### `InterfaceTypeDefinition`

This element must be one of the following enum values:
The object must be one of the following types:

* `camelCase`
* `PascalCase`
* `snake_case`
* `UPPER_CASE`
* `asString`
* `asObject`

#### `EnumTypeDefinition` (string, enum)
#### `EnumTypeDefinition`

This element must be one of the following enum values:
The object must be one of the following types:

* `camelCase`
* `PascalCase`
* `snake_case`
* `UPPER_CASE`
* `asString`
* `asObject`

#### `UnionTypeDefinition` (string, enum)
#### `UnionTypeDefinition`

This element must be one of the following enum values:
The object must be one of the following types:

* `camelCase`
* `PascalCase`
* `snake_case`
* `UPPER_CASE`
* `asString`
* `asObject`

#### `ScalarTypeDefinition` (string, enum)
#### `ScalarTypeDefinition`

This element must be one of the following enum values:
The object must be one of the following types:

* `camelCase`
* `PascalCase`
* `snake_case`
* `UPPER_CASE`
* `asString`
* `asObject`

#### `OperationDefinition` (string, enum)
#### `OperationDefinition`

This element must be one of the following enum values:
The object must be one of the following types:

* `camelCase`
* `PascalCase`
* `snake_case`
* `UPPER_CASE`
* `asString`
* `asObject`

#### `FragmentDefinition` (string, enum)
#### `FragmentDefinition`

This element must be one of the following enum values:
The object must be one of the following types:

* `camelCase`
* `PascalCase`
* `snake_case`
* `UPPER_CASE`
* `asString`
* `asObject`

#### `leadingUnderscore` (string, enum)

Expand All @@ -152,4 +130,31 @@ This element must be one of the following enum values:
* `allow`
* `forbid`

Default: `"forbid"`
Default: `"forbid"`

---

# Sub Schemas

The schema defines the following additional types:

## `asString` (string)

One of: `camelCase`, `PascalCase`, `snake_case`, `UPPER_CASE`

## `asObject` (object)

Properties of the `asObject` object:

### `style` (string, enum)

This element must be one of the following enum values:

* `camelCase`
* `PascalCase`
* `snake_case`
* `UPPER_CASE`

### `prefix` (string)

### `suffix` (string)
18 changes: 17 additions & 1 deletion docs/rules/require-description.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,4 +37,20 @@ type someTypeName {

## Config Schema

The schema defines the following properties:
### (array)

The schema defines an array with all elements of the type `object`.

The array object has the following properties:

#### `on` (array)

The object is an array with all elements of the type `string`.

Additional restrictions:

* Minimum items: `1`

Additional restrictions:

* Minimum items: `1`
10 changes: 9 additions & 1 deletion docs/rules/require-id-when-available.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,4 +50,12 @@ query user {

## Config Schema

The schema defines the following properties:
### (array)

The schema defines an array with all elements of the type `object`.

The array object has the following properties:

#### `fieldName` (string)

Default: `"id"`
Loading