🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more
Socket
DemoInstallSign in
Socket

eslint-plugin-relay

Package Overview
Dependencies
Maintainers
4
Versions
60
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

eslint-plugin-relay - npm Package Compare versions

Comparing version

to
0.0.26

2

package.json
{
"name": "eslint-plugin-relay",
"version": "0.0.25",
"version": "0.0.26",
"description": "ESLint plugin for Relay.",

@@ -5,0 +5,0 @@ "main": "eslint-plugin-relay",

@@ -24,4 +24,4 @@ # eslint-plugin-relay [![Build Status](https://travis-ci.org/relayjs/eslint-plugin-relay.svg?branch=master)](https://travis-ci.org/relayjs/eslint-plugin-relay) [![npm version](https://badge.fury.io/js/eslint-plugin-relay.svg)](http://badge.fury.io/js/eslint-plugin-relay)

'relay/generated-flow-types': 'warn',
'no-future-added-value': 'warn',
'unused-fields': 'warn'
'relay/no-future-added-value': 'warn',
'relay/unused-fields': 'warn'
},

@@ -28,0 +28,0 @@ plugins: ['relay']

@@ -22,4 +22,4 @@ /**

if (node.kind === 'Field' && !ignoreLevel) {
const fieldName = (node.alias || node.name).value;
fieldNames[fieldName] = true;
const nameNode = node.alias || node.name;
fieldNames[nameNode.value] = nameNode;
}

@@ -53,3 +53,3 @@ if (node.kind === 'OperationDefinition') {

walkAST(graphQLAst);
return Object.keys(fieldNames);
return fieldNames;
}

@@ -135,21 +135,15 @@

const queriedFields = getGraphQLFieldNames(graphQLAst);
const unusedFields = queriedFields.filter(
field => !foundMemberAccesses[field] && !isPageInfoField(field)
);
if (unusedFields.length === 0) {
return;
for (const field in queriedFields) {
if (!foundMemberAccesses[field] && !isPageInfoField(field)) {
context.report({
node: templateLiteral,
loc: utils.getLoc(context, templateLiteral, queriedFields[field]),
message:
`This queries for the field \`${field}\` but this file does ` +
'not seem to use it directly. If a different file needs this ' +
'information that file should export a fragment and colocate ' +
'the query for the data with the usage.'
});
}
}
const whatsUnused =
unusedFields.length === 1
? 'field `' + unusedFields[0] + '`'
: 'fields `' + unusedFields.join('`, `') + '`';
context.report(
templateLiteral,
'It looks like this queries for the ' +
whatsUnused +
' but this ' +
'file is not using it directly. If a different file needs this ' +
'information that file should export a fragment and colocate the ' +
'query for the data with the usage.'
);
});

@@ -156,0 +150,0 @@ },