Skip to content

Commit e9d1d53

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

File tree

60 files changed

+929
-52
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

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

docs/rules/executable-definitions.md

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).

docs/rules/fields-on-correct-type.md

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)