Typescript-eslint 2 (#193)

This commit is contained in:
Jaco Greeff
2019-08-31 09:25:48 +02:00
committed by GitHub
parent 52cc245c37
commit 876410cc8e
20 changed files with 137 additions and 75 deletions
+2 -2
View File
@@ -25,8 +25,8 @@
"react": "*"
},
"devDependencies": {
"@polkadot/keyring": "^1.1.1",
"@polkadot/util-crypto": "^1.1.1",
"@polkadot/keyring": "^1.2.0-beta.3",
"@polkadot/util-crypto": "^1.2.0-beta.3",
"xmlserializer": "^0.6.1"
}
}
+2 -2
View File
@@ -32,8 +32,8 @@ function getDataUrl (value: Uint8Array): string {
// HACK See out qrcode stringToBytes override as used internally. This
// will only work for the case where we actuall pass `Bytes` in here
// @ts-ignore
qr.addData(value, 'Byte');
// eslint-disable-next-line @typescript-eslint/no-explicit-any
qr.addData(value as any, 'Byte');
qr.make();
return qr.createDataURL(16, 0);
+2 -2
View File
@@ -6,8 +6,8 @@ import qrcode from 'qrcode-generator';
// HACK The default function take string -> number[], the Uint8array is compatible
// with that signature and the use thereof
// @ts-ignore
qrcode.stringToBytes = (data: Uint8Array): Uint8Array =>
// eslint-disable-next-line @typescript-eslint/no-explicit-any
(qrcode as any).stringToBytes = (data: Uint8Array): Uint8Array =>
data;
export default qrcode;
+3 -3
View File
@@ -19,9 +19,9 @@
"styled-components": "^4.3.1"
},
"devDependencies": {
"@polkadot/keyring": "^1.1.1",
"@polkadot/types": "^0.91.0-beta.9",
"@polkadot/util": "^1.1.1"
"@polkadot/keyring": "^1.2.0-beta.3",
"@polkadot/types": "^0.91.0-beta.10",
"@polkadot/util": "^1.2.0-beta.3"
},
"peerDependencies": {
"@polkadot/keyring": "*",
@@ -25,7 +25,7 @@ function callNext (current: SubjectInfo, subject: BehaviorSubject<SubjectInfo>,
subject.next(filtered);
}
export default function genericSubject (keyCreator: (address: string) => string, withTest: boolean = false): AddressSubject {
export default function genericSubject (keyCreator: (address: string) => string, withTest = false): AddressSubject {
let current: SubjectInfo = {};
const subject = new BehaviorSubject({});
const next = (): void => callNext(current, subject, withTest);
+1 -1
View File
@@ -9,7 +9,7 @@ import { isUndefined } from '@polkadot/util';
import KeyPair from './KeyPair';
export default function createItem (address: string, _name?: string, isUppercase: boolean = true): KeyringSectionOption {
export default function createItem (address: string, _name?: string, isUppercase = true): KeyringSectionOption {
const name = isUndefined(_name)
? (
(address.length > 15)
+1 -1
View File
@@ -47,7 +47,7 @@ export default class ExtensionStore implements KeyringStore {
public set (key: string, value: KeyringJson, cb?: () => void): void {
// shortcut, don't save testing accounts in extension storage
if (key.indexOf('account:') === 0 && value.meta && value.meta.isTesting) {
if (key.startsWith('account:') && value.meta && value.meta.isTesting) {
cb && cb();
return;
+1 -1
View File
@@ -14,7 +14,7 @@
"store": "^2.0.12"
},
"devDependencies": {
"@polkadot/util": "^1.1.1"
"@polkadot/util": "^1.2.0-beta.3"
},
"peerDependencies": {
"@polkadot/util": "*"
+2 -2
View File
@@ -5,7 +5,7 @@
import { Options } from './types';
// matches https://polkadot.js.org & https://*.polkadot.io
const isPolkadot = typeof window !== 'undefined' && window.location.host.indexOf('polkadot') !== -1;
const isPolkadot = typeof window !== 'undefined' && window.location.host.includes('polkadot');
const WSS_NODES = {
parity: {
@@ -158,7 +158,7 @@ const UITHEME_DEFAULT = isPolkadot
? 'polkadot'
: 'substrate';
const UIMODE_DEFAULT = !isPolkadot && typeof window !== 'undefined' && window.location.host.indexOf('ui-light') !== -1
const UIMODE_DEFAULT = !isPolkadot && typeof window !== 'undefined' && window.location.host.includes('ui-light')
? 'light'
: 'full';
+1 -1
View File
@@ -17,6 +17,6 @@
"@polkadot/util-crypto": "*"
},
"devDependencies": {
"@polkadot/util-crypto": "^1.1.1"
"@polkadot/util-crypto": "^1.2.0-beta.3"
}
}
@@ -17,7 +17,7 @@ export default function colors (seeder: Seeder): ColorGen {
Color(hex).rotate(amount)
);
return (alpha: number = 1): string => {
return (alpha = 1): string => {
const index = Math.floor(all.length * seeder());
return all.splice(index, 1)[0]
@@ -3,7 +3,7 @@
// This software may be modified and distributed under the terms
// of the Apache-2.0 license. See the LICENSE file for details.
export default function container (diameter: number, background: string = 'white', className: string = '', _style: { [index: string]: string } = {}): HTMLElement {
export default function container (diameter: number, background = 'white', className = '', _style: { [index: string]: string } = {}): HTMLElement {
const element = document.createElement('div');
const style = Object.assign({
background,
+1 -1
View File
@@ -24,7 +24,7 @@ function generateIcon (seed: string = encodeAddress(randomAsU8a(32))): void {
console.log(`Icon generated in ${(Date.now() - start)}ms`);
}
function generateIcons (count: number = 512): void {
function generateIcons (count = 512): void {
generateIcon(encodeAddress(new Uint8Array(32)));
for (let index = 1; index < count; index++) {
@@ -10,7 +10,7 @@ import newShape from './shape/circle';
import newElement from './svg/element';
import { SHAPE_COUNT } from './defaults';
export default function identicon (seed: string | Uint8Array, diameter: number = 256, className: string = '', style?: { [index: string]: string }): HTMLElement {
export default function identicon (seed: string | Uint8Array, diameter = 256, className = '', style?: { [index: string]: string }): HTMLElement {
const seeder = newSeeder(seed);
const colorGen = colors(seeder);
const outer = newContainer(diameter, 'white', className, style);
@@ -5,7 +5,7 @@
import createSvg from './svg';
export default function element (size: number, type: string = 'svg', x: number = 0, y: number = 0): Element {
export default function element (size: number, type = 'svg', x = 0, y = 0): Element {
const elem = createSvg(type);
elem.setAttributeNS('', 'x', `${x}`);
+1 -1
View File
@@ -134,7 +134,7 @@ function getColors (address: string): string[] {
/**
* @description Generate a array of the circles that make up an indenticon
*/
export default function generate (address: string, isSixPoint: boolean = false): Circle[] {
export default function generate (address: string, isSixPoint = false): Circle[] {
const colors = getColors(address);
return [OUTER_CIRCLE].concat(