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

graphql-schema-linter

Package Overview
Dependencies
Maintainers
1
Versions
54
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

graphql-schema-linter - npm Package Compare versions

Comparing version 0.0.8 to 0.0.9

5

CHANGELOG.md
# Changelog
## 0.0.9 (August 10th, 2017)
- Fix a bug where the wrong location (column/line) was being reported for `DeprecationsHaveAReason` rule. [#13](https://github.com/cjoudrey/graphql-schema-linter/issues/13)
- Fix a bug where the wrong location (column/line) was being reported for `TypesAreCapitalized` rule. [#14](https://github.com/cjoudrey/graphql-schema-linter/issues/14)
## 0.0.8 (August 10th, 2017)

@@ -4,0 +9,0 @@

30

lib/rules/deprecations_have_a_reason.js

@@ -15,20 +15,32 @@ 'use strict';

FieldDefinition: function FieldDefinition(node, key, parent, path, ancestors) {
if (!isDeprecatedWithoutReason(node)) {
var deprecatedDirective = getDeprecatedDirective(node);
if (!deprecatedDirective) {
return;
}
var reasonArgument = getReasonArgument(deprecatedDirective);
if (reasonArgument) {
return;
}
var fieldName = node.name.value;
var parentName = ancestors[ancestors.length - 1].name.value;
context.reportError(new _error.GraphQLError('The field `' + parentName + '.' + fieldName + '` is deprecated but has no deprecation reason.', [node]));
context.reportError(new _error.GraphQLError('The field `' + parentName + '.' + fieldName + '` is deprecated but has no deprecation reason.', [deprecatedDirective]));
},
EnumValueDefinition: function EnumValueDefinition(node, key, parent, path, ancestors) {
if (!isDeprecatedWithoutReason(node)) {
var deprecatedDirective = getDeprecatedDirective(node);
if (!deprecatedDirective) {
return;
}
var reasonArgument = getReasonArgument(deprecatedDirective);
if (reasonArgument) {
return;
}
var fieldName = node.name.value;
var parentName = ancestors[ancestors.length - 1].name.value;
context.reportError(new _error.GraphQLError('The enum value `' + parentName + '.' + fieldName + '` is deprecated but has no deprecation reason.', [node]));
context.reportError(new _error.GraphQLError('The enum value `' + parentName + '.' + fieldName + '` is deprecated but has no deprecation reason.', [deprecatedDirective]));
}

@@ -38,3 +50,3 @@ };

function isDeprecatedWithoutReason(node) {
function getDeprecatedDirective(node) {
var deprecatedDirective = node.directives.find(function (directive) {

@@ -48,6 +60,6 @@ if (directive.name.value != 'deprecated') {

if (!deprecatedDirective) {
return false;
}
return deprecatedDirective;
}
function getReasonArgument(deprecatedDirective) {
var reasonArgument = deprecatedDirective.arguments.find(function (arg) {

@@ -61,3 +73,3 @@ if (arg.name.value == 'reason') {

return !reasonArgument;
return reasonArgument;
}

@@ -15,3 +15,3 @@ 'use strict';

if (typeName[0] == typeName[0].toLowerCase()) {
context.reportError(new _error.GraphQLError('The object type `' + typeName + '` should start with a capital letter.', [node]));
context.reportError(new _error.GraphQLError('The object type `' + typeName + '` should start with a capital letter.', [node.name]));
}

@@ -22,3 +22,3 @@ },

if (typeName[0] == typeName[0].toLowerCase()) {
context.reportError(new _error.GraphQLError('The interface type `' + typeName + '` should start with a capital letter.', [node]));
context.reportError(new _error.GraphQLError('The interface type `' + typeName + '` should start with a capital letter.', [node.name]));
}

@@ -25,0 +25,0 @@ }

{
"name": "graphql-schema-linter",
"version": "0.0.8",
"version": "0.0.9",
"description": "Command line tool and package to validate GraphQL schemas against a set of rules.",

@@ -5,0 +5,0 @@ "author": "Christian Joudrey",

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