mirror of
https://github.com/zhigang1992/DefinitelyTyped.git
synced 2026-06-05 20:02:05 +08:00
Removing some of the tslint rules, for better code
This commit is contained in:
@@ -4,11 +4,21 @@ import graphqlHTTP = require('express-graphql');
|
||||
import { GraphQLSchema } from 'graphql/type/schema';
|
||||
|
||||
const app = express();
|
||||
const schema = {} as GraphQLSchema;
|
||||
const schema: GraphQLSchema = {
|
||||
getQueryType: null,
|
||||
getMutationType: null,
|
||||
getSubscriptionType: null,
|
||||
getTypeMap: null,
|
||||
getType: null,
|
||||
getPossibleTypes: null,
|
||||
isPossibleType: null,
|
||||
getDirective: null,
|
||||
getDirectives: null,
|
||||
};
|
||||
|
||||
const graphqlOption: graphqlHTTP.OptionsData = {
|
||||
graphiql: true,
|
||||
schema: schema,
|
||||
schema,
|
||||
formatError: (error: Error) => ({
|
||||
message: error.message
|
||||
}),
|
||||
@@ -18,7 +28,7 @@ const graphqlOption: graphqlHTTP.OptionsData = {
|
||||
|
||||
const graphqlOptionRequest = (request: express.Request): graphqlHTTP.OptionsData => ({
|
||||
graphiql: true,
|
||||
schema: schema,
|
||||
schema,
|
||||
context: request.session,
|
||||
validationRules: [() => false, () => true],
|
||||
});
|
||||
|
||||
60
types/express-graphql/index.d.ts
vendored
60
types/express-graphql/index.d.ts
vendored
@@ -1,4 +1,4 @@
|
||||
// Type definitions for express-graphql 0.6.12
|
||||
// Type definitions for express-graphql 0.6
|
||||
// Project: https://github.com/graphql/express-graphql
|
||||
// Definitions by: Isman Usoh <https://github.com/isman-usoh>
|
||||
// Nitin Tutlani <https://github.com/nitintutlani>
|
||||
@@ -21,39 +21,39 @@ declare namespace graphqlHTTP {
|
||||
response: Response,
|
||||
params?: GraphQLParams) => OptionsResult) | OptionsResult;
|
||||
export type OptionsResult = OptionsData | Promise<OptionsData>;
|
||||
export type OptionsData = {
|
||||
export interface OptionsData {
|
||||
/**
|
||||
* A GraphQL schema from graphql-js.
|
||||
*/
|
||||
schema: GraphQLSchema,
|
||||
schema: GraphQLSchema;
|
||||
|
||||
/**
|
||||
* A value to pass as the context to the graphql() function.
|
||||
*/
|
||||
context?: Object,
|
||||
context?: any;
|
||||
|
||||
/**
|
||||
* An object to pass as the rootValue to the graphql() function.
|
||||
*/
|
||||
rootValue?: Object,
|
||||
rootValue?: any;
|
||||
|
||||
/**
|
||||
* A boolean to configure whether the output should be pretty-printed.
|
||||
*/
|
||||
pretty?: boolean,
|
||||
pretty?: boolean;
|
||||
|
||||
/**
|
||||
* An optional function which will be used to format any errors produced by
|
||||
* fulfilling a GraphQL operation. If no function is provided, GraphQL's
|
||||
* default spec-compliant `formatError` function will be used.
|
||||
*/
|
||||
formatError?: (error: GraphQLError) => any,
|
||||
formatError?: (error: GraphQLError) => any;
|
||||
|
||||
/**
|
||||
* An optional array of validation rules that will be applied on the document
|
||||
* in additional to those defined by the GraphQL spec.
|
||||
*/
|
||||
validationRules?: any[],
|
||||
validationRules?: any[];
|
||||
|
||||
/**
|
||||
* An optional function for adding additional metadata to the GraphQL response
|
||||
@@ -65,51 +65,51 @@ declare namespace graphqlHTTP {
|
||||
*
|
||||
* This function may be async.
|
||||
*/
|
||||
extensions?: (info: RequestInfo) => { [key: string]: any },
|
||||
extensions?: (info: RequestInfo) => { [key: string]: any };
|
||||
|
||||
/**
|
||||
* A boolean to optionally enable GraphiQL mode.
|
||||
*/
|
||||
graphiql?: boolean,
|
||||
};
|
||||
graphiql?: boolean;
|
||||
}
|
||||
|
||||
/**
|
||||
* All information about a GraphQL request.
|
||||
*/
|
||||
export type RequestInfo = {
|
||||
export interface RequestInfo {
|
||||
/**
|
||||
* The parsed GraphQL document.
|
||||
*/
|
||||
document?: DocumentNode,
|
||||
|
||||
document?: DocumentNode;
|
||||
|
||||
/**
|
||||
* The variable values used at runtime.
|
||||
*/
|
||||
variables?: { [name: string]: any },
|
||||
|
||||
variables?: { [name: string]: any };
|
||||
|
||||
/**
|
||||
* The (optional) operation name requested.
|
||||
*/
|
||||
operationName?: string,
|
||||
|
||||
operationName?: string;
|
||||
|
||||
/**
|
||||
* The result of executing the operation.
|
||||
*/
|
||||
result?: any,
|
||||
};
|
||||
|
||||
export type GraphQLParams = {
|
||||
query?: string,
|
||||
variables?: { [name: string]: any },
|
||||
operationName?: string,
|
||||
raw?: boolean,
|
||||
};
|
||||
result?: any;
|
||||
}
|
||||
|
||||
export interface GraphQLParams {
|
||||
query?: string;
|
||||
variables?: { [name: string]: any };
|
||||
operationName?: string;
|
||||
raw?: boolean;
|
||||
}
|
||||
|
||||
type Middleware = (request: Request, response: Response) => void;
|
||||
}
|
||||
|
||||
/**
|
||||
* Middleware for express; takes an options object or function as input to
|
||||
* configure behavior, and returns an express middleware.
|
||||
*/
|
||||
* Middleware for express; takes an options object or function as input to
|
||||
* configure behavior, and returns an express middleware.
|
||||
*/
|
||||
declare function graphqlHTTP(options: graphqlHTTP.Options): graphqlHTTP.Middleware;
|
||||
|
||||
@@ -1,79 +1,6 @@
|
||||
{
|
||||
"extends": "dtslint/dt.json",
|
||||
"rules": {
|
||||
"adjacent-overload-signatures": false,
|
||||
"array-type": false,
|
||||
"arrow-return-shorthand": false,
|
||||
"ban-types": false,
|
||||
"callable-types": false,
|
||||
"comment-format": false,
|
||||
"dt-header": false,
|
||||
"eofline": false,
|
||||
"export-just-namespace": false,
|
||||
"import-spacing": false,
|
||||
"interface-name": false,
|
||||
"interface-over-type-literal": false,
|
||||
"jsdoc-format": false,
|
||||
"max-line-length": false,
|
||||
"member-access": false,
|
||||
"new-parens": false,
|
||||
"no-any-union": false,
|
||||
"no-boolean-literal-compare": false,
|
||||
"no-conditional-assignment": false,
|
||||
"no-consecutive-blank-lines": false,
|
||||
"no-construct": false,
|
||||
"no-declare-current-package": false,
|
||||
"no-duplicate-imports": false,
|
||||
"no-duplicate-variable": false,
|
||||
"no-empty-interface": false,
|
||||
"no-for-in-array": false,
|
||||
"no-inferrable-types": false,
|
||||
"no-internal-module": false,
|
||||
"no-irregular-whitespace": false,
|
||||
"no-mergeable-namespace": false,
|
||||
"no-misused-new": false,
|
||||
"no-namespace": false,
|
||||
"no-object-literal-type-assertion": false,
|
||||
"no-padding": false,
|
||||
"no-redundant-jsdoc": false,
|
||||
"no-redundant-jsdoc-2": false,
|
||||
"no-redundant-undefined": false,
|
||||
"no-reference-import": false,
|
||||
"no-relative-import-in-test": false,
|
||||
"no-self-import": false,
|
||||
"no-single-declare-module": false,
|
||||
"no-string-throw": false,
|
||||
"no-unnecessary-callback-wrapper": false,
|
||||
"no-unnecessary-class": false,
|
||||
"no-unnecessary-generics": false,
|
||||
"no-unnecessary-qualifier": false,
|
||||
"no-unnecessary-type-assertion": false,
|
||||
"no-useless-files": false,
|
||||
"no-var-keyword": false,
|
||||
"no-var-requires": false,
|
||||
"no-void-expression": false,
|
||||
"no-trailing-whitespace": false,
|
||||
"object-literal-key-quotes": false,
|
||||
"object-literal-shorthand": false,
|
||||
"one-line": false,
|
||||
"one-variable-per-declaration": false,
|
||||
"only-arrow-functions": false,
|
||||
"prefer-conditional-expression": false,
|
||||
"prefer-const": false,
|
||||
"prefer-declare-function": false,
|
||||
"prefer-for-of": false,
|
||||
"prefer-method-signature": false,
|
||||
"prefer-template": false,
|
||||
"radix": false,
|
||||
"semicolon": false,
|
||||
"space-before-function-paren": false,
|
||||
"space-within-parens": false,
|
||||
"strict-export-declare-modifiers": false,
|
||||
"trim-file": false,
|
||||
"triple-equals": false,
|
||||
"typedef-whitespace": false,
|
||||
"unified-signatures": false,
|
||||
"void-return": false,
|
||||
"whitespace": false
|
||||
"strict-export-declare-modifiers": false
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user