eslint-plugin-graphql
Advanced tools
Comparing version 0.2.1 to 0.2.2
@@ -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
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
94416
1618
2
4
+ Addedlodash@^4.11.1
+ Addedlodash@4.17.21(transitive)