@graphql-eslint/eslint-plugin 2.1.0-alpha-b4cd82d.0 → 2.3.0-alpha-6ba4002.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.
Files changed (58) hide show
  1. package/README.md +38 -18
  2. package/configs/all.d.ts +61 -0
  3. package/configs/index.d.ts +107 -0
  4. package/configs/recommended.d.ts +44 -0
  5. package/docs/README.md +64 -60
  6. package/docs/rules/avoid-scalar-result-type-on-mutation.md +30 -0
  7. package/docs/rules/avoid-typename-prefix.md +2 -0
  8. package/docs/rules/executable-definitions.md +3 -1
  9. package/docs/rules/fields-on-correct-type.md +3 -1
  10. package/docs/rules/fragments-on-composite-type.md +3 -1
  11. package/docs/rules/known-argument-names.md +3 -1
  12. package/docs/rules/known-directives.md +3 -1
  13. package/docs/rules/known-fragment-names.md +3 -1
  14. package/docs/rules/known-type-names.md +3 -1
  15. package/docs/rules/lone-anonymous-operation.md +3 -1
  16. package/docs/rules/lone-schema-definition.md +3 -1
  17. package/docs/rules/match-document-filename.md +1 -1
  18. package/docs/rules/naming-convention.md +2 -0
  19. package/docs/rules/no-anonymous-operations.md +2 -0
  20. package/docs/rules/no-case-insensitive-enum-values-duplicates.md +5 -1
  21. package/docs/rules/no-fragment-cycles.md +3 -1
  22. package/docs/rules/no-operation-name-suffix.md +4 -0
  23. package/docs/rules/no-undefined-variables.md +3 -1
  24. package/docs/rules/no-unreachable-types.md +2 -0
  25. package/docs/rules/no-unused-fields.md +2 -0
  26. package/docs/rules/no-unused-fragments.md +3 -1
  27. package/docs/rules/no-unused-variables.md +3 -1
  28. package/docs/rules/one-field-subscriptions.md +3 -1
  29. package/docs/rules/overlapping-fields-can-be-merged.md +3 -1
  30. package/docs/rules/possible-fragment-spread.md +3 -1
  31. package/docs/rules/possible-type-extension.md +3 -1
  32. package/docs/rules/provided-required-arguments.md +3 -1
  33. package/docs/rules/require-deprecation-date.md +53 -0
  34. package/docs/rules/require-deprecation-reason.md +2 -0
  35. package/docs/rules/require-field-of-type-query-in-mutation-result.md +42 -0
  36. package/docs/rules/scalar-leafs.md +3 -1
  37. package/docs/rules/strict-id-in-types.md +2 -0
  38. package/docs/rules/unique-argument-names.md +3 -1
  39. package/docs/rules/unique-directive-names-per-location.md +3 -1
  40. package/docs/rules/unique-directive-names.md +3 -1
  41. package/docs/rules/unique-enum-value-names.md +3 -1
  42. package/docs/rules/unique-field-definition-names.md +3 -1
  43. package/docs/rules/unique-input-field-names.md +3 -1
  44. package/docs/rules/unique-operation-types.md +3 -1
  45. package/docs/rules/unique-type-names.md +3 -1
  46. package/docs/rules/unique-variable-names.md +3 -1
  47. package/docs/rules/value-literals-of-correct-type.md +3 -1
  48. package/docs/rules/variables-are-input-types.md +3 -1
  49. package/docs/rules/variables-in-allowed-position.md +3 -1
  50. package/index.d.ts +1 -0
  51. package/index.js +389 -74
  52. package/index.mjs +390 -76
  53. package/package.json +1 -1
  54. package/rules/avoid-scalar-result-type-on-mutation.d.ts +3 -0
  55. package/rules/index.d.ts +5 -0
  56. package/rules/require-deprecation-date.d.ts +5 -0
  57. package/rules/require-field-of-type-query-in-mutation-result.d.ts +3 -0
  58. package/utils.d.ts +9 -4
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@graphql-eslint/eslint-plugin",
3
- "version": "2.1.0-alpha-b4cd82d.0",
3
+ "version": "2.3.0-alpha-6ba4002.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"
@@ -0,0 +1,3 @@
1
+ import { GraphQLESLintRule } from '../types';
2
+ declare const rule: GraphQLESLintRule;
3
+ export default rule;
package/rules/index.d.ts CHANGED
@@ -1,6 +1,7 @@
1
1
  export declare const rules: {
2
2
  'avoid-duplicate-fields': import("..").GraphQLESLintRule<[], false>;
3
3
  'avoid-operation-name-prefix': import("..").GraphQLESLintRule<import("./avoid-operation-name-prefix").AvoidOperationNamePrefixConfig, false>;
4
+ 'avoid-scalar-result-type-on-mutation': import("..").GraphQLESLintRule<any[], false>;
4
5
  'avoid-typename-prefix': import("..").GraphQLESLintRule<any[], false>;
5
6
  'description-style': import("..").GraphQLESLintRule<[{
6
7
  style: "block" | "inline";
@@ -53,10 +54,14 @@ export declare const rules: {
53
54
  'no-operation-name-suffix': import("..").GraphQLESLintRule<any[], false>;
54
55
  'no-unreachable-types': import("..").GraphQLESLintRule<any[], false>;
55
56
  'no-unused-fields': import("..").GraphQLESLintRule<any[], false>;
57
+ 'require-deprecation-date': import("..").GraphQLESLintRule<[{
58
+ argumentName?: string;
59
+ }], false>;
56
60
  'require-deprecation-reason': import("..").GraphQLESLintRule<any[], false>;
57
61
  'require-description': import("..").GraphQLESLintRule<[{
58
62
  on: ("SchemaDefinition" | "ObjectTypeDefinition" | "FieldDefinition" | "InputValueDefinition" | "InterfaceTypeDefinition" | "UnionTypeDefinition" | "EnumTypeDefinition" | "EnumValueDefinition" | "InputObjectTypeDefinition" | "DirectiveDefinition")[];
59
63
  }], false>;
64
+ 'require-field-of-type-query-in-mutation-result': import("..").GraphQLESLintRule<any[], false>;
60
65
  'require-id-when-available': import("..").GraphQLESLintRule<[{
61
66
  fieldName: string;
62
67
  }], true>;
@@ -0,0 +1,5 @@
1
+ import { GraphQLESLintRule } from '../types';
2
+ declare const rule: GraphQLESLintRule<[{
3
+ argumentName?: string;
4
+ }]>;
5
+ export default rule;
@@ -0,0 +1,3 @@
1
+ import { GraphQLESLintRule } from '../types';
2
+ declare const rule: GraphQLESLintRule;
3
+ export default rule;
package/utils.d.ts CHANGED
@@ -1,9 +1,10 @@
1
- import { GraphQLSchema } from 'graphql';
1
+ import { GraphQLSchema, ObjectTypeDefinitionNode, ObjectTypeExtensionNode } from 'graphql';
2
2
  import { AST } from 'eslint';
3
3
  import { Source as LoaderSource } from '@graphql-tools/utils';
4
4
  import { GraphQLESLintRuleContext } from './types';
5
5
  import { SiblingOperations } from './sibling-operations';
6
6
  import { UsedFields, ReachableTypes } from './graphql-ast';
7
+ import { GraphQLESTreeNode } from './estree-parser';
7
8
  export declare function requireSiblingsOperations(ruleName: string, context: GraphQLESLintRuleContext): SiblingOperations | never;
8
9
  export declare function requireGraphQLSchemaFromContext(ruleName: string, context: GraphQLESLintRuleContext): GraphQLSchema | never;
9
10
  export declare function requireReachableTypesFromContext(ruleName: string, context: GraphQLESLintRuleContext): ReachableTypes | never;
@@ -17,10 +18,12 @@ export declare const normalizePath: (path: string) => string;
17
18
  * on disk. This attempts to transform a virtual path into an on-disk path
18
19
  */
19
20
  export declare const getOnDiskFilepath: (filepath: string) => string;
21
+ export declare const getTypeName: (node: any) => any;
20
22
  export declare const loaderCache: Record<string, LoaderSource[]>;
21
- export declare const isQueryType: (node: any) => boolean;
22
- export declare const isMutationType: (node: any) => boolean;
23
- export declare const isSubscriptionType: (node: any) => boolean;
23
+ declare type ObjectTypeNode = GraphQLESTreeNode<ObjectTypeDefinitionNode | ObjectTypeExtensionNode>;
24
+ export declare const isQueryType: (node: ObjectTypeNode) => boolean;
25
+ export declare const isMutationType: (node: ObjectTypeNode) => boolean;
26
+ export declare const isSubscriptionType: (node: ObjectTypeNode) => boolean;
24
27
  export declare enum CaseStyle {
25
28
  camelCase = "camelCase",
26
29
  pascalCase = "PascalCase",
@@ -28,4 +31,6 @@ export declare enum CaseStyle {
28
31
  upperCase = "UPPER_CASE",
29
32
  kebabCase = "kebab-case"
30
33
  }
34
+ export declare const camelCase: (str: string) => string;
31
35
  export declare const convertCase: (style: CaseStyle, str: string) => string;
36
+ export {};