@graphql-eslint/eslint-plugin 2.3.0-alpha-6ba4002.0 → 2.3.2-alpha-99be3d2.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 (70) hide show
  1. package/README.md +1 -1
  2. package/configs/all.d.ts +7 -0
  3. package/configs/index.d.ts +7 -0
  4. package/docs/README.md +2 -1
  5. package/docs/custom-rules.md +3 -3
  6. package/docs/rules/alphabetize.md +145 -0
  7. package/docs/rules/avoid-duplicate-fields.md +6 -1
  8. package/docs/rules/avoid-operation-name-prefix.md +8 -8
  9. package/docs/rules/avoid-scalar-result-type-on-mutation.md +6 -1
  10. package/docs/rules/avoid-typename-prefix.md +6 -1
  11. package/docs/rules/description-style.md +10 -9
  12. package/docs/rules/executable-definitions.md +6 -1
  13. package/docs/rules/fields-on-correct-type.md +6 -1
  14. package/docs/rules/fragments-on-composite-type.md +6 -1
  15. package/docs/rules/input-name.md +11 -10
  16. package/docs/rules/known-argument-names.md +6 -1
  17. package/docs/rules/known-directives.md +6 -1
  18. package/docs/rules/known-fragment-names.md +6 -1
  19. package/docs/rules/known-type-names.md +6 -1
  20. package/docs/rules/lone-anonymous-operation.md +6 -1
  21. package/docs/rules/lone-schema-definition.md +6 -1
  22. package/docs/rules/match-document-filename.md +12 -11
  23. package/docs/rules/naming-convention.md +21 -20
  24. package/docs/rules/no-anonymous-operations.md +6 -1
  25. package/docs/rules/no-case-insensitive-enum-values-duplicates.md +5 -1
  26. package/docs/rules/no-deprecated.md +6 -1
  27. package/docs/rules/no-fragment-cycles.md +6 -1
  28. package/docs/rules/no-hashtag-description.md +6 -1
  29. package/docs/rules/no-operation-name-suffix.md +5 -1
  30. package/docs/rules/no-undefined-variables.md +6 -1
  31. package/docs/rules/no-unreachable-types.md +6 -1
  32. package/docs/rules/no-unused-fields.md +6 -1
  33. package/docs/rules/no-unused-fragments.md +6 -1
  34. package/docs/rules/no-unused-variables.md +6 -1
  35. package/docs/rules/one-field-subscriptions.md +6 -1
  36. package/docs/rules/overlapping-fields-can-be-merged.md +6 -1
  37. package/docs/rules/possible-fragment-spread.md +6 -1
  38. package/docs/rules/possible-type-extension.md +6 -1
  39. package/docs/rules/provided-required-arguments.md +6 -1
  40. package/docs/rules/require-deprecation-date.md +5 -4
  41. package/docs/rules/require-deprecation-reason.md +6 -1
  42. package/docs/rules/require-description.md +5 -8
  43. package/docs/rules/require-field-of-type-query-in-mutation-result.md +6 -1
  44. package/docs/rules/require-id-when-available.md +6 -5
  45. package/docs/rules/scalar-leafs.md +6 -1
  46. package/docs/rules/selection-set-depth.md +6 -9
  47. package/docs/rules/strict-id-in-types.md +12 -11
  48. package/docs/rules/unique-argument-names.md +6 -1
  49. package/docs/rules/unique-directive-names-per-location.md +6 -1
  50. package/docs/rules/unique-directive-names.md +6 -1
  51. package/docs/rules/unique-enum-value-names.md +6 -1
  52. package/docs/rules/unique-field-definition-names.md +6 -1
  53. package/docs/rules/unique-fragment-name.md +6 -1
  54. package/docs/rules/unique-input-field-names.md +6 -1
  55. package/docs/rules/unique-operation-name.md +6 -1
  56. package/docs/rules/unique-operation-types.md +6 -1
  57. package/docs/rules/unique-type-names.md +6 -1
  58. package/docs/rules/unique-variable-names.md +6 -1
  59. package/docs/rules/value-literals-of-correct-type.md +6 -1
  60. package/docs/rules/variables-are-input-types.md +6 -1
  61. package/docs/rules/variables-in-allowed-position.md +6 -1
  62. package/estree-parser/estree-ast.d.ts +2 -2
  63. package/index.js +466 -102
  64. package/index.mjs +466 -102
  65. package/package.json +1 -1
  66. package/rules/alphabetize.d.ts +17 -0
  67. package/rules/index.d.ts +7 -0
  68. package/testkit.d.ts +6 -4
  69. package/types.d.ts +3 -0
  70. package/utils.d.ts +4 -0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@graphql-eslint/eslint-plugin",
