Browse Source

fix(lint): fixed some linting errors

renovate/lint-staged-8.x
Jack Mallers 7 years ago
parent
commit
c08f56e6ca
  1. 2
      app/components/LndSyncing/LndSyncing.js
  2. 2
      app/components/Nav/Nav.js
  3. 63
      app/containers/Root.js
  4. 5
      app/lnd/methods/index.js
  5. 4
      app/reducers/address.js
  6. 14
      app/reducers/channels.js
  7. 8
      app/reducers/info.js
  8. 6
      app/reducers/lnd.js
  9. 8
      app/routes/activity/components/Activity.js
  10. 6
      app/routes/activity/components/Activity.scss
  11. 16
      app/routes/app/components/App.js
  12. 18
      app/routes/channels/components/Channels.js
  13. 15
      app/routes/peers/components/Peers.js

2
app/components/LndSyncing/LndSyncing.js

@ -21,7 +21,7 @@ class LndSyncing extends Component {
}, },
{ {
title: 'Onion Routing', title: 'Onion Routing',
description: 'Onion routing is a technique for anonymous communication over a computer network. In an onion network, messages are encapsulated in layers of encryption, analogous to layers of an onion.' // eslint-diabale-line description: 'Onion routing is a technique for anonymous communication over a computer network. In an onion network, messages are encapsulated in layers of encryption, analogous to layers of an onion.' // eslint-disable-line
} }
], ],
currentFact: 0 currentFact: 0

2
app/components/Nav/Nav.js

@ -6,8 +6,6 @@ import Isvg from 'react-inlinesvg'
import walletIcon from 'icons/wallet.svg' import walletIcon from 'icons/wallet.svg'
import peersIcon from 'icons/peers.svg' import peersIcon from 'icons/peers.svg'
import channelsIcon from 'icons/channels.svg' import channelsIcon from 'icons/channels.svg'
import settingsIcon from 'icons/settings.svg'
import globeIcon from 'icons/globe.svg'
import styles from './Nav.scss' import styles from './Nav.scss'

63
app/containers/Root.js

@ -2,6 +2,7 @@
import React from 'react' import React from 'react'
import { Provider, connect } from 'react-redux' import { Provider, connect } from 'react-redux'
import { ConnectedRouter } from 'react-router-redux' import { ConnectedRouter } from 'react-router-redux'
import PropTypes from 'prop-types'
import { fetchBlockHeight, lndSelectors } from 'reducers/lnd' import { fetchBlockHeight, lndSelectors } from 'reducers/lnd'
import LoadingBolt from 'components/LoadingBolt' import LoadingBolt from 'components/LoadingBolt'
import LndSyncing from 'components/LndSyncing' import LndSyncing from 'components/LndSyncing'
@ -22,40 +23,42 @@ type RootType = {
history: {} history: {}
}; };
class Root extends React.Component { const Root = ({
render() { store,
const { history,
store, lnd,
history, fetchBlockHeight,
lnd, syncPercentage
fetchBlockHeight, }) => {
syncPercentage // If we are syncing show the syncing screen
} = this.props if (lnd.syncing) {
console.log('lnd: ', lnd)
console.log('lnd: ', lnd)
if (lnd.syncing) {
return (
<LndSyncing
fetchBlockHeight={fetchBlockHeight}
fetchingBlockHeight={lnd.fetchingBlockHeight}
syncPercentage={syncPercentage}
/>
)
}
if (!lnd.grpcStarted) { return <LoadingBolt /> }
return ( return (
<Provider store={store}> <LndSyncing
<ConnectedRouter history={history}> fetchBlockHeight={fetchBlockHeight}
<Routes /> fetchingBlockHeight={lnd.fetchingBlockHeight}
</ConnectedRouter> syncPercentage={syncPercentage}
</Provider> />
) )
} }
// Don't launch the app without gRPC connection
if (!lnd.grpcStarted) { return <LoadingBolt /> }
return (
<Provider store={store}>
<ConnectedRouter history={history}>
<Routes />
</ConnectedRouter>
</Provider>
)
} }
Root.propTypes = {
store: PropTypes.object.isRequired,
history: PropTypes.object.isRequired,
lnd: PropTypes.object.isRequired,
fetchBlockHeight: PropTypes.func.isRequired,
syncPercentage: PropTypes.number.isRequired
}
export default connect(mapStateToProps, mapDispatchToProps)(Root) export default connect(mapStateToProps, mapDispatchToProps)(Root)

