mirror of
https://github.com/pezkuwichain/pezkuwi-ui.git
synced 2026-07-02 09:47:26 +00:00
Swap to eslint (#154)
* 311 problems (173 errors, 138 warnings) * Make a start... * swap to react config * Literally a handful left * Clean. * any removal * Use Record * Adjust versions * Update with latest eslint-standard ruleset * Update defaults.ts
This commit is contained in:
@@ -10,20 +10,19 @@ import { BehaviorSubject } from 'rxjs';
|
||||
import createOptionItem from '../options/item';
|
||||
import development from './development';
|
||||
|
||||
function callNext (current: SubjectInfo, subject: BehaviorSubject<any>, withTest: boolean) {
|
||||
function callNext (current: SubjectInfo, subject: BehaviorSubject<SubjectInfo>, withTest: boolean): void {
|
||||
const isDevMode = development.isDevelopment();
|
||||
const filtered: SubjectInfo = {};
|
||||
|
||||
subject.next(
|
||||
Object.keys(current).reduce((filtered, key) => {
|
||||
const { json: { meta: { isTesting = false } = {} } = {} } = current[key];
|
||||
Object.keys(current).forEach((key): void => {
|
||||
const { json: { meta: { isTesting = false } = {} } = {} } = current[key];
|
||||
|
||||
if (!withTest || isDevMode || isTesting !== true) {
|
||||
filtered[key] = current[key];
|
||||
}
|
||||
if (!withTest || isDevMode || isTesting !== true) {
|
||||
filtered[key] = current[key];
|
||||
}
|
||||
});
|
||||
|
||||
return filtered;
|
||||
}, {} as SubjectInfo)
|
||||
);
|
||||
subject.next(filtered);
|
||||
}
|
||||
|
||||
export default function genericSubject (keyCreator: (address: string) => string, withTest: boolean = false): AddressSubject {
|
||||
@@ -56,7 +55,7 @@ export default function genericSubject (keyCreator: (address: string) => string,
|
||||
|
||||
return current[address];
|
||||
},
|
||||
remove: (store: KeyringStore, address: string) => {
|
||||
remove: (store: KeyringStore, address: string): void => {
|
||||
current = { ...current };
|
||||
|
||||
delete current[address];
|
||||
|
||||
@@ -2,6 +2,8 @@
|
||||
// This software may be modified and distributed under the terms
|
||||
// of the Apache-2.0 license. See the LICENSE file for details.
|
||||
|
||||
import { SubjectInfo } from './types';
|
||||
|
||||
import { combineLatest } from 'rxjs';
|
||||
import { map } from 'rxjs/operators';
|
||||
|
||||
@@ -9,12 +11,18 @@ import accounts from './accounts';
|
||||
import addresses from './addresses';
|
||||
import contracts from './contracts';
|
||||
|
||||
interface Result {
|
||||
accounts: SubjectInfo;
|
||||
addresses: SubjectInfo;
|
||||
contracts: SubjectInfo;
|
||||
}
|
||||
|
||||
export default combineLatest(
|
||||
accounts.subject,
|
||||
addresses.subject,
|
||||
contracts.subject
|
||||
).pipe(
|
||||
map(([accounts, addresses, contracts]) => ({
|
||||
map(([accounts, addresses, contracts]): Result => ({
|
||||
accounts,
|
||||
addresses,
|
||||
contracts
|
||||
|
||||
@@ -6,17 +6,17 @@ import { BehaviorSubject } from 'rxjs';
|
||||
import { KeyringSectionOption } from '../options/types';
|
||||
import { KeyringJson, KeyringStore } from '../types';
|
||||
|
||||
export type SingleAddress = {
|
||||
json: KeyringJson,
|
||||
option: KeyringSectionOption
|
||||
};
|
||||
export interface SingleAddress {
|
||||
json: KeyringJson;
|
||||
option: KeyringSectionOption;
|
||||
}
|
||||
|
||||
export type SubjectInfo = {
|
||||
[index: string]: SingleAddress
|
||||
};
|
||||
export interface SubjectInfo {
|
||||
[index: string]: SingleAddress;
|
||||
}
|
||||
|
||||
export type AddressSubject = {
|
||||
add: (store: KeyringStore, address: string, json: KeyringJson) => SingleAddress,
|
||||
remove: (store: KeyringStore, address: string) => void,
|
||||
subject: BehaviorSubject<SubjectInfo>
|
||||
};
|
||||
export interface AddressSubject {
|
||||
add: (store: KeyringStore, address: string, json: KeyringJson) => SingleAddress;
|
||||
remove: (store: KeyringStore, address: string) => void;
|
||||
subject: BehaviorSubject<SubjectInfo>;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user