@graphql-eslint/eslint-plugin 2.3.0-alpha-4c161e5.0 → 2.3.1
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/README.md +1 -1
- package/docs/README.md +1 -1
- package/docs/custom-rules.md +2 -2
- package/docs/rules/alphabetize.md +6 -1
- package/docs/rules/avoid-duplicate-fields.md +6 -1
- package/docs/rules/avoid-operation-name-prefix.md +5 -1
- package/docs/rules/avoid-scalar-result-type-on-mutation.md +6 -1
- package/docs/rules/avoid-typename-prefix.md +6 -1
- package/docs/rules/description-style.md +6 -1
- package/docs/rules/executable-definitions.md +6 -1
- package/docs/rules/fields-on-correct-type.md +6 -1
- package/docs/rules/fragments-on-composite-type.md +6 -1
- package/docs/rules/input-name.md +6 -1
- package/docs/rules/known-argument-names.md +6 -1
- package/docs/rules/known-directives.md +6 -1
- package/docs/rules/known-fragment-names.md +6 -1
- package/docs/rules/known-type-names.md +6 -1
- package/docs/rules/lone-anonymous-operation.md +6 -1
- package/docs/rules/lone-schema-definition.md +6 -1
- package/docs/rules/match-document-filename.md +6 -1
- package/docs/rules/naming-convention.md +6 -1
- package/docs/rules/no-anonymous-operations.md +6 -1
- package/docs/rules/no-case-insensitive-enum-values-duplicates.md +5 -1
- package/docs/rules/no-deprecated.md +6 -1
- package/docs/rules/no-fragment-cycles.md +6 -1
- package/docs/rules/no-hashtag-description.md +6 -1
- package/docs/rules/no-operation-name-suffix.md +5 -1
- package/docs/rules/no-undefined-variables.md +6 -1
- package/docs/rules/no-unreachable-types.md +6 -1
- package/docs/rules/no-unused-fields.md +6 -1
- package/docs/rules/no-unused-fragments.md +6 -1
- package/docs/rules/no-unused-variables.md +6 -1
- package/docs/rules/one-field-subscriptions.md +6 -1
- package/docs/rules/overlapping-fields-can-be-merged.md +6 -1
- package/docs/rules/possible-fragment-spread.md +6 -1
- package/docs/rules/possible-type-extension.md +6 -1
- package/docs/rules/provided-required-arguments.md +6 -1
- package/docs/rules/require-deprecation-date.md +6 -1
- package/docs/rules/require-deprecation-reason.md +6 -1
- package/docs/rules/require-description.md +6 -1
- package/docs/rules/require-field-of-type-query-in-mutation-result.md +6 -1
- package/docs/rules/require-id-when-available.md +6 -1
- package/docs/rules/scalar-leafs.md +6 -1
- package/docs/rules/selection-set-depth.md +6 -1
- package/docs/rules/strict-id-in-types.md +6 -1
- package/docs/rules/unique-argument-names.md +6 -1
- package/docs/rules/unique-directive-names-per-location.md +6 -1
- package/docs/rules/unique-directive-names.md +6 -1
- package/docs/rules/unique-enum-value-names.md +6 -1
- package/docs/rules/unique-field-definition-names.md +6 -1
- package/docs/rules/unique-fragment-name.md +6 -1
- package/docs/rules/unique-input-field-names.md +6 -1
- package/docs/rules/unique-operation-name.md +6 -1
- package/docs/rules/unique-operation-types.md +6 -1
- package/docs/rules/unique-type-names.md +6 -1
- package/docs/rules/unique-variable-names.md +6 -1
- package/docs/rules/value-literals-of-correct-type.md +6 -1
- package/docs/rules/variables-are-input-types.md +6 -1
- package/docs/rules/variables-in-allowed-position.md +6 -1
- package/estree-parser/estree-ast.d.ts +2 -2
- package/index.js +77 -35
- package/index.mjs +77 -35
- package/package.json +1 -1
- package/types.d.ts +2 -0
@@ -9,4 +9,9 @@
|
|
9
9
|
|
10
10
|
A GraphQL input object value is only valid if all supplied fields are uniquely named.
|
11
11
|
|
12
|
-
> This rule is a wrapper around a `graphql-js` validation function. [You can find its source code here](https://github.com/graphql/graphql-js/blob/main/src/validation/rules/UniqueInputFieldNamesRule.ts).
|
12
|
+
> This rule is a wrapper around a `graphql-js` validation function. [You can find its source code here](https://github.com/graphql/graphql-js/blob/main/src/validation/rules/UniqueInputFieldNamesRule.ts).
|
13
|
+
|
14
|
+
## Resources
|
15
|
+
|
16
|
+
- [Rule source](https://github.com/graphql/graphql-js/blob/main/src/validation/rules/UniqueInputFieldNamesRule.ts)
|
17
|
+
- [Test source](https://github.com/graphql/graphql-js/tree/main/src/validation/__tests__/UniqueInputFieldNamesRule-test.ts)
|
@@ -9,4 +9,9 @@
|
|
9
9
|
|
10
10
|
A GraphQL document is only valid if it has only one type per operation.
|
11
11
|
|
12
|
-
> This rule is a wrapper around a `graphql-js` validation function. [You can find its source code here](https://github.com/graphql/graphql-js/blob/main/src/validation/rules/UniqueOperationTypesRule.ts).
|
12
|
+
> This rule is a wrapper around a `graphql-js` validation function. [You can find its source code here](https://github.com/graphql/graphql-js/blob/main/src/validation/rules/UniqueOperationTypesRule.ts).
|
13
|
+
|
14
|
+
## Resources
|
15
|
+
|
16
|
+
- [Rule source](https://github.com/graphql/graphql-js/blob/main/src/validation/rules/UniqueOperationTypesRule.ts)
|
17
|
+
- [Test source](https://github.com/graphql/graphql-js/tree/main/src/validation/__tests__/UniqueOperationTypesRule-test.ts)
|
@@ -9,4 +9,9 @@
|
|
9
9
|
|
10
10
|
A GraphQL document is only valid if all defined types have unique names.
|
11
11
|
|
12
|
-
> This rule is a wrapper around a `graphql-js` validation function. [You can find its source code here](https://github.com/graphql/graphql-js/blob/main/src/validation/rules/UniqueTypeNamesRule.ts).
|
12
|
+
> This rule is a wrapper around a `graphql-js` validation function. [You can find its source code here](https://github.com/graphql/graphql-js/blob/main/src/validation/rules/UniqueTypeNamesRule.ts).
|
13
|
+
|
14
|
+
## Resources
|
15
|
+
|
16
|
+
- [Rule source](https://github.com/graphql/graphql-js/blob/main/src/validation/rules/UniqueTypeNamesRule.ts)
|
17
|
+
- [Test source](https://github.com/graphql/graphql-js/tree/main/src/validation/__tests__/UniqueTypeNamesRule-test.ts)
|
@@ -9,4 +9,9 @@
|
|
9
9
|
|
10
10
|
A GraphQL operation is only valid if all its variables are uniquely named.
|
11
11
|
|
12
|
-
> This rule is a wrapper around a `graphql-js` validation function. [You can find its source code here](https://github.com/graphql/graphql-js/blob/main/src/validation/rules/UniqueVariableNamesRule.ts).
|
12
|
+
> This rule is a wrapper around a `graphql-js` validation function. [You can find its source code here](https://github.com/graphql/graphql-js/blob/main/src/validation/rules/UniqueVariableNamesRule.ts).
|
13
|
+
|
14
|
+
## Resources
|
15
|
+
|
16
|
+
- [Rule source](https://github.com/graphql/graphql-js/blob/main/src/validation/rules/UniqueVariableNamesRule.ts)
|
17
|
+
- [Test source](https://github.com/graphql/graphql-js/tree/main/src/validation/__tests__/UniqueVariableNamesRule-test.ts)
|
@@ -9,4 +9,9 @@
|
|
9
9
|
|
10
10
|
A GraphQL document is only valid if all value literals are of the type expected at their position.
|
11
11
|
|
12
|
-
> This rule is a wrapper around a `graphql-js` validation function. [You can find its source code here](https://github.com/graphql/graphql-js/blob/main/src/validation/rules/ValuesOfCorrectTypeRule.ts).
|
12
|
+
> This rule is a wrapper around a `graphql-js` validation function. [You can find its source code here](https://github.com/graphql/graphql-js/blob/main/src/validation/rules/ValuesOfCorrectTypeRule.ts).
|
13
|
+
|
14
|
+
## Resources
|
15
|
+
|
16
|
+
- [Rule source](https://github.com/graphql/graphql-js/blob/main/src/validation/rules/ValuesOfCorrectTypeRule.ts)
|
17
|
+
- [Test source](https://github.com/graphql/graphql-js/tree/main/src/validation/__tests__/ValuesOfCorrectTypeRule-test.ts)
|
@@ -9,4 +9,9 @@
|
|
9
9
|
|
10
10
|
A GraphQL operation is only valid if all the variables it defines are of input types (scalar, enum, or input object).
|
11
11
|
|
12
|
-
> This rule is a wrapper around a `graphql-js` validation function. [You can find its source code here](https://github.com/graphql/graphql-js/blob/main/src/validation/rules/VariablesAreInputTypesRule.ts).
|
12
|
+
> This rule is a wrapper around a `graphql-js` validation function. [You can find its source code here](https://github.com/graphql/graphql-js/blob/main/src/validation/rules/VariablesAreInputTypesRule.ts).
|
13
|
+
|
14
|
+
## Resources
|
15
|
+
|
16
|
+
- [Rule source](https://github.com/graphql/graphql-js/blob/main/src/validation/rules/VariablesAreInputTypesRule.ts)
|
17
|
+
- [Test source](https://github.com/graphql/graphql-js/tree/main/src/validation/__tests__/VariablesAreInputTypesRule-test.ts)
|
@@ -9,4 +9,9 @@
|
|
9
9
|
|
10
10
|
Variables passed to field arguments conform to type.
|
11
11
|
|
12
|
-
> This rule is a wrapper around a `graphql-js` validation function. [You can find its source code here](https://github.com/graphql/graphql-js/blob/main/src/validation/rules/VariablesInAllowedPositionRule.ts).
|
12
|
+
> This rule is a wrapper around a `graphql-js` validation function. [You can find its source code here](https://github.com/graphql/graphql-js/blob/main/src/validation/rules/VariablesInAllowedPositionRule.ts).
|
13
|
+
|
14
|
+
## Resources
|
15
|
+
|
16
|
+
- [Rule source](https://github.com/graphql/graphql-js/blob/main/src/validation/rules/VariablesInAllowedPositionRule.ts)
|
17
|
+
- [Test source](https://github.com/graphql/graphql-js/tree/main/src/validation/__tests__/VariablesInAllowedPositionRule-test.ts)
|
@@ -5,7 +5,7 @@ export declare type SafeGraphQLType<T extends ASTNode | ValueNode> = Omit<T exte
|
|
5
5
|
} ? Omit<T, 'type'> & {
|
6
6
|
readonly gqlType: TypeNode;
|
7
7
|
} : T, 'loc'>;
|
8
|
-
export declare type SingleESTreeNode<T
|
8
|
+
export declare type SingleESTreeNode<T, WithTypeInfo extends boolean> = T extends ASTNode | ValueNode ? SafeGraphQLType<T> & Pick<BaseNode, 'leadingComments' | 'loc' | 'range'> & {
|
9
9
|
type: T['kind'];
|
10
10
|
gqlLocation: Location;
|
11
11
|
} & (WithTypeInfo extends true ? {
|
@@ -21,7 +21,7 @@ export declare type SingleESTreeNode<T extends any, WithTypeInfo extends boolean
|
|
21
21
|
gqlType?: ReturnType<TypeInfo['getType']>;
|
22
22
|
};
|
23
23
|
} : {}) : T;
|
24
|
-
export declare type GraphQLESTreeNode<T
|
24
|
+
export declare type GraphQLESTreeNode<T, WithTypeInfo extends boolean = false> = T extends ASTNode | ValueNode ? {
|
25
25
|
rawNode: () => T;
|
26
26
|
} & {
|
27
27
|
[K in keyof SingleESTreeNode<T, WithTypeInfo>]: SingleESTreeNode<T, WithTypeInfo>[K] extends ReadonlyArray<infer Nested> ? GraphQLESTreeNode<Nested, WithTypeInfo>[] : SingleESTreeNode<T, WithTypeInfo>[K] extends ASTNode ? GraphQLESTreeNode<SingleESTreeNode<T, WithTypeInfo>[K], WithTypeInfo> : SingleESTreeNode<T, WithTypeInfo>[K];
|
package/index.js
CHANGED
@@ -292,6 +292,7 @@ const validationToRule = (name, ruleName, docs, getDocumentNode) => {
|
|
292
292
|
meta: {
|
293
293
|
docs: {
|
294
294
|
...docs,
|
295
|
+
graphQLJSRuleName: ruleName,
|
295
296
|
category: 'Validation',
|
296
297
|
recommended: true,
|
297
298
|
requiresSchema,
|
@@ -320,6 +321,14 @@ const validationToRule = (name, ruleName, docs, getDocumentNode) => {
|
|
320
321
|
},
|
321
322
|
};
|
322
323
|
};
|
324
|
+
const importFiles = (context) => {
|
325
|
+
const code = context.getSourceCode().text;
|
326
|
+
if (!isGraphQLImportFile(code)) {
|
327
|
+
return null;
|
328
|
+
}
|
329
|
+
// Import documents because file contains '#import' comments
|
330
|
+
return _import.processImport(context.getFilename());
|
331
|
+
};
|
323
332
|
const GRAPHQL_JS_VALIDATIONS = Object.assign({}, validationToRule('executable-definitions', 'ExecutableDefinitions', {
|
324
333
|
description: `A GraphQL document is only valid for execution if all definitions are either operation or fragment definitions.`,
|
325
334
|
}), validationToRule('fields-on-correct-type', 'FieldsOnCorrectType', {
|
@@ -396,14 +405,7 @@ const GRAPHQL_JS_VALIDATIONS = Object.assign({}, validationToRule('executable-de
|
|
396
405
|
\``,
|
397
406
|
},
|
398
407
|
],
|
399
|
-
},
|
400
|
-
const code = context.getSourceCode().text;
|
401
|
-
if (!isGraphQLImportFile(code)) {
|
402
|
-
return null;
|
403
|
-
}
|
404
|
-
// Import documents because file contains '#import' comments
|
405
|
-
return _import.processImport(context.getFilename());
|
406
|
-
}), validationToRule('known-type-names', 'KnownTypeNames', {
|
408
|
+
}, importFiles), validationToRule('known-type-names', 'KnownTypeNames', {
|
407
409
|
description: `A GraphQL document is only valid if referenced types (specifically variable definitions and fragment conditions) are defined by the type schema.`,
|
408
410
|
}), validationToRule('lone-anonymous-operation', 'LoneAnonymousOperation', {
|
409
411
|
description: `A GraphQL document is only valid if when it contains an anonymous operation (the query short-hand) that it contains only that one operation definition.`,
|
@@ -414,7 +416,7 @@ const GRAPHQL_JS_VALIDATIONS = Object.assign({}, validationToRule('executable-de
|
|
414
416
|
description: `A GraphQL fragment is only valid when it does not have cycles in fragments usage.`,
|
415
417
|
}), validationToRule('no-undefined-variables', 'NoUndefinedVariables', {
|
416
418
|
description: `A GraphQL operation is only valid if all variables encountered, both directly and via fragment spreads, are defined by that operation.`,
|
417
|
-
}), validationToRule('no-unused-fragments', 'NoUnusedFragments', {
|
419
|
+
}, importFiles), validationToRule('no-unused-fragments', 'NoUnusedFragments', {
|
418
420
|
description: `A GraphQL document is only valid if all fragment definitions are spread within operations, or spread within other fragments spread within operations.`,
|
419
421
|
requiresSiblings: true,
|
420
422
|
}, context => {
|
@@ -445,7 +447,7 @@ const GRAPHQL_JS_VALIDATIONS = Object.assign({}, validationToRule('executable-de
|
|
445
447
|
return getParentNode(context.getFilename());
|
446
448
|
}), validationToRule('no-unused-variables', 'NoUnusedVariables', {
|
447
449
|
description: `A GraphQL operation is only valid if all variables defined by an operation are used, either directly or within a spread fragment.`,
|
448
|
-
}), validationToRule('overlapping-fields-can-be-merged', 'OverlappingFieldsCanBeMerged', {
|
450
|
+
}, importFiles), validationToRule('overlapping-fields-can-be-merged', 'OverlappingFieldsCanBeMerged', {
|
449
451
|
description: `A selection set is only valid if all fields (including spreading any fragments) either correspond to distinct response names or can be merged without ambiguity.`,
|
450
452
|
}), validationToRule('possible-fragment-spread', 'PossibleFragmentSpreads', {
|
451
453
|
description: `A fragment spread is only valid if the type condition could ever possibly be true: if there is a non-empty intersection of the possible parent types, and possible types which pass the type condition.`,
|
@@ -655,10 +657,7 @@ const rule = {
|
|
655
657
|
line: start.line,
|
656
658
|
column: start.column - (isVariableNode ? 2 : 1),
|
657
659
|
},
|
658
|
-
end
|
659
|
-
line: end.line,
|
660
|
-
column: end.column,
|
661
|
-
},
|
660
|
+
end,
|
662
661
|
},
|
663
662
|
messageId: ALPHABETIZE,
|
664
663
|
data: isVariableNode
|
@@ -789,6 +788,7 @@ const rule$1 = {
|
|
789
788
|
messages: {
|
790
789
|
[AVOID_DUPLICATE_FIELDS]: `{{ type }} "{{ fieldName }}" defined multiple times.`,
|
791
790
|
},
|
791
|
+
schema: [],
|
792
792
|
},
|
793
793
|
create(context) {
|
794
794
|
return {
|
@@ -908,15 +908,16 @@ const rule$2 = {
|
|
908
908
|
const testKeyword = caseSensitive ? keyword : keyword.toLowerCase();
|
909
909
|
const testName = caseSensitive ? node.name.value : node.name.value.toLowerCase();
|
910
910
|
if (testName.startsWith(testKeyword)) {
|
911
|
+
const { start } = node.name.loc;
|
911
912
|
context.report({
|
912
913
|
loc: {
|
913
914
|
start: {
|
914
|
-
line:
|
915
|
-
column:
|
915
|
+
line: start.line,
|
916
|
+
column: start.column - 1,
|
916
917
|
},
|
917
918
|
end: {
|
918
|
-
line:
|
919
|
-
column:
|
919
|
+
line: start.line,
|
920
|
+
column: start.column - 1 + testKeyword.length,
|
920
921
|
},
|
921
922
|
},
|
922
923
|
data: {
|
@@ -959,6 +960,7 @@ const rule$3 = {
|
|
959
960
|
},
|
960
961
|
],
|
961
962
|
},
|
963
|
+
schema: [],
|
962
964
|
},
|
963
965
|
create(context) {
|
964
966
|
const schema = requireGraphQLSchemaFromContext('avoid-scalar-result-type-on-mutation', context);
|
@@ -1014,22 +1016,33 @@ const rule$4 = {
|
|
1014
1016
|
messages: {
|
1015
1017
|
[AVOID_TYPENAME_PREFIX]: `Field "{{ fieldName }}" starts with the name of the parent type "{{ typeName }}"`,
|
1016
1018
|
},
|
1019
|
+
schema: [],
|
1017
1020
|
},
|
1018
1021
|
create(context) {
|
1019
1022
|
return {
|
1020
1023
|
'ObjectTypeDefinition, ObjectTypeExtension, InterfaceTypeDefinition, InterfaceTypeExtension'(node) {
|
1021
1024
|
const typeName = node.name.value;
|
1022
|
-
const lowerTypeName =
|
1025
|
+
const lowerTypeName = typeName.toLowerCase();
|
1023
1026
|
for (const field of node.fields) {
|
1024
|
-
const fieldName = field.name.value
|
1025
|
-
if (fieldName
|
1027
|
+
const fieldName = field.name.value;
|
1028
|
+
if (fieldName.toLowerCase().startsWith(lowerTypeName)) {
|
1029
|
+
const { start } = field.loc;
|
1026
1030
|
context.report({
|
1027
|
-
node: field.name,
|
1028
1031
|
data: {
|
1029
1032
|
fieldName,
|
1030
1033
|
typeName,
|
1031
1034
|
},
|
1032
1035
|
messageId: AVOID_TYPENAME_PREFIX,
|
1036
|
+
loc: {
|
1037
|
+
start: {
|
1038
|
+
line: start.line,
|
1039
|
+
column: start.column - 1,
|
1040
|
+
},
|
1041
|
+
end: {
|
1042
|
+
line: start.line,
|
1043
|
+
column: start.column - 1 + lowerTypeName.length,
|
1044
|
+
},
|
1045
|
+
},
|
1033
1046
|
});
|
1034
1047
|
}
|
1035
1048
|
}
|
@@ -1727,20 +1740,24 @@ const rule$9 = {
|
|
1727
1740
|
messages: {
|
1728
1741
|
[NO_ANONYMOUS_OPERATIONS]: `Anonymous GraphQL operations are forbidden. Please make sure to name your {{ operation }}!`,
|
1729
1742
|
},
|
1743
|
+
schema: [],
|
1730
1744
|
},
|
1731
1745
|
create(context) {
|
1732
1746
|
return {
|
1733
1747
|
OperationDefinition(node) {
|
1734
|
-
|
1748
|
+
var _a;
|
1749
|
+
const isAnonymous = (((_a = node.name) === null || _a === void 0 ? void 0 : _a.value) || '').length === 0;
|
1750
|
+
if (isAnonymous) {
|
1751
|
+
const { start } = node.loc;
|
1735
1752
|
context.report({
|
1736
1753
|
loc: {
|
1737
1754
|
start: {
|
1738
|
-
column:
|
1739
|
-
line:
|
1755
|
+
column: start.column - 1,
|
1756
|
+
line: start.line,
|
1740
1757
|
},
|
1741
1758
|
end: {
|
1742
|
-
column:
|
1743
|
-
line:
|
1759
|
+
column: start.column - 1 + node.operation.length,
|
1760
|
+
line: start.line,
|
1744
1761
|
},
|
1745
1762
|
},
|
1746
1763
|
data: {
|
@@ -1790,6 +1807,7 @@ const rule$a = {
|
|
1790
1807
|
messages: {
|
1791
1808
|
[ERROR_MESSAGE_ID]: `Case-insensitive enum values duplicates are not allowed! Found: "{{ found }}"`,
|
1792
1809
|
},
|
1810
|
+
schema: [],
|
1793
1811
|
},
|
1794
1812
|
create(context) {
|
1795
1813
|
return {
|
@@ -1884,6 +1902,7 @@ const rule$b = {
|
|
1884
1902
|
messages: {
|
1885
1903
|
[NO_DEPRECATED]: `This {{ type }} is marked as deprecated in your GraphQL schema {{ reason }}`,
|
1886
1904
|
},
|
1905
|
+
schema: [],
|
1887
1906
|
},
|
1888
1907
|
create(context) {
|
1889
1908
|
return {
|
@@ -1970,6 +1989,7 @@ const rule$c = {
|
|
1970
1989
|
],
|
1971
1990
|
},
|
1972
1991
|
type: 'suggestion',
|
1992
|
+
schema: [],
|
1973
1993
|
},
|
1974
1994
|
create(context) {
|
1975
1995
|
return {
|
@@ -2030,15 +2050,28 @@ const rule$d = {
|
|
2030
2050
|
messages: {
|
2031
2051
|
[NO_OPERATION_NAME_SUFFIX]: `Unnecessary "{{ invalidSuffix }}" suffix in your operation name!`,
|
2032
2052
|
},
|
2053
|
+
schema: [],
|
2033
2054
|
},
|
2034
2055
|
create(context) {
|
2035
2056
|
return {
|
2036
2057
|
'OperationDefinition, FragmentDefinition'(node) {
|
2037
|
-
|
2038
|
-
|
2039
|
-
|
2058
|
+
var _a;
|
2059
|
+
const name = ((_a = node.name) === null || _a === void 0 ? void 0 : _a.value) || '';
|
2060
|
+
if (name.length > 0) {
|
2061
|
+
const invalidSuffix = 'operation' in node ? node.operation : 'fragment';
|
2062
|
+
if (name.toLowerCase().endsWith(invalidSuffix)) {
|
2063
|
+
const { start, end } = node.name.loc;
|
2040
2064
|
context.report({
|
2041
|
-
|
2065
|
+
loc: {
|
2066
|
+
start: {
|
2067
|
+
column: start.column - 1 + name.length - invalidSuffix.length,
|
2068
|
+
line: start.line,
|
2069
|
+
},
|
2070
|
+
end: {
|
2071
|
+
column: end.column - 1 + name.length,
|
2072
|
+
line: end.line,
|
2073
|
+
},
|
2074
|
+
},
|
2042
2075
|
data: {
|
2043
2076
|
invalidSuffix,
|
2044
2077
|
},
|
@@ -2095,6 +2128,7 @@ const rule$e = {
|
|
2095
2128
|
},
|
2096
2129
|
fixable: 'code',
|
2097
2130
|
type: 'suggestion',
|
2131
|
+
schema: [],
|
2098
2132
|
},
|
2099
2133
|
create(context) {
|
2100
2134
|
const reachableTypes = requireReachableTypesFromContext(RULE_NAME, context);
|
@@ -2186,6 +2220,7 @@ const rule$f = {
|
|
2186
2220
|
},
|
2187
2221
|
fixable: 'code',
|
2188
2222
|
type: 'suggestion',
|
2223
|
+
schema: [],
|
2189
2224
|
},
|
2190
2225
|
create(context) {
|
2191
2226
|
const usedFields = requireUsedFieldsFromContext(RULE_NAME$1, context);
|
@@ -2451,6 +2486,7 @@ const rule$h = {
|
|
2451
2486
|
],
|
2452
2487
|
},
|
2453
2488
|
type: 'suggestion',
|
2489
|
+
schema: [],
|
2454
2490
|
},
|
2455
2491
|
create(context) {
|
2456
2492
|
return {
|
@@ -2487,15 +2523,18 @@ const DESCRIBABLE_NODES = [
|
|
2487
2523
|
function verifyRule(context, node) {
|
2488
2524
|
if (node) {
|
2489
2525
|
if (!node.description || !node.description.value || node.description.value.trim().length === 0) {
|
2526
|
+
const { start, end } = ('name' in node ? node.name : node).loc;
|
2490
2527
|
context.report({
|
2491
2528
|
loc: {
|
2492
2529
|
start: {
|
2493
|
-
line:
|
2494
|
-
column:
|
2530
|
+
line: start.line,
|
2531
|
+
column: start.column - 1,
|
2495
2532
|
},
|
2496
2533
|
end: {
|
2497
|
-
line:
|
2498
|
-
column:
|
2534
|
+
line: end.line,
|
2535
|
+
column:
|
2536
|
+
// node.name don't exist on SchemaDefinition
|
2537
|
+
'name' in node ? end.column - 1 + node.name.value.length : end.column,
|
2499
2538
|
},
|
2500
2539
|
},
|
2501
2540
|
messageId: REQUIRE_DESCRIPTION_ERROR,
|
@@ -2609,6 +2648,7 @@ const rule$j = {
|
|
2609
2648
|
},
|
2610
2649
|
],
|
2611
2650
|
},
|
2651
|
+
schema: [],
|
2612
2652
|
},
|
2613
2653
|
create(context) {
|
2614
2654
|
const schema = requireGraphQLSchemaFromContext(RULE_NAME$2, context);
|
@@ -3228,6 +3268,7 @@ const rule$n = {
|
|
3228
3268
|
messages: {
|
3229
3269
|
[UNIQUE_FRAGMENT_NAME]: 'Fragment named "{{ documentName }}" already defined in:\n{{ summary }}',
|
3230
3270
|
},
|
3271
|
+
schema: [],
|
3231
3272
|
},
|
3232
3273
|
create(context) {
|
3233
3274
|
return {
|
@@ -3290,6 +3331,7 @@ const rule$o = {
|
|
3290
3331
|
messages: {
|
3291
3332
|
[UNIQUE_OPERATION_NAME]: 'Operation named "{{ documentName }}" already defined in:\n{{ summary }}',
|
3292
3333
|
},
|
3334
|
+
schema: [],
|
3293
3335
|
},
|
3294
3336
|
create(context) {
|
3295
3337
|
return {
|