5
app/lnd/methods/index.js

@ -31,10 +31,7 @@ export default function (lnd, event, msg, data) {
event.sender.send('receiveInfo', infoData) event.sender.send('receiveInfo', infoData)
event.sender.send('receiveCryptocurrency', infoData.chains[0]) event.sender.send('receiveCryptocurrency', infoData.chains[0])
}) })
.catch(error => { .catch(() => event.sender.send('infoFailed'))
console.log('error: ', error)
event.sender.send('infoFailed')
})
break break
case 'describeNetwork': case 'describeNetwork':
networkController.describeGraph(lnd) networkController.describeGraph(lnd)

4
app/reducers/address.js

@ -28,9 +28,7 @@ export const newAddress = type => async (dispatch) => {
} }
// Receive IPC event for info // Receive IPC event for info
export const receiveAddress = (event, address) => dispatch => { export const receiveAddress = (event, address) => dispatch => dispatch({ type: RECEIVE_ADDRESS, address })
dispatch({ type: RECEIVE_ADDRESS, address })
}
// ------------------------------------ // ------------------------------------
// Action Handlers // Action Handlers

14
app/reducers/channels.js

@ -1,10 +1,10 @@
import { createSelector } from 'reselect' import { createSelector } from 'reselect'
import { ipcRenderer } from 'electron' import { ipcRenderer } from 'electron'
import { btc } from 'utils' import { btc } from 'utils'
import { showNotification } from 'notifications'
import { fetchDescribeNetwork } from './network' import { fetchDescribeNetwork } from './network'
import { closeChannelForm } from './channelform' import { closeChannelForm } from './channelform'
import { setError } from './error' import { setError } from './error'
import { showNotification } from 'notifications'
// ------------------------------------ // ------------------------------------
// Constants // Constants
// ------------------------------------ // ------------------------------------
@ -199,18 +199,18 @@ export const channelGraphData = (event, data) => (dispatch, getState) => {
dispatch(fetchDescribeNetwork()) dispatch(fetchDescribeNetwork())
// loop through the channel updates // loop through the channel updates
for(let i = 0; i < channel_updates.length; i++) { for (let i = 0; i < channel_updates.length; i++) {
let channel_update = channel_updates[i] const channel_update = channel_updates[i]
let { advertising_node, connecting_node } = channel_update const { advertising_node, connecting_node } = channel_update
// if our node is involved in this update we wanna show a notification // if our node is involved in this update we wanna show a notification
if(info.data.identity_pubkey === advertising_node || info.data.identity_pubkey === connecting_node) { if (info.data.identity_pubkey === advertising_node || info.data.identity_pubkey === connecting_node) {
// this channel has to do with the user, lets fetch a new channel list for them // this channel has to do with the user, lets fetch a new channel list for them
// TODO: full fetch is probably not necessary // TODO: full fetch is probably not necessary
dispatch(fetchChannels()) dispatch(fetchChannels())
// Construct the notification // Construct the notification
let otherParty = info.data.identity_pubkey === advertising_node ? connecting_node : advertising_node const otherParty = info.data.identity_pubkey === advertising_node ? connecting_node : advertising_node
let notifBody = `No new friends, just new channels. Your channel with ${otherParty}` // eslint-disable-line let notifBody = `No new friends, just new channels. Your channel with ${otherParty}` // eslint-disable-line
const notifTitle = 'New channel detected' const notifTitle = 'New channel detected'
@ -222,7 +222,7 @@ export const channelGraphData = (event, data) => (dispatch, getState) => {
} }
// IPC event for channel graph status // IPC event for channel graph status
export const channelGraphStatus = (event, data) => (dispatch) => { export const channelGraphStatus = (event, data) => () => {
console.log('channelGraphStatus: ', data) console.log('channelGraphStatus: ', data)
} }

8
app/reducers/info.js

@ -19,23 +19,19 @@ export function getInfo() {
// Send IPC event for getinfo // Send IPC event for getinfo
export const fetchInfo = () => async (dispatch) => { export const fetchInfo = () => async (dispatch) => {
console.log('fetching info')
dispatch(getInfo()) dispatch(getInfo())
ipcRenderer.send('lnd', { msg: 'info' }) ipcRenderer.send('lnd', { msg: 'info' })
} }
// Receive IPC event for info // Receive IPC event for info
export const receiveInfo = (event, data) => dispatch => { export const receiveInfo = (event, data) => (dispatch) => {
console.log('receiving info and fetching other stuff')
dispatch(fetchBalance()) dispatch(fetchBalance())
dispatch(newAddress('p2pkh')) dispatch(newAddress('p2pkh'))
dispatch({ type: RECEIVE_INFO, data }) dispatch({ type: RECEIVE_INFO, data })
} }
// IPC info fetch failed // IPC info fetch failed
export const infoFailed = (event, data) => dispatch => { // export const infoFailed = (event, data) => dispatch => {}
console.log('INFO FAILED data: ', data)
}
// ------------------------------------ // ------------------------------------
// Action Handlers // Action Handlers

6
app/reducers/lnd.js

@ -41,12 +41,12 @@ export const lndSynced = () => (dispatch) => {
showNotification(notifTitle, notifBody) showNotification(notifTitle, notifBody)
} }
export const grpcDisconnected = () => (dispatch) => dispatch({ type: GRPC_DISCONNECTED }) export const grpcDisconnected = () => dispatch => dispatch({ type: GRPC_DISCONNECTED })
export const grpcConnected = () => (dispatch) => dispatch({ type: GRPC_CONNECTED }) export const grpcConnected = () => dispatch => dispatch({ type: GRPC_CONNECTED })
// Receive IPC event for LND streaming a line // Receive IPC event for LND streaming a line
export const lndStdout = (event, line) => dispatch => { export const lndStdout = (event, line) => (dispatch) => {
let height let height
let trimmed let trimmed

8
app/routes/activity/components/Activity.js

@ -123,19 +123,25 @@ Activity.propTypes = {
fetchPayments: PropTypes.func.isRequired, fetchPayments: PropTypes.func.isRequired,
fetchInvoices: PropTypes.func.isRequired, fetchInvoices: PropTypes.func.isRequired,
fetchTransactions: PropTypes.func.isRequired, fetchTransactions: PropTypes.func.isRequired,
ticker: PropTypes.object.isRequired, ticker: PropTypes.object.isRequired,
searchInvoices: PropTypes.func.isRequired, searchInvoices: PropTypes.func.isRequired,
invoice: PropTypes.object.isRequired, invoice: PropTypes.object.isRequired,
payment: PropTypes.object.isRequired, payment: PropTypes.object.isRequired,
currentTicker: PropTypes.object.isRequired, currentTicker: PropTypes.object.isRequired,
showActivityModal: PropTypes.func.isRequired, showActivityModal: PropTypes.func.isRequired,
hideActivityModal: PropTypes.func.isRequired, hideActivityModal: PropTypes.func.isRequired,
changeFilter: PropTypes.func.isRequired, changeFilter: PropTypes.func.isRequired,
newAddress: PropTypes.func.isRequired, newAddress: PropTypes.func.isRequired,
toggleFilterPulldown: PropTypes.func.isRequired, toggleFilterPulldown: PropTypes.func.isRequired,
activity: PropTypes.object.isRequired, activity: PropTypes.object.isRequired,
currentActivity: PropTypes.array.isRequired, currentActivity: PropTypes.array.isRequired,
nonActiveFilters: PropTypes.array.isRequired nonActiveFilters: PropTypes.array.isRequired,
address: PropTypes.object.isRequired,
balance: PropTypes.object.isRequired,
info: PropTypes.object.isRequired
} }
export default Activity export default Activity

6
app/routes/activity/components/Activity.scss

@ -1,7 +1,7 @@
@import '../../../variables.scss'; @import '../../../variables.scss';
.search { .search {
height: 75px; height: 55px;
padding: 2px; padding: 2px;
border-bottom: 1px solid $darkgrey; border-bottom: 1px solid $darkgrey;
@ -13,7 +13,7 @@
.label { .label {
width: 5%; width: 5%;
line-height: 70px; line-height: 50px;
font-size: 25px; font-size: 25px;
text-align: center; text-align: center;
cursor: pointer; cursor: pointer;
@ -25,7 +25,7 @@
padding: 0; padding: 0;
border: 0; border: 0;
border-radius: 0; border-radius: 0;
height: 68px; height: 50px;
font-size: 18px; font-size: 18px;
} }
} }

16
app/routes/app/components/App.js

@ -1,6 +1,5 @@
import React, { Component } from 'react' import React, { Component } from 'react'
import PropTypes from 'prop-types' import PropTypes from 'prop-types'
import LndSyncing from 'components/LndSyncing'
import GlobalError from 'components/GlobalError' import GlobalError from 'components/GlobalError'
import LoadingBolt from 'components/LoadingBolt' import LoadingBolt from 'components/LoadingBolt'
import Form from 'components/Form' import Form from 'components/Form'
@ -10,7 +9,7 @@ import styles from './App.scss'
class App extends Component { class App extends Component {
componentWillMount() { componentWillMount() {
const { fetchTicker, fetchBalance, fetchInfo, newAddress, lnd: { syncing } } = this.props const { fetchTicker, fetchBalance, fetchInfo, newAddress } = this.props
fetchTicker() fetchTicker()
fetchBalance() fetchBalance()
@ -20,17 +19,11 @@ class App extends Component {
render() { render() {
const { const {
lnd,
syncPercentage,
fetchBlockHeight,
modal: { modalType, modalProps }, modal: { modalType, modalProps },
hideModal, hideModal,
ticker, ticker,
currentTicker, currentTicker,
address: { address },
balance, balance,
info,
form, form,
openPayForm, openPayForm,
@ -73,16 +66,9 @@ class App extends Component {
} }
App.propTypes = { App.propTypes = {
lnd: PropTypes.object.isRequired,
syncPercentage: PropTypes.number.isRequired,
fetchBlockHeight: PropTypes.func.isRequired,
modal: PropTypes.object.isRequired, modal: PropTypes.object.isRequired,
ticker: PropTypes.object.isRequired, ticker: PropTypes.object.isRequired,
address: PropTypes.object.isRequired,
balance: PropTypes.object.isRequired, balance: PropTypes.object.isRequired,
info: PropTypes.object.isRequired,
form: PropTypes.object.isRequired, form: PropTypes.object.isRequired,
formProps: PropTypes.object.isRequired, formProps: PropTypes.object.isRequired,
closeForm: PropTypes.func.isRequired, closeForm: PropTypes.func.isRequired,

18
app/routes/channels/components/Channels.js

@ -1,7 +1,7 @@
import React, { Component } from 'react' import React, { Component } from 'react'
import PropTypes from 'prop-types' import PropTypes from 'prop-types'
import { FaAlignJustify, FaGlobe, FaAngleDown, FaRepeat } from 'react-icons/lib/fa' import { FaAngleDown, FaRepeat } from 'react-icons/lib/fa'
import { MdSearch } from 'react-icons/lib/md' import { MdSearch } from 'react-icons/lib/md'
import OpenPendingChannel from 'components/Channels/OpenPendingChannel' import OpenPendingChannel from 'components/Channels/OpenPendingChannel'
@ -42,11 +42,8 @@ class Channels extends Component {
toggleFilterPulldown, toggleFilterPulldown,
changeFilter, changeFilter,
activeChannels,
currentChannels, currentChannels,
openChannels,
updateChannelSearchQuery, updateChannelSearchQuery,
setViewType,
openChannelForm, openChannelForm,
@ -56,18 +53,18 @@ class Channels extends Component {
channelFormProps channelFormProps
} = this.props } = this.props
const refreshClicked = event => { const refreshClicked = () => {
// turn the spinner on // turn the spinner on
this.setState({ refreshing: true }) this.setState({ refreshing: true })
// store event in icon so we dont get an error when react clears it // store event in icon so we dont get an error when react clears it
let icon = this.refs.repeat.childNodes const icon = this.refs.repeat.childNodes
// fetch peers // fetch peers
fetchChannels() fetchChannels()
// wait for the svg to appear as child // wait for the svg to appear as child
let svgTimeout = setTimeout(() => { const svgTimeout = setTimeout(() => {
if (icon[0].tagName === 'svg') { if (icon[0].tagName === 'svg') {
// spin icon for 1 sec // spin icon for 1 sec
icon[0].style.animation = 'spin 1000ms linear 1' icon[0].style.animation = 'spin 1000ms linear 1'
@ -76,7 +73,7 @@ class Channels extends Component {
}, 1) }, 1)
// clear animation after the second so we can reuse it // clear animation after the second so we can reuse it
let refreshTimeout = setTimeout(() => { const refreshTimeout = setTimeout(() => {
icon[0].style.animation = '' icon[0].style.animation = ''
this.setState({ refreshing: false }) this.setState({ refreshing: false })
clearTimeout(refreshTimeout) clearTimeout(refreshTimeout)
@ -134,7 +131,7 @@ class Channels extends Component {
{ {
this.state.refreshing ? this.state.refreshing ?
<FaRepeat /> <FaRepeat />
: :
'Refresh' 'Refresh'
} }
</span> </span>
@ -189,16 +186,15 @@ Channels.propTypes = {
channels: PropTypes.object.isRequired, channels: PropTypes.object.isRequired,
currentChannels: PropTypes.array.isRequired, currentChannels: PropTypes.array.isRequired,
openChannels: PropTypes.array.isRequired,
nonActiveFilters: PropTypes.array.isRequired, nonActiveFilters: PropTypes.array.isRequired,
updateChannelSearchQuery: PropTypes.func.isRequired, updateChannelSearchQuery: PropTypes.func.isRequired,
setViewType: PropTypes.func.isRequired,
setCurrentChannel: PropTypes.func.isRequired, setCurrentChannel: PropTypes.func.isRequired,
openChannelForm: PropTypes.func.isRequired, openChannelForm: PropTypes.func.isRequired,
closeChannel: PropTypes.func.isRequired, closeChannel: PropTypes.func.isRequired,
toggleFilterPulldown: PropTypes.func.isRequired, toggleFilterPulldown: PropTypes.func.isRequired,
changeFilter: PropTypes.func.isRequired, changeFilter: PropTypes.func.isRequired,
fetchPeers: PropTypes.func.isRequired,
ticker: PropTypes.object.isRequired, ticker: PropTypes.object.isRequired,
currentTicker: PropTypes.object.isRequired, currentTicker: PropTypes.object.isRequired,

15
app/routes/peers/components/Peers.js

@ -1,9 +1,7 @@
import React, { Component } from 'react' import React, { Component } from 'react'
import PropTypes from 'prop-types' import PropTypes from 'prop-types'
import Isvg from 'react-inlinesvg'
import userIcon from 'icons/user.svg' import { FaRepeat } from 'react-icons/lib/fa'
import { FaUser, FaRepeat } from 'react-icons/lib/fa'
import { MdSearch } from 'react-icons/lib/md' import { MdSearch } from 'react-icons/lib/md'
import PeerForm from 'components/Peers/PeerForm' import PeerForm from 'components/Peers/PeerForm'
@ -39,18 +37,18 @@ class Peers extends Component {
peers: { peer, searchQuery } peers: { peer, searchQuery }
} = this.props } = this.props
const refreshClicked = event => { const refreshClicked = () => {
// turn the spinner on // turn the spinner on
this.setState({ refreshing: true }) this.setState({ refreshing: true })
// store event in icon so we dont get an error when react clears it // store event in icon so we dont get an error when react clears it
let icon = this.refs.repeat.childNodes const icon = this.refs.repeat.childNodes
// fetch peers // fetch peers
fetchPeers() fetchPeers()
// wait for the svg to appear as child // wait for the svg to appear as child
let svgTimeout = setTimeout(() => { const svgTimeout = setTimeout(() => {
if (icon[0].tagName === 'svg') { if (icon[0].tagName === 'svg') {
// spin icon for 1 sec // spin icon for 1 sec
icon[0].style.animation = 'spin 1000ms linear 1' icon[0].style.animation = 'spin 1000ms linear 1'
@ -59,7 +57,7 @@ class Peers extends Component {
}, 1) }, 1)
// clear animation after the second so we can reuse it // clear animation after the second so we can reuse it
let refreshTimeout = setTimeout(() => { const refreshTimeout = setTimeout(() => {
icon[0].style.animation = '' icon[0].style.animation = ''
this.setState({ refreshing: false }) this.setState({ refreshing: false })
clearTimeout(refreshTimeout) clearTimeout(refreshTimeout)
@ -104,7 +102,7 @@ class Peers extends Component {
{ {
this.state.refreshing ? this.state.refreshing ?
<FaRepeat /> <FaRepeat />
: :
'Refresh' 'Refresh'
} }
</span> </span>
@ -130,6 +128,7 @@ Peers.propTypes = {
peerModalOpen: PropTypes.bool.isRequired, peerModalOpen: PropTypes.bool.isRequired,
filteredPeers: PropTypes.array.isRequired, filteredPeers: PropTypes.array.isRequired,
peers: PropTypes.object.isRequired,
peer: PropTypes.object, peer: PropTypes.object,
searchQuery: PropTypes.string searchQuery: PropTypes.string
} }

Loading…
Cancel
Save