@graphql-eslint/eslint-plugin 3.8.0-alpha-998ffa8.0 → 3.8.0-alpha-fb12b01.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.
@@ -131,7 +131,7 @@ The schema defines the following additional types:
131
131
 
132
132
  ## `asString` (enum)
133
133
 
134
- One of: `camelCase`, `PascalCase`, `snake_case`, `UPPER_CASE`, `kebab-case`, `documentStyle`
134
+ One of: `camelCase`, `PascalCase`, `snake_case`, `UPPER_CASE`, `kebab-case`, `matchDocumentStyle`
135
135
 
136
136
  ## `asObject` (object)
137
137
 
@@ -146,7 +146,7 @@ This element must be one of the following enum values:
146
146
  - `snake_case`
147
147
  - `UPPER_CASE`
148
148
  - `kebab-case`
149
- - `documentStyle`
149
+ - `matchDocumentStyle`
150
150
 
151
151
  ### `suffix` (string)
152
152
 
package/index.js CHANGED
@@ -1098,7 +1098,7 @@ const rule$2 = {
1098
1098
  const MATCH_EXTENSION = 'MATCH_EXTENSION';
1099
1099
  const MATCH_STYLE = 'MATCH_STYLE';
1100
1100
  const ACCEPTED_EXTENSIONS = ['.gql', '.graphql'];
1101
- const CASE_STYLES = ['camelCase', 'PascalCase', 'snake_case', 'UPPER_CASE', 'kebab-case', 'documentStyle'];
1101
+ const CASE_STYLES = ['camelCase', 'PascalCase', 'snake_case', 'UPPER_CASE', 'kebab-case', 'matchDocumentStyle'];
1102
1102
  const schemaOption = {
1103
1103
  oneOf: [{ $ref: '#/definitions/asString' }, { $ref: '#/definitions/asObject' }],
1104
1104
  };
@@ -1274,7 +1274,7 @@ const rule$3 = {
1274
1274
  const expectedExtension = options.fileExtension || fileExtension;
1275
1275
  let expectedFilename;
1276
1276
  if (option.style) {
1277
- expectedFilename = option.style === 'documentStyle' ? docName : convertCase(option.style, docName);
1277
+ expectedFilename = option.style === 'matchDocumentStyle' ? docName : convertCase(option.style, docName);
1278
1278
  }
1279
1279
  else {
1280
1280
  expectedFilename = filename;
@@ -2635,12 +2635,40 @@ const rule$g = {
2635
2635
  const RULE_ID$2 = 'require-description';
2636
2636
  const ALLOWED_KINDS$1 = [
2637
2637
  ...TYPES_KINDS,
2638
+ graphql.Kind.DIRECTIVE_DEFINITION,
2638
2639
  graphql.Kind.FIELD_DEFINITION,
2639
2640
  graphql.Kind.INPUT_VALUE_DEFINITION,
2640
2641
  graphql.Kind.ENUM_VALUE_DEFINITION,
2641
- graphql.Kind.DIRECTIVE_DEFINITION,
2642
2642
  graphql.Kind.OPERATION_DEFINITION,
2643
2643
  ];
2644
+ function getNodeName(node) {
2645
+ const DisplayNodeNameMap = {
2646
+ [graphql.Kind.OBJECT_TYPE_DEFINITION]: 'type',
2647
+ [graphql.Kind.INTERFACE_TYPE_DEFINITION]: 'interface',
2648
+ [graphql.Kind.ENUM_TYPE_DEFINITION]: 'enum',
2649
+ [graphql.Kind.SCALAR_TYPE_DEFINITION]: 'scalar',
2650
+ [graphql.Kind.INPUT_OBJECT_TYPE_DEFINITION]: 'input',
2651
+ [graphql.Kind.UNION_TYPE_DEFINITION]: 'union',
2652
+ [graphql.Kind.DIRECTIVE_DEFINITION]: 'directive',
2653
+ };
2654
+ switch (node.kind) {
2655
+ case graphql.Kind.OBJECT_TYPE_DEFINITION:
2656
+ case graphql.Kind.INTERFACE_TYPE_DEFINITION:
2657
+ case graphql.Kind.ENUM_TYPE_DEFINITION:
2658
+ case graphql.Kind.SCALAR_TYPE_DEFINITION:
2659
+ case graphql.Kind.INPUT_OBJECT_TYPE_DEFINITION:
2660
+ case graphql.Kind.UNION_TYPE_DEFINITION:
2661
+ return `${DisplayNodeNameMap[node.kind]} ${node.name.value}`;
2662
+ case graphql.Kind.DIRECTIVE_DEFINITION:
2663
+ return `${DisplayNodeNameMap[node.kind]} @${node.name.value}`;
2664
+ case graphql.Kind.FIELD_DEFINITION:
2665
+ case graphql.Kind.INPUT_VALUE_DEFINITION:
2666
+ case graphql.Kind.ENUM_VALUE_DEFINITION:
2667
+ return `${node.parent.name.value}.${node.name.value}`;
2668
+ case graphql.Kind.OPERATION_DEFINITION:
2669
+ return node.name ? `${node.operation} ${node.name.value}` : node.operation;
2670
+ }
2671
+ }
2644
2672
  const rule$h = {
2645
2673
  meta: {
2646
2674
  docs: {
@@ -2693,7 +2721,7 @@ const rule$h = {
2693
2721
  },
2694
2722
  type: 'suggestion',
2695
2723
  messages: {
2696
- [RULE_ID$2]: 'Description is required for nodes of type "{{ nodeType }}"',
2724
+ [RULE_ID$2]: 'Description is required for `{{ nodeName }}`.',
2697
2725
  },
2698
2726
  schema: {
2699
2727
  type: 'array',
@@ -2755,7 +2783,7 @@ const rule$h = {
2755
2783
  loc: isOperation ? getLocation(node.loc, node.operation) : getLocation(node.name.loc, node.name.value),
2756
2784
  messageId: RULE_ID$2,
2757
2785
  data: {
2758
- nodeType: node.kind,
2786
+ nodeName: getNodeName(node),
2759
2787
  },
2760
2788
  });
2761
2789
  }
package/index.mjs CHANGED
@@ -1092,7 +1092,7 @@ const rule$2 = {
1092
1092
  const MATCH_EXTENSION = 'MATCH_EXTENSION';
1093
1093
  const MATCH_STYLE = 'MATCH_STYLE';
1094
1094
  const ACCEPTED_EXTENSIONS = ['.gql', '.graphql'];
1095
- const CASE_STYLES = ['camelCase', 'PascalCase', 'snake_case', 'UPPER_CASE', 'kebab-case', 'documentStyle'];
1095
+ const CASE_STYLES = ['camelCase', 'PascalCase', 'snake_case', 'UPPER_CASE', 'kebab-case', 'matchDocumentStyle'];
1096
1096
  const schemaOption = {
1097
1097
  oneOf: [{ $ref: '#/definitions/asString' }, { $ref: '#/definitions/asObject' }],
1098
1098
  };
@@ -1268,7 +1268,7 @@ const rule$3 = {
1268
1268
  const expectedExtension = options.fileExtension || fileExtension;
1269
1269
  let expectedFilename;
1270
1270
  if (option.style) {
1271
- expectedFilename = option.style === 'documentStyle' ? docName : convertCase(option.style, docName);
1271
+ expectedFilename = option.style === 'matchDocumentStyle' ? docName : convertCase(option.style, docName);
1272
1272
  }
1273
1273
  else {
1274
1274
  expectedFilename = filename;
@@ -2629,12 +2629,40 @@ const rule$g = {
2629
2629
  const RULE_ID$2 = 'require-description';
2630
2630
  const ALLOWED_KINDS$1 = [
2631
2631
  ...TYPES_KINDS,
2632
+ Kind.DIRECTIVE_DEFINITION,
2632
2633
  Kind.FIELD_DEFINITION,
2633
2634
  Kind.INPUT_VALUE_DEFINITION,
2634
2635
  Kind.ENUM_VALUE_DEFINITION,
2635
- Kind.DIRECTIVE_DEFINITION,
2636
2636
  Kind.OPERATION_DEFINITION,
2637
2637
  ];
2638
+ function getNodeName(node) {
2639
+ const DisplayNodeNameMap = {
2640
+ [Kind.OBJECT_TYPE_DEFINITION]: 'type',
2641
+ [Kind.INTERFACE_TYPE_DEFINITION]: 'interface',
2642
+ [Kind.ENUM_TYPE_DEFINITION]: 'enum',
2643
+ [Kind.SCALAR_TYPE_DEFINITION]: 'scalar',
2644
+ [Kind.INPUT_OBJECT_TYPE_DEFINITION]: 'input',
2645
+ [Kind.UNION_TYPE_DEFINITION]: 'union',
2646
+ [Kind.DIRECTIVE_DEFINITION]: 'directive',
2647
+ };
2648
+ switch (node.kind) {
2649
+ case Kind.OBJECT_TYPE_DEFINITION:
2650
+ case Kind.INTERFACE_TYPE_DEFINITION:
2651
+ case Kind.ENUM_TYPE_DEFINITION:
2652
+ case Kind.SCALAR_TYPE_DEFINITION:
2653
+ case Kind.INPUT_OBJECT_TYPE_DEFINITION:
2654
+ case Kind.UNION_TYPE_DEFINITION:
2655
+ return `${DisplayNodeNameMap[node.kind]} ${node.name.value}`;
2656
+ case Kind.DIRECTIVE_DEFINITION:
2657
+ return `${DisplayNodeNameMap[node.kind]} @${node.name.value}`;
2658
+ case Kind.FIELD_DEFINITION:
2659
+ case Kind.INPUT_VALUE_DEFINITION:
2660
+ case Kind.ENUM_VALUE_DEFINITION:
2661
+ return `${node.parent.name.value}.${node.name.value}`;
2662
+ case Kind.OPERATION_DEFINITION:
2663
+ return node.name ? `${node.operation} ${node.name.value}` : node.operation;
2664
+ }
2665
+ }
2638
2666
  const rule$h = {
2639
2667
  meta: {
2640
2668
  docs: {
@@ -2687,7 +2715,7 @@ const rule$h = {
2687
2715
  },
2688
2716
  type: 'suggestion',
2689
2717
  messages: {
2690
- [RULE_ID$2]: 'Description is required for nodes of type "{{ nodeType }}"',
2718
+ [RULE_ID$2]: 'Description is required for `{{ nodeName }}`.',
2691
2719
  },
2692
2720
  schema: {
2693
2721
  type: 'array',
@@ -2749,7 +2777,7 @@ const rule$h = {
2749
2777
  loc: isOperation ? getLocation(node.loc, node.operation) : getLocation(node.name.loc, node.name.value),
2750
2778
  messageId: RULE_ID$2,
2751
2779
  data: {
2752
- nodeType: node.kind,
2780
+ nodeName: getNodeName(node),
2753
2781
  },
2754
2782
  });
2755
2783
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@graphql-eslint/eslint-plugin",
3
- "version": "3.8.0-alpha-998ffa8.0",
3
+ "version": "3.8.0-alpha-fb12b01.0",
4
4
  "description": "GraphQL plugin for ESLint",
5
5
  "sideEffects": false,
6
6
  "peerDependencies": {
@@ -1,6 +1,6 @@
1
1
  import { CaseStyle as _CaseStyle } from '../utils';
2
2
  import { GraphQLESLintRule } from '../types';
3
- declare type CaseStyle = _CaseStyle | 'documentStyle';
3
+ declare type CaseStyle = _CaseStyle | 'matchDocumentStyle';
4
4
  declare const ACCEPTED_EXTENSIONS: ['.gql', '.graphql'];
5
5
  declare type PropertySchema = {
6
6
  style?: CaseStyle;
@@ -1,6 +1,6 @@
1
1
  import { Kind } from 'graphql';
2
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, Kind.OPERATION_DEFINITION];
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.DIRECTIVE_DEFINITION, Kind.FIELD_DEFINITION, Kind.INPUT_VALUE_DEFINITION, Kind.ENUM_VALUE_DEFINITION, Kind.OPERATION_DEFINITION];
4
4
  declare type AllowedKind = typeof ALLOWED_KINDS[number];
5
5
  export declare type RequireDescriptionRuleConfig = {
6
6
  types?: boolean;