Skip to content

Commit b05545f

Browse files
committed
style: Using reexported graphql via graphql-compose/lib/graphql
1 parent 9770db1 commit b05545f

File tree

9 files changed

+37
-35
lines changed

9 files changed

+37
-35
lines changed

src/__mocks__/userTypeComposer.js

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,15 @@
11
/* @flow */
22
/* eslint-disable no-param-reassign */
33

4-
import { TypeComposer, Resolver, graphql } from 'graphql-compose';
5-
6-
import type { ConnectionSortMapOpts } from '../connectionResolver';
7-
8-
const {
4+
import { TypeComposer, Resolver } from 'graphql-compose';
5+
import {
96
GraphQLString,
107
GraphQLObjectType,
118
GraphQLInputObjectType,
129
GraphQLEnumType,
1310
GraphQLInt,
14-
} = graphql;
11+
} from 'graphql-compose/lib/graphql';
12+
import type { ConnectionSortMapOpts } from '../connectionResolver';
1513

1614
export const UserType = new GraphQLObjectType({
1715
name: 'User',

src/__tests__/composeWithConnection-test.js

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,12 @@
11
/* @flow */
22
/* eslint-disable no-param-reassign */
33

4-
import { TypeComposer, graphql } from 'graphql-compose';
4+
import { TypeComposer } from 'graphql-compose';
5+
import { GraphQLSchema, GraphQLList, graphql } from 'graphql-compose/lib/graphql';
56
import { composeWithConnection } from '../composeWithConnection';
67
import { userTypeComposer, sortOptions } from '../__mocks__/userTypeComposer';
78
import { rootQueryTypeComposer as rootQueryTC } from '../__mocks__/rootQueryTypeComposer';
89

9-
const { GraphQLSchema, GraphQLList } = graphql;
10-
1110
describe('composeWithRelay', () => {
1211
const userComposer = composeWithConnection(userTypeComposer, {
1312
countResolverName: 'count',
@@ -94,7 +93,7 @@ describe('composeWithRelay', () => {
9493
}
9594
}
9695
}`;
97-
const result = await graphql.graphql(schema, query);
96+
const result = await graphql(schema, query);
9897

9998
// $FlowFixMe
10099
expect(result.data.userConnection).toEqual({
@@ -149,7 +148,7 @@ describe('composeWithRelay', () => {
149148
}
150149
}
151150
}`;
152-
const result = await graphql.graphql(schema, query);
151+
const result = await graphql(schema, query);
153152

154153
// $FlowFixMe
155154
expect(result.data.userConnection).toEqual({
@@ -214,7 +213,7 @@ describe('composeWithRelay', () => {
214213
gender
215214
}
216215
`;
217-
const result = await graphql.graphql(schema, query);
216+
const result = await graphql(schema, query);
218217
expect(result).toEqual({
219218
data: {
220219
userConnection: {
@@ -264,7 +263,7 @@ describe('composeWithRelay', () => {
264263
count
265264
}
266265
}`;
267-
await graphql.graphql(schema, query);
266+
await graphql(schema, query);
268267
// $FlowFixMe
269268
expect(Object.keys(topResolveParams.countResolveParams)).toEqual(
270269
expect.arrayContaining(['source', 'args', 'context', 'info', 'projection'])
@@ -297,7 +296,7 @@ describe('composeWithRelay', () => {
297296
count
298297
}
299298
}`;
300-
await graphql.graphql(schema, query);
299+
await graphql(schema, query);
301300
// $FlowFixMe
302301
expect(Object.keys(topResolveParams.findManyResolveParams)).toEqual(
303302
expect.arrayContaining(['source', 'args', 'context', 'info', 'projection'])

src/__tests__/connectionResolver-test.js

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,13 @@
11
/* @flow */
22
/* eslint-disable no-param-reassign */
33

4-
import { Resolver, graphql } from 'graphql-compose';
4+
import { Resolver } from 'graphql-compose';
5+
import { GraphQLInt } from 'graphql-compose/lib/graphql';
56
import { userTypeComposer, userList, sortOptions } from '../__mocks__/userTypeComposer';
67
import { dataToCursor } from '../cursor';
78
import { prepareConnectionResolver, prepareRawQuery, preparePageInfo } from '../connectionResolver';
89
import Cursor from '../types/cursorType';
910

10-
const { GraphQLInt } = graphql;
11-
1211
describe('connectionResolver', () => {
1312
const connectionResolver = prepareConnectionResolver(userTypeComposer, {
1413
countResolverName: 'count',

src/types/__tests__/connectionType-test.js

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,18 @@
11
/* @flow */
22

3-
import { TypeComposer, graphql } from 'graphql-compose';
3+
import { TypeComposer } from 'graphql-compose';
4+
import {
5+
GraphQLNonNull,
6+
GraphQLObjectType,
7+
getNamedType,
8+
GraphQLInt,
9+
GraphQLList,
10+
} from 'graphql-compose/lib/graphql';
411
import { userTypeComposer } from '../../__mocks__/userTypeComposer';
512
import { prepareEdgeType, prepareConnectionType } from '../connectionType';
613
import GraphQLConnectionCursor from '../cursorType';
714
import PageInfoType from '../pageInfoType';
815

9-
const { GraphQLNonNull, GraphQLObjectType, getNamedType, GraphQLInt, GraphQLList } = graphql;
10-
1116
describe('types/connectionType.js', () => {
1217
describe('prepareEdgeType()', () => {
1318
it('should return GraphQLObjectType', () => {

src/types/__tests__/sortInputType-test.js

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,9 @@
11
/* @flow */
22

3-
import { graphql } from 'graphql-compose';
3+
import { GraphQLEnumType } from 'graphql-compose/lib/graphql';
44
import { userTypeComposer } from '../../__mocks__/userTypeComposer';
55
import { prepareSortType } from '../sortInputType';
66

7-
const { GraphQLEnumType } = graphql;
8-
97
describe('types/sortInputType.js', () => {
108
describe('basic checks', () => {
119
it('should throw error if opts.sort are empty', () => {

src/types/connectionType.js

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,17 @@
11
/* @flow */
22
/* eslint-disable arrow-body-style */
33

4-
import { graphql } from 'graphql-compose';
4+
import {
5+
GraphQLInt,
6+
GraphQLObjectType,
7+
GraphQLNonNull,
8+
GraphQLList,
9+
} from 'graphql-compose/lib/graphql';
510
import type { TypeComposer } from 'graphql-compose';
611
import GraphQLConnectionCursor from './cursorType';
712

813
import PageInfoType from './pageInfoType';
914

10-
const { GraphQLInt, GraphQLObjectType, GraphQLNonNull, GraphQLList } = graphql;
11-
1215
const cachedConnectionTypes = new WeakMap();
1316
const cachedEdgeTypes = new WeakMap();
1417

src/types/cursorType.js

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
/* @flow */
22

3-
import { graphql } from 'graphql-compose';
4-
5-
const { GraphQLScalarType, Kind } = graphql;
3+
import { GraphQLScalarType, Kind } from 'graphql-compose/lib/graphql';
64

75
const GraphQLConnectionCursor = new GraphQLScalarType({
86
name: 'ConnectionCursor',

src/types/pageInfoType.js

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,11 @@
11
/* @flow */
22

3-
import { graphql } from 'graphql-compose';
4-
5-
const { GraphQLBoolean, GraphQLString, GraphQLObjectType, GraphQLNonNull } = graphql;
3+
import {
4+
GraphQLBoolean,
5+
GraphQLString,
6+
GraphQLObjectType,
7+
GraphQLNonNull,
8+
} from 'graphql-compose/lib/graphql';
69

710
const PageInfoType = new GraphQLObjectType({
811
name: 'PageInfo',

src/types/sortInputType.js

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,12 @@
11
/* @flow */
22
/* eslint-disable no-use-before-define, no-param-reassign */
33

4-
import { TypeComposer, graphql } from 'graphql-compose';
4+
import { TypeComposer } from 'graphql-compose';
5+
import { GraphQLEnumType } from 'graphql-compose/lib/graphql';
56
import { isFunction } from '../utils/is';
67
import type { ComposeWithConnectionOpts } from '../composeWithConnection';
78
import type { ConnectionSortOpts } from '../connectionResolver';
89

9-
const { GraphQLEnumType } = graphql;
10-
1110
export function prepareSortType(
1211
typeComposer: TypeComposer,
1312
opts: ComposeWithConnectionOpts

0 commit comments

Comments
 (0)