Skip to content

Commit 65fb7a8

Browse files
committed
style: run prettier
1 parent 502e720 commit 65fb7a8

21 files changed

+82
-61
lines changed

src/__testUtils__/__tests__/genFuzzStrings-test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@ import { describe, it } from 'mocha';
44
import genFuzzStrings from '../genFuzzStrings';
55

66
function expectFuzzStrings(options: {
7-
allowedChars: Array<string>,
8-
maxLength: number,
7+
allowedChars: Array<string>;
8+
maxLength: number;
99
}) {
1010
return expect(Array.from(genFuzzStrings(options)));
1111
}

src/__testUtils__/genFuzzStrings.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22
* Generator that produces all possible combinations of allowed characters.
33
*/
44
export default function* genFuzzStrings(options: {
5-
allowedChars: Array<string>,
6-
maxLength: number,
5+
allowedChars: Array<string>;
6+
maxLength: number;
77
}): Generator<string, void, void> {
88
const { allowedChars, maxLength } = options;
99
const numAllowedChars = allowedChars.length;

src/__tests__/starWarsData.ts

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -3,28 +3,28 @@
33
* They represent the shape of the data visited during field resolution.
44
*/
55
export type Character = {
6-
id: string,
7-
name: string,
8-
friends: Array<string>,
9-
appearsIn: Array<number>,
6+
id: string;
7+
name: string;
8+
friends: Array<string>;
9+
appearsIn: Array<number>;
1010
};
1111

1212
export type Human = {
13-
type: 'Human',
14-
id: string,
15-
name: string,
16-
friends: Array<string>,
17-
appearsIn: Array<number>,
18-
homePlanet?: string,
13+
type: 'Human';
14+
id: string;
15+
name: string;
16+
friends: Array<string>;
17+
appearsIn: Array<number>;
18+
homePlanet?: string;
1919
};
2020

2121
export type Droid = {
22-
type: 'Droid',
23-
id: string,
24-
name: string,
25-
friends: Array<string>,
26-
appearsIn: Array<number>,
27-
primaryFunction: string,
22+
type: 'Droid';
23+
id: string;
24+
name: string;
25+
friends: Array<string>;
26+
appearsIn: Array<number>;
27+
primaryFunction: string;
2828
};
2929

3030
/**

src/error/formatError.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,22 +29,22 @@ export type GraphQLFormattedError = {
2929
* from occurrence to occurrence of the problem, except for purposes of
3030
* localization.
3131
*/
32-
readonly message: string,
32+
readonly message: string;
3333
/**
3434
* If an error can be associated to a particular point in the requested
3535
* GraphQL document, it should contain a list of locations.
3636
*/
37-
readonly locations: ReadonlyArray<SourceLocation> | void,
37+
readonly locations: ReadonlyArray<SourceLocation> | void;
3838
/**
3939
* If an error can be associated to a particular field in the GraphQL result,
4040
* it _must_ contain an entry with the key `path` that details the path of
4141
* the response field which experienced the error. This allows clients to
4242
* identify whether a null result is intentional or caused by a runtime error.
4343
*/
44-
readonly path: ReadonlyArray<string | number> | void,
44+
readonly path: ReadonlyArray<string | number> | void;
4545
/**
4646
* Reserved for implementors to extend the protocol however they see fit,
4747
* and hence there are no additional restrictions on its contents.
4848
*/
49-
readonly extensions?: { [key: string]: unknown },
49+
readonly extensions?: { [key: string]: unknown };
5050
};

src/execution/__tests__/lists-test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ describe('Execute: Accepts any iterable as list value', () => {
6565
});
6666

