Skip to content

Commit 86c4fbc

Browse files
committed
move all graphql-js validation to standalone rules
fixes for converter added unique operation name rule
1 parent b7eb87e commit 86c4fbc

File tree

60 files changed

+934
-57
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

60 files changed

+934
-57
lines changed

.changeset/curvy-suits-kneel.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@graphql-eslint/eslint-plugin': minor
3+
---
4+
5+
NEW RULE: unique-operation-name

.changeset/cyan-bugs-design.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@graphql-eslint/eslint-plugin': patch
3+
---
4+
5+
Fix issues with AST converter and root Document causing to invalid ASTs when rawNode is called

.changeset/sixty-toes-design.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@graphql-eslint/eslint-plugin': patch
3+
---
4+
5+
Fix issue with siblings operations and getOperation method

.changeset/smooth-news-greet.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@graphql-eslint/eslint-plugin': minor
3+
---
4+
5+
Port all graphql-js validation rules to standalone rules

docs/README.md

Lines changed: 47 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,54 @@
11
## Available Rules
22

3-
- [`avoid-operation-name-prefix`](./rules/avoid-operation-name-prefix.md)
4-
- [`input-name`](./rules/input-name.md)
5-
- [`description-style`](./rules/description-style.md)
6-
- [`naming-convention`](./rules/naming-convention.md)
7-
- [`no-anonymous-operations`](./rules/no-anonymous-operations.md)
8-
- [`require-deprecation-reason`](./rules/require-deprecation-reason.md)
9-
- [`no-case-insensitive-enum-values-duplicates`](./rules/no-case-insensitive-enum-values-duplicates.md)
10-
- [`no-operation-name-suffix`](./rules/no-operation-name-suffix.md)
11-
- [`require-id-when-available`](./rules/require-id-when-available.md)
12-
- [`validate-against-schema`](./rules/validate-against-schema.md)
13-
- [`prettier`](./rules/prettier.md)
14-
- [`require-description`](./rules/require-description.md)
3+
4+
- [`unique-fragment-name`](./unique-fragment-name.md)
5+
- [`unique-operation-name`](./unique-operation-name.md)
6+
- [`validate-against-schema`](./validate-against-schema.md)
7+
- [`no-anonymous-operations`](./no-anonymous-operations.md)
8+
- [`no-operation-name-suffix`](./no-operation-name-suffix.md)
9+
- [`require-deprecation-reason`](./require-deprecation-reason.md)
10+
- [`avoid-operation-name-prefix`](./avoid-operation-name-prefix.md)
11+
- [`no-case-insensitive-enum-values-duplicates`](./no-case-insensitive-enum-values-duplicates.md)
12+
- [`require-description`](./require-description.md)
13+
- [`require-id-when-available`](./require-id-when-available.md)
14+
- [`description-style`](./description-style.md)
15+
- [`prettier`](./prettier.md)
16+
- [`naming-convention`](./naming-convention.md)
17+
- [`input-name`](./input-name.md)
18+
- [`executable-definitions`](./executable-definitions.md)
19+
- [`fields-on-correct-type`](./fields-on-correct-type.md)
20+
- [`fragments-on-composite-type`](./fragments-on-composite-type.md)
21+
- [`known-argument-names`](./known-argument-names.md)
22+
- [`known-directives`](./known-directives.md)
23+
- [`known-fragment-names`](./known-fragment-names.md)
24+
- [`known-type-names`](./known-type-names.md)
25+
- [`lone-anonymous-operation`](./lone-anonymous-operation.md)
26+
- [`lone-schema-definition`](./lone-schema-definition.md)
27+
- [`no-fragment-cycles`](./no-fragment-cycles.md)
28+
- [`no-undefined-variables`](./no-undefined-variables.md)
29+
- [`no-unused-fragments`](./no-unused-fragments.md)
30+
- [`no-unused-variables`](./no-unused-variables.md)
31+
- [`overlapping-fields-can-be-merged`](./overlapping-fields-can-be-merged.md)
32+
- [`possible-fragment-spread`](./possible-fragment-spread.md)
33+
- [`possible-type-extension`](./possible-type-extension.md)
34+
- [`provided-required-arguments`](./provided-required-arguments.md)
35+
- [`scalar-leafs`](./scalar-leafs.md)
36+
- [`one-field-subscriptions`](./one-field-subscriptions.md)
37+
- [`unique-argument-names`](./unique-argument-names.md)
38+
- [`unique-directive-names`](./unique-directive-names.md)
39+
- [`unique-directive-names-per-location`](./unique-directive-names-per-location.md)
40+
- [`unique-enum-value-names`](./unique-enum-value-names.md)
41+
- [`unique-field-definition-names`](./unique-field-definition-names.md)
42+
- [`unique-input-field-names`](./unique-input-field-names.md)
43+
- [`unique-operation-types`](./unique-operation-types.md)
44+
- [`unique-type-names`](./unique-type-names.md)
45+
- [`unique-variable-names`](./unique-variable-names.md)
46+
- [`value-literals-of-correct-type`](./value-literals-of-correct-type.md)
47+
- [`variables-are-input-types`](./variables-are-input-types.md)
48+
- [`variables-in-allowed-position`](./variables-in-allowed-position.md)
1549

