Skip to content

Commit

Permalink
fix(docs): linting
Browse files Browse the repository at this point in the history
  • Loading branch information
jacobheun committed Oct 4, 2018
1 parent 03dc652 commit b84ba05
Show file tree
Hide file tree
Showing 8 changed files with 64 additions and 64 deletions.
5 changes: 1 addition & 4 deletions examples/delegated-routing/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,6 @@
"react-scripts": "1.1.5"
},
"scripts": {
"start": "react-scripts start",
"build": "react-scripts build",
"test": "react-scripts test --env=jsdom",
"eject": "react-scripts eject"
"start": "react-scripts start"
}
}
1 change: 1 addition & 0 deletions examples/delegated-routing/public/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<meta name="theme-color" content="#000000">
<title>Delegated Routing</title>
<link rel="stylesheet" type="text/css" href="main.css">
</head>
<body>
<noscript>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
body {
margin: 0;
padding: 0;
font-family: sans-serif;
}

section * {
margin: 10px;
}
Expand Down
60 changes: 32 additions & 28 deletions examples/delegated-routing/src/App.js
Original file line number Diff line number Diff line change
@@ -1,42 +1,46 @@
import React, { Component } from 'react';
import './App.css';
import Ipfs from 'ipfs';
import libp2pBundle from './libp2p-bundle';
// eslint-disable-next-line
'use strict'

const React = require('react')
const Component = React.Component
const Ipfs = require('ipfs')
const libp2pBundle = require('./libp2p-bundle')
// require('./App.css')

const BootstrapNode = '/ip4/127.0.0.1/tcp/8081/ws/ipfs/QmdoG8DpzYUZMVP5dGmgmigZwR1RE8Cf6SxMPg1SBXJAQ8'

class App extends Component {
constructor(props) {
super(props);
constructor (props) {
super(props)
this.state = {
peers: 0,
// This hash is the IPFS readme
hash: 'QmPZ9gcCEpqKTo6aq61g2nXGUhM4iCL3ewB6LDXZCtioEB',
// This peer is one of the Bootstrap nodes for IPFS
peer: 'QmV6kA2fB8kTr6jc3pL5zbNsjKbmPUHAPKKHRBYe1kDEyc',
isLoading: 0
};
this.peerInterval = null;
}
this.peerInterval = null

this.handleHashChange = this.handleHashChange.bind(this);
this.handleHashSubmit = this.handleHashSubmit.bind(this);
this.handlePeerChange = this.handlePeerChange.bind(this);
this.handlePeerSubmit = this.handlePeerSubmit.bind(this);
this.handleHashChange = this.handleHashChange.bind(this)
this.handleHashSubmit = this.handleHashSubmit.bind(this)
this.handlePeerChange = this.handlePeerChange.bind(this)
this.handlePeerSubmit = this.handlePeerSubmit.bind(this)
}

handleHashChange(event) {
handleHashChange (event) {
this.setState({
hash: event.target.value
});
})
}
handlePeerChange(event) {
handlePeerChange (event) {
this.setState({
peer: event.target.value
});
})
}

handleHashSubmit(event) {
event.preventDefault();
handleHashSubmit (event) {
event.preventDefault()
this.setState({
isLoading: this.state.isLoading + 1
})
Expand All @@ -48,10 +52,10 @@ class App extends Component {
response: data.toString(),
isLoading: this.state.isLoading - 1
})
});
})
}
handlePeerSubmit(event) {
event.preventDefault();
handlePeerSubmit (event) {
event.preventDefault()
this.setState({
isLoading: this.state.isLoading + 1
})
Expand All @@ -63,10 +67,10 @@ class App extends Component {
response: JSON.stringify(results, null, 2),
isLoading: this.state.isLoading - 1
})
});
})
}

componentDidMount() {
componentDidMount () {
window.ipfs = this.ipfs = new Ipfs({
config: {
Addresses: {
Expand Down Expand Up @@ -101,7 +105,7 @@ class App extends Component {
console.log('Connected!')
})

this.peerInterval = setInterval(() => {
this.peerInterval = setInterval(() => {
this.ipfs.swarm.peers((err, peers) => {
if (err) console.log(err)
if (peers) this.setState({peers: peers.length})
Expand All @@ -110,7 +114,7 @@ class App extends Component {
})
}

render() {
render () {
return (
<div>
<header className="center">
Expand All @@ -133,7 +137,7 @@ class App extends Component {
</label>
</form>
</section>
<section className={[this.state.isLoading > 0 ? 'loading': '', 'loader'].join(' ')}>
<section className={[this.state.isLoading > 0 ? 'loading' : '', 'loader'].join(' ')}>
<div className="lds-ripple"><div></div><div></div></div>
</section>
<section>
Expand All @@ -142,8 +146,8 @@ class App extends Component {
</pre>
</section>
</div>
);
)
}
}

export default App;
module.exports = App
9 changes: 0 additions & 9 deletions examples/delegated-routing/src/App.test.js

This file was deleted.

5 changes: 0 additions & 5 deletions examples/delegated-routing/src/index.css

This file was deleted.

13 changes: 8 additions & 5 deletions examples/delegated-routing/src/index.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
import React from 'react';
import ReactDOM from 'react-dom';
import './index.css';
import App from './App';
// eslint-disable-next-line
'use strict'

ReactDOM.render(<App />, document.getElementById('root'));
const React = require('react') // eslint-disable-line no-unused-vars
const ReactDOM = require('react-dom')
const App = require('./App') // eslint-disable-line no-unused-vars
// require('index.css')

ReactDOM.render(<App />, document.getElementById('root'))
29 changes: 16 additions & 13 deletions examples/delegated-routing/src/libp2p-bundle.js
Original file line number Diff line number Diff line change
@@ -1,16 +1,19 @@
import Libp2p from 'libp2p';
import Websockets from 'libp2p-websockets';
import WebSocketStar from 'libp2p-websocket-star';
import WebRTCStar from 'libp2p-webrtc-star';
import MPLEX from 'libp2p-mplex';
import SECIO from 'libp2p-secio';
import KadDHT from 'libp2p-kad-dht';
import DelegatedPeerRouter from 'libp2p-delegated-peer-routing';
import DelegatedContentRouter from 'libp2p-delegated-content-routing';
// eslint-disable-next-line
'use strict'

export default ({peerInfo, peerBook}) => {
const wrtcstar = new WebRTCStar({id: peerInfo.id});
const wsstar = new WebSocketStar({id: peerInfo.id});
const Libp2p = require('libp2p')
const Websockets = require('libp2p-websockets')
const WebSocketStar = require('libp2p-websocket-star')
const WebRTCStar = require('libp2p-webrtc-star')
const MPLEX = require('libp2p-mplex')
const SECIO = require('libp2p-secio')
const KadDHT = require('libp2p-kad-dht')
const DelegatedPeerRouter = require('libp2p-delegated-peer-routing')
const DelegatedContentRouter = require('libp2p-delegated-content-routing')

module.exports = ({peerInfo, peerBook}) => {
const wrtcstar = new WebRTCStar({id: peerInfo.id})
const wsstar = new WebSocketStar({id: peerInfo.id})
const delegatedApiOptions = {
host: '0.0.0.0',
protocol: 'http',
Expand Down Expand Up @@ -72,4 +75,4 @@ export default ({peerInfo, peerBook}) => {
}
}
})
};
}

0 comments on commit b84ba05

Please sign in to comment.