3
- "version": "2.3.0-alpha-6ba4002.0",
3
+ "version": "2.3.2-alpha-99be3d2.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,17 @@
1
+ import { GraphQLESLintRule } from '../types';
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: ("Field" | "Directive" | "FieldDefinition" | "DirectiveDefinition")[];
7
+ declare type AlphabetizeConfig = [
8
+ {
9
+ fields?: typeof fieldsEnum;
10
+ values?: typeof valuesEnum;
11
+ selections?: typeof selectionsEnum;
12
+ variables?: typeof variablesEnum;
13
+ arguments?: typeof argumentsEnum;
14
+ }
15
+ ];
16
+ declare const rule: GraphQLESLintRule<AlphabetizeConfig>;
17
+ export default rule;
package/rules/index.d.ts CHANGED
@@ -1,4 +1,11 @@
1
1
  export declare const rules: {
2
+ alphabetize: import("..").GraphQLESLintRule<[{
3
+ fields?: ("ObjectTypeDefinition" | "InterfaceTypeDefinition" | "InputObjectTypeDefinition")[];
4
+ values?: "EnumTypeDefinition"[];
5
+ selections?: ("OperationDefinition" | "FragmentDefinition")[];
6
+ variables?: "OperationDefinition"[];
7
+ arguments?: ("Field" | "Directive" | "FieldDefinition" | "DirectiveDefinition")[];
8
+ }], false>;
2
9
  'avoid-duplicate-fields': import("..").GraphQLESLintRule<[], false>;
3
10
  'avoid-operation-name-prefix': import("..").GraphQLESLintRule<import("./avoid-operation-name-prefix").AvoidOperationNamePrefixConfig, false>;
4
11
  'avoid-scalar-result-type-on-mutation': import("..").GraphQLESLintRule<any[], false>;
package/testkit.d.ts CHANGED
@@ -2,7 +2,7 @@ import { RuleTester } from 'eslint';
2
2
  import { ASTKindToNode } from 'graphql';
3
3
  import { GraphQLESTreeNode } from './estree-parser';
4
4
  import { GraphQLESLintRule, ParserOptions } from './types';
5
- export declare type GraphQLESLintRuleListener<WithTypeInfo extends boolean> = {
5
+ export declare type GraphQLESLintRuleListener<WithTypeInfo extends boolean = false> = {
6
6
  [K in keyof ASTKindToNode]?: (node: GraphQLESTreeNode<ASTKindToNode[K], WithTypeInfo>) => void;
7
7
  } & Record<string, any>;
8
8
  export declare type GraphQLValidTestCase<Options> = Omit<RuleTester.ValidTestCase, 'options' | 'parserOptions'> & {
@@ -13,8 +13,11 @@ export declare type GraphQLInvalidTestCase<T> = GraphQLValidTestCase<T> & {
13
13
  errors: number | Array<RuleTester.TestCaseError | string>;
14
14
  output?: string | null;
15
15
  };
16
- declare const GraphQLRuleTester_base: any;
17
- export declare class GraphQLRuleTester extends GraphQLRuleTester_base {
16
+ export declare class GraphQLRuleTester extends RuleTester {
17
+ config: {
18
+ parser: string;
19
+ parserOptions: ParserOptions;
20
+ };
18
21
  constructor(parserOptions?: ParserOptions);
19
22
  fromMockFile(path: string): string;
20
23
  runGraphQLTests<Config>(name: string, rule: GraphQLESLintRule, tests: {
@@ -22,4 +25,3 @@ export declare class GraphQLRuleTester extends GraphQLRuleTester_base {
22
25
  invalid: GraphQLInvalidTestCase<Config>[];
23
26
  }): void;
24
27
  }
25
- export {};
package/types.d.ts CHANGED
@@ -55,9 +55,12 @@ export declare type RuleDocsInfo<T> = Rule.RuleMetaData & {
55
55
  code: string;
56
56
  usage?: T;
57
57
  }[];
58
+ optionsForConfig?: T;
59
+ graphQLJSRuleName?: string;
58
60
  };
59
61
  };
60
62
  export declare type GraphQLESLintRule<Options = any[], WithTypeInfo extends boolean = false> = {
61
63
  create(context: GraphQLESLintRuleContext<Options>): GraphQLESLintRuleListener<WithTypeInfo>;
62
64
  meta: Rule.RuleMetaData & RuleDocsInfo<Options>;
63
65
  };
66
+ export declare type ValueOf<T> = T[keyof T];
package/utils.d.ts CHANGED
@@ -33,4 +33,8 @@ export declare enum CaseStyle {
33
33
  }
34
34
  export declare const camelCase: (str: string) => string;
35
35
  export declare const convertCase: (style: CaseStyle, str: string) => string;
36
+ export declare function getLocation(loc: Partial<AST.SourceLocation>, fieldName?: string, offset?: {
37
+ offsetStart?: number;
38
+ offsetEnd?: number;
39
+ }): AST.SourceLocation;
36
40
  export {};