Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ESLint: enable bunch of TS lint rules #2390

Merged
merged 1 commit into from
Jan 25, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .eslintrc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -461,7 +461,7 @@ overrides:
'@typescript-eslint/member-ordering': off # TODO consider
'@typescript-eslint/naming-convention': off # TODO consider
'@typescript-eslint/no-dynamic-delete': off
'@typescript-eslint/no-empty-interface': off # TODO error
'@typescript-eslint/no-empty-interface': error
'@typescript-eslint/no-explicit-any': off # TODO error
'@typescript-eslint/no-extra-non-null-assertion': error
'@typescript-eslint/no-extraneous-class': off # TODO consider
Expand Down Expand Up @@ -503,7 +503,7 @@ overrides:
'@typescript-eslint/triple-slash-reference': error
'@typescript-eslint/typedef': off
'@typescript-eslint/unbound-method': off # TODO consider
'@typescript-eslint/unified-signatures': off # TODO error
'@typescript-eslint/unified-signatures': error

# Extension Rules
# https://github.com/typescript-eslint/typescript-eslint/tree/master/packages/eslint-plugin#extension-rules
Expand Down
3 changes: 1 addition & 2 deletions src/type/definition.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -238,9 +238,8 @@ export function isNullableType(type: any): type is GraphQLNullableType;
export function assertNullableType(type: any): GraphQLNullableType;

export function getNullableType(type: void): undefined;
export function getNullableType<T extends GraphQLNullableType>(type: T): T;
export function getNullableType<T extends GraphQLNullableType>(
type: GraphQLNonNull<T>,
type: GraphQLNonNull<T> | T,
): T;

/**
Expand Down
3 changes: 1 addition & 2 deletions src/type/definition.js
Original file line number Diff line number Diff line change
Expand Up @@ -474,8 +474,7 @@ export function assertNullableType(type: mixed): GraphQLNullableType {

/* eslint-disable no-redeclare */
declare function getNullableType(type: void | null): void;
declare function getNullableType<T: GraphQLNullableType>(type: T): T;
declare function getNullableType<T>(type: GraphQLNonNull<T>): T;
declare function getNullableType<T>(type: GraphQLNonNull<T> | T): T;
export function getNullableType(type) {
/* eslint-enable no-redeclare */
if (type) {
Expand Down
4 changes: 1 addition & 3 deletions src/utilities/buildClientSchema.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@ import { GraphQLSchema, GraphQLSchemaValidationOptions } from '../type/schema';

import { IntrospectionQuery } from './getIntrospectionQuery';

interface Options extends GraphQLSchemaValidationOptions {}

/**
* Build a GraphQLSchema for use by client tools.
*
Expand All @@ -18,5 +16,5 @@ interface Options extends GraphQLSchemaValidationOptions {}
*/
export function buildClientSchema(
introspection: IntrospectionQuery,
options?: Options,
options?: GraphQLSchemaValidationOptions,
): GraphQLSchema;
6 changes: 1 addition & 5 deletions src/utilities/buildClientSchema.js
Original file line number Diff line number Diff line change
Expand Up @@ -52,10 +52,6 @@ import {
type IntrospectionNamedTypeRef,
} from './getIntrospectionQuery';

type Options = {|
...GraphQLSchemaValidationOptions,
|};

/**
* Build a GraphQLSchema for use by client tools.
*
Expand All @@ -70,7 +66,7 @@ type Options = {|
*/
export function buildClientSchema(
introspection: IntrospectionQuery,
options?: Options,
options?: GraphQLSchemaValidationOptions,
): GraphQLSchema {
devAssert(
isObjectLike(introspection) && isObjectLike(introspection.__schema),
Expand Down