Skip to content

Commit

Permalink
prettier
Browse files Browse the repository at this point in the history
  • Loading branch information
JoviDeCroock committed Aug 5, 2022
1 parent a6a2403 commit 730e58b
Show file tree
Hide file tree
Showing 21 changed files with 98 additions and 88 deletions.
4 changes: 2 additions & 2 deletions src/execution/collectFields.ts
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ export function collectSubfields(
const subFieldNodes = new AccumulatorMap<string, FieldNode>();
const visitedFragmentNames = new Set<string>();
for (let i = 0; i < fieldNodes.length; i++) {
const node = fieldNodes[i]
const node = fieldNodes[i];
if (node.selectionSet) {
collectFieldsImpl(
schema,
Expand All @@ -98,7 +98,7 @@ function collectFieldsImpl(
visitedFragmentNames: Set<string>,
): void {
for (let i = 0; i < selectionSet.selections.length; i++) {
const selection = selectionSet.selections[i]
const selection = selectionSet.selections[i];
switch (selection.kind) {
case Kind.FIELD: {
if (!shouldIncludeNode(variableValues, selection)) {
Expand Down
10 changes: 6 additions & 4 deletions src/execution/execute.ts
Original file line number Diff line number Diff line change
Expand Up @@ -266,7 +266,7 @@ export function buildExecutionContext(
let operation: OperationDefinitionNode | undefined;
const fragments: ObjMap<FragmentDefinitionNode> = Object.create(null);
for (let i = 0; i < document.definitions.length; i++) {
const definition = document.definitions[i]
const definition = document.definitions[i];
switch (definition.kind) {
case Kind.OPERATION_DEFINITION:
if (operationName == null) {
Expand Down Expand Up @@ -432,9 +432,9 @@ function executeFields(
const results = Object.create(null);
let containsPromise = false;

const fieldsEntries = Array.from(fields.entries())
const fieldsEntries = Array.from(fields.entries());
for (let i = 0; i < fieldsEntries.length; i++) {
const { 0: responseName, 1: fieldNodes } = fieldsEntries[i]
const { 0: responseName, 1: fieldNodes } = fieldsEntries[i];
const fieldPath = addPath(path, responseName, parentType.name);
const result = executeField(
exeContext,
Expand Down Expand Up @@ -1230,7 +1230,9 @@ function executeSubscription(
rootType,
operation.selectionSet,
);
const {0:responseName, 1:fieldNodes} = Array.from(rootFields.entries())[0];
const { 0: responseName, 1: fieldNodes } = Array.from(
rootFields.entries(),
)[0];
const fieldName = fieldNodes[0].name.value;
const fieldDef = schema.getField(rootType, fieldName);

Expand Down
4 changes: 2 additions & 2 deletions src/execution/values.ts
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ function coerceVariableValues(
): { [variable: string]: unknown } {
const coercedValues: { [variable: string]: unknown } = {};
for (let i = 0; i < varDefNodes.length; i++) {
const varDefNode = varDefNodes[i]
const varDefNode = varDefNodes[i];
const varName = varDefNode.variable.name.value;
const varType = typeFromAST(schema, varDefNode.type);
if (!isInputType(varType)) {
Expand Down Expand Up @@ -163,7 +163,7 @@ export function getArgumentValues(
const argNodeMap = keyMap(argumentNodes, (arg) => arg.name.value);

for (let i = 0; i < def.args.length; i++) {
const argDef = def.args[i]
const argDef = def.args[i];
const name = argDef.name;
const argType = argDef.type;
const argumentNode = argNodeMap[name];
Expand Down
2 changes: 1 addition & 1 deletion src/jsutils/groupBy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ export function groupBy<K, T>(
): Map<K, ReadonlyArray<T>> {
const result = new AccumulatorMap<K, T>();
for (let i = 0; i < list.length; i++) {
const item = list[i]
const item = list[i];
result.add(keyFn(item), item);
}
return result;
Expand Down
2 changes: 1 addition & 1 deletion src/jsutils/keyMap.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ export function keyMap<T>(
): ObjMap<T> {
const result = Object.create(null);
for (let i = 0; i < list.length; i++) {
const key = list[i]
const key = list[i];
result[keyFn(key)] = key;
}
return result;
Expand Down
2 changes: 1 addition & 1 deletion src/jsutils/keyValMap.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ export function keyValMap<T, V>(
): ObjMap<V> {
const result = Object.create(null);
for (let i = 0; i < list.length; i++) {
const item = list[i]
const item = list[i];
result[keyFn(item)] = valFn(item);
}
return result;
Expand Down
4 changes: 2 additions & 2 deletions src/jsutils/mapValue.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@ export function mapValue<T, V>(
fn: (value: T, key: string) => V,
): ObjMap<V> {
const result = Object.create(null);
const keys = Object.keys(map)
const keys = Object.keys(map);
for (let i = 0; i < keys.length; i++) {
const key = keys[i]
const key = keys[i];
result[key] = fn(map[key], key);
}
return result;
Expand Down
4 changes: 2 additions & 2 deletions src/jsutils/toObjMap.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@ export function toObjMap<T>(
}

const map = Object.create(null);
const entries = Object.entries(obj)
const entries = Object.entries(obj);
for (let i = 0; i < entries.length; i++) {
const { 0: key, 1: value } = entries[i]
const { 0: key, 1: value } = entries[i];
map[key] = value;
}
return map;
Expand Down
10 changes: 5 additions & 5 deletions src/language/visitor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ export type ASTVisitorKeyMap = {
};

export const BREAK: unknown = Object.freeze({});
const KINDS = Object.values(Kind)
const KINDS = Object.values(Kind);

/**
* visit() will walk through an AST using a depth-first traversal, calling
Expand Down Expand Up @@ -182,7 +182,7 @@ export function visit(
): any {
const enterLeaveMap = new Map<Kind, EnterLeaveVisitor<ASTNode>>();
for (let i = 0; i < KINDS.length; i++) {
const kind = KINDS[i]
const kind = KINDS[i];
enterLeaveMap.set(kind, getEnterLeaveForKind(visitor, kind));
}

Expand Down Expand Up @@ -213,7 +213,7 @@ export function visit(

let editOffset = 0;
for (let i = 0; i < edits.length; i++) {
const { 0: editKey, 1: editValue } = edits[i]
const { 0: editKey, 1: editValue } = edits[i];
const arrayKey = editKey - editOffset;
if (editValue === null) {
node.splice(arrayKey, 1);
Expand All @@ -228,7 +228,7 @@ export function visit(
Object.getOwnPropertyDescriptors(node),
);
for (let i = 0; i < edits.length; i++) {
const { 0: editKey, 1: editValue } = edits[i]
const { 0: editKey, 1: editValue } = edits[i];
node[editKey] = editValue;
}
}
Expand Down Expand Up @@ -319,7 +319,7 @@ export function visitInParallel(
const mergedVisitor = Object.create(null);

for (let j = 0; j < KINDS.length; j++) {
const kind = KINDS[j]
const kind = KINDS[j];
let hasVisitor = false;
const enterList = new Array(visitors.length).fill(undefined);
const leaveList = new Array(visitors.length).fill(undefined);
Expand Down
26 changes: 13 additions & 13 deletions src/type/schema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ export class GraphQLSchema {
const allReferencedTypes = new Set<GraphQLNamedType>(config.types);
if (config.types != null) {
for (let i = 0; i < config.types.length; i++) {
const type = config.types[i]
const type = config.types[i];
// When we ready to process this type, we remove it from "collected" types
// and then add it together with all dependent types in the correct position.
allReferencedTypes.delete(type);
Expand All @@ -192,11 +192,11 @@ export class GraphQLSchema {
}

for (let i = 0; i < this._directives.length; i++) {
const directive = this._directives[i]
const directive = this._directives[i];
// Directives are not validated until validateSchema() is called.
if (isDirective(directive)) {
for (let j = 0; j < directive.args.length; j++) {
const arg = directive.args[j]
for (let j = 0; j < directive.args.length; j++) {
const arg = directive.args[j];
collectReferencedTypes(arg.type, allReferencedTypes);
}
}
Expand All @@ -209,9 +209,9 @@ export class GraphQLSchema {
// Keep track of all implementations by interface name.
this._implementationsMap = Object.create(null);

const refTypes = Array.from(allReferencedTypes)
const refTypes = Array.from(allReferencedTypes);
for (let j = 0; j < refTypes.length; j++) {
const namedType = refTypes[j]
const namedType = refTypes[j];
if (namedType == null) {
continue;
}
Expand All @@ -228,7 +228,7 @@ export class GraphQLSchema {
// Store implementations by interface.
const interfaces = namedType.getInterfaces();
for (let i = 0; i < interfaces.length; i++) {
const iface = interfaces[i]
const iface = interfaces[i];
if (isInterfaceType(iface)) {
let implementations = this._implementationsMap[iface.name];
if (implementations === undefined) {
Expand All @@ -245,7 +245,7 @@ export class GraphQLSchema {
// Store implementations by objects.
const interfaces = namedType.getInterfaces();
for (let i = 0; i < interfaces.length; i++) {
const iface = interfaces[i]
const iface = interfaces[i];
if (isInterfaceType(iface)) {
let implementations = this._implementationsMap[iface.name];
if (implementations === undefined) {
Expand Down Expand Up @@ -322,7 +322,7 @@ export class GraphQLSchema {
map = Object.create(null);

if (isUnionType(abstractType)) {
const types = abstractType.getTypes()
const types = abstractType.getTypes();
for (let i = 0; i < types.length; i++) {
map[types[i].name] = true;
}
Expand Down Expand Up @@ -452,21 +452,21 @@ function collectReferencedTypes(
collectReferencedTypes(types[i], typeSet);
}
} else if (isObjectType(namedType) || isInterfaceType(namedType)) {
const interfaces = namedType.getInterfaces()
const interfaces = namedType.getInterfaces();
for (let i = 0; i < interfaces.length; i++) {
collectReferencedTypes(interfaces[i], typeSet);
}

const fields = Object.values(namedType.getFields())
const fields = Object.values(namedType.getFields());
for (let i = 0; i < fields.length; i++) {
const field = fields[i]
const field = fields[i];
collectReferencedTypes(field.type, typeSet);
for (let j = 0; j < field.args.length; j++) {
collectReferencedTypes(field.args[j].type, typeSet);
}
}
} else if (isInputObjectType(namedType)) {
const fields = Object.values(namedType.getFields())
const fields = Object.values(namedType.getFields());
for (let i = 0; i < fields.length; i++) {
collectReferencedTypes(fields[i].type, typeSet);
}
Expand Down
Loading

0 comments on commit 730e58b

Please sign in to comment.