Skip to content

Commit bcf93ec

Browse files
committed
Fix linting issues
1 parent 3dd9e9d commit bcf93ec

File tree

2 files changed

+19
-24
lines changed

2 files changed

+19
-24
lines changed

types/index.d.ts

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
import { Hook, HookContext, Params, Query, Paginated, Application } from '@feathersjs/feathers';
44
import * as ajv from 'ajv';
5-
import { GraphQLSchema } from 'graphql';
5+
import { GraphQLSchema, parse } from 'graphql';
66

77
export type HookType = 'before' | 'after' | 'error';
88
export type MethodName = 'find' | 'create' | 'get' | 'update' | 'patch' | 'remove';
@@ -199,17 +199,14 @@ export interface ResolverMap<T> {
199199
*/
200200
export function fastJoin(resolvers: ResolverMap<any> | SyncContextFunction<ResolverMap<any>>, query?: Query | SyncContextFunction<Query>): Hook;
201201

202-
import * as GraphQL from 'graphql';
202+
type ResolversFunction = (app: Application, runtime: any) => ResolversObject;
203203

204-
export interface ResolversFunction {
205-
(app: Application, runtime: any): ResolversObject
206-
}
207204
export interface ResolversObject {
208205
[i: string]: {
209-
[i: string]: (parent: any, args: any, content: any, ast: any) => any
206+
[i: string]: (parent: any, args: any, content: any, ast: any) => any;
210207
};
211208
Query: {
212-
[i: string]: (parent: any, args: any, content: any, ast: any) => any
209+
[i: string]: (parent: any, args: any, content: any, ast: any) => any;
213210
}
214211
}
215212

@@ -225,7 +222,7 @@ export interface FGraphqlOptions {
225222
inclJoinedNames?: boolean;
226223
extraAuthProps?: string[];
227224
runTime: any;
228-
parse: typeof GraphQL.parse
225+
parse: typeof parse
229226
}
230227

231228
/**

types/tests.ts

Lines changed: 14 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -214,7 +214,7 @@ fastJoin(ctx => postResolvers);
214214
fastJoin(postResolvers);
215215

216216
// used from https://github.com/feathers-plus/hooks-graphql-example
217-
let fgraphqlOptions: FGraphqlOptions = {
217+
const fgraphqlOptions: FGraphqlOptions = {
218218
parse,
219219
runTime: null,
220220
schema: ``,
@@ -226,17 +226,15 @@ let fgraphqlOptions: FGraphqlOptions = {
226226
following: {},
227227
likes: {}
228228
},
229-
resolvers: () => {
230-
return {
231-
Comment: {
232-
author: () => { return {}; },
233-
likes: () => { return {}; },
234-
},
235-
Query: {}
236-
};
237-
}
229+
resolvers: () => ({
230+
Comment: {
231+
author: () => ({}),
232+
likes: () => ({}),
233+
},
234+
Query: {}
235+
})
238236
};
239-
// $ExpectType any
237+
// $ExpectType Hook
240238
fgraphql(fgraphqlOptions);
241239

242240
const fgraphqlOptions2: FGraphqlOptions = {
@@ -250,13 +248,13 @@ const fgraphqlOptions2: FGraphqlOptions = {
250248
}),
251249
resolvers: {
252250
Comment: {
253-
author: () => { return {}; },
254-
likes: () => { return {}; },
251+
author: () => ({}),
252+
likes: () => ({}),
255253
},
256254
Query: {}
257255
}
258256
};
259-
// $ExpectType any
257+
// $ExpectType Hook
260258
fgraphql(fgraphqlOptions2);
261259

262260
// $ExpectType any
@@ -402,13 +400,13 @@ stashBefore();
402400
stashBefore('abc');
403401

404402
// $ExpectType Hook
405-
traverse(function (node) {
403+
traverse(function(node) {
406404
if (typeof node === 'string') {
407405
this.update(node.trim());
408406
}
409407
});
410408
// $ExpectType Hook
411-
traverse(function (node) {
409+
traverse(function(node) {
412410
if (typeof node === 'string') {
413411
this.update(node.trim());
414412
}

0 commit comments

Comments
 (0)