eslint-plugin-relay
Advanced tools
Comparing version
{ | ||
"name": "eslint-plugin-relay", | ||
"version": "1.1.0", | ||
"version": "1.2.0", | ||
"description": "ESLint plugin for Relay.", | ||
@@ -5,0 +5,0 @@ "main": "eslint-plugin-relay", |
@@ -70,6 +70,11 @@ /** | ||
switch (field) { | ||
case 'pageInfo': | ||
case 'page_info': | ||
case 'hasNextPage': | ||
case 'has_next_page': | ||
case 'hasPreviousPage': | ||
case 'has_previous_page': | ||
case 'startCursor': | ||
case 'start_cursor': | ||
case 'endCursor': | ||
case 'end_cursor': | ||
@@ -134,3 +139,9 @@ return true; | ||
for (const field in queriedFields) { | ||
if (!foundMemberAccesses[field] && !isPageInfoField(field)) { | ||
if ( | ||
!foundMemberAccesses[field] && | ||
!isPageInfoField(field) && | ||
// Do not warn for unused __typename which can be a workaround | ||
// when only interested in existence of an object. | ||
field !== '__typename' | ||
) { | ||
context.report({ | ||
@@ -143,3 +154,5 @@ node: templateLiteral, | ||
'information that file should export a fragment and colocate ' + | ||
'the query for the data with the usage.' | ||
'the query for the data with the usage.\n' + | ||
'If only interested in the existence of a record, __typename ' + | ||
'can be used without this warning.' | ||
}); | ||
@@ -146,0 +159,0 @@ } |
45198
1.05%1227
1.07%