From 3d9ee73d02a5862dd1416e1abfdf6b08d5468b86 Mon Sep 17 00:00:00 2001 From: Jack Mallers Date: Thu, 26 Oct 2017 23:14:35 -0500 Subject: [PATCH] fix(lint): fix linting errors --- app/components/ChannelForm/ChannelForm.js | 18 ++++- app/components/ChannelForm/Footer.js | 7 +- app/components/ChannelForm/StepFour.js | 55 +++++++-------- app/components/ChannelForm/StepOne.js | 10 ++- app/components/ChannelForm/StepThree.js | 17 +++-- app/components/ChannelForm/StepTwo.js | 17 +++-- app/components/ChannelForm/index.js | 2 +- app/components/Channels/CardChannel.js | 5 +- app/components/Channels/Channel.js | 2 +- app/components/CryptoIcon/CryptoIcon.js | 1 - app/reducers/channelform.js | 6 +- app/reducers/channels.js | 6 +- app/routes/channels/components/Channels.js | 63 +++++++++--------- .../channels/containers/ChannelsContainer.js | 2 +- resources/bin/linux/lnd | Bin 26274991 -> 26274977 bytes resources/bin/win32/lnd.exe | Bin 26313820 -> 26313815 bytes test/components/Nav.spec.js | 3 - 17 files changed, 123 insertions(+), 91 deletions(-) diff --git a/app/components/ChannelForm/ChannelForm.js b/app/components/ChannelForm/ChannelForm.js index 249abdb6..b1a98f65 100644 --- a/app/components/ChannelForm/ChannelForm.js +++ b/app/components/ChannelForm/ChannelForm.js @@ -39,7 +39,7 @@ const ChannelForm = ({ return } } - + return (

{channelFormHeader}

-
+
@@ -73,6 +73,18 @@ const ChannelForm = ({ ) } -ChannelForm.propTypes = {} +ChannelForm.propTypes = { + channelform: PropTypes.object.isRequired, + openChannel: PropTypes.func.isRequired, + closeChannelForm: PropTypes.func.isRequired, + changeStep: PropTypes.func.isRequired, + setNodeKey: PropTypes.func.isRequired, + setLocalAmount: PropTypes.func.isRequired, + setPushAmount: PropTypes.func.isRequired, + channelFormHeader: PropTypes.string.isRequired, + channelFormProgress: PropTypes.number.isRequired, + stepTwoIsValid: PropTypes.bool.isRequired, + peers: PropTypes.array.isRequired +} export default ChannelForm diff --git a/app/components/ChannelForm/Footer.js b/app/components/ChannelForm/Footer.js index 0bf79d91..36675975 100644 --- a/app/components/ChannelForm/Footer.js +++ b/app/components/ChannelForm/Footer.js @@ -1,16 +1,15 @@ import React from 'react' import PropTypes from 'prop-types' -import { FaArrowLeft, FaArrowRight, FaCheck } from 'react-icons/lib/fa' import styles from './Footer.scss' const Footer = ({ step, changeStep, stepTwoIsValid, submit }) => { - if ( step === 1 ) { return null } + if (step === 1) { return null } // See if the next button on step 2 should be active const nextIsInactive = step === 2 && !stepTwoIsValid - + // Function that's called when the user clicks "next" in the form - const nextFunc = () => { + const nextFunc = () => { if (nextIsInactive) { return } changeStep(step + 1) diff --git a/app/components/ChannelForm/StepFour.js b/app/components/ChannelForm/StepFour.js index 04be2fcb..a1f64582 100644 --- a/app/components/ChannelForm/StepFour.js +++ b/app/components/ChannelForm/StepFour.js @@ -1,34 +1,37 @@ -import React, { Component } from 'react' +import React from 'react' import PropTypes from 'prop-types' -import CurrencyIcon from 'components/CurrencyIcon' import styles from './StepFour.scss' -class StepFour extends Component { - render() { - const { node_key, local_amt, push_amt } = this.props +const StepFour = ({ node_key, local_amt, push_amt }) => ( +
+
+

Peer

+

{node_key}

+
- return ( -
-
-

Peer

-

{node_key}

-
- -
-
-

Local Amount

-

{local_amt}

-
-
-

Push Amount

-

{push_amt}

-
-
+
+
+

Local Amount

+

{local_amt}

- ) - } -} +
+

Push Amount

+

{push_amt}

