@graphql-eslint/eslint-plugin 2.3.2-alpha-da2ba63.0 → 2.3.2-alpha-53e82da.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 +15 -8
- package/index.mjs +15 -8
- package/package.json +1 -1
package/index.js
CHANGED
@@ -1626,7 +1626,7 @@ const rule$8 = {
|
|
1626
1626
|
});
|
1627
1627
|
if (result.ok === false) {
|
1628
1628
|
context.report({
|
1629
|
-
node,
|
1629
|
+
loc: getLocation(node.loc, node.value),
|
1630
1630
|
message: result.errorMessage,
|
1631
1631
|
data: {
|
1632
1632
|
prefix,
|
@@ -1653,10 +1653,16 @@ const rule$8 = {
|
|
1653
1653
|
return {
|
1654
1654
|
Name: node => {
|
1655
1655
|
if (node.value.startsWith('_') && options.leadingUnderscore === 'forbid') {
|
1656
|
-
context.report({
|
1656
|
+
context.report({
|
1657
|
+
loc: getLocation(node.loc, node.value),
|
1658
|
+
message: 'Leading underscores are not allowed',
|
1659
|
+
});
|
1657
1660
|
}
|
1658
1661
|
if (node.value.endsWith('_') && options.trailingUnderscore === 'forbid') {
|
1659
|
-
context.report({
|
1662
|
+
context.report({
|
1663
|
+
loc: getLocation(node.loc, node.value),
|
1664
|
+
message: 'Trailing underscores are not allowed',
|
1665
|
+
});
|
1660
1666
|
}
|
1661
1667
|
},
|
1662
1668
|
ObjectTypeDefinition: node => {
|
@@ -2162,7 +2168,7 @@ const rule$e = {
|
|
2162
2168
|
const typeName = node.name.value;
|
2163
2169
|
if (!reachableTypes.has(typeName)) {
|
2164
2170
|
context.report({
|
2165
|
-
|
2171
|
+
node,
|
2166
2172
|
messageId: UNREACHABLE_TYPE,
|
2167
2173
|
data: { typeName },
|
2168
2174
|
fix: fixer => fixer.remove(node),
|
@@ -2260,7 +2266,7 @@ const rule$f = {
|
|
2260
2266
|
return;
|
2261
2267
|
}
|
2262
2268
|
context.report({
|
2263
|
-
|
2269
|
+
node,
|
2264
2270
|
messageId: UNUSED_FIELD,
|
2265
2271
|
data: { fieldName },
|
2266
2272
|
fix(fixer) {
|
@@ -3189,15 +3195,16 @@ const rule$m = {
|
|
3189
3195
|
}
|
3190
3196
|
return isValidIdName && isValidIdType;
|
3191
3197
|
});
|
3198
|
+
const typeName = node.name.value;
|
3192
3199
|
// Usually, there should be only one unique identifier field per type.
|
3193
3200
|
// Some clients allow multiple fields to be used. If more people need this,
|
3194
3201
|
// we can extend this rule later.
|
3195
3202
|
if (validIds.length !== 1) {
|
3196
3203
|
context.report({
|
3197
|
-
node,
|
3198
|
-
message:
|
3204
|
+
loc: getLocation(node.name.loc, typeName),
|
3205
|
+
message: `{{ typeName }} must have exactly one non-nullable unique identifier. Accepted name(s): {{ acceptedNamesString }} ; Accepted type(s): {{ acceptedTypesString }}`,
|
3199
3206
|
data: {
|
3200
|
-
|
3207
|
+
typeName,
|
3201
3208
|
acceptedNamesString: options.acceptedIdNames.join(','),
|
3202
3209
|
acceptedTypesString: options.acceptedIdTypes.join(','),
|
3203
3210
|
},
|
package/index.mjs
CHANGED
@@ -1620,7 +1620,7 @@ const rule$8 = {
|
|
1620
1620
|
});
|
1621
1621
|
if (result.ok === false) {
|
1622
1622
|
context.report({
|
1623
|
-
node,
|
1623
|
+
loc: getLocation(node.loc, node.value),
|
1624
1624
|
message: result.errorMessage,
|
1625
1625
|
data: {
|
1626
1626
|
prefix,
|
@@ -1647,10 +1647,16 @@ const rule$8 = {
|
|
1647
1647
|
return {
|
1648
1648
|
Name: node => {
|
1649
1649
|
if (node.value.startsWith('_') && options.leadingUnderscore === 'forbid') {
|
1650
|
-
context.report({
|
1650
|
+
context.report({
|
1651
|
+
loc: getLocation(node.loc, node.value),
|
1652
|
+
message: 'Leading underscores are not allowed',
|
1653
|
+
});
|
1651
1654
|
}
|
1652
1655
|
if (node.value.endsWith('_') && options.trailingUnderscore === 'forbid') {
|
1653
|
-
context.report({
|
1656
|
+
context.report({
|
1657
|
+
loc: getLocation(node.loc, node.value),
|
1658
|
+
message: 'Trailing underscores are not allowed',
|
1659
|
+
});
|
1654
1660
|
}
|
1655
1661
|
},
|
1656
1662
|
ObjectTypeDefinition: node => {
|
@@ -2156,7 +2162,7 @@ const rule$e = {
|
|
2156
2162
|
const typeName = node.name.value;
|
2157
2163
|
if (!reachableTypes.has(typeName)) {
|
2158
2164
|
context.report({
|
2159
|
-
|
2165
|
+
node,
|
2160
2166
|
messageId: UNREACHABLE_TYPE,
|
2161
2167
|
data: { typeName },
|
2162
2168
|
fix: fixer => fixer.remove(node),
|
@@ -2254,7 +2260,7 @@ const rule$f = {
|
|
2254
2260
|
return;
|
2255
2261
|
}
|
2256
2262
|
context.report({
|
2257
|
-
|
2263
|
+
node,
|
2258
2264
|
messageId: UNUSED_FIELD,
|
2259
2265
|
data: { fieldName },
|
2260
2266
|
fix(fixer) {
|
@@ -3183,15 +3189,16 @@ const rule$m = {
|
|
3183
3189
|
}
|
3184
3190
|
return isValidIdName && isValidIdType;
|
3185
3191
|
});
|
3192
|
+
const typeName = node.name.value;
|
3186
3193
|
// Usually, there should be only one unique identifier field per type.
|
3187
3194
|
// Some clients allow multiple fields to be used. If more people need this,
|
3188
3195
|
// we can extend this rule later.
|
3189
3196
|
if (validIds.length !== 1) {
|
3190
3197
|
context.report({
|
3191
|
-
node,
|
3192
|
-
message:
|
3198
|
+
loc: getLocation(node.name.loc, typeName),
|
3199
|
+
message: `{{ typeName }} must have exactly one non-nullable unique identifier. Accepted name(s): {{ acceptedNamesString }} ; Accepted type(s): {{ acceptedTypesString }}`,
|
3193
3200
|
data: {
|
3194
|
-
|
3201
|
+
typeName,
|
3195
3202
|
acceptedNamesString: options.acceptedIdNames.join(','),
|
3196
3203
|
acceptedTypesString: options.acceptedIdTypes.join(','),
|
3197
3204
|
},
|
package/package.json
CHANGED