eslint rules (#1099)

* Off to the races - 3760 problems (1794 errors, 1966 warnings)

* Convert Array<T> -> T[] (not all correct, eg. extends)

* () => { -> (): void  => {

* get is/as -> public get is/as

* public for getters, constructors & base Codec

* Some cleanups from previous overzealous search & replace

* Under 2k, 1874 problems (649 errors, 1225 warnings)

* ^^^ check that commit for details ;)

* Minor.

* rm config header

* Minor cleanups

* Default to tslint, eslint as option

* Trigger

* Update jsonrpc

* 1494 problems (433 errors, 1061 warnings)

* 1103 problems (135 errors, 968 warnings)

* 899 problems (9 errors, 890 warnings)

* 483 problems (9 errors, 474 warnings) (ignore any... for now)

* 366 problems (9 errors, 357 warnings)

* 336 problems (9 errors, 327 warnings)

* 148 problems (9 errors, 139 warnings)

* 31 problems (8 errors, 23 warnings)

* 0, 0
This commit is contained in:
Jaco Greeff
2019-07-14 12:15:14 +02:00
committed by GitHub
parent f770fb973f
commit 71c5920b1f
354 changed files with 3817 additions and 3632 deletions
+2 -2
View File
@@ -2,7 +2,7 @@
// This software may be modified and distributed under the terms
// of the Apache-2.0 license. See the LICENSE file for details.
import { RpcMethodOpt, RpcSection } from './types';
import { RpcMethodOpt } from './types';
import createMethod from './create/method';
import createParam from './create/param';
@@ -51,4 +51,4 @@ export default {
submitExtrinsic: createMethod(section, 'submitExtrinsic', submitExtrinsic),
submitAndWatchExtrinsic: createMethod(section, 'submitAndWatchExtrinsic', submitAndWatchExtrinsic)
}
} as RpcSection;
};
+2 -2
View File
@@ -2,7 +2,7 @@
// This software may be modified and distributed under the terms
// of the Apache-2.0 license. See the LICENSE file for details.
import { RpcMethodOpt, RpcSection } from './types';
import { RpcMethodOpt } from './types';
import createMethod from './create/method';
import createParam from './create/param';
@@ -102,4 +102,4 @@ export default {
subscribeRuntimeVersion: createMethod(section, 'subscribeRuntimeVersion', subscribeRuntimeVersion),
subscribeNewHead: createMethod(section, 'subscribeNewHead', subscribeNewHead)
}
} as RpcSection;
};
+3 -3
View File
@@ -5,9 +5,9 @@
import { CodecTypes } from '@polkadot/types/classes';
import { RpcParam } from '../types';
type RpcParamOptions = {
isOptional?: boolean
};
interface RpcParamOptions {
isOptional?: boolean;
}
export default function createParam (name: string, type: CodecTypes, { isOptional = false }: RpcParamOptions = { isOptional: false }): RpcParam {
return {
+2 -2
View File
@@ -4,8 +4,8 @@
import interfaces from './';
describe('jsonrpc', () => {
it('exports the available interfaces', () => {
describe('jsonrpc', (): void => {
it('exports the available interfaces', (): void => {
expect(interfaces).toBeDefined();
expect(Object.keys(interfaces).length).toBeGreaterThan(0);
});
+1 -1
View File
@@ -9,7 +9,7 @@ import chain from './chain';
import state from './state';
import system from './system';
const interfaces: { [key: string]: RpcSection } = {
const interfaces: Record<string, RpcSection> = {
author,
chain,
state,
+2 -2
View File
@@ -2,7 +2,7 @@
// This software may be modified and distributed under the terms
// of the Apache-2.0 license. See the LICENSE file for details.
import { RpcMethodOpt, RpcSection } from './types';
import { RpcMethodOpt } from './types';
import createMethod from './create/method';
import createParam from './create/param';
@@ -164,4 +164,4 @@ export default {
queryStorage: createMethod(section, 'queryStorage', queryStorage),
subscribeStorage: createMethod(section, 'subscribeStorage', subscribeStorage)
}
} as RpcSection;
};
+2 -2
View File
@@ -2,7 +2,7 @@
// This software may be modified and distributed under the terms
// of the Apache-2.0 license. See the LICENSE file for details.
import { RpcMethodOpt, RpcSection } from './types';
import { RpcMethodOpt } from './types';
import createMethod from './create/method';
@@ -70,4 +70,4 @@ export default {
properties: createMethod(section, 'properties', properties),
version: createMethod(section, 'version', version)
}
} as RpcSection;
};
+35 -37
View File
@@ -6,43 +6,41 @@ import { CodecTypes } from '@polkadot/types/classes';
type PubSub = [string, string, string];
export type RpcParam = {
isOptional: boolean,
name: string,
type: CodecTypes
};
export interface RpcParam {
isOptional: boolean;
name: string;
type: CodecTypes;
}
export type RpcMethodOpt = {
description: string,
isDeprecated?: boolean,
isHidden?: boolean,
isSigned?: boolean,
isSubscription?: boolean,
params: Array<RpcParam>,
pubsub?: PubSub,
type: CodecTypes
};
export interface RpcMethodOpt {
description: string;
isDeprecated?: boolean;
isHidden?: boolean;
isSigned?: boolean;
isSubscription?: boolean;
params: RpcParam[];
pubsub?: PubSub;
type: CodecTypes;
}
export type RpcMethod = {
alias?: string,
description: string,
isDeprecated: boolean,
isHidden: boolean,
isSigned: boolean,
isSubscription: boolean,
method: string,
params: Array<RpcParam>,
pubsub: PubSub,
section: string,
type: CodecTypes
};
export interface RpcMethod {
alias?: string;
description: string;
isDeprecated: boolean;
isHidden: boolean;
isSigned: boolean;
isSubscription: boolean;
method: string;
params: RpcParam[];
pubsub: PubSub;
section: string;
type: CodecTypes;
}
export type RpcSection = {
isDeprecated: boolean,
isHidden: boolean,
description: string,
section: string,
methods: {
[index: string]: RpcMethod
}
};
export interface RpcSection {
isDeprecated: boolean;
isHidden: boolean;
description: string;
section: string;
methods: Record<string, RpcMethod>;
}