@graphql-eslint/eslint-plugin 3.0.0-alpha-3168a9b.0 → 3.0.0-alpha-7462f3d.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@graphql-eslint/eslint-plugin",
3
- "version": "3.0.0-alpha-3168a9b.0",
3
+ "version": "3.0.0-alpha-7462f3d.0",
4
4
  "sideEffects": false,
5
5
  "peerDependencies": {
6
6
  "graphql": "^0.8.0 || ^0.9.0 || ^0.10.0 || ^0.11.0 || ^0.12.0 || ^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"
@@ -1,10 +1,9 @@
1
- import { Kind } from 'graphql';
2
1
  import { GraphQLESLintRule } from '../types';
3
- declare const fieldsEnum: Kind[];
4
- declare const valuesEnum: Kind[];
5
- declare const selectionsEnum: Kind[];
6
- declare const variablesEnum: Kind[];
7
- declare const argumentsEnum: Kind[];
2
+ declare const fieldsEnum: ('ObjectTypeDefinition' | 'InterfaceTypeDefinition' | 'InputObjectTypeDefinition')[];
3
+ declare const valuesEnum: ['EnumTypeDefinition'];
4
+ declare const selectionsEnum: ('OperationDefinition' | 'FragmentDefinition')[];
5
+ declare const variablesEnum: ['OperationDefinition'];
6
+ declare const argumentsEnum: ('FieldDefinition' | 'Field' | 'DirectiveDefinition' | 'Directive')[];
8
7
  declare type AlphabetizeConfig = [
9
8
  {
10
9
  fields?: typeof fieldsEnum;
package/rules/index.d.ts CHANGED
@@ -1,15 +1,11 @@
1
1
  export declare const rules: {
2
2
  alphabetize: import("..").GraphQLESLintRule<[{
3
- fields?: import("graphql").Kind[];
4
- values?: import("graphql").Kind[];
5
- selections?: import("graphql").Kind[];
6
- variables?: import("graphql").Kind[];
7
- arguments?: import("graphql").Kind[];
3
+ fields?: ("ObjectTypeDefinition" | "InterfaceTypeDefinition" | "InputObjectTypeDefinition")[];
4
+ values?: ["EnumTypeDefinition"];
5
+ selections?: ("OperationDefinition" | "FragmentDefinition")[];
6
+ variables?: ["OperationDefinition"];
7
+ arguments?: ("Field" | "Directive" | "FieldDefinition" | "DirectiveDefinition")[];
8
8
  }], false>;
9
- 'avoid-duplicate-fields': import("..").GraphQLESLintRule<any[], false>;
10
- 'avoid-operation-name-prefix': import("..").GraphQLESLintRule<import("./avoid-operation-name-prefix").AvoidOperationNamePrefixConfig, false>;
11
- 'avoid-scalar-result-type-on-mutation': import("..").GraphQLESLintRule<any[], false>;
12
- 'avoid-typename-prefix': import("..").GraphQLESLintRule<any[], false>;
13
9
  'description-style': import("..").GraphQLESLintRule<[{
14
10
  style: "block" | "inline";
15
11
  }], false>;
@@ -159,11 +155,13 @@ export declare const rules: {
159
155
  'no-anonymous-operations': import("..").GraphQLESLintRule<any[], false>;
160
156
  'no-case-insensitive-enum-values-duplicates': import("..").GraphQLESLintRule<any[], false>;
161
157
  'no-deprecated': import("..").GraphQLESLintRule<[], true>;
158
+ 'no-duplicate-fields': import("..").GraphQLESLintRule<any[], false>;
162
159
  'no-hashtag-description': import("..").GraphQLESLintRule<any[], false>;
163
- 'no-operation-name-suffix': import("..").GraphQLESLintRule<any[], false>;
164
160
  'no-root-type': import("..").GraphQLESLintRule<[{
165
161
  disallow: ("query" | "mutation" | "subscription")[];
166
162
  }], false>;
163
+ 'no-scalar-result-type-on-mutation': import("..").GraphQLESLintRule<any[], false>;
164
+ 'no-typename-prefix': import("..").GraphQLESLintRule<any[], false>;
167
165
  'no-unreachable-types': import("..").GraphQLESLintRule<any[], false>;
168
166
  'no-unused-fields': import("..").GraphQLESLintRule<any[], false>;
169
167
  'require-deprecation-date': import("..").GraphQLESLintRule<[{
@@ -171,7 +169,19 @@ export declare const rules: {
171
169
  }], false>;
172
170
  'require-deprecation-reason': import("..").GraphQLESLintRule<any[], false>;
173
171
  'require-description': import("..").GraphQLESLintRule<[{
174
- on: import("graphql").Kind[];
172
+ types?: boolean;
173
+ overrides?: {
174
+ ScalarTypeDefinition?: boolean;
175
+ ObjectTypeDefinition?: boolean;
176
+ FieldDefinition?: boolean;
177
+ InputValueDefinition?: boolean;
178
+ InterfaceTypeDefinition?: boolean;
179
+ UnionTypeDefinition?: boolean;
180
+ EnumTypeDefinition?: boolean;
181
+ EnumValueDefinition?: boolean;
182
+ InputObjectTypeDefinition?: boolean;
183
+ DirectiveDefinition?: boolean;
184
+ };
175
185
  }], false>;
176
186
  'require-field-of-type-query-in-mutation-result': import("..").GraphQLESLintRule<any[], false>;
177
187
  'require-id-when-available': import("..").GraphQLESLintRule<[{
@@ -1,8 +1,12 @@
1
- import { GraphQLESLintRule } from '../types';
2
1
  import { Kind } from 'graphql';
3
- declare const DESCRIBABLE_NODES: Kind[];
4
- declare type RequireDescriptionRuleConfig = [{
5
- on: typeof DESCRIBABLE_NODES;
6
- }];
7
- declare const rule: GraphQLESLintRule<RequireDescriptionRuleConfig>;
2
+ import { GraphQLESLintRule } from '../types';
3
+ declare const ALLOWED_KINDS: readonly [Kind.OBJECT_TYPE_DEFINITION, Kind.INTERFACE_TYPE_DEFINITION, Kind.ENUM_TYPE_DEFINITION, Kind.SCALAR_TYPE_DEFINITION, Kind.INPUT_OBJECT_TYPE_DEFINITION, Kind.UNION_TYPE_DEFINITION, Kind.FIELD_DEFINITION, Kind.INPUT_VALUE_DEFINITION, Kind.ENUM_VALUE_DEFINITION, Kind.DIRECTIVE_DEFINITION];
4
+ declare type AllowedKind = typeof ALLOWED_KINDS[number];
5
+ declare type RequireDescriptionRuleConfig = {
6
+ types?: boolean;
7
+ overrides?: {
8
+ [key in AllowedKind]?: boolean;
9
+ };
10
+ };
11
+ declare const rule: GraphQLESLintRule<[RequireDescriptionRuleConfig]>;
8
12
  export default rule;
package/utils.d.ts CHANGED
@@ -19,7 +19,7 @@ export declare const normalizePath: (path: string) => string;
19
19
  export declare const getOnDiskFilepath: (filepath: string) => string;
20
20
  export declare const getTypeName: (node: any) => any;
21
21
  export declare const loaderCache: Record<string, LoaderSource[]>;
22
- export declare const TYPES_KINDS: Kind[];
22
+ export declare const TYPES_KINDS: readonly [Kind.OBJECT_TYPE_DEFINITION, Kind.INTERFACE_TYPE_DEFINITION, Kind.ENUM_TYPE_DEFINITION, Kind.SCALAR_TYPE_DEFINITION, Kind.INPUT_OBJECT_TYPE_DEFINITION, Kind.UNION_TYPE_DEFINITION];
23
23
  export declare enum CaseStyle {
24
24
  camelCase = "camelCase",
25
25
  pascalCase = "PascalCase",
@@ -1,50 +0,0 @@
1
- # `avoid-operation-name-prefix`
2
-
3
- - Category: `Stylistic Issues`
4
- - Rule name: `@graphql-eslint/avoid-operation-name-prefix`
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)
7
-
8
- Enforce/avoid operation name prefix, useful if you wish to avoid prefix in your root fields, or avoid using REST terminology in your schema.
9
-
10
- ## Usage Examples
11
-
12
- ### Incorrect
13
-
14
- ```graphql
15
- # eslint @graphql-eslint/avoid-operation-name-prefix: ['error', { keywords: ['get'] }]
16
-
17
- query getUserDetails {
18
- # ...
19
- }
20
- ```
21
-
22
- ### Correct
23
-
24
- ```graphql
25
- # eslint @graphql-eslint/avoid-operation-name-prefix: ['error', { keywords: ['get'] }]
26
-
27
- query userDetails {
28
- # ...
29
- }
30
- ```
31
-
32
- ## Config Schema
33
-
34
- The schema defines the following properties:
35
-
36
- ### `caseSensitive` (boolean)
37
-
38
- Default: `false`
39
-
40
- ### `keywords` (array, required)
41
-
42
- The object is an array with all elements of the type `string`.
43
-
44
- Additional restrictions:
45
-
46
- * Minimum items: `1`
47
-
48
- ## Resources
49
-
50
- - [Rule source](../../packages/plugin/src/rules/avoid-operation-name-prefix.ts)
@@ -1,38 +0,0 @@
1
- # `no-operation-name-suffix`
2
-
3
- ✅ The `"extends": "plugin:@graphql-eslint/recommended"` property in a configuration file enables this rule.
4
-
5
- 🔧 The `--fix` option on the [command line](https://eslint.org/docs/user-guide/command-line-interface#--fix) can automatically fix some of the problems reported by this rule.
6
-
7
- - Category: `Stylistic Issues`
8
- - Rule name: `@graphql-eslint/no-operation-name-suffix`
9
- - Requires GraphQL Schema: `false` [ℹ️](../../README.md#extended-linting-rules-with-graphql-schema)
10
- - Requires GraphQL Operations: `false` [ℹ️](../../README.md#extended-linting-rules-with-siblings-operations)
11
-
12
- Makes sure you are not adding the operation type to the name of the operation.
13
-
14
- ## Usage Examples
15
-
16
- ### Incorrect
17
-
18
- ```graphql
19
- # eslint @graphql-eslint/no-operation-name-suffix: 'error'
20
-
21
- query userQuery {
22
- # ...
23
- }
24
- ```
25
-
26
- ### Correct
27
-
28
- ```graphql
29
- # eslint @graphql-eslint/no-operation-name-suffix: 'error'
30
-
31
- query user {
32
- # ...
33
- }
34
- ```
35
-
36
- ## Resources
37
-
38
- - [Rule source](../../packages/plugin/src/rules/no-operation-name-suffix.ts)
@@ -1,9 +0,0 @@
1
- import { GraphQLESLintRule } from '../types';
2
- export declare type AvoidOperationNamePrefixConfig = [
3
- {
4
- keywords: string[];
5
- caseSensitive?: boolean;
6
- }
7
- ];
8
- declare const rule: GraphQLESLintRule<AvoidOperationNamePrefixConfig>;
9
- export default rule;
@@ -1,3 +0,0 @@
1
- import { GraphQLESLintRule } from '../types';
2
- declare const rule: GraphQLESLintRule;
3
- export default rule;