From d0e0c6baf274aab378233a7ae0d67307c03b3a7c Mon Sep 17 00:00:00 2001 From: Florian Dold Date: Mon, 29 May 2017 15:18:48 +0200 Subject: fix linter errors --- src/webex/pages/tree.tsx | 70 ++++++++++++++++++++++++++---------------------- 1 file changed, 38 insertions(+), 32 deletions(-) (limited to 'src/webex/pages/tree.tsx') diff --git a/src/webex/pages/tree.tsx b/src/webex/pages/tree.tsx index ddf8f2dbc..850a3c46d 100644 --- a/src/webex/pages/tree.tsx +++ b/src/webex/pages/tree.tsx @@ -34,9 +34,15 @@ import { import { ImplicitStateComponent, StateHolder } from "../components"; import { - getReserves, getExchanges, getCoins, getPreCoins, - refresh, getDenoms, payback, + getCoins, + getDenoms, + getExchanges, + getPreCoins, + getReserves, + payback, + refresh, } from "../wxApi"; + import * as React from "react"; import * as ReactDOM from "react-dom"; @@ -46,7 +52,7 @@ interface ReserveViewProps { class ReserveView extends React.Component { render(): JSX.Element { - let r: ReserveRecord = this.props.reserve; + const r: ReserveRecord = this.props.reserve; return (
    @@ -71,11 +77,11 @@ interface ToggleProps { class Toggle extends ImplicitStateComponent { renderButton() { - let show = () => { + const show = () => { this.props.expanded(true); this.setState({}); }; - let hide = () => { + const hide = () => { this.props.expanded(false); this.setState({}); }; @@ -104,7 +110,7 @@ interface RefreshDialogProps { } class RefreshDialog extends ImplicitStateComponent { - refreshRequested = this.makeState(false); + private refreshRequested = this.makeState(false); render(): JSX.Element { if (!this.refreshRequested()) { return ( @@ -125,7 +131,7 @@ class RefreshDialog extends ImplicitStateComponent { class CoinView extends React.Component { render() { - let c = this.props.coin; + const c = this.props.coin; return (
      @@ -143,14 +149,13 @@ class CoinView extends React.Component { } - interface PreCoinViewProps { precoin: PreCoinRecord; } class PreCoinView extends React.Component { render() { - let c = this.props.precoin; + const c = this.props.precoin; return (
        @@ -166,8 +171,8 @@ interface CoinListProps { } class CoinList extends ImplicitStateComponent { - coins = this.makeState(null); - expanded = this.makeState(false); + private coins = this.makeState(null); + private expanded = this.makeState(false); constructor(props: CoinListProps) { super(props); @@ -175,7 +180,7 @@ class CoinList extends ImplicitStateComponent { } async update(props: CoinListProps) { - let coins = await getCoins(props.exchangeBaseUrl); + const coins = await getCoins(props.exchangeBaseUrl); this.coins(coins); } @@ -205,8 +210,8 @@ interface PreCoinListProps { } class PreCoinList extends ImplicitStateComponent { - precoins = this.makeState(null); - expanded = this.makeState(false); + private precoins = this.makeState(null); + private expanded = this.makeState(false); constructor(props: PreCoinListProps) { super(props); @@ -214,7 +219,7 @@ class PreCoinList extends ImplicitStateComponent { } async update() { - let precoins = await getPreCoins(this.props.exchangeBaseUrl); + const precoins = await getPreCoins(this.props.exchangeBaseUrl); this.precoins(precoins); } @@ -243,8 +248,8 @@ interface ExpanderTextProps { } class ExpanderText extends ImplicitStateComponent { - expanded = this.makeState(false); - textArea: any = undefined; + private expanded = this.makeState(false); + private textArea: any = undefined; componentDidUpdate() { if (this.expanded() && this.textArea) { @@ -258,10 +263,10 @@ class ExpanderText extends ImplicitStateComponent { return ( { this.expanded(true); }}> {(this.props.text.length <= 10) - ? this.props.text + ? this.props.text : ( - {this.props.text.substring(0,10)} + {this.props.text.substring(0, 10)} ... ) @@ -282,8 +287,8 @@ class ExpanderText extends ImplicitStateComponent { } class DenominationList extends ImplicitStateComponent { - expanded = this.makeState(false); - denoms = this.makeState(undefined); + private expanded = this.makeState(false); + private denoms = this.makeState(undefined); constructor(props: DenominationListProps) { super(props); @@ -291,7 +296,7 @@ class DenominationList extends ImplicitStateComponent { } async update() { - let d = await getDenoms(this.props.exchange.baseUrl); + const d = await getDenoms(this.props.exchange.baseUrl); this.denoms(d); } @@ -316,7 +321,7 @@ class DenominationList extends ImplicitStateComponent { } render(): JSX.Element { - let denoms = this.denoms() + const denoms = this.denoms(); if (!denoms) { return (
        @@ -340,9 +345,10 @@ class DenominationList extends ImplicitStateComponent { } } + class ReserveList extends ImplicitStateComponent { - reserves = this.makeState(null); - expanded = this.makeState(false); + private reserves = this.makeState(null); + private expanded = this.makeState(false); constructor(props: ReserveListProps) { super(props); @@ -350,7 +356,7 @@ class ReserveList extends ImplicitStateComponent { } async update() { - let reserves = await getReserves(this.props.exchangeBaseUrl); + const reserves = await getReserves(this.props.exchangeBaseUrl); this.reserves(reserves); } @@ -376,7 +382,7 @@ interface ExchangeProps { class ExchangeView extends React.Component { render(): JSX.Element { - let e = this.props.exchange; + const e = this.props.exchange; return (
          @@ -399,7 +405,7 @@ interface ExchangesListState { class ExchangesList extends React.Component { constructor() { super(); - let port = chrome.runtime.connect(); + const port = chrome.runtime.connect(); port.onMessage.addListener((msg: any) => { if (msg.notify) { console.log("got notified"); @@ -411,26 +417,26 @@ class ExchangesList extends React.Component { } async update() { - let exchanges = await getExchanges(); + const exchanges = await getExchanges(); console.log("exchanges: ", exchanges); this.setState({ exchanges }); } render(): JSX.Element { - let exchanges = this.state.exchanges; + const exchanges = this.state.exchanges; if (!exchanges) { return ...; } return (
          Exchanges ({exchanges.length.toString()}): - {exchanges.map(e => )} + {exchanges.map((e) => )}
          ); } } -export function main() { +function main() { ReactDOM.render(, document.getElementById("container")!); } -- cgit v1.2.3