Skip to content

Commit

Permalink
[naming-convention] Update property schema to accept objects. Add pre…
Browse files Browse the repository at this point in the history
…fix and suffix option (#201)

Co-authored-by: Dotan Simha <dotansimha@gmail.com>
  • Loading branch information
eddeee888 and dotansimha committed Dec 23, 2020
1 parent 5e1bbe6 commit 174a66f
Show file tree
Hide file tree
Showing 7 changed files with 301 additions and 118 deletions.
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"`

0 comments on commit 174a66f

Please sign in to comment.