1650
## Further Reading
1751

1852
- [Writing Custom Rules](./custom-rules.md)
1953
- [How the parser works?](./parser.md)
20-
- [`parserOptions`](./parser-options.md)
54+
- [`parserOptions`](./parser-options.md)

docs/rules/avoid-operation-name-prefix.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22

33
- Category: `Stylistic Issues`
44
- Rule name: `@graphql-eslint/avoid-operation-name-prefix`
5-
- Requires GraphQL Schema: `false`
6-
- Requires GraphQL Operations: `false`
5+
- Requires GraphQL Schema: `false` [ℹ️](../../README.md#extended-linting-rules-with-graphql-schema)
6+
- Requires GraphQL Operations: `false` [ℹ️](../../README.md#extended-linting-rules-with-siblings-operations)
77

88
Enforce/avoid operation name prefix, useful if you wish to avoid prefix in your root fields, or avoid using REST terminology in your schema
99

docs/rules/description-style.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22

33
- Category: `Stylistic Issues`
44
- Rule name: `@graphql-eslint/description-style`
5-
- Requires GraphQL Schema: `false`
6-
- Requires GraphQL Operations: `false`
5+
- Requires GraphQL Schema: `false` [ℹ️](../../README.md#extended-linting-rules-with-graphql-schema)
6+
- Requires GraphQL Operations: `false` [ℹ️](../../README.md#extended-linting-rules-with-siblings-operations)
77

88
Require all comments to follow the same style (either block or inline)
99

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
# `executable-definitions`
2+
3+
- Category: `Validation`
4+
- Rule name: `@graphql-eslint/executable-definitions`
5+
- Requires GraphQL Schema: `true` [ℹ️](../../README.md#extended-linting-rules-with-graphql-schema)
6+
- Requires GraphQL Operations: `false` [ℹ️](../../README.md#extended-linting-rules-with-siblings-operations)
7+
8+
A GraphQL document is only valid for execution if all definitions are either operation or fragment definitions.
9+
10+
> This rule is a wrapper around a `graphql-js` validation function. [You can find it's source code here](https://github.com/graphql/graphql-js/blob/master/src/validation/rules/ExecutableDefinitionsRule.js).
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
# `fields-on-correct-type`
2+
3+
- Category: `Validation`
4+
- Rule name: `@graphql-eslint/fields-on-correct-type`
5+
- Requires GraphQL Schema: `true` [ℹ️](../../README.md#extended-linting-rules-with-graphql-schema)
6+
- Requires GraphQL Operations: `false` [ℹ️](../../README.md#extended-linting-rules-with-siblings-operations)
7+
8+
A GraphQL document is only valid if all fields selected are defined by the parent type, or are an allowed meta field such as __typename.
9+
10+
> This rule is a wrapper around a `graphql-js` validation function. [You can find it's source code here](https://github.com/graphql/graphql-js/blob/master/src/validation/rules/FieldsOnCorrectTypeRule.js).
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
# `fragments-on-composite-type`
2+
3+
- Category: `Validation`
4+
- Rule name: `@graphql-eslint/fragments-on-composite-type`
5+
- Requires GraphQL Schema: `true` [ℹ️](../../README.md#extended-linting-rules-with-graphql-schema)
6+
- Requires GraphQL Operations: `false` [ℹ️](../../README.md#extended-linting-rules-with-siblings-operations)
7+
8+
Fragments use a type condition to determine if they apply, since fragments can only be spread into a composite type (object, interface, or union), the type condition must also be a composite type.
9+
10+
> This rule is a wrapper around a `graphql-js` validation function. [You can find it's source code here](https://github.com/graphql/graphql-js/blob/master/src/validation/rules/FragmentsOnCompositeTypesRule.js).

0 commit comments

Comments
 (0)