6767
describe('Execute: Handles list nullability', () => {
68-
async function complete(args: { listField: unknown, as: string }) {
68+
async function complete(args: { listField: unknown; as: string }) {
6969
const { listField, as } = args;
7070
const schema = buildSchema(`type Query { listField: ${as} }`);
7171
const document = parse('{ listField }');

src/graphql.ts

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -57,14 +57,14 @@ import { Maybe } from './jsutils/Maybe';
5757
* `__typename` field or alternatively calls the `isTypeOf` method).
5858
*/
5959
export type GraphQLArgs = {
60-
schema: GraphQLSchema,
61-
source: string | Source,
62-
rootValue?: unknown,
63-
contextValue?: unknown,
64-
variableValues?: Maybe<{ readonly [variable: string]: unknown }>,
65-
operationName?: Maybe<string>,
66-
fieldResolver?: Maybe<GraphQLFieldResolver<any, any>>,
67-
typeResolver?: Maybe<GraphQLTypeResolver<any, any>>,
60+
schema: GraphQLSchema;
61+
source: string | Source;
62+
rootValue?: unknown;
63+
contextValue?: unknown;
64+
variableValues?: Maybe<{ readonly [variable: string]: unknown }>;
65+
operationName?: Maybe<string>;
66+
fieldResolver?: Maybe<GraphQLFieldResolver<any, any>>;
67+
typeResolver?: Maybe<GraphQLTypeResolver<any, any>>;
6868
};
6969

7070
export function graphql(args: GraphQLArgs): Promise<ExecutionResult> {

src/jsutils/ObjMap.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
export type ObjMap<T> = { [key: string]: T, __proto__: null };
1+
export type ObjMap<T> = { [key: string]: T; __proto__: null };
22
export type ObjMapLike<T> = ObjMap<T> | { [key: string]: T };
33

4-
export type ReadOnlyObjMap<T> = { readonly [key: string]: T, __proto__: null };
4+
export type ReadOnlyObjMap<T> = { readonly [key: string]: T; __proto__: null };
55
export type ReadOnlyObjMapLike<T> =
66
| ReadOnlyObjMap<T>
77
| { readonly [key: string]: T };

src/jsutils/Path.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
import { Maybe } from './Maybe';
22

33
export type Path = {
4-
readonly prev: Path | void,
5-
readonly key: string | number,
6-
readonly typename: string | void,
4+
readonly prev: Path | void;
5+
readonly key: string | number;
6+
readonly typename: string | void;
77
};
88

99
/**

src/jsutils/inspect.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,10 @@ function formatObject(object: Object, seenValues: Array<unknown>): string {
7070
return '{ ' + properties.join(', ') + ' }';
7171
}
7272

73-
function formatArray(array: Array<unknown>, seenValues: Array<unknown>): string {
73+
function formatArray(
74+
array: Array<unknown>,
75+
seenValues: Array<unknown>,
76+
): string {
7477
if (array.length === 0) {
7578
return '[]';
7679
}

src/language/__tests__/schema-parser-test.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,12 @@ function fieldNode(name: unknown, type: unknown, loc: unknown) {
3232
return fieldNodeWithArgs(name, type, [], loc);
3333
}
3434

35-
function fieldNodeWithArgs(name: unknown, type: unknown, args: unknown, loc: unknown) {
35+
function fieldNodeWithArgs(
36+
name: unknown,
37+
type: unknown,
38+
args: unknown,
39+
loc: unknown,
40+
) {
3641
return {
3742
kind: 'FieldDefinition',
3843
description: undefined,

src/language/__tests__/source-test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ describe('Source', () => {
2525
});
2626

2727
it('rejects invalid locationOffset', () => {
28-
function createSource(locationOffset: { line: number, column: number }) {
28+
function createSource(locationOffset: { line: number; column: number }) {
2929
return new Source('', '', locationOffset);
3030
}
3131

src/language/location.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@ import type { Source } from './source';
44
* Represents a location in a Source.
55
*/
66
export type SourceLocation = {
7-
readonly line: number,
8-
readonly column: number,
7+
readonly line: number;
8+
readonly column: number;
99
};
1010

1111
/**

src/subscription/__tests__/subscribe-test.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,10 @@ import { createSourceEventStream, subscribe } from '../subscribe';
2020
import SimplePubSub from './simplePubSub';
2121

2222
type Email = {
23-
from: string,
24-
subject: string,
25-
message: string,
26-
unread: boolean,
23+
from: string;
24+
subject: string;
25+
message: string;
26+
unread: boolean;
2727
};
2828

2929
const EmailType = new GraphQLObjectType({

src/utilities/__tests__/buildASTSchema-test.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,9 @@ function cycleSDL(sdl: string): string {
5252
return printSchema(buildSchema(sdl));
5353
}
5454

55-
function printASTNode(obj: Maybe<{ readonly astNode: Maybe<ASTNode> }>): string {
55+
function printASTNode(
56+
obj: Maybe<{ readonly astNode: Maybe<ASTNode> }>,
57+
): string {
5658
invariant(obj?.astNode != null);
5759
return print(obj.astNode);
5860
}

src/utilities/__tests__/extendSchema-test.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,9 @@ import { extendSchema } from '../extendSchema';
3838
import { buildSchema } from '../buildASTSchema';
3939
import { Maybe } from '../../jsutils/Maybe';
4040

41-
function printExtensionNodes(obj: Maybe<GraphQLNamedType | GraphQLSchema>): string {
41+
function printExtensionNodes(
42+
obj: Maybe<GraphQLNamedType | GraphQLSchema>,
43+
): string {
4244
invariant(obj?.extensionASTNodes != null);
4345
return print({
4446
kind: Kind.DOCUMENT,
@@ -60,7 +62,9 @@ function printSchemaChanges(
6062
});
6163
}
6264

63-
function printASTNode(obj: Maybe<{ readonly astNode: Maybe<ASTNode> }>): string {
65+
function printASTNode(
66+
obj: Maybe<{ readonly astNode: Maybe<ASTNode> }>,
67+
): string {
6468
invariant(obj?.astNode != null);
6569
return print(obj.astNode);
6670
}

src/utilities/__tests__/printSchema-test.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,9 @@ function expectPrintedSchema(schema: GraphQLSchema) {
3030
return expect(schemaText);
3131
}
3232

33-
function buildSingleFieldSchema(fieldConfig: GraphQLFieldConfig<unknown, unknown>) {
33+
function buildSingleFieldSchema(
34+
fieldConfig: GraphQLFieldConfig<unknown, unknown>,
35+
) {
3436
const Query = new GraphQLObjectType({
3537
name: 'Query',
3638
fields: { singleField: fieldConfig },

src/utilities/__tests__/valueFromASTUntyped-test.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,10 @@ import { parseValue } from '../../language/parser';
99
import { valueFromASTUntyped } from '../valueFromASTUntyped';
1010

1111
describe('valueFromASTUntyped', () => {
12-
function expectValueFrom(valueText: string, variables?: Maybe<ObjMap<unknown>>) {
12+
function expectValueFrom(
13+
valueText: string,
14+
variables?: Maybe<ObjMap<unknown>>,
15+
) {
1316
const ast = parseValue(valueText);
1417
const value = valueFromASTUntyped(ast, variables);
1518
return expect(value);

src/utilities/getOperationAST.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import { Kind } from '../language/kinds';
1010
export function getOperationAST(
1111
documentAST: DocumentNode,
1212
operationName?: Maybe<string>,
13-
): Maybe<OperationDefinitionNode> {
13+
): Maybe<OperationDefinitionNode> {
1414
let operation = null;
1515
for (const definition of documentAST.definitions) {
1616
if (definition.kind === Kind.OPERATION_DEFINITION) {

src/validation/ValidationContext.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,9 @@ import { Maybe } from '../jsutils/Maybe';
3131

3232
type NodeWithSelectionSet = OperationDefinitionNode | FragmentDefinitionNode;
3333
type VariableUsage = {
34-
readonly node: VariableNode,
35-
readonly type: Maybe<GraphQLInputType>,
36-
readonly defaultValue: Maybe<unknown>,
34+
readonly node: VariableNode;
35+
readonly type: Maybe<GraphQLInputType>;
36+
readonly defaultValue: Maybe<unknown>;
3737
};
3838

3939
/**
@@ -48,7 +48,7 @@ export class ASTValidationContext {
4848
_fragmentSpreads: Map<SelectionSetNode, ReadonlyArray<FragmentSpreadNode>>;
4949
_recursivelyReferencedFragments: Map<
5050
OperationDefinitionNode,
51-
ReadonlyArray<FragmentDefinitionNode>,
51+
ReadonlyArray<FragmentDefinitionNode>
5252
>;
5353

5454
constructor(ast: DocumentNode, onError: (err: GraphQLError) => void): void {
@@ -160,7 +160,7 @@ export class ValidationContext extends ASTValidationContext {
160160
_variableUsages: Map<NodeWithSelectionSet, ReadonlyArray<VariableUsage>>;
161161
_recursiveVariableUsages: Map<
162162
OperationDefinitionNode,
163-
ReadonlyArray<VariableUsage>,
163+
ReadonlyArray<VariableUsage>
164164
>;
165165

166166
constructor(

src/validation/rules/FieldsOnCorrectTypeRule.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ function getSuggestedTypeNames(
8080
}
8181

8282
const suggestedTypes: Set<
83-
GraphQLObjectType | GraphQLInterfaceType,
83+
GraphQLObjectType | GraphQLInterfaceType
8484
> = new Set();
8585
const usageCount = Object.create(null);
8686
for (const possibleType of schema.getPossibleTypes(type)) {

src/validation/rules/UniqueFieldDefinitionNamesRule.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,10 @@ export function UniqueFieldDefinitionNamesRule(
3838
};
3939

4040
function checkFieldUniqueness(node: {
41-
readonly name: NameNode,
42-
readonly fields?: ReadonlyArray<InputValueDefinitionNode | FieldDefinitionNode>,
41+
readonly name: NameNode;
42+
readonly fields?: ReadonlyArray<
43+
InputValueDefinitionNode | FieldDefinitionNode
44+
>;
4345
}) {
4446
const typeName = node.name.value;
4547

0 commit comments

Comments
 (0)