Skip to content

Commit 63cc5df

Browse files
Manually concat all static strings (#1921)
Makes editing strings easier and clean resulting diffs Plus all modern editors support wrapping of long lines.
1 parent 5eecef2 commit 63cc5df

File tree

10 files changed

+28
-82
lines changed

10 files changed

+28
-82
lines changed

src/execution/__tests__/abstract-test.js

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -423,10 +423,7 @@ describe('Execute: Handles execution of abstract types', () => {
423423
errors: [
424424
{
425425
message:
426-
'Abstract type FooInterface must resolve to an Object type at ' +
427-
'runtime for field Query.foo with value "dummy", received "[]". ' +
428-
'Either the FooInterface type should provide a "resolveType" ' +
429-
'function or each possible type should provide an "isTypeOf" function.',
426+
'Abstract type FooInterface must resolve to an Object type at runtime for field Query.foo with value "dummy", received "[]". Either the FooInterface type should provide a "resolveType" function or each possible type should provide an "isTypeOf" function.',
430427
locations: [{ line: 1, column: 3 }],
431428
path: ['foo'],
432429
},

src/execution/execute.js

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -288,9 +288,7 @@ export function assertValidExecutionArguments(
288288
// Variables, if provided, must be an object.
289289
invariant(
290290
!rawVariableValues || typeof rawVariableValues === 'object',
291-
'Variables must be provided as an Object where each property is a ' +
292-
'variable value. Perhaps look to see if an unparsed JSON string ' +
293-
'was provided.',
291+
'Variables must be provided as an Object where each property is a variable value. Perhaps look to see if an unparsed JSON string was provided.',
294292
);
295293
}
296294

src/language/__tests__/lexer-test.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -226,8 +226,7 @@ describe('Lexer', () => {
226226

227227
expectSyntaxError(
228228
"'single quotes'",
229-
"Unexpected single quote character ('), " +
230-
'did you mean to use a double quote (")?',
229+
'Unexpected single quote character (\'), did you mean to use a double quote (")?',
231230
{ line: 1, column: 1 },
232231
);
233232

src/language/lexer.js

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -364,10 +364,7 @@ function unexpectedCharacterMessage(code) {
364364
365365
if (code === 39) {
366366
// '
367-
return (
368-
"Unexpected single quote character ('), did you mean to use " +
369-
'a double quote (")?'
370-
);
367+
return 'Unexpected single quote character (\'), did you mean to use a double quote (")?';
371368
}
372369
373370
return `Cannot parse the unexpected character ${printCharCode(code)}.`;

src/type/__tests__/introspection-test.js

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1291,10 +1291,7 @@ describe('Introspection', () => {
12911291
schemaType: {
12921292
name: '__Schema',
12931293
description:
1294-
'A GraphQL Schema defines the capabilities of a ' +
1295-
'GraphQL server. It exposes all available types and ' +
1296-
'directives on the server, as well as the entry ' +
1297-
'points for query, mutation, and subscription operations.',
1294+
'A GraphQL Schema defines the capabilities of a GraphQL server. It exposes all available types and directives on the server, as well as the entry points for query, mutation, and subscription operations.',
12981295
fields: [
12991296
{
13001297
name: 'types',

src/type/definition.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -567,8 +567,7 @@ export class GraphQLScalarType {
567567
invariant(
568568
typeof config.serialize === 'function',
569569
`${this.name} must provide "serialize" function. If this custom Scalar ` +
570-
'is also used as an input type, ensure "parseValue" and "parseLiteral" ' +
571-
'functions are also provided.',
570+
'is also used as an input type, ensure "parseValue" and "parseLiteral" functions are also provided.',
572571
);
573572
if (config.parseValue || config.parseLiteral) {
574573
invariant(

src/type/directives.js

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -118,8 +118,7 @@ export type GraphQLDirectiveConfig = {|
118118
export const GraphQLIncludeDirective = new GraphQLDirective({
119119
name: 'include',
120120
description:
121-
'Directs the executor to include this field or fragment only when ' +
122-
'the `if` argument is true.',
121+
'Directs the executor to include this field or fragment only when the `if` argument is true.',
123122
locations: [
124123
DirectiveLocation.FIELD,
125124
DirectiveLocation.FRAGMENT_SPREAD,
@@ -139,8 +138,7 @@ export const GraphQLIncludeDirective = new GraphQLDirective({
139138
export const GraphQLSkipDirective = new GraphQLDirective({
140139
name: 'skip',
141140
description:
142-
'Directs the executor to skip this field or fragment when the `if` ' +
143-
'argument is true.',
141+
'Directs the executor to skip this field or fragment when the `if` argument is true.',
144142
locations: [
145143
DirectiveLocation.FIELD,
146144
DirectiveLocation.FRAGMENT_SPREAD,
@@ -170,9 +168,7 @@ export const GraphQLDeprecatedDirective = new GraphQLDirective({
170168
reason: {
171169
type: GraphQLString,
172170
description:
173-
'Explains why this element was deprecated, usually also including a ' +
174-
'suggestion for how to access supported similar data. Formatted using ' +
175-
'the Markdown syntax (as specified by [CommonMark](https://commonmark.org/).',
171+
'Explains why this element was deprecated, usually also including a suggestion for how to access supported similar data. Formatted using the Markdown syntax (as specified by [CommonMark](https://commonmark.org/).',
176172
defaultValue: DEFAULT_DEPRECATION_REASON,
177173
},
178174
},

src/type/introspection.js

Lines changed: 13 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -34,9 +34,7 @@ import { DirectiveLocation } from '../language/directiveLocation';
3434
export const __Schema = new GraphQLObjectType({
3535
name: '__Schema',
3636
description:
37-
'A GraphQL Schema defines the capabilities of a GraphQL server. It ' +
38-
'exposes all available types and directives on the server, as well as ' +
39-
'the entry points for query, mutation, and subscription operations.',
37+
'A GraphQL Schema defines the capabilities of a GraphQL server. It exposes all available types and directives on the server, as well as the entry points for query, mutation, and subscription operations.',
4038
fields: () => ({
4139
types: {
4240
description: 'A list of all types supported by this server.',
@@ -52,15 +50,13 @@ export const __Schema = new GraphQLObjectType({
5250
},
5351
mutationType: {
5452
description:
55-
'If this server supports mutation, the type that ' +
56-
'mutation operations will be rooted at.',
53+
'If this server supports mutation, the type that mutation operations will be rooted at.',
5754
type: __Type,
5855
resolve: schema => schema.getMutationType(),
5956
},
6057
subscriptionType: {
6158
description:
62-
'If this server support subscription, the type that ' +
63-
'subscription operations will be rooted at.',
59+
'If this server support subscription, the type that subscription operations will be rooted at.',
6460
type: __Type,
6561
resolve: schema => schema.getSubscriptionType(),
6662
},
@@ -75,12 +71,7 @@ export const __Schema = new GraphQLObjectType({
7571
export const __Directive = new GraphQLObjectType({
7672
name: '__Directive',
7773
description:
78-
'A Directive provides a way to describe alternate runtime execution and ' +
79-
'type validation behavior in a GraphQL document.' +
80-
"\n\nIn some cases, you need to provide options to alter GraphQL's " +
81-
'execution behavior in ways field arguments will not suffice, such as ' +
82-
'conditionally including or skipping a field. Directives provide this by ' +
83-
'describing additional information to the executor.',
74+
"A Directive provides a way to describe alternate runtime execution and type validation behavior in a GraphQL document.\n\nIn some cases, you need to provide options to alter GraphQL's execution behavior in ways field arguments will not suffice, such as conditionally including or skipping a field. Directives provide this by describing additional information to the executor.",
8475
fields: () => ({
8576
name: {
8677
type: GraphQLNonNull(GraphQLString),
@@ -104,8 +95,7 @@ export const __Directive = new GraphQLObjectType({
10495
export const __DirectiveLocation = new GraphQLEnumType({
10596
name: '__DirectiveLocation',
10697
description:
107-
'A Directive can be adjacent to many parts of the GraphQL language, a ' +
108-
'__DirectiveLocation describes one such possible adjacencies.',
98+
'A Directive can be adjacent to many parts of the GraphQL language, a __DirectiveLocation describes one such possible adjacencies.',
10999
values: {
110100
QUERY: {
111101
value: DirectiveLocation.QUERY,
@@ -189,14 +179,7 @@ export const __DirectiveLocation = new GraphQLEnumType({
189179
export const __Type = new GraphQLObjectType({
190180
name: '__Type',
191181
description:
192-
'The fundamental unit of any GraphQL Schema is the type. There are ' +
193-
'many kinds of types in GraphQL as represented by the `__TypeKind` enum.' +
194-
'\n\nDepending on the kind of a type, certain fields describe ' +
195-
'information about that type. Scalar types provide no information ' +
196-
'beyond a name and description, while Enum types provide their values. ' +
197-
'Object and Interface types provide the fields they describe. Abstract ' +
198-
'types, Union and Interface, provide the Object types possible ' +
199-
'at runtime. List and NonNull types compose other types.',
182+
'The fundamental unit of any GraphQL Schema is the type. There are many kinds of types in GraphQL as represented by the `__TypeKind` enum.\n\nDepending on the kind of a type, certain fields describe information about that type. Scalar types provide no information beyond a name and description, while Enum types provide their values. Object and Interface types provide the fields they describe. Abstract types, Union and Interface, provide the Object types possible at runtime. List and NonNull types compose other types.',
200183
fields: () => ({
201184
kind: {
202185
type: GraphQLNonNull(__TypeKind),
@@ -297,8 +280,7 @@ export const __Type = new GraphQLObjectType({
297280
export const __Field = new GraphQLObjectType({
298281
name: '__Field',
299282
description:
300-
'Object and Interface types are described by a list of Fields, each of ' +
301-
'which has a name, potentially a list of arguments, and a return type.',
283+
'Object and Interface types are described by a list of Fields, each of which has a name, potentially a list of arguments, and a return type.',
302284
fields: () => ({
303285
name: {
304286
type: GraphQLNonNull(GraphQLString),
@@ -330,9 +312,7 @@ export const __Field = new GraphQLObjectType({
330312
export const __InputValue = new GraphQLObjectType({
331313
name: '__InputValue',
332314
description:
333-
'Arguments provided to Fields or Directives and the input fields of an ' +
334-
'InputObject are represented as Input Values which describe their type ' +
335-
'and optionally a default value.',
315+
'Arguments provided to Fields or Directives and the input fields of an InputObject are represented as Input Values which describe their type and optionally a default value.',
336316
fields: () => ({
337317
name: {
338318
type: GraphQLNonNull(GraphQLString),
@@ -349,8 +329,7 @@ export const __InputValue = new GraphQLObjectType({
349329
defaultValue: {
350330
type: GraphQLString,
351331
description:
352-
'A GraphQL-formatted string representing the default value for this ' +
353-
'input value.',
332+
'A GraphQL-formatted string representing the default value for this input value.',
354333
resolve(inputVal) {
355334
const valueAST = astFromValue(inputVal.defaultValue, inputVal.type);
356335
return valueAST ? print(valueAST) : null;
@@ -362,9 +341,7 @@ export const __InputValue = new GraphQLObjectType({
362341
export const __EnumValue = new GraphQLObjectType({
363342
name: '__EnumValue',
364343
description:
365-
'One possible value for a given Enum. Enum values are unique values, not ' +
366-
'a placeholder for a string or numeric value. However an Enum value is ' +
367-
'returned in a JSON response as a string.',
344+
'One possible value for a given Enum. Enum values are unique values, not a placeholder for a string or numeric value. However an Enum value is returned in a JSON response as a string.',
368345
fields: () => ({
369346
name: {
370347
type: GraphQLNonNull(GraphQLString),
@@ -407,14 +384,12 @@ export const __TypeKind = new GraphQLEnumType({
407384
OBJECT: {
408385
value: TypeKind.OBJECT,
409386
description:
410-
'Indicates this type is an object. ' +
411-
'`fields` and `interfaces` are valid fields.',
387+
'Indicates this type is an object. `fields` and `interfaces` are valid fields.',
412388
},
413389
INTERFACE: {
414390
value: TypeKind.INTERFACE,
415391
description:
416-
'Indicates this type is an interface. ' +
417-
'`fields` and `possibleTypes` are valid fields.',
392+
'Indicates this type is an interface. `fields` and `possibleTypes` are valid fields.',
418393
},
419394
UNION: {
420395
value: TypeKind.UNION,
@@ -429,8 +404,7 @@ export const __TypeKind = new GraphQLEnumType({
429404
INPUT_OBJECT: {
430405
value: TypeKind.INPUT_OBJECT,
431406
description:
432-
'Indicates this type is an input object. ' +
433-
'`inputFields` is a valid field.',
407+
'Indicates this type is an input object. `inputFields` is a valid field.',
434408
},
435409
LIST: {
436410
value: TypeKind.LIST,

src/type/scalars.js

Lines changed: 4 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -61,8 +61,7 @@ function coerceInt(value: mixed): number {
6161
export const GraphQLInt = new GraphQLScalarType({
6262
name: 'Int',
6363
description:
64-
'The `Int` scalar type represents non-fractional signed whole numeric ' +
65-
'values. Int can represent values between -(2^31) and 2^31 - 1.',
64+
'The `Int` scalar type represents non-fractional signed whole numeric values. Int can represent values between -(2^31) and 2^31 - 1.',
6665
serialize: serializeInt,
6766
parseValue: coerceInt,
6867
parseLiteral(ast) {
@@ -105,9 +104,7 @@ function coerceFloat(value: mixed): number {
105104
export const GraphQLFloat = new GraphQLScalarType({
106105
name: 'Float',
107106
description:
108-
'The `Float` scalar type represents signed double-precision fractional ' +
109-
'values as specified by ' +
110-
'[IEEE 754](https://en.wikipedia.org/wiki/IEEE_floating_point).',
107+
'The `Float` scalar type represents signed double-precision fractional values as specified by [IEEE 754](https://en.wikipedia.org/wiki/IEEE_floating_point).',
111108
serialize: serializeFloat,
112109
parseValue: coerceFloat,
113110
parseLiteral(ast) {
@@ -165,9 +162,7 @@ function coerceString(value: mixed): string {
165162
export const GraphQLString = new GraphQLScalarType({
166163
name: 'String',
167164
description:
168-
'The `String` scalar type represents textual data, represented as UTF-8 ' +
169-
'character sequences. The String type is most often used by GraphQL to ' +
170-
'represent free-form human-readable text.',
165+
'The `String` scalar type represents textual data, represented as UTF-8 character sequences. The String type is most often used by GraphQL to represent free-form human-readable text.',
171166
serialize: serializeString,
172167
parseValue: coerceString,
173168
parseLiteral(ast) {
@@ -231,11 +226,7 @@ function coerceID(value: mixed): string {
231226
export const GraphQLID = new GraphQLScalarType({
232227
name: 'ID',
233228
description:
234-
'The `ID` scalar type represents a unique identifier, often used to ' +
235-
'refetch an object or as key for a cache. The ID type appears in a JSON ' +
236-
'response as a String; however, it is not intended to be human-readable. ' +
237-
'When expected as an input type, any string (such as `"4"`) or integer ' +
238-
'(such as `4`) input value will be accepted as an ID.',
229+
'The `ID` scalar type represents a unique identifier, often used to refetch an object or as key for a cache. The ID type appears in a JSON response as a String; however, it is not intended to be human-readable. When expected as an input type, any string (such as `"4"`) or integer (such as `4`) input value will be accepted as an ID.',
239230
serialize: serializeID,
240231
parseValue: coerceID,
241232
parseLiteral(ast) {

src/utilities/buildClientSchema.js

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -154,8 +154,7 @@ export function buildClientSchema(
154154
if (!type) {
155155
throw new Error(
156156
`Invalid or incomplete schema, unknown type: ${typeName}. Ensure ` +
157-
'that a full introspection query is used in order to build a ' +
158-
'client schema.',
157+
'that a full introspection query is used in order to build a client schema.',
159158
);
160159
}
161160

@@ -220,8 +219,7 @@ export function buildClientSchema(
220219
}
221220
}
222221
throw new Error(
223-
'Invalid or incomplete introspection result. Ensure that a full ' +
224-
'introspection query is used in order to build a client schema:' +
222+
'Invalid or incomplete introspection result. Ensure that a full introspection query is used in order to build a client schema:' +
225223
inspect(type),
226224
);
227225
}

0 commit comments

Comments
 (0)