Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

eslint-plugin-graphql

Package Overview
Dependencies
Maintainers
1
Versions
44
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

eslint-plugin-graphql - npm Package Compare versions

Comparing version 0.2.1 to 0.2.2

21

lib/index.js

@@ -10,11 +10,12 @@ 'use strict';

var graphQLValidationRuleNames = ['UniqueOperationNames', 'LoneAnonymousOperation', 'KnownTypeNames', 'FragmentsOnCompositeTypes', 'VariablesAreInputTypes',
//'ScalarLeafs', XXX only for Relay!
'FieldsOnCorrectType', 'UniqueFragmentNames',
var _lodash = require('lodash');
var graphQLValidationRuleNames = ['UniqueOperationNames', 'LoneAnonymousOperation', 'KnownTypeNames', 'FragmentsOnCompositeTypes', 'VariablesAreInputTypes', 'ScalarLeafs', 'FieldsOnCorrectType', 'UniqueFragmentNames',
//'KnownFragmentNames', -> any interpolation
//'NoUnusedFragments', -> any standalone fragment
'PossibleFragmentSpreads', 'NoFragmentCycles', 'UniqueVariableNames', 'NoUndefinedVariables', 'NoUnusedVariables', 'KnownDirectives', 'KnownArgumentNames', 'UniqueArgumentNames', 'ArgumentsOfCorrectType',
//'ProvidedNonNullArguments', -> arguments aren't provided in Relay apparently
'DefaultValuesOfCorrectType', 'VariablesInAllowedPosition', 'OverlappingFieldsCanBeMerged', 'UniqueInputFieldNames'];
'PossibleFragmentSpreads', 'NoFragmentCycles', 'UniqueVariableNames', 'NoUndefinedVariables', 'NoUnusedVariables', 'KnownDirectives', 'KnownArgumentNames', 'UniqueArgumentNames', 'ArgumentsOfCorrectType', 'ProvidedNonNullArguments', 'DefaultValuesOfCorrectType', 'VariablesInAllowedPosition', 'OverlappingFieldsCanBeMerged', 'UniqueInputFieldNames'];
// Omit these rules when in Relay env
var relayRuleNames = (0, _lodash.without)(graphQLValidationRuleNames, 'ScalarLeafs', 'ProvidedNonNullArguments');
var graphQLValidationRules = graphQLValidationRuleNames.map(function (ruleName) {

@@ -24,2 +25,6 @@ return require('graphql/validation/rules/' + ruleName)[ruleName];

var relayGraphQLValidationRules = relayRuleNames.map(function (ruleName) {
return require('graphql/validation/rules/' + ruleName)[ruleName];
});
var rules = {

@@ -106,4 +111,6 @@ 'template-strings': function templateStrings(context) {

var validationErrors = schema ? (0, _graphql.validate)(schema, ast, graphQLValidationRules) : [];
var rules = env === 'relay' ? relayGraphQLValidationRules : graphQLValidationRules;
var validationErrors = schema ? (0, _graphql.validate)(schema, ast, rules) : [];
if (validationErrors && validationErrors.length > 0) {

@@ -110,0 +117,0 @@ context.report({

{
"name": "eslint-plugin-graphql",
"version": "0.2.1",
"version": "0.2.2",
"description": "GraphQL ESLint plugin.",

@@ -29,4 +29,5 @@ "author": "Sashko Stubailo",

"dependencies": {
"graphql": "^0.5.0"
"graphql": "^0.5.0",
"lodash": "^4.11.1"
}
}

@@ -217,3 +217,14 @@ {

"description": null,
"args": [],
"args": [
{
"name": "input",
"description": null,
"type": {
"kind": "INPUT_OBJECT",
"name": "CreateCommentInput",
"ofType": null
},
"defaultValue": null
}
],
"type": {

@@ -234,2 +245,23 @@ "kind": "OBJECT",

{
"kind": "INPUT_OBJECT",
"name": "CreateCommentInput",
"description": null,
"fields": null,
"inputFields": [
{
"name": "stuff",
"description": null,
"type": {
"kind": "SCALAR",
"name": "String",
"ofType": null
},
"defaultValue": null
}
],
"interfaces": null,
"enumValues": null,
"possibleTypes": null
},
{
"kind": "OBJECT",

@@ -236,0 +268,0 @@ "name": "CreateCommentPayload",

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc