Bump deps w/ eslint (#322)

* Bump deps w/ eslint

* theme default
This commit is contained in:
Jaco Greeff
2020-05-24 09:35:43 +02:00
committed by GitHub
parent 050d1966c6
commit 2df46e88ce
26 changed files with 504 additions and 353 deletions
+3 -3
View File
@@ -31,9 +31,9 @@
"devDependencies": {
"@babel/core": "^7.9.6",
"@babel/runtime": "^7.9.6",
"@polkadot/dev": "^0.53.5",
"@polkadot/ts": "^0.3.22",
"@types/jest": "^25.2.2",
"@polkadot/dev": "^0.54.1",
"@polkadot/ts": "^0.3.23",
"@types/jest": "^25.2.3",
"babel-plugin-transform-vue-template": "^0.4.2",
"empty": "^0.10.1",
"react": "^16.13.1",
+6 -4
View File
@@ -113,7 +113,9 @@ function App ({ className }: Props): React.ReactElement<Props> | null {
);
}
cryptoWaitReady().then((): void => {
keyring.loadAll({ ss58Format: 42, type: 'sr25519' });
ReactDOM.render(<App />, rootElement);
});
cryptoWaitReady()
.then((): void => {
keyring.loadAll({ ss58Format: 42, type: 'sr25519' });
ReactDOM.render(<App />, rootElement);
})
.catch(console.error);
+8 -6
View File
@@ -88,10 +88,12 @@ const Example = Vue.extend({
}
});
cryptoWaitReady().then((): void => {
keyring.loadAll({ ss58Format: 42, type: 'sr25519' });
cryptoWaitReady()
.then((): void => {
keyring.loadAll({ ss58Format: 42, type: 'sr25519' });
new Vue({
render: (h): VNode => h(Example)
}).$mount('#example');
});
new Vue({
render: (h): VNode => h(Example)
}).$mount('#example');
})
.catch(console.error);
+8 -1
View File
@@ -12,6 +12,7 @@ import { mnemonicGenerate, cryptoWaitReady } from '@polkadot/util-crypto';
const styles = StyleSheet.create({
body: {
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment,@typescript-eslint/no-unsafe-member-access
backgroundColor: Colors.white
},
buttonContainer: {
@@ -20,11 +21,13 @@ const styles = StyleSheet.create({
flexDirection: 'column'
},
mainTitle: {
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment,@typescript-eslint/no-unsafe-member-access
color: Colors.black,
fontSize: 28,
fontWeight: '600'
},
scrollView: {
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment,@typescript-eslint/no-unsafe-member-access
backgroundColor: Colors.lighter
},
sectionContainer: {
@@ -32,12 +35,14 @@ const styles = StyleSheet.create({
paddingHorizontal: 24
},
sectionDescription: {
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment,@typescript-eslint/no-unsafe-member-access
color: Colors.dark,
fontSize: 18,
fontWeight: '400',
marginTop: 8
},
sectionTitle: {
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment,@typescript-eslint/no-unsafe-member-access
color: Colors.black,
fontSize: 24,
fontWeight: '600'
@@ -46,7 +51,7 @@ const styles = StyleSheet.create({
const globalAny = global as unknown as Window;
export default function App (): React.ReactElement<{}> | null {
export default function App (): React.ReactElement | null {
const [isReady, setReady] = useState(false);
const [address, setAddress] = useState<string | null>(null);
const [phrase, setPhrase] = useState<string | null>(null);
@@ -80,6 +85,7 @@ export default function App (): React.ReactElement<{}> | null {
console.log('Error loading keyring ', e);
}
// eslint-disable-next-line @typescript-eslint/no-unsafe-call
await globalAny.localStorage.init();
await cryptoWaitReady();
@@ -88,6 +94,7 @@ export default function App (): React.ReactElement<{}> | null {
};
if (!isReady) {
// eslint-disable-next-line @typescript-eslint/no-floating-promises
initialize();
}
+2 -2
View File
@@ -26,7 +26,7 @@
"@polkadot/reactnative-identicon": "0.54.0-beta.1",
"@polkadot/ui-keyring": "0.54.0-beta.1",
"@polkadot/ui-settings": "0.54.0-beta.1",
"@react-native-community/async-storage": "^1.10.1",
"@react-native-community/async-storage": "^1.10.3",
"fast-text-encoding": "^1.0.2",
"get-yarn-workspaces": "^1.0.2",
"os-browserify": "^0.3.0",
@@ -43,7 +43,7 @@
"@polkadot/keyring": "^2.10.1",
"@polkadot/util": "^2.10.1",
"@polkadot/util-crypto": "^2.10.1",
"@react-native-community/cli-platform-ios": "^4.8.0",
"@react-native-community/cli-platform-ios": "^4.9.0",
"@types/react-test-renderer": "16.9.2",
"babel-jest": "^26.0.1",
"metro-react-native-babel-preset": "^0.59.0",
+1 -1
View File
@@ -117,7 +117,7 @@ class BaseIcon extends React.PureComponent<Props, State> {
return (
<Wrapper
className={`ui--IdentityIcon ${className}`}
className={`ui--IdentityIcon ${className || ''}`}
key={address}
style={style}
>
@@ -7,7 +7,7 @@ import { Props } from '../types';
import React, { useCallback } from 'react';
import { beachballIcon } from '@polkadot/ui-shared';
function Beachball ({ address, className, size, style }: Props): React.ReactElement<Props> {
function Beachball ({ address, className = '', size, style }: Props): React.ReactElement<Props> {
const updateElem = useCallback(
(node: HTMLDivElement): void => {
node && node.appendChild(
+1 -1
View File
@@ -6,7 +6,7 @@ import { Props } from '../types';
import React from 'react';
function Empty ({ className, size, style }: Props): React.ReactElement<Props> {
function Empty ({ className = '', size, style }: Props): React.ReactElement<Props> {
return (
<div
className={`container ${className}`}
@@ -7,7 +7,7 @@ import { Props } from '../types';
import React from 'react';
import jdenticon from 'jdenticon';
function Jdenticon ({ className, publicKey, size, style }: Props): React.ReactElement<Props> {
function Jdenticon ({ className = '', publicKey, size, style }: Props): React.ReactElement<Props> {
return (
<div
className={`container ${className}`}
@@ -38,7 +38,7 @@ function renderCircle ({ cx, cy, fill, r }: Circle, key: number): React.ReactNod
);
}
function Identicon ({ address, className, isAlternative = false, size, style }: Props): React.ReactElement<Props> {
function Identicon ({ address, className = '', isAlternative = false, size, style }: Props): React.ReactElement<Props> {
return (
<div
className={`container ${className}`}
+1 -1
View File
@@ -37,7 +37,7 @@ function ScanAddress ({ className, onError, onScan, size, style }: Props): React
decodeAddress(address);
onScan({ address, genesisHash, name });
} catch (error) {
console.error('@polkadot/react-qr:QrScanAddress', error.message, data);
console.error('@polkadot/react-qr:QrScanAddress', (error as Error).message, data);
}
},
[onScan]
+1 -1
View File
@@ -9,7 +9,7 @@ const qrcode: typeof _qrcode = _qrcode;
// HACK The default function take string -> number[], the Uint8array is compatible
// with that signature and the use thereof
// eslint-disable-next-line @typescript-eslint/no-explicit-any
// eslint-disable-next-line @typescript-eslint/no-explicit-any,@typescript-eslint/no-unsafe-member-access
(qrcode as any).stringToBytes = (data: Uint8Array): Uint8Array =>
data;
+1 -1
View File
@@ -20,6 +20,6 @@
},
"devDependencies": {
"@polkadot/util-crypto": "^2.10.1",
"@types/react-native": "^0.62.9"
"@types/react-native": "^0.62.11"
}
}
+2 -1
View File
@@ -26,9 +26,10 @@
},
"devDependencies": {
"@polkadot/keyring": "^2.10.1",
"@polkadot/types": "^1.15.0-beta.5",
"@polkadot/types": "^1.15.1",
"@polkadot/util": "^2.10.1",
"@types/ledgerhq__hw-transport-node-hid": "^4.22.1",
"@types/ledgerhq__hw-transport-webusb": "^4.70.0",
"@types/mkdirp": "^1.0.0",
"@types/store": "^2.0.2"
},
+1 -1
View File
@@ -326,7 +326,7 @@ export class Keyring extends Base implements KeyringStruct {
};
Object.keys(meta).forEach((key): void => {
json.meta[key] = meta[key];
json.meta[key] = meta[key] as unknown;
});
delete json.meta.isRecent;
@@ -1 +0,0 @@
declare module '@ledgerhq/hw-transport-webusb';
+1 -1
View File
@@ -50,6 +50,6 @@ export default class FileStore implements KeyringStore {
private _readKey (key: string): KeyringJson {
return JSON.parse(
fs.readFileSync(this._getPath(key)).toString('utf-8')
);
) as KeyringJson;
}
}
+1 -3
View File
@@ -26,7 +26,6 @@ export interface KeyringOptions extends KeyringOptionsBase {
store?: KeyringStore;
}
// eslint-disable-next-line @typescript-eslint/class-name-casing
export interface KeyringJson$Meta {
contract?: ContractMeta;
genesisHash?: string | null;
@@ -39,8 +38,7 @@ export interface KeyringJson$Meta {
whenCreated?: number;
whenEdited?: number;
whenUsed?: number;
// eslint-disable-next-line @typescript-eslint/no-explicit-any
[index: string]: any;
[index: string]: unknown;
}
export interface KeyringJson {
+2 -2
View File
@@ -42,11 +42,11 @@ export class Settings implements SettingsStruct {
#uiTheme: string;
constructor () {
const settings = store.get('settings') || {};
const settings = (store.get('settings') as SettingsStruct) || {};
this.#emitter = new EventEmitter();
this.#apiUrl = (typeof settings.apiUrl === 'string' && settings.apiUrl) || process.env.WS_URL || ENDPOINT_DEFAULT;
this.#apiUrl = (typeof settings.apiUrl === 'string' && settings.apiUrl) || process.env.WS_URL || (ENDPOINT_DEFAULT.value as string);
this.#camera = withDefault(CAMERA, settings.camera, CAMERA_DEFAULT);
this.#ledgerConn = withDefault(LEDGER_CONN, settings.ledgerConn, LEDGER_CONN_DEFAULT);
this.#i18nLang = settings.i18nLang || LANGUAGE_DEFAULT;
+2 -1
View File
@@ -19,6 +19,7 @@
"devDependencies": {
"@polkadot/util": "^2.10.1",
"@polkadot/util-crypto": "^2.10.1",
"@types/color": "^3.0.1"
"@types/color": "^3.0.1",
"@types/xmlserializer": "^0.6.0"
}
}
@@ -7,7 +7,7 @@ import container from './container';
describe('container', (): void => {
it('applies default styles', (): void => {
expect(
// eslint-disable-next-line @typescript-eslint/no-explicit-any
// eslint-disable-next-line @typescript-eslint/no-explicit-any,@typescript-eslint/no-unsafe-member-access
(container(100).style as any)._values
).toMatchObject({
background: 'white',
@@ -23,7 +23,7 @@ describe('container', (): void => {
it('overrides with supplied styles', (): void => {
expect(
// eslint-disable-next-line @typescript-eslint/no-explicit-any
// eslint-disable-next-line @typescript-eslint/no-explicit-any,@typescript-eslint/no-unsafe-member-access
(container(50, 'black', '', { display: 'block' }).style as any)._values
).toMatchObject({
background: 'black',
@@ -1,5 +0,0 @@
// Copyright 2017-2020 @polkadot/ui-shared authors & contributors
// This software may be modified and distributed under the terms
// of the Apache-2.0 license. See the LICENSE file for details.
declare module 'xmlserializer';
+2 -2
View File
@@ -65,8 +65,8 @@ export const Identicon = Vue.extend({
},
methods: {
createData: function (): void {
this.iconSize = this.size || DEFAULT_SIZE;
this.type = this.theme;
this.iconSize = this.size as number || DEFAULT_SIZE;
this.type = this.theme as 'empty';
this.recodeAddress();
},
@@ -25,7 +25,7 @@ export const Jdenticon = Vue.extend({
},
methods: {
createSvgHtml: function (): void {
this.svgHtml = jdenticon.toSvg(this.publicKey.substr(2), this.size);
this.svgHtml = jdenticon.toSvg((this.publicKey as string).substr(2), this.size);
}
},
props: ['publicKey', 'size'],
+7 -2
View File
@@ -9,6 +9,11 @@ interface Data {
svgHtml: string;
}
interface This {
address: string;
isAlternative?: boolean;
}
/**
* @name Polkadot
* @description The Polkadot default identicon
@@ -25,11 +30,11 @@ export const Polkadot = Vue.extend({
},
methods: {
createSvgHtml: function (): void {
const circles = polkadotIcon(this.address, { isAlternative: this.isAlternative || false }).map(({ cx, cy, fill, r }) =>
const circles = polkadotIcon(this.address, { isAlternative: (this as This).isAlternative || false }).map(({ cx, cy, fill, r }) =>
`<circle cx=${cx} cy=${cy} fill="${fill}" r=${r} />`
).join('');
this.svgHtml = `<svg height=${this.size} viewBox='0 0 64 64' width=${this.size}>${circles}</svg>`;
this.svgHtml = `<svg height=${this.size as number} viewBox='0 0 64 64' width=${this.size as number}>${circles}</svg>`;
}
},
props: ['address', 'isAlternative', 'size'],
+448 -307
View File
File diff suppressed because it is too large Load Diff