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. 67
      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
  14. 2
      app/routes/peers/containers/PeersContainer.js

2
app/components/LndSyncing/LndSyncing.js

@ -21,7 +21,7 @@ class LndSyncing extends Component {
},
{
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

2
app/components/Nav/Nav.js

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

67
app/containers/Root.js

@ -2,6 +2,7 @@
import React from 'react'
import { Provider, connect } from 'react-redux'
import { ConnectedRouter } from 'react-router-redux'
import PropTypes from 'prop-types'
import { fetchBlockHeight, lndSelectors } from 'reducers/lnd'
import LoadingBolt from 'components/LoadingBolt'
import LndSyncing from 'components/LndSyncing'
@ -22,40 +23,42 @@ type RootType = {
history: {}
};
class Root extends React.Component {
render() {
const {
store,
history,
lnd,
fetchBlockHeight,
syncPercentage
} = this.props
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 /> }
const Root = ({
store,
history,
lnd,
fetchBlockHeight,
syncPercentage
}) => {
// If we are syncing show the syncing screen
if (lnd.syncing) {
return (
<Provider store={store}>
<ConnectedRouter history={history}>
<Routes />
</ConnectedRouter>
</Provider>
<LndSyncing
fetchBlockHeight={fetchBlockHeight}
fetchingBlockHeight={lnd.fetchingBlockHeight}
syncPercentage={syncPercentage}
/>
)
}
}
// 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('receiveCryptocurrency', infoData.chains[0])
})
.catch(error => {
console.log('error: ', error)
event.sender.send('infoFailed')
})
.catch(() => event.sender.send('infoFailed'))
break
case 'describeNetwork':
networkController.describeGraph(lnd)

4
app/reducers/address.js

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

14
app/reducers/channels.js

@ -1,10 +1,10 @@
import { createSelector } from 'reselect'
import { ipcRenderer } from 'electron'
import { btc } from 'utils'
import { showNotification } from 'notifications'
import { fetchDescribeNetwork } from './network'
import { closeChannelForm } from './channelform'
import { setError } from './error'
import { showNotification } from 'notifications'
// ------------------------------------
// Constants
// ------------------------------------
@ -199,18 +199,18 @@ export const channelGraphData = (event, data) => (dispatch, getState) => {
dispatch(fetchDescribeNetwork())
// loop through the channel updates
for(let i = 0; i < channel_updates.length; i++) {
let channel_update = channel_updates[i]
let { advertising_node, connecting_node } = channel_update
for (let i = 0; i < channel_updates.length; i++) {
const channel_update = channel_updates[i]
const { advertising_node, connecting_node } = channel_update
// 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
// TODO: full fetch is probably not necessary
dispatch(fetchChannels())
// 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
const notifTitle = 'New channel detected'
@ -222,7 +222,7 @@ export const channelGraphData = (event, data) => (dispatch, getState) => {
}
// IPC event for channel graph status
export const channelGraphStatus = (event, data) => (dispatch) => {
export const channelGraphStatus = (event, data) => () => {
console.log('channelGraphStatus: ', data)
}

8
app/reducers/info.js

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

6
app/reducers/lnd.js

@ -41,12 +41,12 @@ export const lndSynced = () => (dispatch) => {
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
export const lndStdout = (event, line) => dispatch => {
export const lndStdout = (event, line) => (dispatch) => {
let height
let trimmed

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

@ -123,19 +123,25 @@ Activity.propTypes = {
fetchPayments: PropTypes.func.isRequired,
fetchInvoices: PropTypes.func.isRequired,
fetchTransactions: PropTypes.func.isRequired,
ticker: PropTypes.object.isRequired,
searchInvoices: PropTypes.func.isRequired,
invoice: PropTypes.object.isRequired,
payment: PropTypes.object.isRequired,
currentTicker: PropTypes.object.isRequired,
showActivityModal: PropTypes.func.isRequired,
hideActivityModal: PropTypes.func.isRequired,
changeFilter: PropTypes.func.isRequired,
newAddress: PropTypes.func.isRequired,
toggleFilterPulldown: PropTypes.func.isRequired,
activity: PropTypes.object.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

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

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

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

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

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

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

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

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

2
app/routes/peers/containers/PeersContainer.js

@ -1,7 +1,7 @@
import { withRouter } from 'react-router'
import { connect } from 'react-redux'
import {
import {
fetchPeers,
setPeer,
setPeerForm,

Loading…
Cancel
Save