From fb502ec781f274aa50f472aaad4cee5dcd05efa5 Mon Sep 17 00:00:00 2001 From: Ivan Goncharov Date: Fri, 7 Jun 2019 14:54:51 +0300 Subject: [PATCH] Remove unnecessary concatenations from template strings (#1957) Became possible after Prettier 1.18 --- src/execution/execute.js | 9 ++-- src/execution/values.js | 3 +- src/language/lexer.js | 4 +- src/type/definition.js | 30 +++++-------- src/type/validate.js | 21 +++------ src/utilities/assertValidName.js | 3 +- src/utilities/buildClientSchema.js | 3 +- src/utilities/findBreakingChanges.js | 44 +++++-------------- .../rules/FragmentsOnCompositeTypes.js | 5 +-- .../rules/PossibleFragmentSpreads.js | 10 +---- .../rules/ProvidedRequiredArguments.js | 10 +---- src/validation/rules/ScalarLeafs.js | 10 +---- .../rules/SingleFieldSubscriptions.js | 7 ++- src/validation/rules/UniqueDirectiveNames.js | 5 +-- .../rules/UniqueDirectivesPerLocation.js | 5 +-- src/validation/rules/UniqueEnumValueNames.js | 5 +-- .../rules/UniqueFieldDefinitionNames.js | 5 +-- src/validation/rules/UniqueOperationTypes.js | 5 +-- src/validation/rules/UniqueTypeNames.js | 5 +-- src/validation/rules/ValuesOfCorrectType.js | 5 +-- .../rules/VariablesInAllowedPosition.js | 5 +-- 21 files changed, 54 insertions(+), 145 deletions(-) diff --git a/src/execution/execute.js b/src/execution/execute.js index e9da2a1166..6539617858 100644 --- a/src/execution/execute.js +++ b/src/execution/execute.js @@ -1046,19 +1046,16 @@ function ensureValidRuntimeType( if (!isObjectType(runtimeType)) { throw new GraphQLError( - `Abstract type ${returnType.name} must resolve to an Object type at ` + - `runtime for field ${info.parentType.name}.${info.fieldName} with ` + + `Abstract type ${returnType.name} must resolve to an Object type at runtime for field ${info.parentType.name}.${info.fieldName} with ` + `value ${inspect(result)}, received "${inspect(runtimeType)}". ` + - `Either the ${returnType.name} type should provide a "resolveType" ` + - 'function or each possible type should provide an "isTypeOf" function.', + `Either the ${returnType.name} type should provide a "resolveType" function or each possible type should provide an "isTypeOf" function.`, fieldNodes, ); } if (!exeContext.schema.isPossibleType(returnType, runtimeType)) { throw new GraphQLError( - `Runtime Object type "${runtimeType.name}" is not a possible type ` + - `for "${returnType.name}".`, + `Runtime Object type "${runtimeType.name}" is not a possible type for "${returnType.name}".`, fieldNodes, ); } diff --git a/src/execution/values.js b/src/execution/values.js index 35d27ac94d..3c88cf4a04 100644 --- a/src/execution/values.js +++ b/src/execution/values.js @@ -171,8 +171,7 @@ export function getArgumentValues( const variableName = argumentNode.value.name.value; throw new GraphQLError( `Argument "${name}" of required type "${inspect(argType)}" ` + - `was provided the variable "$${variableName}" ` + - 'which was not provided a runtime value.', + `was provided the variable "$${variableName}" which was not provided a runtime value.`, argumentNode.value, ); } else { diff --git a/src/language/lexer.js b/src/language/lexer.js index 11e74180e3..6f9f9d33c5 100644 --- a/src/language/lexer.js +++ b/src/language/lexer.js @@ -603,11 +603,11 @@ function readString(source, start, line, col, prev): Token { body.charCodeAt(position + 4), ); if (charCode < 0) { + const invalidSequence = body.slice(position + 1, position + 5); throw syntaxError( source, position, - 'Invalid character escape sequence: ' + - `\\u${body.slice(position + 1, position + 5)}.`, + `Invalid character escape sequence: \\u${invalidSequence}.`, ); } value += String.fromCharCode(charCode); diff --git a/src/type/definition.js b/src/type/definition.js index e43600a713..a8de46dbe0 100644 --- a/src/type/definition.js +++ b/src/type/definition.js @@ -570,16 +570,14 @@ export class GraphQLScalarType { invariant(typeof config.name === 'string', 'Must provide name.'); invariant( config.serialize == null || typeof config.serialize === 'function', - `${this.name} must provide "serialize" function. If this custom Scalar ` + - 'is also used as an input type, ensure "parseValue" and "parseLiteral" functions are also provided.', + `${this.name} must provide "serialize" function. If this custom Scalar is also used as an input type, ensure "parseValue" and "parseLiteral" functions are also provided.`, ); if (config.parseLiteral) { invariant( typeof config.parseValue === 'function' && typeof config.parseLiteral === 'function', - `${this.name} must provide both "parseValue" and "parseLiteral" ` + - 'functions.', + `${this.name} must provide both "parseValue" and "parseLiteral" functions.`, ); } } @@ -740,8 +738,7 @@ function defineInterfaces( const interfaces = resolveThunk(config.interfaces) || []; invariant( Array.isArray(interfaces), - `${config.name} interfaces must be an Array or a function which returns ` + - 'an Array.', + `${config.name} interfaces must be an Array or a function which returns an Array.`, ); return interfaces; } @@ -754,8 +751,7 @@ function defineFieldMap( const fieldMap = resolveThunk(config.fields) || {}; invariant( isPlainObj(fieldMap), - `${config.name} fields must be an object with field names as keys or a ` + - 'function which returns such an object.', + `${config.name} fields must be an object with field names as keys or a function which returns such an object.`, ); return mapValue(fieldMap, (fieldConfig, fieldName) => { @@ -765,8 +761,7 @@ function defineFieldMap( ); invariant( !('isDeprecated' in fieldConfig), - `${config.name}.${fieldName} should provide "deprecationReason" ` + - 'instead of "isDeprecated".', + `${config.name}.${fieldName} should provide "deprecationReason" instead of "isDeprecated".`, ); invariant( fieldConfig.resolve == null || typeof fieldConfig.resolve === 'function', @@ -777,8 +772,7 @@ function defineFieldMap( const argsConfig = fieldConfig.args || {}; invariant( isPlainObj(argsConfig), - `${config.name}.${fieldName} args must be an object with argument ` + - 'names as keys.', + `${config.name}.${fieldName} args must be an object with argument names as keys.`, ); const args = objectEntries(argsConfig).map(([argName, arg]) => ({ @@ -1111,8 +1105,7 @@ function defineTypes( const types = resolveThunk(config.types) || []; invariant( Array.isArray(types), - 'Must provide Array of types or a function which returns ' + - `such an array for Union ${config.name}.`, + `Must provide Array of types or a function which returns such an array for Union ${config.name}.`, ); return types; } @@ -1259,8 +1252,7 @@ function defineEnumValues( ); invariant( !('isDeprecated' in value), - `${type.name}.${valueName} should provide "deprecationReason" instead ` + - 'of "isDeprecated".', + `${type.name}.${valueName} should provide "deprecationReason" instead of "isDeprecated".`, ); return { name: valueName, @@ -1379,14 +1371,12 @@ function defineInputFieldMap( const fieldMap = resolveThunk(config.fields) || {}; invariant( isPlainObj(fieldMap), - `${config.name} fields must be an object with field names as keys or a ` + - 'function which returns such an object.', + `${config.name} fields must be an object with field names as keys or a function which returns such an object.`, ); return mapValue(fieldMap, (fieldConfig, fieldName) => { invariant( !('resolve' in fieldConfig), - `${config.name}.${fieldName} field has a resolve property, but ` + - 'Input Types cannot define resolvers.', + `${config.name}.${fieldName} field has a resolve property, but Input Types cannot define resolvers.`, ); return { ...fieldConfig, name: fieldName }; diff --git a/src/type/validate.js b/src/type/validate.js index f88c0d5bcb..9738b762f4 100644 --- a/src/type/validate.js +++ b/src/type/validate.js @@ -301,8 +301,7 @@ function validateFields( // Ensure they are unique per field. if (argNames[argName]) { context.reportError( - `Field argument ${type.name}.${field.name}(${argName}:) can only ` + - 'be defined once.', + `Field argument ${type.name}.${field.name}(${argName}:) can only be defined once.`, field.args .filter(({ name }) => name === argName) .map(({ astNode }) => astNode), @@ -364,8 +363,7 @@ function validateObjectImplementsInterface( // Assert interface field exists on object. if (!objectField) { context.reportError( - `Interface field ${iface.name}.${fieldName} expected but ` + - `${object.name} does not provide it.`, + `Interface field ${iface.name}.${fieldName} expected but ${object.name} does not provide it.`, [ifaceField.astNode, ...getAllNodes(object)], ); continue; @@ -393,8 +391,7 @@ function validateObjectImplementsInterface( // Assert interface field arg exists on object field. if (!objectArg) { context.reportError( - `Interface field argument ${iface.name}.${fieldName}(${argName}:) ` + - `expected but ${object.name}.${fieldName} does not provide it.`, + `Interface field argument ${iface.name}.${fieldName}(${argName}:) expected but ${object.name}.${fieldName} does not provide it.`, [ifaceArg.astNode, objectField.astNode], ); continue; @@ -425,9 +422,7 @@ function validateObjectImplementsInterface( const ifaceArg = find(ifaceField.args, arg => arg.name === argName); if (!ifaceArg && isRequiredArgument(objectArg)) { context.reportError( - `Object field ${object.name}.${fieldName} includes required ` + - `argument ${argName} that is missing from the Interface field ` + - `${iface.name}.${fieldName}.`, + `Object field ${object.name}.${fieldName} includes required argument ${argName} that is missing from the Interface field ${iface.name}.${fieldName}.`, [objectArg.astNode, ifaceField.astNode], ); } @@ -452,8 +447,7 @@ function validateUnionMembers( for (const memberType of memberTypes) { if (includedTypeNames[memberType.name]) { context.reportError( - `Union type ${union.name} can only include type ` + - `${memberType.name} once.`, + `Union type ${union.name} can only include type ${memberType.name} once.`, getUnionMemberTypeNodes(union, memberType.name), ); continue; @@ -563,10 +557,9 @@ function createInputObjectCircularRefsValidator( detectCycleRecursive(fieldType); } else { const cyclePath = fieldPath.slice(cycleIndex); - const fieldNames = cyclePath.map(fieldObj => fieldObj.name); + const pathStr = cyclePath.map(fieldObj => fieldObj.name).join('.'); context.reportError( - `Cannot reference Input Object "${fieldType.name}" within itself ` + - `through a series of non-null fields: "${fieldNames.join('.')}".`, + `Cannot reference Input Object "${fieldType.name}" within itself through a series of non-null fields: "${pathStr}".`, cyclePath.map(fieldObj => fieldObj.astNode), ); } diff --git a/src/utilities/assertValidName.js b/src/utilities/assertValidName.js index 7bf0b93791..eafed3be68 100644 --- a/src/utilities/assertValidName.js +++ b/src/utilities/assertValidName.js @@ -34,8 +34,7 @@ export function isValidNameError( invariant(typeof name === 'string', 'Expected string'); if (name.length > 1 && name[0] === '_' && name[1] === '_') { return new GraphQLError( - `Name "${name}" must not begin with "__", which is reserved by ` + - 'GraphQL introspection.', + `Name "${name}" must not begin with "__", which is reserved by GraphQL introspection.`, node, ); } diff --git a/src/utilities/buildClientSchema.js b/src/utilities/buildClientSchema.js index 20417d2d4c..f10daebf4e 100644 --- a/src/utilities/buildClientSchema.js +++ b/src/utilities/buildClientSchema.js @@ -153,8 +153,7 @@ export function buildClientSchema( const type = typeMap[typeName]; if (!type) { throw new Error( - `Invalid or incomplete schema, unknown type: ${typeName}. Ensure ` + - 'that a full introspection query is used in order to build a client schema.', + `Invalid or incomplete schema, unknown type: ${typeName}. Ensure that a full introspection query is used in order to build a client schema.`, ); } diff --git a/src/utilities/findBreakingChanges.js b/src/utilities/findBreakingChanges.js index ddbd48e08c..c764ba66f9 100644 --- a/src/utilities/findBreakingChanges.js +++ b/src/utilities/findBreakingChanges.js @@ -137,9 +137,7 @@ function findDirectiveChanges( if (isRequiredArgument(newArg)) { schemaChanges.push({ type: BreakingChangeType.REQUIRED_DIRECTIVE_ARG_ADDED, - description: - `A required arg ${newArg.name} on directive ` + - `${oldDirective.name} was added.`, + description: `A required arg ${newArg.name} on directive ${oldDirective.name} was added.`, }); } } @@ -220,16 +218,12 @@ function findInputObjectTypeChanges( if (isRequiredInputField(newField)) { schemaChanges.push({ type: BreakingChangeType.REQUIRED_INPUT_FIELD_ADDED, - description: - `A required field ${newField.name} on ` + - `input type ${oldType.name} was added.`, + description: `A required field ${newField.name} on input type ${oldType.name} was added.`, }); } else { schemaChanges.push({ type: DangerousChangeType.OPTIONAL_INPUT_FIELD_ADDED, - description: - `An optional field ${newField.name} on ` + - `input type ${oldType.name} was added.`, + description: `An optional field ${newField.name} on input type ${oldType.name} was added.`, }); } } @@ -276,9 +270,7 @@ function findUnionTypeChanges( for (const oldPossibleType of possibleTypesDiff.removed) { schemaChanges.push({ type: BreakingChangeType.TYPE_REMOVED_FROM_UNION, - description: - `${oldPossibleType.name} was removed from ` + - `union type ${oldType.name}.`, + description: `${oldPossibleType.name} was removed from union type ${oldType.name}.`, }); } @@ -319,18 +311,14 @@ function findObjectTypeChanges( for (const newInterface of interfacesDiff.added) { schemaChanges.push({ type: DangerousChangeType.INTERFACE_ADDED_TO_OBJECT, - description: - `${newInterface.name} added to interfaces implemented ` + - `by ${oldType.name}.`, + description: `${newInterface.name} added to interfaces implemented by ${oldType.name}.`, }); } for (const oldInterface of interfacesDiff.removed) { schemaChanges.push({ type: BreakingChangeType.INTERFACE_REMOVED_FROM_OBJECT, - description: - `${oldType.name} no longer implements interface ` + - `${oldInterface.name}.`, + description: `${oldType.name} no longer implements interface ${oldInterface.name}.`, }); } @@ -398,17 +386,14 @@ function findArgChanges( schemaChanges.push({ type: BreakingChangeType.ARG_CHANGED_KIND, description: - `${oldType.name}.${oldField.name} arg ` + - `${oldArg.name} has changed type from ` + + `${oldType.name}.${oldField.name} arg ${oldArg.name} has changed type from ` + `${String(oldArg.type)} to ${String(newArg.type)}.`, }); } else if (oldArg.defaultValue !== undefined) { if (newArg.defaultValue === undefined) { schemaChanges.push({ type: DangerousChangeType.ARG_DEFAULT_VALUE_CHANGE, - description: - `${oldType.name}.${oldField.name} arg ` + - `${oldArg.name} defaultValue was removed.`, + description: `${oldType.name}.${oldField.name} arg ${oldArg.name} defaultValue was removed.`, }); } else { const oldValueStr = stringifyValue(oldArg.defaultValue, oldArg.type); @@ -417,10 +402,7 @@ function findArgChanges( if (oldValueStr !== newValueStr) { schemaChanges.push({ type: DangerousChangeType.ARG_DEFAULT_VALUE_CHANGE, - description: - `${oldType.name}.${oldField.name} arg ` + - `${oldArg.name} has changed defaultValue ` + - `from ${oldValueStr} to ${newValueStr}.`, + description: `${oldType.name}.${oldField.name} arg ${oldArg.name} has changed defaultValue from ${oldValueStr} to ${newValueStr}.`, }); } } @@ -431,16 +413,12 @@ function findArgChanges( if (isRequiredArgument(newArg)) { schemaChanges.push({ type: BreakingChangeType.REQUIRED_ARG_ADDED, - description: - `A required arg ${newArg.name} on ` + - `${oldType.name}.${oldField.name} was added.`, + description: `A required arg ${newArg.name} on ${oldType.name}.${oldField.name} was added.`, }); } else { schemaChanges.push({ type: DangerousChangeType.OPTIONAL_ARG_ADDED, - description: - `An optional arg ${newArg.name} on ` + - `${oldType.name}.${oldField.name} was added.`, + description: `An optional arg ${newArg.name} on ${oldType.name}.${oldField.name} was added.`, }); } } diff --git a/src/validation/rules/FragmentsOnCompositeTypes.js b/src/validation/rules/FragmentsOnCompositeTypes.js index d9ba5733d4..b05815727e 100644 --- a/src/validation/rules/FragmentsOnCompositeTypes.js +++ b/src/validation/rules/FragmentsOnCompositeTypes.js @@ -22,10 +22,7 @@ export function fragmentOnNonCompositeErrorMessage( fragName: string, type: string, ): string { - return ( - `Fragment "${fragName}" cannot condition on non composite ` + - `type "${type}".` - ); + return `Fragment "${fragName}" cannot condition on non composite type "${type}".`; } /** diff --git a/src/validation/rules/PossibleFragmentSpreads.js b/src/validation/rules/PossibleFragmentSpreads.js index ae9e2db769..44a0dad3c4 100644 --- a/src/validation/rules/PossibleFragmentSpreads.js +++ b/src/validation/rules/PossibleFragmentSpreads.js @@ -20,20 +20,14 @@ export function typeIncompatibleSpreadMessage( parentType: string, fragType: string, ): string { - return ( - `Fragment "${fragName}" cannot be spread here as objects of ` + - `type "${parentType}" can never be of type "${fragType}".` - ); + return `Fragment "${fragName}" cannot be spread here as objects of type "${parentType}" can never be of type "${fragType}".`; } export function typeIncompatibleAnonSpreadMessage( parentType: string, fragType: string, ): string { - return ( - 'Fragment cannot be spread here as objects of ' + - `type "${parentType}" can never be of type "${fragType}".` - ); + return `Fragment cannot be spread here as objects of type "${parentType}" can never be of type "${fragType}".`; } /** diff --git a/src/validation/rules/ProvidedRequiredArguments.js b/src/validation/rules/ProvidedRequiredArguments.js index 4ac40f4f64..82fba59e7e 100644 --- a/src/validation/rules/ProvidedRequiredArguments.js +++ b/src/validation/rules/ProvidedRequiredArguments.js @@ -25,10 +25,7 @@ export function missingFieldArgMessage( argName: string, type: string, ): string { - return ( - `Field "${fieldName}" argument "${argName}" of type ` + - `"${type}" is required, but it was not provided.` - ); + return `Field "${fieldName}" argument "${argName}" of type "${type}" is required, but it was not provided.`; } export function missingDirectiveArgMessage( @@ -36,10 +33,7 @@ export function missingDirectiveArgMessage( argName: string, type: string, ): string { - return ( - `Directive "@${directiveName}" argument "${argName}" of type ` + - `"${type}" is required, but it was not provided.` - ); + return `Directive "@${directiveName}" argument "${argName}" of type "${type}" is required, but it was not provided.`; } /** diff --git a/src/validation/rules/ScalarLeafs.js b/src/validation/rules/ScalarLeafs.js index c3f376c9c8..d1168d075c 100644 --- a/src/validation/rules/ScalarLeafs.js +++ b/src/validation/rules/ScalarLeafs.js @@ -18,20 +18,14 @@ export function noSubselectionAllowedMessage( fieldName: string, type: string, ): string { - return ( - `Field "${fieldName}" must not have a selection since ` + - `type "${type}" has no subfields.` - ); + return `Field "${fieldName}" must not have a selection since type "${type}" has no subfields.`; } export function requiredSubselectionMessage( fieldName: string, type: string, ): string { - return ( - `Field "${fieldName}" of type "${type}" must have a selection of subfields.` + - ` Did you mean "${fieldName} { ... }"?` - ); + return `Field "${fieldName}" of type "${type}" must have a selection of subfields. Did you mean "${fieldName} { ... }"?`; } /** diff --git a/src/validation/rules/SingleFieldSubscriptions.js b/src/validation/rules/SingleFieldSubscriptions.js index 268f22a5b6..9c13cbb504 100644 --- a/src/validation/rules/SingleFieldSubscriptions.js +++ b/src/validation/rules/SingleFieldSubscriptions.js @@ -13,10 +13,9 @@ import { type OperationDefinitionNode } from '../../language/ast'; import { type ASTVisitor } from '../../language/visitor'; export function singleFieldOnlyMessage(name: ?string): string { - return ( - (name ? `Subscription "${name}" ` : 'Anonymous Subscription ') + - 'must select only one top level field.' - ); + return name + ? `Subscription "${name}" must select only one top level field.` + : 'Anonymous Subscription must select only one top level field.'; } /** diff --git a/src/validation/rules/UniqueDirectiveNames.js b/src/validation/rules/UniqueDirectiveNames.js index 506e109c85..89bb6f1b78 100644 --- a/src/validation/rules/UniqueDirectiveNames.js +++ b/src/validation/rules/UniqueDirectiveNames.js @@ -16,10 +16,7 @@ export function duplicateDirectiveNameMessage(directiveName: string): string { } export function existedDirectiveNameMessage(directiveName: string): string { - return ( - `Directive "${directiveName}" already exists in the schema. ` + - 'It cannot be redefined.' - ); + return `Directive "${directiveName}" already exists in the schema. It cannot be redefined.`; } /** diff --git a/src/validation/rules/UniqueDirectivesPerLocation.js b/src/validation/rules/UniqueDirectivesPerLocation.js index 8d8ef2143b..82cd8e3549 100644 --- a/src/validation/rules/UniqueDirectivesPerLocation.js +++ b/src/validation/rules/UniqueDirectivesPerLocation.js @@ -13,10 +13,7 @@ import { type DirectiveNode } from '../../language/ast'; import { type ASTVisitor } from '../../language/visitor'; export function duplicateDirectiveMessage(directiveName: string): string { - return ( - `The directive "${directiveName}" can only be used once at ` + - 'this location.' - ); + return `The directive "${directiveName}" can only be used once at this location.`; } /** diff --git a/src/validation/rules/UniqueEnumValueNames.js b/src/validation/rules/UniqueEnumValueNames.js index ecd1e8626b..a76186870b 100644 --- a/src/validation/rules/UniqueEnumValueNames.js +++ b/src/validation/rules/UniqueEnumValueNames.js @@ -23,10 +23,7 @@ export function existedEnumValueNameMessage( typeName: string, valueName: string, ): string { - return ( - `Enum value "${typeName}.${valueName}" already exists in the schema. ` + - 'It cannot also be defined in this type extension.' - ); + return `Enum value "${typeName}.${valueName}" already exists in the schema. It cannot also be defined in this type extension.`; } /** diff --git a/src/validation/rules/UniqueFieldDefinitionNames.js b/src/validation/rules/UniqueFieldDefinitionNames.js index ad9e997889..dd7f63fa2a 100644 --- a/src/validation/rules/UniqueFieldDefinitionNames.js +++ b/src/validation/rules/UniqueFieldDefinitionNames.js @@ -27,10 +27,7 @@ export function existedFieldDefinitionNameMessage( typeName: string, fieldName: string, ): string { - return ( - `Field "${typeName}.${fieldName}" already exists in the schema. ` + - 'It cannot also be defined in this type extension.' - ); + return `Field "${typeName}.${fieldName}" already exists in the schema. It cannot also be defined in this type extension.`; } /** diff --git a/src/validation/rules/UniqueOperationTypes.js b/src/validation/rules/UniqueOperationTypes.js index 8eda3bbe1d..34ef1d30e4 100644 --- a/src/validation/rules/UniqueOperationTypes.js +++ b/src/validation/rules/UniqueOperationTypes.js @@ -16,10 +16,7 @@ export function duplicateOperationTypeMessage(operation: string): string { } export function existedOperationTypeMessage(operation: string): string { - return ( - `Type for ${operation} already defined in the schema. ` + - 'It cannot be redefined.' - ); + return `Type for ${operation} already defined in the schema. It cannot be redefined.`; } /** diff --git a/src/validation/rules/UniqueTypeNames.js b/src/validation/rules/UniqueTypeNames.js index ccc1b7ba0b..3726c5e2f2 100644 --- a/src/validation/rules/UniqueTypeNames.js +++ b/src/validation/rules/UniqueTypeNames.js @@ -17,10 +17,7 @@ export function duplicateTypeNameMessage(typeName: string): string { } export function existedTypeNameMessage(typeName: string): string { - return ( - `Type "${typeName}" already exists in the schema. ` + - 'It cannot also be defined in this type definition.' - ); + return `Type "${typeName}" already exists in the schema. It cannot also be defined in this type definition.`; } /** diff --git a/src/validation/rules/ValuesOfCorrectType.js b/src/validation/rules/ValuesOfCorrectType.js index 95484ab39c..92dc2274ea 100644 --- a/src/validation/rules/ValuesOfCorrectType.js +++ b/src/validation/rules/ValuesOfCorrectType.js @@ -56,10 +56,7 @@ export function requiredFieldMessage( fieldName: string, fieldTypeName: string, ): string { - return ( - `Field ${typeName}.${fieldName} of required type ` + - `${fieldTypeName} was not provided.` - ); + return `Field ${typeName}.${fieldName} of required type ${fieldTypeName} was not provided.`; } export function unknownFieldMessage( diff --git a/src/validation/rules/VariablesInAllowedPosition.js b/src/validation/rules/VariablesInAllowedPosition.js index 97cdd5374a..445b4c524d 100644 --- a/src/validation/rules/VariablesInAllowedPosition.js +++ b/src/validation/rules/VariablesInAllowedPosition.js @@ -23,10 +23,7 @@ export function badVarPosMessage( varType: string, expectedType: string, ): string { - return ( - `Variable "$${varName}" of type "${varType}" used in ` + - `position expecting type "${expectedType}".` - ); + return `Variable "$${varName}" of type "${varType}" used in position expecting type "${expectedType}".`; } /**