You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
> Make sure you have `graphql` dependency in your project.
44
44
45
-
###Configuration
45
+
## Configuration
46
46
47
47
To get started, define an override in your ESLint config to apply this plugin to `.graphql` files. Add the [rules](docs/README.md) you want applied.
48
48
@@ -65,7 +65,7 @@ To get started, define an override in your ESLint config to apply this plugin to
65
65
66
66
If your GraphQL definitions are defined only in `.graphql` files, and you're only using rules that apply to individual files, you should be good to go 👍. If you would like use a remote schema or use rules that apply across the entire collection of definitions at once, see [here](#using-a-remote-schema-or-rules-with-constraints-that-span-the-entire-schema).
67
67
68
-
#### Tell ESLint to apply this plugin to GraphQL definitions defined in code files
68
+
###Apply this plugin to GraphQL definitions defined in code files
69
69
70
70
If you are defining GraphQL schema or GraphQL operations in code files, you'll want to define an additional override to extend the functionality of this plugin to the schema and operations in those files.
71
71
@@ -90,7 +90,7 @@ If you are defining GraphQL schema or GraphQL operations in code files, you'll w
90
90
91
91
Under the hood, specifying the `@graphql-eslint/graphql` processor for code files will cause `graphql-eslint/graphql` to extract the schema and operation definitions from these files into virtual GraphQL documents with `.graphql` extensions. This will allow the overrides you've defined for `.graphql` files, via `"files": ["*.graphql"]`, to get applied to the definitions defined in your code files.
92
92
93
-
#### Using a remote schema or rules with constraints that span the entire schema
93
+
###Extended linting rules with GraphQL Schema
94
94
95
95
Some rules require an understanding of the entire schema at once. For example, [no-unreachable-types](https://github.com/dotansimha/graphql-eslint/blob/master/docs/rules/no-unreachable-types.md#no-unreachable-types) checks that all types are reachable by root-level fields.
96
96
@@ -120,7 +120,7 @@ The parser allows you to specify a json file / graphql files(s) / url / raw stri
120
120
121
121
> Some rules require type information to operate, it's marked in the docs for each rule!
122
122
123
-
####Extended linting rules with siblings operations
123
+
### Extended linting rules with siblings operations
124
124
125
125
While implementing this tool, we had to find solutions for a better integration of the GraphQL ecosystem and ESLint core.
126
126
@@ -180,7 +180,7 @@ You can find a list of [ESLint directives here](https://eslint.org/docs/2.13.1/u
`You rule "${ruleId}" depends on a GraphQL validation rule "${ruleName}" but it's not available in the "graphql-js" version you are using. Skipping...`
171
+
);
172
+
return{};
173
+
}
174
+
170
175
return{
171
176
Document(node){
172
-
if(!ruleFn){
173
-
// eslint-disable-next-line no-console
174
-
console.warn(
175
-
`You rule "${ruleId}" depends on a GraphQL validation rule "${ruleName}" but it's not available in the "graphql-js" version you are using. Skipping...`
description: `Limit the complexity of the GraphQL operations solely by their depth. Based on [graphql-depth-limit](https://github.com/stems/graphql-depth-limit).`,
0 commit comments