Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion .babelrc.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
{
"plugins": ["@babel/plugin-transform-flow-strip-types"],
"presets": [["@babel/preset-env", { "targets": { "node": "current" } }]]
"presets": [
[
"@babel/preset-env",
{ "bugfixes": true, "targets": { "node": "current" } }
]
]
}
19 changes: 3 additions & 16 deletions src/type/validate.js
Original file line number Diff line number Diff line change
Expand Up @@ -183,11 +183,7 @@ function validateDirectives(context: SchemaValidationContext): void {
if (isRequiredArgument(arg) && arg.deprecationReason != null) {
context.reportError(
`Required argument @${directive.name}(${arg.name}:) cannot be deprecated.`,
[
getDeprecatedDirectiveNode(arg.astNode),
// istanbul ignore next (TODO need to write coverage tests)
arg.astNode?.type,
],
[getDeprecatedDirectiveNode(arg.astNode), arg.astNode?.type],
);
}
}
Expand Down Expand Up @@ -299,11 +295,7 @@ function validateFields(
if (isRequiredArgument(arg) && arg.deprecationReason != null) {
context.reportError(
`Required argument ${type.name}.${field.name}(${argName}:) cannot be deprecated.`,
[
getDeprecatedDirectiveNode(arg.astNode),
// istanbul ignore next (TODO need to write coverage tests)
arg.astNode?.type,
],
[getDeprecatedDirectiveNode(arg.astNode), arg.astNode?.type],
);
}
}
Expand Down Expand Up @@ -376,12 +368,7 @@ function validateTypeImplementsInterface(
`Interface field ${iface.name}.${fieldName} expects type ` +
`${inspect(ifaceField.type)} but ${type.name}.${fieldName} ` +
`is type ${inspect(typeField.type)}.`,
[
// istanbul ignore next (TODO need to write coverage tests)
ifaceField.astNode?.type,
// istanbul ignore next (TODO need to write coverage tests)
typeField.astNode?.type,
],
[ifaceField.astNode?.type, typeField.astNode?.type],
);
}

Expand Down
1 change: 0 additions & 1 deletion src/utilities/__tests__/buildASTSchema-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,6 @@ function cycleSDL(sdl: string): string {
}

function expectASTNode(obj: ?{ +astNode: ?ASTNode, ... }) {
// istanbul ignore next (FIXME)
invariant(obj?.astNode != null);
return expect(print(obj.astNode));
}
Expand Down
1 change: 0 additions & 1 deletion src/utilities/__tests__/extendSchema-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@ function expectExtensionASTNodes(obj: {
}

function expectASTNode(obj: ?{ +astNode: ?ASTNode, ... }) {
// istanbul ignore next (FIXME)
invariant(obj?.astNode != null);
return expect(print(obj.astNode));
}
Expand Down
4 changes: 2 additions & 2 deletions src/utilities/__tests__/getOperationRootType-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ const subscriptionType = new GraphQLObjectType({

function getOperationNode(doc: DocumentNode) {
const operationNode = doc.definitions[0];
invariant(operationNode && operationNode.kind === Kind.OPERATION_DEFINITION);
invariant(operationNode.kind === Kind.OPERATION_DEFINITION);
return operationNode;
}

Expand Down Expand Up @@ -76,7 +76,7 @@ describe('getOperationRootType', () => {
`);

const schemaNode = doc.definitions[0];
invariant(schemaNode && schemaNode.kind === Kind.SCHEMA_DEFINITION);
invariant(schemaNode.kind === Kind.SCHEMA_DEFINITION);
const [
queryNode,
mutationNode,
Expand Down