Skip to content
This repository has been archived by the owner on Mar 20, 2023. It is now read-only.

Commit

Permalink
Switch to alternative format for type imports
Browse files Browse the repository at this point in the history
  • Loading branch information
danielrearden committed Jun 20, 2020
1 parent 975ba2c commit 0cac296
Show file tree
Hide file tree
Showing 8 changed files with 28 additions and 29 deletions.
4 changes: 2 additions & 2 deletions .eslintrc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ rules:
flowtype/sort-keys: off
flowtype/spread-exact-type: off
flowtype/type-id-match: [error, '^[A-Z]|^\$']
flowtype/type-import-style: [error, identifier, { ignoreTypeDefault: true }]
flowtype/type-import-style: [error, declaration]
flowtype/use-flow-type: error

# Bellow rules are disabled because coflicts with Prettier, see:
Expand Down Expand Up @@ -391,7 +391,7 @@ rules:
no-class-assign: error
no-const-assign: error
no-dupe-class-members: error
no-duplicate-imports: error
no-duplicate-imports: off # Superseded by `import/no-duplicates`
no-new-symbol: error
no-restricted-exports: off
no-restricted-imports: off
Expand Down
3 changes: 1 addition & 2 deletions src/__tests__/http-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,12 @@ import restify from 'restify';
import supertest from 'supertest';
import bodyParser from 'body-parser';

import type { ASTVisitor, ValidationContext } from 'graphql';
import sinon from 'sinon';
import multer from 'multer';
import { expect } from 'chai';
import { describe, it } from 'mocha';
import {
type ASTVisitor,
type ValidationContext,
Source,
GraphQLError,
GraphQLString,
Expand Down
6 changes: 3 additions & 3 deletions src/index.d.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
// TypeScript Version: 3.4

import { IncomingMessage, ServerResponse } from 'http';
import type { IncomingMessage, ServerResponse } from 'http';

import {
import type {
Source,
ASTVisitor,
DocumentNode,
Expand All @@ -16,7 +16,7 @@ import {
GraphQLTypeResolver,
} from 'graphql';

import { GraphiQLOptions } from './renderGraphiQL';
import type { GraphiQLOptions } from './renderGraphiQL';

export {};

Expand Down
33 changes: 16 additions & 17 deletions src/index.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,19 @@
// @flow strict

import { type IncomingMessage, type ServerResponse } from 'http';

import type { IncomingMessage, type ServerResponse } from 'http';

import type {
ASTVisitor,
DocumentNode,
ValidationRule,
ValidationContext,
ExecutionArgs,
ExecutionResult,
GraphQLError,
GraphQLSchema,
GraphQLFieldResolver,
GraphQLTypeResolver,
} from 'graphql';
import accepts from 'accepts';
import httpError from 'http-errors';
import {
Expand All @@ -13,24 +25,11 @@ import {
validateSchema,
getOperationAST,
specifiedRules,
type ASTVisitor,
type DocumentNode,
type ValidationRule,
type ValidationContext,
type ExecutionArgs,
type ExecutionResult,
type GraphQLError,
type GraphQLSchema,
type GraphQLFieldResolver,
type GraphQLTypeResolver,
} from 'graphql';

import type { GraphiQLOptions, GraphiQLData } from './renderGraphiQL';
import { parseBody } from './parseBody';
import {
renderGraphiQL,
type GraphiQLOptions,
type GraphiQLData,
} from './renderGraphiQL';
import { renderGraphiQL } from './renderGraphiQL';

type $Request = IncomingMessage;
type $Response = ServerResponse & {| json?: (data: mixed) => void |};
Expand Down
2 changes: 1 addition & 1 deletion src/parseBody.d.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { IncomingMessage } from 'http';
import type { IncomingMessage } from 'http';

export {};

Expand Down
5 changes: 3 additions & 2 deletions src/parseBody.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
// @flow strict

import { type IncomingMessage } from 'http';
import zlib, { type Inflate, type Gunzip } from 'zlib';
import type { IncomingMessage } from 'http';
import type { Inflate, Gunzip } from 'zlib';
import zlib from 'zlib';
import querystring from 'querystring';

import getBody from 'raw-body';
Expand Down
2 changes: 1 addition & 1 deletion src/renderGraphiQL.d.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { ExecutionResult } from 'graphql';
import type { ExecutionResult } from 'graphql';

export interface GraphiQLData {
query?: string | null;
Expand Down
2 changes: 1 addition & 1 deletion src/renderGraphiQL.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// @flow strict

import { type ExecutionResult } from 'graphql';
import type { ExecutionResult } from 'graphql';

export type GraphiQLData = {|
query?: string | null,
Expand Down

0 comments on commit 0cac296

Please sign in to comment.