diff --git a/src/error/__tests__/GraphQLError-test.ts b/src/error/__tests__/GraphQLError-test.ts index 96abdfa8975..1aa7d92f0c8 100644 --- a/src/error/__tests__/GraphQLError-test.ts +++ b/src/error/__tests__/GraphQLError-test.ts @@ -313,9 +313,7 @@ describe('toJSON', () => { it('includes extension fields', () => { const error = new GraphQLError('msg', { - extensions: { - foo: 'bar', - }, + extensions: { foo: 'bar' }, }); expect(error.toJSON()).to.deep.equal({ diff --git a/src/validation/rules/KnownTypeNamesRule.ts b/src/validation/rules/KnownTypeNamesRule.ts index e1d30846b16..fadc080c35c 100644 --- a/src/validation/rules/KnownTypeNamesRule.ts +++ b/src/validation/rules/KnownTypeNamesRule.ts @@ -62,9 +62,7 @@ export function KnownTypeNamesRule( context.reportError( new GraphQLError( `Unknown type "${typeName}".` + didYouMean(suggestedTypes), - { - nodes: node, - }, + { nodes: node }, ), ); } diff --git a/src/validation/rules/UniqueDirectiveNamesRule.ts b/src/validation/rules/UniqueDirectiveNamesRule.ts index 9007066d195..ade517ddcef 100644 --- a/src/validation/rules/UniqueDirectiveNamesRule.ts +++ b/src/validation/rules/UniqueDirectiveNamesRule.ts @@ -33,9 +33,7 @@ export function UniqueDirectiveNamesRule( context.reportError( new GraphQLError( `There can be only one directive named "@${directiveName}".`, - { - nodes: [knownDirectiveNames[directiveName], node.name], - }, + { nodes: [knownDirectiveNames[directiveName], node.name] }, ), ); } else { diff --git a/src/validation/rules/UniqueDirectivesPerLocationRule.ts b/src/validation/rules/UniqueDirectivesPerLocationRule.ts index 4cafd61d8a5..a4fc54690a2 100644 --- a/src/validation/rules/UniqueDirectivesPerLocationRule.ts +++ b/src/validation/rules/UniqueDirectivesPerLocationRule.ts @@ -78,9 +78,7 @@ export function UniqueDirectivesPerLocationRule( context.reportError( new GraphQLError( `The directive "@${directiveName}" can only be used once at this location.`, - { - nodes: [seenDirectives[directiveName], directive], - }, + { nodes: [seenDirectives[directiveName], directive] }, ), ); } else { diff --git a/src/validation/rules/UniqueEnumValueNamesRule.ts b/src/validation/rules/UniqueEnumValueNamesRule.ts index c2588fa673c..2bdf8749a2e 100644 --- a/src/validation/rules/UniqueEnumValueNamesRule.ts +++ b/src/validation/rules/UniqueEnumValueNamesRule.ts @@ -49,18 +49,14 @@ export function UniqueEnumValueNamesRule( context.reportError( new GraphQLError( `Enum value "${typeName}.${valueName}" already exists in the schema. It cannot also be defined in this type extension.`, - { - nodes: valueDef.name, - }, + { nodes: valueDef.name }, ), ); } else if (valueNames[valueName]) { context.reportError( new GraphQLError( `Enum value "${typeName}.${valueName}" can only be defined once.`, - { - nodes: [valueNames[valueName], valueDef.name], - }, + { nodes: [valueNames[valueName], valueDef.name] }, ), ); } else { diff --git a/src/validation/rules/UniqueFieldDefinitionNamesRule.ts b/src/validation/rules/UniqueFieldDefinitionNamesRule.ts index d4d4c6dc0e3..52f6527d64d 100644 --- a/src/validation/rules/UniqueFieldDefinitionNamesRule.ts +++ b/src/validation/rules/UniqueFieldDefinitionNamesRule.ts @@ -61,18 +61,14 @@ export function UniqueFieldDefinitionNamesRule( context.reportError( new GraphQLError( `Field "${typeName}.${fieldName}" already exists in the schema. It cannot also be defined in this type extension.`, - { - nodes: fieldDef.name, - }, + { nodes: fieldDef.name }, ), ); } else if (fieldNames[fieldName]) { context.reportError( new GraphQLError( `Field "${typeName}.${fieldName}" can only be defined once.`, - { - nodes: [fieldNames[fieldName], fieldDef.name], - }, + { nodes: [fieldNames[fieldName], fieldDef.name] }, ), ); } else { diff --git a/src/validation/rules/UniqueFragmentNamesRule.ts b/src/validation/rules/UniqueFragmentNamesRule.ts index e6c636c3c9a..3b4311e9c8d 100644 --- a/src/validation/rules/UniqueFragmentNamesRule.ts +++ b/src/validation/rules/UniqueFragmentNamesRule.ts @@ -23,9 +23,7 @@ export function UniqueFragmentNamesRule( context.reportError( new GraphQLError( `There can be only one fragment named "${fragmentName}".`, - { - nodes: [knownFragmentNames[fragmentName], node.name], - }, + { nodes: [knownFragmentNames[fragmentName], node.name] }, ), ); } else { diff --git a/src/validation/rules/UniqueInputFieldNamesRule.ts b/src/validation/rules/UniqueInputFieldNamesRule.ts index e5d0414fe5e..c1916a73b3f 100644 --- a/src/validation/rules/UniqueInputFieldNamesRule.ts +++ b/src/validation/rules/UniqueInputFieldNamesRule.ts @@ -40,9 +40,7 @@ export function UniqueInputFieldNamesRule( context.reportError( new GraphQLError( `There can be only one input field named "${fieldName}".`, - { - nodes: [knownNames[fieldName], node.name], - }, + { nodes: [knownNames[fieldName], node.name] }, ), ); } else { diff --git a/src/validation/rules/UniqueOperationTypesRule.ts b/src/validation/rules/UniqueOperationTypesRule.ts index deec1bbf450..f8ac6871ec6 100644 --- a/src/validation/rules/UniqueOperationTypesRule.ts +++ b/src/validation/rules/UniqueOperationTypesRule.ts @@ -53,9 +53,7 @@ export function UniqueOperationTypesRule( context.reportError( new GraphQLError( `There can be only one ${operation} type in schema.`, - { - nodes: [alreadyDefinedOperationType, operationType], - }, + { nodes: [alreadyDefinedOperationType, operationType] }, ), ); } else { diff --git a/src/validation/rules/UniqueVariableNamesRule.ts b/src/validation/rules/UniqueVariableNamesRule.ts index 23889ea65ef..3c9f76d8855 100644 --- a/src/validation/rules/UniqueVariableNamesRule.ts +++ b/src/validation/rules/UniqueVariableNamesRule.ts @@ -30,9 +30,7 @@ export function UniqueVariableNamesRule( context.reportError( new GraphQLError( `There can be only one variable named "$${variableName}".`, - { - nodes: variableNodes.map((node) => node.variable.name), - }, + { nodes: variableNodes.map((node) => node.variable.name) }, ), ); } diff --git a/src/validation/rules/ValuesOfCorrectTypeRule.ts b/src/validation/rules/ValuesOfCorrectTypeRule.ts index 704b382326e..5d81a3833a0 100644 --- a/src/validation/rules/ValuesOfCorrectTypeRule.ts +++ b/src/validation/rules/ValuesOfCorrectTypeRule.ts @@ -86,9 +86,7 @@ export function ValuesOfCorrectTypeRule( context.reportError( new GraphQLError( `Expected value of type "${inspect(type)}", found ${print(node)}.`, - { - nodes: node, - }, + { nodes: node }, ), ); } @@ -119,9 +117,7 @@ function isValidValueNode(context: ValidationContext, node: ValueNode): void { context.reportError( new GraphQLError( `Expected value of type "${typeStr}", found ${print(node)}.`, - { - nodes: node, - }, + { nodes: node }, ), ); return; @@ -136,9 +132,7 @@ function isValidValueNode(context: ValidationContext, node: ValueNode): void { context.reportError( new GraphQLError( `Expected value of type "${typeStr}", found ${print(node)}.`, - { - nodes: node, - }, + { nodes: node }, ), ); } @@ -151,10 +145,7 @@ function isValidValueNode(context: ValidationContext, node: ValueNode): void { new GraphQLError( `Expected value of type "${typeStr}", found ${print(node)}; ` + error.message, - { - nodes: node, - originalError: error, // Ensure a reference to the original error is maintained. - }, + { nodes: node, originalError: error }, ), ); } diff --git a/src/validation/rules/VariablesAreInputTypesRule.ts b/src/validation/rules/VariablesAreInputTypesRule.ts index 895e01f15fb..58d535ce815 100644 --- a/src/validation/rules/VariablesAreInputTypesRule.ts +++ b/src/validation/rules/VariablesAreInputTypesRule.ts @@ -32,9 +32,7 @@ export function VariablesAreInputTypesRule( context.reportError( new GraphQLError( `Variable "$${variableName}" cannot be non-input type "${typeName}".`, - { - nodes: node.type, - }, + { nodes: node.type }, ), ); } diff --git a/src/validation/rules/VariablesInAllowedPositionRule.ts b/src/validation/rules/VariablesInAllowedPositionRule.ts index a6410eb5888..a0b7e991a6e 100644 --- a/src/validation/rules/VariablesInAllowedPositionRule.ts +++ b/src/validation/rules/VariablesInAllowedPositionRule.ts @@ -62,9 +62,7 @@ export function VariablesInAllowedPositionRule( context.reportError( new GraphQLError( `Variable "$${varName}" of type "${varTypeStr}" used in position expecting type "${typeStr}".`, - { - nodes: [varDef, node], - }, + { nodes: [varDef, node] }, ), ); } diff --git a/src/validation/rules/custom/NoDeprecatedCustomRule.ts b/src/validation/rules/custom/NoDeprecatedCustomRule.ts index dd2ffd2916f..e06ac2e789c 100644 --- a/src/validation/rules/custom/NoDeprecatedCustomRule.ts +++ b/src/validation/rules/custom/NoDeprecatedCustomRule.ts @@ -29,9 +29,7 @@ export function NoDeprecatedCustomRule(context: ValidationContext): ASTVisitor { context.reportError( new GraphQLError( `The field ${parentType.name}.${fieldDef.name} is deprecated. ${deprecationReason}`, - { - nodes: node, - }, + { nodes: node }, ), ); } @@ -45,9 +43,7 @@ export function NoDeprecatedCustomRule(context: ValidationContext): ASTVisitor { context.reportError( new GraphQLError( `Directive "@${directiveDef.name}" argument "${argDef.name}" is deprecated. ${deprecationReason}`, - { - nodes: node, - }, + { nodes: node }, ), ); } else { @@ -57,9 +53,7 @@ export function NoDeprecatedCustomRule(context: ValidationContext): ASTVisitor { context.reportError( new GraphQLError( `Field "${parentType.name}.${fieldDef.name}" argument "${argDef.name}" is deprecated. ${deprecationReason}`, - { - nodes: node, - }, + { nodes: node }, ), ); } @@ -74,9 +68,7 @@ export function NoDeprecatedCustomRule(context: ValidationContext): ASTVisitor { context.reportError( new GraphQLError( `The input field ${inputObjectDef.name}.${inputFieldDef.name} is deprecated. ${deprecationReason}`, - { - nodes: node, - }, + { nodes: node }, ), ); } @@ -91,9 +83,7 @@ export function NoDeprecatedCustomRule(context: ValidationContext): ASTVisitor { context.reportError( new GraphQLError( `The enum value "${enumTypeDef.name}.${enumValueDef.name}" is deprecated. ${deprecationReason}`, - { - nodes: node, - }, + { nodes: node }, ), ); } diff --git a/src/validation/rules/custom/NoSchemaIntrospectionCustomRule.ts b/src/validation/rules/custom/NoSchemaIntrospectionCustomRule.ts index 45ded653f0d..257d58d7237 100644 --- a/src/validation/rules/custom/NoSchemaIntrospectionCustomRule.ts +++ b/src/validation/rules/custom/NoSchemaIntrospectionCustomRule.ts @@ -28,9 +28,7 @@ export function NoSchemaIntrospectionCustomRule( context.reportError( new GraphQLError( `GraphQL introspection has been disabled, but the requested query contained the field "${node.name.value}".`, - { - nodes: node, - }, + { nodes: node }, ), ); }