@graphql-eslint/eslint-plugin 2.3.2-alpha-2901045.0 → 2.3.2-alpha-5f59ef8.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/index.js +19 -8
- package/index.mjs +19 -8
- package/package.json +1 -1
package/index.js
CHANGED
@@ -612,7 +612,7 @@ const rule = {
|
|
612
612
|
],
|
613
613
|
},
|
614
614
|
messages: {
|
615
|
-
[ALPHABETIZE]: '"{{ currName }}" should be before "{{ prevName }}"',
|
615
|
+
[ALPHABETIZE]: '"{{ currName }}" should be before "{{ prevName }}".',
|
616
616
|
},
|
617
617
|
schema: {
|
618
618
|
type: 'array',
|
@@ -669,9 +669,16 @@ const rule = {
|
|
669
669
|
for (const node of nodes) {
|
670
670
|
const currName = node.name.value;
|
671
671
|
if (prevName && prevName > currName) {
|
672
|
+
const { start, end } = node.name.loc;
|
672
673
|
const isVariableNode = node.kind === graphql.Kind.VARIABLE;
|
673
674
|
context.report({
|
674
|
-
loc:
|
675
|
+
loc: {
|
676
|
+
start: {
|
677
|
+
line: start.line,
|
678
|
+
column: start.column - (isVariableNode ? 2 : 1),
|
679
|
+
},
|
680
|
+
end,
|
681
|
+
},
|
675
682
|
messageId: ALPHABETIZE,
|
676
683
|
data: isVariableNode
|
677
684
|
? {
|
@@ -981,16 +988,20 @@ const rule$3 = {
|
|
981
988
|
if (!mutationType) {
|
982
989
|
return {};
|
983
990
|
}
|
984
|
-
const selector =
|
991
|
+
const selector = [
|
992
|
+
`:matches(${graphql.Kind.OBJECT_TYPE_DEFINITION}, ${graphql.Kind.OBJECT_TYPE_EXTENSION})[name.value=${mutationType.name}]`,
|
993
|
+
'>',
|
994
|
+
graphql.Kind.FIELD_DEFINITION,
|
995
|
+
graphql.Kind.NAMED_TYPE,
|
996
|
+
].join(' ');
|
985
997
|
return {
|
986
998
|
[selector](node) {
|
987
|
-
const
|
988
|
-
const typeName = getTypeName(rawNode);
|
999
|
+
const typeName = node.name.value;
|
989
1000
|
const graphQLType = schema.getType(typeName);
|
990
1001
|
if (graphql.isScalarType(graphQLType)) {
|
991
1002
|
context.report({
|
992
|
-
node,
|
993
|
-
message: `Unexpected scalar result type "${typeName}"
|
1003
|
+
loc: getLocation(node.loc, typeName),
|
1004
|
+
message: `Unexpected scalar result type "${typeName}"`,
|
994
1005
|
});
|
995
1006
|
}
|
996
1007
|
},
|
@@ -1115,7 +1126,7 @@ const rule$5 = {
|
|
1115
1126
|
'[description.type="StringValue"]': node => {
|
1116
1127
|
if (node.description.block !== (style === 'block')) {
|
1117
1128
|
context.report({
|
1118
|
-
|
1129
|
+
loc: getLocation(node.description.loc),
|
1119
1130
|
message: `Unexpected ${wrongDescriptionType} description`,
|
1120
1131
|
});
|
1121
1132
|
}
|
package/index.mjs
CHANGED
@@ -606,7 +606,7 @@ const rule = {
|
|
606
606
|
],
|
607
607
|
},
|
608
608
|
messages: {
|
609
|
-
[ALPHABETIZE]: '"{{ currName }}" should be before "{{ prevName }}"',
|
609
|
+
[ALPHABETIZE]: '"{{ currName }}" should be before "{{ prevName }}".',
|
610
610
|
},
|
611
611
|
schema: {
|
612
612
|
type: 'array',
|
@@ -663,9 +663,16 @@ const rule = {
|
|
663
663
|
for (const node of nodes) {
|
664
664
|
const currName = node.name.value;
|
665
665
|
if (prevName && prevName > currName) {
|
666
|
+
const { start, end } = node.name.loc;
|
666
667
|
const isVariableNode = node.kind === Kind.VARIABLE;
|
667
668
|
context.report({
|
668
|
-
loc:
|
669
|
+
loc: {
|
670
|
+
start: {
|
671
|
+
line: start.line,
|
672
|
+
column: start.column - (isVariableNode ? 2 : 1),
|
673
|
+
},
|
674
|
+
end,
|
675
|
+
},
|
669
676
|
messageId: ALPHABETIZE,
|
670
677
|
data: isVariableNode
|
671
678
|
? {
|
@@ -975,16 +982,20 @@ const rule$3 = {
|
|
975
982
|
if (!mutationType) {
|
976
983
|
return {};
|
977
984
|
}
|
978
|
-
const selector =
|
985
|
+
const selector = [
|
986
|
+
`:matches(${Kind.OBJECT_TYPE_DEFINITION}, ${Kind.OBJECT_TYPE_EXTENSION})[name.value=${mutationType.name}]`,
|
987
|
+
'>',
|
988
|
+
Kind.FIELD_DEFINITION,
|
989
|
+
Kind.NAMED_TYPE,
|
990
|
+
].join(' ');
|
979
991
|
return {
|
980
992
|
[selector](node) {
|
981
|
-
const
|
982
|
-
const typeName = getTypeName(rawNode);
|
993
|
+
const typeName = node.name.value;
|
983
994
|
const graphQLType = schema.getType(typeName);
|
984
995
|
if (isScalarType(graphQLType)) {
|
985
996
|
context.report({
|
986
|
-
node,
|
987
|
-
message: `Unexpected scalar result type "${typeName}"
|
997
|
+
loc: getLocation(node.loc, typeName),
|
998
|
+
message: `Unexpected scalar result type "${typeName}"`,
|
988
999
|
});
|
989
1000
|
}
|
990
1001
|
},
|
@@ -1109,7 +1120,7 @@ const rule$5 = {
|
|
1109
1120
|
'[description.type="StringValue"]': node => {
|
1110
1121
|
if (node.description.block !== (style === 'block')) {
|
1111
1122
|
context.report({
|
1112
|
-
|
1123
|
+
loc: getLocation(node.description.loc),
|
1113
1124
|
message: `Unexpected ${wrongDescriptionType} description`,
|
1114
1125
|
});
|
1115
1126
|
}
|
package/package.json
CHANGED