Skip to content

Commit

Permalink
Sort imports in all JS files (#2059)
Browse files Browse the repository at this point in the history
  • Loading branch information
IvanGoncharov committed Jul 28, 2019
1 parent fc4058d commit 5c9946b
Show file tree
Hide file tree
Showing 184 changed files with 831 additions and 435 deletions.
4 changes: 3 additions & 1 deletion src/__tests__/starWarsIntrospection-test.js
Expand Up @@ -2,9 +2,11 @@

import { expect } from 'chai';
import { describe, it } from 'mocha';
import { StarWarsSchema } from './starWarsSchema';

import { graphqlSync } from '../graphql';

import { StarWarsSchema } from './starWarsSchema';

describe('Star Wars Introspection Tests', () => {
describe('Basic Introspection', () => {
it('Allows querying the schema for types', () => {
Expand Down
4 changes: 3 additions & 1 deletion src/__tests__/starWarsQuery-test.js
Expand Up @@ -2,9 +2,11 @@

import { expect } from 'chai';
import { describe, it } from 'mocha';
import { StarWarsSchema } from './starWarsSchema';

import { graphql } from '../graphql';

import { StarWarsSchema } from './starWarsSchema';

describe('Star Wars Query Tests', () => {
describe('Basic Queries', () => {
it('Correctly identifies R2-D2 as the hero of the Star Wars Saga', async () => {
Expand Down
7 changes: 5 additions & 2 deletions src/__tests__/starWarsValidation-test.js
Expand Up @@ -2,11 +2,14 @@

import { expect } from 'chai';
import { describe, it } from 'mocha';
import { StarWarsSchema } from './starWarsSchema';
import { Source } from '../language/source';

import { parse } from '../language/parser';
import { Source } from '../language/source';

import { validate } from '../validation/validate';

import { StarWarsSchema } from './starWarsSchema';

/**
* Helper function to test a query and the expected response.
*/
Expand Down
1 change: 1 addition & 0 deletions src/__tests__/version-test.js
Expand Up @@ -2,6 +2,7 @@

import { expect } from 'chai';
import { describe, it } from 'mocha';

import { version, versionInfo } from '../version';

describe('Version', () => {
Expand Down
1 change: 1 addition & 0 deletions src/error/GraphQLError.js
@@ -1,6 +1,7 @@
// @flow strict

import isObjectLike from '../jsutils/isObjectLike';

import { type ASTNode } from '../language/ast';
import { type Source } from '../language/source';
import { type SourceLocation, getLocation } from '../language/location';
Expand Down
1 change: 1 addition & 0 deletions src/error/__tests__/GraphQLError-test.js
Expand Up @@ -5,6 +5,7 @@ import { describe, it } from 'mocha';

import dedent from '../../jsutils/dedent';
import invariant from '../../jsutils/invariant';

import {
Kind,
parse,
Expand Down
4 changes: 3 additions & 1 deletion src/error/formatError.js
@@ -1,9 +1,11 @@
// @flow strict

import invariant from '../jsutils/invariant';
import { type GraphQLError } from './GraphQLError';

import { type SourceLocation } from '../language/location';

import { type GraphQLError } from './GraphQLError';

/**
* Given a GraphQLError, format it according to the rules described by the
* Response Format, Errors section of the GraphQL Specification.
Expand Down
3 changes: 2 additions & 1 deletion src/error/locatedError.js
@@ -1,8 +1,9 @@
// @flow strict

import { GraphQLError } from './GraphQLError';
import { type ASTNode } from '../language/ast';

import { GraphQLError } from './GraphQLError';

/**
* Given an arbitrary Error, presumably thrown while attempting to execute a
* GraphQL operation, produce a new GraphQLError aware of the location in the
Expand Down
1 change: 1 addition & 0 deletions src/error/syntaxError.js
@@ -1,6 +1,7 @@
// @flow strict

import { type Source } from '../language/source';

import { GraphQLError } from './GraphQLError';

/**
Expand Down
1 change: 1 addition & 0 deletions src/execution/__tests__/abstract-promise-test.js
Expand Up @@ -2,6 +2,7 @@

import { expect } from 'chai';
import { describe, it } from 'mocha';

import {
graphql,
GraphQLSchema,
Expand Down
1 change: 1 addition & 0 deletions src/execution/__tests__/abstract-test.js
Expand Up @@ -2,6 +2,7 @@

import { expect } from 'chai';
import { describe, it } from 'mocha';

import {
graphqlSync,
GraphQLSchema,
Expand Down
4 changes: 3 additions & 1 deletion src/execution/__tests__/directives-test.js
@@ -1,11 +1,13 @@
// @flow strict

import { expect } from 'chai';
import { execute } from '../execute';
import { describe, it } from 'mocha';

import { parse } from '../../language';
import { GraphQLSchema, GraphQLObjectType, GraphQLString } from '../../type';

import { execute } from '../execute';

const schema = new GraphQLSchema({
query: new GraphQLObjectType({
name: 'TestType',
Expand Down
5 changes: 4 additions & 1 deletion src/execution/__tests__/executor-test.js
Expand Up @@ -2,9 +2,10 @@

import { expect } from 'chai';
import { describe, it } from 'mocha';

import inspect from '../../jsutils/inspect';
import invariant from '../../jsutils/invariant';
import { execute } from '../execute';

import { Kind, parse } from '../../language';
import {
GraphQLSchema,
Expand All @@ -17,6 +18,8 @@ import {
GraphQLNonNull,
} from '../../type';

import { execute } from '../execute';

describe('Execute: Handles basic execution tasks', () => {
it('throws if no document is provided', () => {
const schema = new GraphQLSchema({
Expand Down
4 changes: 3 additions & 1 deletion src/execution/__tests__/lists-test.js
Expand Up @@ -2,7 +2,7 @@

import { expect } from 'chai';
import { describe, it } from 'mocha';
import { execute } from '../execute';

import { parse } from '../../language';
import {
GraphQLSchema,
Expand All @@ -13,6 +13,8 @@ import {
GraphQLNonNull,
} from '../../type';

import { execute } from '../execute';

// resolved() is shorthand for Promise.resolve()
const resolved = Promise.resolve.bind(Promise);

Expand Down
4 changes: 3 additions & 1 deletion src/execution/__tests__/mutations-test.js
Expand Up @@ -2,10 +2,12 @@

import { expect } from 'chai';
import { describe, it } from 'mocha';
import { execute } from '../execute';

import { parse } from '../../language';
import { GraphQLSchema, GraphQLObjectType, GraphQLInt } from '../../type';

import { execute } from '../execute';

class NumberHolder {
theNumber: number;

Expand Down
6 changes: 4 additions & 2 deletions src/execution/__tests__/nonnull-test.js
Expand Up @@ -2,15 +2,17 @@

import { expect } from 'chai';
import { describe, it } from 'mocha';
import { execute } from '../execute';

import { parse } from '../../language';
import { buildSchema } from '../../utilities/buildASTSchema';
import {
GraphQLSchema,
GraphQLObjectType,
GraphQLString,
GraphQLNonNull,
} from '../../type';
import { buildSchema } from '../../utilities/buildASTSchema';

import { execute } from '../execute';

const syncError = new Error('sync');
const syncNonNullError = new Error('syncNonNull');
Expand Down
4 changes: 3 additions & 1 deletion src/execution/__tests__/schema-test.js
Expand Up @@ -3,8 +3,8 @@
import { expect } from 'chai';
import { describe, it } from 'mocha';

import { execute } from '../execute';
import { parse } from '../../language';

import {
GraphQLSchema,
GraphQLObjectType,
Expand All @@ -16,6 +16,8 @@ import {
GraphQLID,
} from '../../type';

import { execute } from '../execute';

describe('Execute: Handles execution with a complex schema', () => {
it('executes using a schema', () => {
const BlogImage = new GraphQLObjectType({
Expand Down
6 changes: 4 additions & 2 deletions src/execution/__tests__/sync-test.js
Expand Up @@ -2,11 +2,13 @@

import { expect } from 'chai';
import { describe, it } from 'mocha';
import { graphqlSync } from '../../graphql';
import { execute } from '../execute';

import { parse } from '../../language';
import { validate } from '../../validation/validate';
import { GraphQLSchema, GraphQLObjectType, GraphQLString } from '../../type';
import { graphqlSync } from '../../graphql';

import { execute } from '../execute';

describe('Execute: synchronously when possible', () => {
const schema = new GraphQLSchema({
Expand Down
3 changes: 2 additions & 1 deletion src/execution/__tests__/union-interface-test.js
Expand Up @@ -3,7 +3,6 @@
import { expect } from 'chai';
import { describe, it } from 'mocha';

import { execute } from '../execute';
import { parse } from '../../language';
import {
GraphQLSchema,
Expand All @@ -15,6 +14,8 @@ import {
GraphQLBoolean,
} from '../../type';

import { execute } from '../execute';

class Dog {
name: string;
barks: boolean;
Expand Down
7 changes: 5 additions & 2 deletions src/execution/__tests__/variables-test.js
@@ -1,9 +1,10 @@
// @flow strict

import inspect from '../../jsutils/inspect';
import { expect } from 'chai';
import { describe, it } from 'mocha';
import { execute } from '../execute';

import inspect from '../../jsutils/inspect';

import { parse } from '../../language';
import {
GraphQLSchema,
Expand All @@ -16,6 +17,8 @@ import {
GraphQLEnumType,
} from '../../type';

import { execute } from '../execute';

const TestComplexScalar = new GraphQLScalarType({
name: 'ComplexScalar',
serialize(value) {
Expand Down
65 changes: 35 additions & 30 deletions src/execution/execute.js
@@ -1,29 +1,45 @@
// @flow strict

import { forEach, isCollection } from 'iterall';
import { GraphQLError } from '../error/GraphQLError';
import { locatedError } from '../error/locatedError';

import inspect from '../jsutils/inspect';
import memoize3 from '../jsutils/memoize3';
import invariant from '../jsutils/invariant';
import isInvalid from '../jsutils/isInvalid';
import isNullish from '../jsutils/isNullish';
import isPromise from '../jsutils/isPromise';
import { type ObjMap } from '../jsutils/ObjMap';
import isObjectLike from '../jsutils/isObjectLike';
import memoize3 from '../jsutils/memoize3';
import promiseForObject from '../jsutils/promiseForObject';
import promiseReduce from '../jsutils/promiseReduce';
import { type ObjMap } from '../jsutils/ObjMap';
import promiseForObject from '../jsutils/promiseForObject';
import { type PromiseOrValue } from '../jsutils/PromiseOrValue';
import { type Path, addPath, pathToArray } from '../jsutils/Path';

import { getOperationRootType } from '../utilities/getOperationRootType';
import { typeFromAST } from '../utilities/typeFromAST';
import { GraphQLError } from '../error/GraphQLError';
import { locatedError } from '../error/locatedError';

import { Kind } from '../language/kinds';
import {
getVariableValues,
getArgumentValues,
getDirectiveValues,
} from './values';
type DocumentNode,
type OperationDefinitionNode,
type SelectionSetNode,
type FieldNode,
type FragmentSpreadNode,
type InlineFragmentNode,
type FragmentDefinitionNode,
} from '../language/ast';

import { assertValidSchema } from '../type/validate';
import { type GraphQLSchema } from '../type/schema';
import {
SchemaMetaFieldDef,
TypeMetaFieldDef,
TypeNameMetaFieldDef,
} from '../type/introspection';
import {
GraphQLIncludeDirective,
GraphQLSkipDirective,
} from '../type/directives';
import {
type GraphQLObjectType,
type GraphQLOutputType,
Expand All @@ -40,26 +56,15 @@ import {
isListType,
isNonNullType,
} from '../type/definition';
import { type GraphQLSchema } from '../type/schema';
import {
SchemaMetaFieldDef,
TypeMetaFieldDef,
TypeNameMetaFieldDef,
} from '../type/introspection';
import {
GraphQLIncludeDirective,
GraphQLSkipDirective,
} from '../type/directives';
import { assertValidSchema } from '../type/validate';

import { typeFromAST } from '../utilities/typeFromAST';
import { getOperationRootType } from '../utilities/getOperationRootType';

import {
type DocumentNode,
type OperationDefinitionNode,
type SelectionSetNode,
type FieldNode,
type FragmentSpreadNode,
type InlineFragmentNode,
type FragmentDefinitionNode,
} from '../language/ast';
getVariableValues,
getArgumentValues,
getDirectiveValues,
} from './values';

/**
* Terminology
Expand Down

0 comments on commit 5c9946b

Please sign in to comment.