Skip to content

Commit

Permalink
Update lint packages
Browse files Browse the repository at this point in the history
  • Loading branch information
ardatan committed May 22, 2020
1 parent 839ca60 commit 979db63
Show file tree
Hide file tree
Showing 17 changed files with 39 additions and 42 deletions.
1 change: 0 additions & 1 deletion .eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@
"@typescript-eslint/explicit-function-return-type": "off",
"@typescript-eslint/ban-ts-ignore": "off",
"@typescript-eslint/return-await": "error",
"@typescript-eslint/class-name-casing": "error",
"@typescript-eslint/naming-convention": "error",
"@typescript-eslint/interface-name-prefix": "off"
},
Expand Down
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,8 @@
"jest": "26.0.1",
"ts-jest": "26.0.0",
"typescript": "3.9.3",
"@typescript-eslint/eslint-plugin": "2.34.0",
"@typescript-eslint/parser": "2.34.0",
"@typescript-eslint/eslint-plugin": "3.0.0",
"@typescript-eslint/parser": "3.0.0",
"bob-the-bundler": "1.0.1",
"eslint": "7.0.0",
"eslint-config-prettier": "6.11.0",
Expand Down Expand Up @@ -81,4 +81,4 @@
"resolutions": {
"graphql": "15.0.0"
}
}
}
2 changes: 1 addition & 1 deletion packages/delegate/src/transforms/FilterToSchema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ function filterToSchema(

function collectFragmentVariables(
targetSchema: GraphQLSchema,
fragmentSet: object,
fragmentSet: any,
validFragments: Array<FragmentDefinitionNode>,
validFragmentsWithType: { [name: string]: GraphQLType },
usedFragments: Array<string>
Expand Down
4 changes: 2 additions & 2 deletions packages/load/src/load-typedefs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ export type LoadTypedefsOptions<ExtraConfig = { [key: string]: any }> = SingleFi

export type UnnormalizedTypeDefPointer = { [key: string]: any } | string;

export async function loadTypedefs<AdditionalConfig = {}>(
export async function loadTypedefs<AdditionalConfig = Record<string, unknown>>(
pointerOrPointers: UnnormalizedTypeDefPointer | UnnormalizedTypeDefPointer[],
options: LoadTypedefsOptions<Partial<AdditionalConfig>>
): Promise<Source[]> {
Expand Down Expand Up @@ -58,7 +58,7 @@ export async function loadTypedefs<AdditionalConfig = {}>(
return prepareResult({ options, pointerOptionMap, validSources });
}

export function loadTypedefsSync<AdditionalConfig = {}>(
export function loadTypedefsSync<AdditionalConfig = Record<string, unknown>>(
pointerOrPointers: UnnormalizedTypeDefPointer | UnnormalizedTypeDefPointer[],
options: LoadTypedefsOptions<Partial<AdditionalConfig>>
): Source[] {
Expand Down
2 changes: 1 addition & 1 deletion packages/load/src/load-typedefs/collect-sources.ts
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,7 @@ function includeIgnored<
}
}

function createGlobbyOptions<T extends object>(options: T): any {
function createGlobbyOptions(options: any): any {
return { absolute: true, ...options, ignore: [] };
}

Expand Down
2 changes: 1 addition & 1 deletion packages/loaders/github/tests/schema-from-github.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ function normalize(doc: string): string {
test('load schema from Github', async () => {
let headers: Record<string, string> = {};
let query: string;
let variables: {};
let variables: any;
let operationName: string;

const server = nock('https://api.github.com').post('/graphql').reply(function reply(_, body: any) {
Expand Down
2 changes: 1 addition & 1 deletion packages/loaders/url/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ export class UrlLoader implements DocumentLoader<LoadFromUrlOptions> {

if (options) {
if (Array.isArray(options.headers)) {
headers = options.headers.reduce((prev: object, v: object) => ({ ...prev, ...v }), {});
headers = options.headers.reduce((prev: any, v: any) => ({ ...prev, ...v }), {});
} else if (typeof options.headers === 'object') {
headers = options.headers;
}
Expand Down
2 changes: 1 addition & 1 deletion packages/mock/tests/mocking.spec.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* eslint-disable @typescript-eslint/camelcase */
/* eslint-disable camelcase */
import {
graphql,
GraphQLResolveInfo,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,6 @@ it('can inline @argumentDefinitions/@arguments annotated fragments', async () =>
const queryDoc = output.find(doc => doc.definitions[0].kind === 'OperationDefinition');

expect(queryDoc).toBeDefined();
// @ts-ignore
expect(print(queryDoc)).toBeSimilarGqlDoc(/* GraphQL */ `
query user {
users {
Expand Down Expand Up @@ -128,7 +127,6 @@ it('handles unions with interfaces the correct way', async () => {
const queryDoc = output.find(doc => doc.definitions[0].kind === 'OperationDefinition');

expect(queryDoc).toBeDefined();
// @ts-ignore
expect(print(queryDoc)).toBeSimilarGqlDoc(/* GraphQL */ `
query user {
user {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ export function composeResolvers<Resolvers extends Record<string, any>>(
resolvers: Resolvers,
mapping: ResolversComposerMapping<Resolvers> = {}
): Resolvers {
const mappingResult: { [path: string]: Function[] } = {};
const mappingResult: { [path: string]: (...args: any[]) => any[] } = {};

Object.keys(mapping).map((resolverPath: string) => {
if (mapping[resolverPath] instanceof Array || typeof mapping[resolverPath] === 'function') {
Expand Down
4 changes: 2 additions & 2 deletions packages/schema/tests/Logger.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ import { ILogger } from '@graphql-tools/schema';
export class Logger implements ILogger {
public errors: Array<Error>;
public name: string | undefined;
private readonly callback: Function | undefined;
private readonly callback: (...args: any[]) => any | undefined;

constructor(name?: string, callback?: Function) {
constructor(name?: string, callback?: (...args: any[]) => any) {
this.name = name;
this.errors = [];
this.callback = callback;
Expand Down
1 change: 0 additions & 1 deletion packages/stitch/tests/alternateStitchSchemas.test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
/* eslint-disable @typescript-eslint/camelcase */
import {
graphql,
GraphQLSchema,
Expand Down
4 changes: 2 additions & 2 deletions packages/utils/src/SchemaDirectiveVisitor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,6 @@ import { getArgumentValues } from './getArgumentValues';
// parameter types, and more details about the properties exposed by instances
// of the SchemaDirectiveVisitor class.

export type SchemaDirectiveVisitorClass = typeof SchemaDirectiveVisitor;

export class SchemaDirectiveVisitor<TArgs = any, TContext = any> extends SchemaVisitor {
// The name of the directive this visitor is allowed to visit (that is, the
// identifier that appears after the @ character in the schema). Note that
Expand Down Expand Up @@ -289,3 +287,5 @@ function directiveLocationToVisitorMethodName(loc: DirectiveLocationEnum) {
loc.replace(/([^_]*)_?/g, (_wholeMatch, part: string) => part.charAt(0).toUpperCase() + part.slice(1).toLowerCase())
);
}

export type SchemaDirectiveVisitorClass = typeof SchemaDirectiveVisitor;
2 changes: 1 addition & 1 deletion packages/utils/src/inspect.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ function formatValue(value: any, seenValues: Array<any>): string {
case 'string':
return JSON.stringify(value);
case 'function':
return value.name ? `[function ${(value as Function).name}]` : '[function]';
return value.name ? `[function ${(value as (...args: any[]) => any).name}]` : '[function]';
case 'object':
if (value === null) {
return 'null';
Expand Down
2 changes: 1 addition & 1 deletion packages/utils/src/validate-documents.ts
Original file line number Diff line number Diff line change
Expand Up @@ -103,5 +103,5 @@ function createDefaultRules() {
ignored.push(rule.replace(/Rule$/, ''));
});

return specifiedRules.filter((f: Function) => !ignored.includes(f.name));
return specifiedRules.filter((f: (...args: any[]) => any) => !ignored.includes(f.name));
}
2 changes: 1 addition & 1 deletion website/docs/mocking.md
Original file line number Diff line number Diff line change
Expand Up @@ -290,7 +290,7 @@ Given an instance of GraphQLSchema and a mock object, `addMocksToSchema` returns
```js
import { MockList } from '@graphql-tools/mock';

new MockList(length: number | number[], mockFunction: Function);
new MockList(length: number | number[], mockFunction: (...args: any[]) => any);
```

This is an object you can return from your mock resolvers which calls the `mockFunction` once for each list item. The first argument can either be an exact length, or an inclusive range of possible lengths for the list, in case you want to see how your UI responds to varying lists of data.
Expand Down
41 changes: 21 additions & 20 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2242,40 +2242,41 @@
dependencies:
"@types/yargs-parser" "*"

"@typescript-eslint/eslint-plugin@2.34.0":
version "2.34.0"
resolved "https://registry.yarnpkg.com/@typescript-eslint/eslint-plugin/-/eslint-plugin-2.34.0.tgz#6f8ce8a46c7dea4a6f1d171d2bb8fbae6dac2be9"
integrity sha512-4zY3Z88rEE99+CNvTbXSyovv2z9PNOVffTWD2W8QF5s2prBQtwN2zadqERcrHpcR7O/+KMI3fcTAmUUhK/iQcQ==
"@typescript-eslint/eslint-plugin@3.0.0":
version "3.0.0"
resolved "https://registry.yarnpkg.com/@typescript-eslint/eslint-plugin/-/eslint-plugin-3.0.0.tgz#02f8ec6b5ce814bda80dfc22463f108bed1f699b"
integrity sha512-lcZ0M6jD4cqGccYOERKdMtg+VWpoq3NSnWVxpc/AwAy0zhkUYVioOUZmfNqiNH8/eBNGhCn6HXd6mKIGRgNc1Q==
dependencies:
"@typescript-eslint/experimental-utils" "2.34.0"
"@typescript-eslint/experimental-utils" "3.0.0"
functional-red-black-tree "^1.0.1"
regexpp "^3.0.0"
semver "^7.3.2"
tsutils "^3.17.1"

"@typescript-eslint/experimental-utils@2.34.0":
version "2.34.0"
resolved "https://registry.yarnpkg.com/@typescript-eslint/experimental-utils/-/experimental-utils-2.34.0.tgz#d3524b644cdb40eebceca67f8cf3e4cc9c8f980f"
integrity sha512-eS6FTkq+wuMJ+sgtuNTtcqavWXqsflWcfBnlYhg/nS4aZ1leewkXGbvBhaapn1q6qf4M71bsR1tez5JTRMuqwA==
"@typescript-eslint/experimental-utils@3.0.0":
version "3.0.0"
resolved "https://registry.yarnpkg.com/@typescript-eslint/experimental-utils/-/experimental-utils-3.0.0.tgz#1ddf53eeb61ac8eaa9a77072722790ac4f641c03"
integrity sha512-BN0vmr9N79M9s2ctITtChRuP1+Dls0x/wlg0RXW1yQ7WJKPurg6X3Xirv61J2sjPif4F8SLsFMs5Nzte0WYoTQ==
dependencies:
"@types/json-schema" "^7.0.3"
"@typescript-eslint/typescript-estree" "2.34.0"
"@typescript-eslint/typescript-estree" "3.0.0"
eslint-scope "^5.0.0"
eslint-utils "^2.0.0"

"@typescript-eslint/parser@2.34.0":
version "2.34.0"
resolved "https://registry.yarnpkg.com/@typescript-eslint/parser/-/parser-2.34.0.tgz#50252630ca319685420e9a39ca05fe185a256bc8"
integrity sha512-03ilO0ucSD0EPTw2X4PntSIRFtDPWjrVq7C3/Z3VQHRC7+13YB55rcJI3Jt+YgeHbjUdJPcPa7b23rXCBokuyA==
"@typescript-eslint/parser@3.0.0":
version "3.0.0"
resolved "https://registry.yarnpkg.com/@typescript-eslint/parser/-/parser-3.0.0.tgz#fe9fdf18a1155c02c04220c14506a320cb6c6944"
integrity sha512-8RRCA9KLxoFNO0mQlrLZA0reGPd/MsobxZS/yPFj+0/XgMdS8+mO8mF3BDj2ZYQj03rkayhSJtF1HAohQ3iylw==
dependencies:
"@types/eslint-visitor-keys" "^1.0.0"
"@typescript-eslint/experimental-utils" "2.34.0"
"@typescript-eslint/typescript-estree" "2.34.0"
"@typescript-eslint/experimental-utils" "3.0.0"
"@typescript-eslint/typescript-estree" "3.0.0"
eslint-visitor-keys "^1.1.0"

"@typescript-eslint/typescript-estree@2.34.0":
version "2.34.0"
resolved "https://registry.yarnpkg.com/@typescript-eslint/typescript-estree/-/typescript-estree-2.34.0.tgz#14aeb6353b39ef0732cc7f1b8285294937cf37d5"
integrity sha512-OMAr+nJWKdlVM9LOqCqh3pQQPwxHAN7Du8DR6dmwCrAmxtiXQnhHJ6tBNtf+cggqfo51SG/FCwnKhXCIM7hnVg==
"@typescript-eslint/typescript-estree@3.0.0":
version "3.0.0"
resolved "https://registry.yarnpkg.com/@typescript-eslint/typescript-estree/-/typescript-estree-3.0.0.tgz#fa40e1b76ccff880130be054d9c398e96004bf42"
integrity sha512-nevQvHyNghsfLrrByzVIH4ZG3NROgJ8LZlfh3ddwPPH4CH7W4GAiSx5qu+xHuX5pWsq6q/eqMc1io840ZhAnUg==
dependencies:
debug "^4.1.1"
eslint-visitor-keys "^1.1.0"
Expand Down

0 comments on commit 979db63

Please sign in to comment.