+
+
+
+) -StepFour.propTypes = {} +StepFour.propTypes = { + node_key: PropTypes.string.isRequired, + local_amt: PropTypes.oneOfType([ + PropTypes.number, + PropTypes.string + ]), + push_amt: PropTypes.oneOfType([ + PropTypes.number, + PropTypes.string + ]) +} export default StepFour diff --git a/app/components/ChannelForm/StepOne.js b/app/components/ChannelForm/StepOne.js index a90fe874..0a92df0e 100644 --- a/app/components/ChannelForm/StepOne.js +++ b/app/components/ChannelForm/StepOne.js @@ -30,7 +30,7 @@ class StepOne extends Component { render() { const { peers, searchQuery } = this.state - + return (
@@ -59,13 +59,17 @@ class StepOne extends Component {

{peer.pub_key}

) - )} + )}
) } } -StepOne.propTypes = {} +StepOne.propTypes = { + peers: PropTypes.array.isRequired, + setNodeKey: PropTypes.func.isRequired, + changeStep: PropTypes.func.isRequired +} export default StepOne diff --git a/app/components/ChannelForm/StepThree.js b/app/components/ChannelForm/StepThree.js index e36fbae2..d864bdfa 100644 --- a/app/components/ChannelForm/StepThree.js +++ b/app/components/ChannelForm/StepThree.js @@ -11,7 +11,11 @@ class StepThree extends Component {

Push Amount

-

The push amount is the amount of bitcoin (if any at all) you'd like to "push" to the other side of the channel when it opens. This amount will be set on the remote side of the channel as part of the initial commitment state.

+

+ The push amount is the amount of bitcoin (if any at all) you'd like + to "push" to the other side of the channel when it opens. + This amount will be set on the remote side of the channel as part of the initial commitment state. +

@@ -19,11 +23,10 @@ class StepThree extends Component { this.input = input} + ref={input => (this.input = input)} size='' value={push_amt} onChange={event => setPushAmount(event.target.value)} @@ -36,6 +39,12 @@ class StepThree extends Component { } } -StepThree.propTypes = {} +StepThree.propTypes = { + push_amt: PropTypes.oneOfType([ + PropTypes.number, + PropTypes.string + ]).isRequired, + setPushAmount: PropTypes.func.isRequired +} export default StepThree diff --git a/app/components/ChannelForm/StepTwo.js b/app/components/ChannelForm/StepTwo.js index 6fd1acc7..ed777351 100644 --- a/app/components/ChannelForm/StepTwo.js +++ b/app/components/ChannelForm/StepTwo.js @@ -1,6 +1,5 @@ import React, { Component } from 'react' import PropTypes from 'prop-types' -import AutosizeInput from 'react-input-autosize' import CurrencyIcon from 'components/CurrencyIcon' import styles from './StepTwo.scss' @@ -12,7 +11,10 @@ class StepTwo extends Component {

Local Amount

-

Local amount is the amount of bitcoin that you would like to commit to the channel. This is the amount that will be sent in an on-chain transaction to open your Lightning channel.

+

+ Local amount is the amount of bitcoin that you would like to commit to the channel. + This is the amount that will be sent in an on-chain transaction to open your Lightning channel. +

@@ -20,11 +22,10 @@ class StepTwo extends Component { this.input = input} + ref={input => (this.input = input)} size='' value={local_amt} onChange={event => setLocalAmount(event.target.value)} @@ -37,6 +38,12 @@ class StepTwo extends Component { } } -StepTwo.propTypes = {} +StepTwo.propTypes = { + local_amt: PropTypes.oneOfType([ + PropTypes.string, + PropTypes.number + ]).isRequired, + setLocalAmount: PropTypes.func.isRequired +} export default StepTwo diff --git a/app/components/ChannelForm/index.js b/app/components/ChannelForm/index.js index 1bcf89ef..a30b36cb 100644 --- a/app/components/ChannelForm/index.js +++ b/app/components/ChannelForm/index.js @@ -1,3 +1,3 @@ import ChannelForm from './ChannelForm' -export default ChannelForm \ No newline at end of file +export default ChannelForm diff --git a/app/components/Channels/CardChannel.js b/app/components/Channels/CardChannel.js index b5420916..e24ba320 100644 --- a/app/components/Channels/CardChannel.js +++ b/app/components/Channels/CardChannel.js @@ -1,16 +1,15 @@ import React from 'react' import PropTypes from 'prop-types' -import { btc } from 'utils' import styles from './CardChannel.scss' const CardChannel = ({ channel }) => (
  • - CardChannel + {channel.chan_id}
  • ) CardChannel.propTypes = { - + channel: PropTypes.object.isRequired } export default CardChannel diff --git a/app/components/Channels/Channel.js b/app/components/Channels/Channel.js index 0a853c9c..e0ebf84b 100644 --- a/app/components/Channels/Channel.js +++ b/app/components/Channels/Channel.js @@ -9,7 +9,7 @@ const Channel = ({ ticker, channel, setChannel, currentTicker }) => (
    Open { - channel.active ? + channel.active ? Active diff --git a/app/components/CryptoIcon/CryptoIcon.js b/app/components/CryptoIcon/CryptoIcon.js index 2b743de1..ee55b5ff 100644 --- a/app/components/CryptoIcon/CryptoIcon.js +++ b/app/components/CryptoIcon/CryptoIcon.js @@ -1,7 +1,6 @@ import React from 'react' import PropTypes from 'prop-types' import path from 'path' -import { FaBitcoin } from 'react-icons/lib/fa' import Isvg from 'react-inlinesvg' const CryptoIcon = ({ currency, styles }) => { diff --git a/app/reducers/channelform.js b/app/reducers/channelform.js index 4ea3cb3f..50a92848 100644 --- a/app/reducers/channelform.js +++ b/app/reducers/channelform.js @@ -78,11 +78,11 @@ export function resetChannelForm() { const ACTION_HANDLERS = { [OPEN_CHANNEL_FORM]: state => ({ ...state, isOpen: true }), [CLOSE_CHANNEL_FORM]: state => ({ ...state, isOpen: false }), - + [SET_NODE_KEY]: (state, { node_key }) => ({ ...state, node_key }), [SET_LOCAL_AMOUNT]: (state, { local_amt }) => ({ ...state, local_amt }), [SET_PUSH_AMOUNT]: (state, { push_amt }) => ({ ...state, push_amt }), - + [CHANGE_STEP]: (state, { step }) => ({ ...state, step }), [RESET_CHANNEL_FORM]: () => (initialState) @@ -94,7 +94,7 @@ const channelFormLocalAmountSelector = state => state.channelform.local_amt channelFormSelectors.channelFormHeader = createSelector( channelFormStepSelector, - step => { + (step) => { switch (step) { case 1: return 'Step 1: Select a peer' diff --git a/app/reducers/channels.js b/app/reducers/channels.js index c738c21f..09c15711 100644 --- a/app/reducers/channels.js +++ b/app/reducers/channels.js @@ -199,9 +199,9 @@ const ACTION_HANDLERS = { [OPENING_FAILURE]: state => ({ ...state, openingChannel: false }), [CLOSING_CHANNEL]: state => ({ ...state, closingChannel: true }), - + [UPDATE_SEARCH_QUERY]: (state, { searchQuery }) => ({ ...state, searchQuery }), - + [SET_VIEW_TYPE]: (state, { viewType }) => ({ ...state, viewType }) } @@ -225,7 +225,7 @@ channelsSelectors.allChannels = createSelector( pendingForceClosedChannelsSelector, channelSearchQuerySelector, (channels, pendingOpenChannels, pendingClosedChannels, pendingForcedClosedChannels, searchQuery) => ( - [...channels, ...pendingOpenChannels, ...pendingClosedChannels, ...pendingForcedClosedChannels].filter(channel => + [...channels, ...pendingOpenChannels, ...pendingClosedChannels, ...pendingForcedClosedChannels].filter(channel => channel.remote_pubkey.includes(searchQuery) || channel.channel_point.includes(searchQuery) ) ) diff --git a/app/routes/channels/components/Channels.js b/app/routes/channels/components/Channels.js index fad0277a..371392db 100644 --- a/app/routes/channels/components/Channels.js +++ b/app/routes/channels/components/Channels.js @@ -13,25 +13,19 @@ import styles from './Channels.scss' class Channels extends Component { componentWillMount() { const { fetchChannels, fetchPeers } = this.props - + fetchChannels() fetchPeers() } render() { const { - channels: { channels, searchQuery, viewType }, + channels: { searchQuery, viewType }, allChannels, updateChannelSearchQuery, setViewType, - - closeChannelForm, - openChannelForm, - channelform, - channelFormHeader, - channelFormProgress, - peers: { peers }, + openChannelForm, ticker, currentTicker, @@ -61,7 +55,7 @@ class Channels extends Component { setViewType(0)}> - setViewType(1)}> +
    @@ -74,26 +68,22 @@ class Channels extends Component {
      - { viewType === 0 && allChannels.map((channel, index) => { - return ( - console.log('hi')} - currentTicker={currentTicker} - /> - ) - }) - } - { viewType === 1 && allChannels.map((channel, index) => { - return ( - + { viewType === 0 && allChannels.map((channel, index) => ( + console.log('hi')} + currentTicker={currentTicker} + /> + )) + } + { viewType === 1 && allChannels.map((channel, index) => ( + card channel - - ) - }) - } + + )) + }
    @@ -102,7 +92,20 @@ class Channels extends Component { } Channels.propTypes = { - + fetchChannels: PropTypes.func.isRequired, + fetchPeers: PropTypes.func.isRequired, + + channels: PropTypes.object.isRequired, + allChannels: PropTypes.array.isRequired, + updateChannelSearchQuery: PropTypes.func.isRequired, + setViewType: PropTypes.func.isRequired, + + openChannelForm: PropTypes.func.isRequired, + + ticker: PropTypes.object.isRequired, + currentTicker: PropTypes.object.isRequired, + + channelFormProps: PropTypes.object.isRequired } export default Channels diff --git a/app/routes/channels/containers/ChannelsContainer.js b/app/routes/channels/containers/ChannelsContainer.js index 592c8779..407c4ec4 100644 --- a/app/routes/channels/containers/ChannelsContainer.js +++ b/app/routes/channels/containers/ChannelsContainer.js @@ -31,7 +31,7 @@ const mapDispatchToProps = { openChannel, updateChannelSearchQuery, setViewType, - + openChannelForm, closeChannelForm, setNodeKey, diff --git a/resources/bin/linux/lnd b/resources/bin/linux/lnd index 8394027267697bb49afa0f5b8c4a89e72da8052b..0c2bfab65394aac00635ff0ceb4b6734613d3847 100755 GIT binary patch delta 1438 zcmW;IXIPd69EI`gb-kj9;8xrV1OaiQBDhclCnC7_9=H$}_$s$PDk|8bP1=A4*|46r zB{sxt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OPe;FVHWsnS(Au?2k$#5AVBW09~ zmN7C`#>sfekO?wTCdp)(B2#6WOqUrlQ)bC*nIm&$p8Wp;^Su_xLRln>Wr<|TQduU; zWreJiRkB*LWsR(rb+TSI$VS;Dn`MjS$X3}V+XdMnJ0(|k$!^&rdu5;OmjiN84ket( K&pe!vm3j_#eSA#- delta 1378 zcmW;KWqS|=7)If1bZm5whSA+MMt9ffhSAN45d#ivFkoO|Vs|TwvoNu+0|NuQTW9Ng z{BZ8;`2o-A+>?oCqHGcQI+@)TaRrX+&dEXhKt((VP~vq!q1cLtEO>o(^=R6P@WoSGv)i9`vLasq`j|KJ=v@ z{TaYO1~Hf+3}qO@8NoWgFYcW(Paj1?*-IIpngJedMv90~{ou zLmcKD&gDGL=K_v!As2BmmvAYUag@usf-AX-tGR}2xsL0(fg8Dro4JKsxsBVogFCs4 zyE(=^+{UMfgMsU(%9id2U3y4Q=_RSsThgSD^p$?nUk1oP86<;chzylsGF(Q;NEs!gWsHoKaWY;e$V8bW z=`vZS$W)mo(`AOtlvy%c=Ez)`C-Y^2ER_E*u*kJomdH|BCd*}otdv!#VV diff --git a/test/components/Nav.spec.js b/test/components/Nav.spec.js index dbe0e4cb..7f98da30 100644 --- a/test/components/Nav.spec.js +++ b/test/components/Nav.spec.js @@ -1,9 +1,6 @@ import React from 'react' import { shallow } from 'enzyme' -import ReactSVG from 'react-svg' import { NavLink } from 'react-router-dom' -import { MdAccountBalanceWallet } from 'react-icons/lib/md' -import { FaClockO, FaDollar } from 'react-icons/lib/fa' import Nav from 'components/Nav' const defaultProps = {