Skip to content

Commit 8682f57

Browse files
Cleanup formatting of string literals (#1498)
1 parent 5d56adb commit 8682f57

File tree

12 files changed

+56
-62
lines changed

12 files changed

+56
-62
lines changed

src/__tests__/starWarsIntrospection-test.js

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -346,9 +346,8 @@ describe('Star Wars Introspection Tests', () => {
346346
{
347347
defaultValue: null,
348348
description:
349-
'If omitted, returns the hero of the whole ' +
350-
'saga. If provided, returns the hero of ' +
351-
'that particular episode.',
349+
'If omitted, returns the hero of the whole saga. ' +
350+
'If provided, returns the hero of that particular episode.',
352351
name: 'episode',
353352
type: {
354353
kind: 'ENUM',

src/__tests__/starWarsSchema.js

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -120,8 +120,7 @@ const characterInterface = new GraphQLInterfaceType({
120120
friends: {
121121
type: GraphQLList(characterInterface),
122122
description:
123-
'The friends of the character, or an empty list if they ' +
124-
'have none.',
123+
'The friends of the character, or an empty list if they have none.',
125124
},
126125
appearsIn: {
127126
type: GraphQLList(episodeEnum),
@@ -263,8 +262,8 @@ const queryType = new GraphQLObjectType({
263262
args: {
264263
episode: {
265264
description:
266-
'If omitted, returns the hero of the whole saga. If ' +
267-
'provided, returns the hero of that particular episode.',
265+
'If omitted, returns the hero of the whole saga. ' +
266+
'If provided, returns the hero of that particular episode.',
268267
type: episodeEnum,
269268
},
270269
},

src/error/__tests__/printError-test.js

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -49,9 +49,10 @@ describe('printError', () => {
4949
const sourceA = parse(
5050
new Source(
5151
dedent`
52-
type Foo {
53-
field: String
54-
}`,
52+
type Foo {
53+
field: String
54+
}
55+
`,
5556
'SourceA',
5657
),
5758
);
@@ -60,9 +61,10 @@ describe('printError', () => {
6061
const sourceB = parse(
6162
new Source(
6263
dedent`
63-
type Foo {
64-
field: Int
65-
}`,
64+
type Foo {
65+
field: Int
66+
}
67+
`,
6668
'SourceB',
6769
),
6870
);

src/execution/execute.js

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -336,8 +336,7 @@ export function buildExecutionContext(
336336
} else if (hasMultipleAssumedOperations) {
337337
errors.push(
338338
new GraphQLError(
339-
'Must provide operation name if query contains ' +
340-
'multiple operations.',
339+
'Must provide operation name if query contains multiple operations.',
341340
),
342341
);
343342
}
@@ -1049,8 +1048,7 @@ function ensureValidRuntimeType(
10491048
`runtime for field ${info.parentType.name}.${info.fieldName} with ` +
10501049
`value ${inspect(result)}, received "${inspect(runtimeType)}". ` +
10511050
`Either the ${returnType.name} type should provide a "resolveType" ` +
1052-
'function or each possible type should provide an ' +
1053-
'"isTypeOf" function.',
1051+
'function or each possible type should provide an "isTypeOf" function.',
10541052
fieldNodes,
10551053
);
10561054
}

src/execution/values.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -98,8 +98,8 @@ export function getVariableValues(
9898
if (coercionErrors) {
9999
for (const error of coercionErrors) {
100100
error.message =
101-
`Variable "$${varName}" got invalid ` +
102-
`value ${inspect(value)}; ${error.message}`;
101+
`Variable "$${varName}" got invalid value ${inspect(value)}; ` +
102+
error.message;
103103
}
104104
errors.push(...coercionErrors);
105105
} else {

src/jsutils/__tests__/dedent-test.js

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,12 @@ describe('dedent', () => {
1515
type Query {
1616
me: User
1717
}
18-
18+
1919
type User {
2020
id: ID
2121
name: String
2222
}
23-
`;
23+
`;
2424
expect(output).to.equal(
2525
[
2626
'type Query {',
@@ -42,7 +42,7 @@ describe('dedent', () => {
4242
quux
4343
quuux
4444
quuuux
45-
`;
45+
`;
4646
expect(output).to.equal(
4747
['qux', ' quux', ' quuux', ' quuuux', ''].join('\n'),
4848
);
@@ -53,7 +53,7 @@ describe('dedent', () => {
5353
type Root {
5454
field(arg: String = "wi\th de\fault"): String
5555
}
56-
`;
56+
`;
5757
expect(output).to.equal(
5858
[
5959
'type Root {',
@@ -69,7 +69,7 @@ describe('dedent', () => {
6969
type Query {
7070
me: User
7171
}
72-
`);
72+
`);
7373
expect(output).to.equal(['type Query {', ' me: User', '}', ''].join('\n'));
7474
});
7575

@@ -78,7 +78,7 @@ describe('dedent', () => {
7878
\t\t type Query {
7979
\t\t me: User
8080
\t\t }
81-
`;
81+
`;
8282
expect(output).to.equal(['type Query {', ' me: User', '}', ''].join('\n'));
8383
});
8484

@@ -98,7 +98,7 @@ describe('dedent', () => {
9898
me: User
9999
}
100100
101-
`;
101+
`;
102102
expect(output).to.equal(
103103
['type Query {', ' me: User', '}', '', ''].join('\n'),
104104
);
@@ -124,13 +124,13 @@ describe('dedent', () => {
124124
const name = 'Luke Skywalker';
125125
const age = 42;
126126
const output = dedent`
127-
{
128-
"me": {
129-
"name": "${name}"
130-
"age": ${age}
131-
}
127+
{
128+
"me": {
129+
"name": "${name}"
130+
"age": ${age}
132131
}
133-
`;
132+
}
133+
`;
134134
expect(output).to.equal(
135135
[
136136
'{',

src/jsutils/dedent.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ function fixIndent(str: string): string {
3131
* {
3232
* test
3333
* }
34-
* `
34+
* `;
3535
* str === "{\n test\n}\n";
3636
*/
3737
export default function dedent(

src/type/__tests__/introspection-test.js

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1293,8 +1293,7 @@ describe('Introspection', () => {
12931293
'A GraphQL Schema defines the capabilities of a ' +
12941294
'GraphQL server. It exposes all available types and ' +
12951295
'directives on the server, as well as the entry ' +
1296-
'points for query, mutation, ' +
1297-
'and subscription operations.',
1296+
'points for query, mutation, and subscription operations.',
12981297
fields: [
12991298
{
13001299
name: 'types',
@@ -1391,14 +1390,12 @@ describe('Introspection', () => {
13911390
},
13921391
{
13931392
description:
1394-
'Indicates this type is a list. ' +
1395-
'`ofType` is a valid field.',
1393+
'Indicates this type is a list. `ofType` is a valid field.',
13961394
name: 'LIST',
13971395
},
13981396
{
13991397
description:
1400-
'Indicates this type is a non-null. ' +
1401-
'`ofType` is a valid field.',
1398+
'Indicates this type is a non-null. `ofType` is a valid field.',
14021399
name: 'NON_NULL',
14031400
},
14041401
],

src/utilities/__tests__/buildASTSchema-test.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@ describe('Schema Builder', () => {
144144
});
145145

146146
it('Maintains @skip & @include', () => {
147-
const body = dedent`
147+
const body = `
148148
type Query {
149149
str: String
150150
}
@@ -159,7 +159,7 @@ describe('Schema Builder', () => {
159159
});
160160

161161
it('Overriding directives excludes specified', () => {
162-
const body = dedent`
162+
const body = `
163163
directive @skip on FIELD
164164
directive @include on FIELD
165165
directive @deprecated on FIELD_DEFINITION
@@ -180,7 +180,7 @@ describe('Schema Builder', () => {
180180
});
181181

182182
it('Adding directives maintains @skip & @include', () => {
183-
const body = dedent`
183+
const body = `
184184
directive @foo(arg: Int) on FIELD
185185
186186
type Query {
@@ -357,7 +357,7 @@ describe('Schema Builder', () => {
357357
});
358358

359359
it('Can build recursive Union', () => {
360-
const schema = buildSchema(dedent`
360+
const schema = buildSchema(`
361361
union Hello = Hello
362362
363363
type Query {
@@ -369,7 +369,7 @@ describe('Schema Builder', () => {
369369
});
370370

371371
it('Specifying Union type using __typename', () => {
372-
const schema = buildSchema(dedent`
372+
const schema = buildSchema(`
373373
type Query {
374374
fruits: [Fruit]
375375
}
@@ -426,7 +426,7 @@ describe('Schema Builder', () => {
426426
});
427427

428428
it('Specifying Interface type using __typename', () => {
429-
const schema = buildSchema(dedent`
429+
const schema = buildSchema(`
430430
type Query {
431431
characters: [Character]
432432
}

src/utilities/__tests__/lexicographicSortSchema-test.js

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ function sortSDL(sdl) {
1919

2020
describe('lexicographicSortSchema', () => {
2121
it('sort fields', () => {
22-
const sorted = sortSDL(dedent`
22+
const sorted = sortSDL(`
2323
input Bar {
2424
barB: String
2525
barA: String
@@ -69,7 +69,7 @@ describe('lexicographicSortSchema', () => {
6969
});
7070

7171
it('sort implemented interfaces', () => {
72-
const sorted = sortSDL(dedent`
72+
const sorted = sortSDL(`
7373
interface FooA {
7474
dummy: String
7575
}
@@ -107,7 +107,7 @@ describe('lexicographicSortSchema', () => {
107107
});
108108

109109
it('sort types in union', () => {
110-
const sorted = sortSDL(dedent`
110+
const sorted = sortSDL(`
111111
type FooA {
112112
dummy: String
113113
}
@@ -149,7 +149,7 @@ describe('lexicographicSortSchema', () => {
149149
});
150150

151151
it('sort enum values', () => {
152-
const sorted = sortSDL(dedent`
152+
const sorted = sortSDL(`
153153
enum Foo {
154154
B
155155
C
@@ -175,7 +175,7 @@ describe('lexicographicSortSchema', () => {
175175
});
176176

177177
it('sort field arguments', () => {
178-
const sorted = sortSDL(dedent`
178+
const sorted = sortSDL(`
179179
type Query {
180180
dummy(argB: Int, argA: String, argC: Float): ID
181181
}
@@ -189,7 +189,7 @@ describe('lexicographicSortSchema', () => {
189189
});
190190

191191
it('sort types', () => {
192-
const sorted = sortSDL(dedent`
192+
const sorted = sortSDL(`
193193
type Query {
194194
dummy(arg1: FooF, arg2: FooA, arg3: FooG): FooD
195195
}
@@ -251,7 +251,7 @@ describe('lexicographicSortSchema', () => {
251251
});
252252

253253
it('sort directive arguments', () => {
254-
const sorted = sortSDL(dedent`
254+
const sorted = sortSDL(`
255255
directive @test(argC: Float, argA: String, argB: Int) on FIELD
256256
257257
type Query {
@@ -269,7 +269,7 @@ describe('lexicographicSortSchema', () => {
269269
});
270270

271271
it('sort directive locations', () => {
272-
const sorted = sortSDL(dedent`
272+
const sorted = sortSDL(`
273273
directive @test(argC: Float, argA: String, argB: Int) on UNION | FIELD | ENUM
274274
275275
type Query {
@@ -287,7 +287,7 @@ describe('lexicographicSortSchema', () => {
287287
});
288288

289289
it('sort directives', () => {
290-
const sorted = sortSDL(dedent`
290+
const sorted = sortSDL(`
291291
directive @fooC on FIELD
292292
293293
directive @fooB on UNION
@@ -313,7 +313,7 @@ describe('lexicographicSortSchema', () => {
313313
});
314314

315315
it('sort recursive types', () => {
316-
const sorted = sortSDL(dedent`
316+
const sorted = sortSDL(`
317317
interface FooC {
318318
fooB: FooB
319319
fooA: FooA

0 commit comments

Comments
 (0)