Skip to content
This repository was archived by the owner on Mar 22, 2020. It is now read-only.

Commit 1fcb9db

Browse files
committed
FIX: Lint fixes
1 parent 55fad53 commit 1fcb9db

File tree

10 files changed

+53
-62
lines changed

10 files changed

+53
-62
lines changed

.eslintrc

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,8 @@
5656
"react/self-closing-comp": 0,
5757
"redux-saga/no-yield-in-race": 2,
5858
"redux-saga/yield-effects": 2,
59-
"jsx-a11y/anchor-is-valid": 0
59+
"jsx-a11y/anchor-is-valid": 0,
60+
"react/jsx-one-expression-per-line": 0
6061
},
6162
"settings": {
6263
"import/resolver": {

app/components/List/List.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,13 @@ import React from 'react';
22
import PropTypes from 'prop-types';
33
import './style.scss';
44

5-
const List = (props) => {
6-
const ComponentToRender = props.component;
5+
const List = ({ component, items }) => {
6+
const ComponentToRender = component;
77
let content = (<div></div>);
88

99
// If we have items, render them
10-
if (props.items) {
11-
content = props.items.map((item) => (
10+
if (items) {
11+
content = items.map((item) => (
1212
<ComponentToRender key={`item-${item.id}`} item={item} />
1313
));
1414
} else {

app/components/ListItem/ListItem.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@ import React from 'react';
22
import PropTypes from 'prop-types';
33
import './style.scss';
44

5-
const ListItem = (props) => (
5+
const ListItem = ({ item }) => (
66
<div className="list-item-wrapper">
7-
<li className="list-item">{props.item}</li>
7+
<li className="list-item">{item}</li>
88
</div>
99
);
1010

app/configureStore.js

Lines changed: 10 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -14,34 +14,22 @@ export default function configureStore(initialState = {}, history) {
1414
// Create the store with two middlewares
1515
// 1. sagaMiddleware: Makes redux-sagas work
1616
// 2. routerMiddleware: Syncs the location/URL path to the state
17-
const middlewares = [
18-
sagaMiddleware,
19-
routerMiddleware(history),
20-
];
17+
const middlewares = [sagaMiddleware, routerMiddleware(history)];
2118

22-
const enhancers = [
23-
applyMiddleware(...middlewares),
24-
];
19+
const enhancers = [applyMiddleware(...middlewares)];
2520

2621
// If Redux DevTools Extension is installed use it, otherwise use Redux compose
2722
/* eslint-disable no-underscore-dangle */
28-
const composeEnhancers =
29-
process.env.NODE_ENV !== 'production' &&
30-
typeof window === 'object' &&
31-
window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__
32-
? window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__({
33-
// TODO Try to remove when `react-router-redux` is out of beta, LOCATION_CHANGE should not be fired more than once after hot reloading
34-
// Prevent recomputing reducers for `replaceReducer`
35-
shouldHotReload: false,
36-
})
37-
: compose;
23+
const composeEnhancers = process.env.NODE_ENV !== 'production' && typeof window === 'object' && window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__
24+
? window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__({
25+
// TODO Try to remove when `react-router-redux` is out of beta, LOCATION_CHANGE should not be fired more than once after hot reloading
26+
// Prevent recomputing reducers for `replaceReducer`
27+
shouldHotReload: false
28+
})
29+
: compose;
3830
/* eslint-enable */
3931

40-
const store = createStore(
41-
createReducer(),
42-
fromJS(initialState),
43-
composeEnhancers(...enhancers)
44-
);
32+
const store = createStore(createReducer(), fromJS(initialState), composeEnhancers(...enhancers));
4533

4634
// Extensions
4735
store.runSaga = sagaMiddleware.run;

app/containers/HomePage/HomePage.js

Lines changed: 17 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -15,17 +15,20 @@ export default class HomePage extends React.PureComponent { // eslint-disable-li
1515
* when initial state username is not null, submit the form to load repos
1616
*/
1717
componentDidMount() {
18-
if (this.props.username && this.props.username.trim().length > 0) {
19-
this.props.onSubmitForm();
18+
const { username, onSubmitForm } = this.props;
19+
if (username && username.trim().length > 0) {
20+
onSubmitForm();
2021
}
2122
}
2223

2324
render() {
24-
const { loading, error, repos } = this.props;
25+
const {
26+
loading, error, repos, username, onChangeUsername, onSubmitForm
27+
} = this.props;
2528
const reposListProps = {
2629
loading,
2730
error,
28-
repos,
31+
repos
2932
};
3033

3134
return (
@@ -37,20 +40,22 @@ export default class HomePage extends React.PureComponent { // eslint-disable-li
3740
<div className="home-page">
3841
<section className="centered">
3942
<h2>Start your next react project in seconds</h2>
40-
<p>A minimal <i>React-Redux</i> boilerplate with all the best practices</p>
43+
<p>
44+
A minimal <i>React-Redux</i> boilerplate with all the best practices
45+
</p>
4146
</section>
4247
<section>
4348
<h2>Try me!</h2>
44-
<form onSubmit={this.props.onSubmitForm}>
49+
<form onSubmit={onSubmitForm}>
4550
<label htmlFor="username">
46-
Show Github repositories by
51+
Show Github repositories by
4752
<span className="at-prefix">@</span>
4853
<input
4954
id="username"
5055
type="text"
5156
placeholder="flexdinesh"
52-
value={this.props.username}
53-
onChange={this.props.onChangeUsername}
57+
value={username}
58+
onChange={onChangeUsername}
5459
/>
5560
</label>
5661
</form>
@@ -64,15 +69,9 @@ export default class HomePage extends React.PureComponent { // eslint-disable-li
6469

6570
HomePage.propTypes = {
6671
loading: PropTypes.bool,
67-
error: PropTypes.oneOfType([
68-
PropTypes.object,
69-
PropTypes.bool,
70-
]),
71-
repos: PropTypes.oneOfType([
72-
PropTypes.array,
73-
PropTypes.bool,
74-
]),
72+
error: PropTypes.oneOfType([PropTypes.object, PropTypes.bool]),
73+
repos: PropTypes.oneOfType([PropTypes.array, PropTypes.bool]),
7574
onSubmitForm: PropTypes.func,
7675
username: PropTypes.string,
77-
onChangeUsername: PropTypes.func,
76+
onChangeUsername: PropTypes.func
7877
};

app/containers/HomePage/saga.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,9 @@
22
* Gets the repositories of the user from Github
33
*/
44

5-
import { call, put, select, takeLatest } from 'redux-saga/effects';
5+
import {
6+
call, put, select, takeLatest
7+
} from 'redux-saga/effects';
68
import { LOAD_REPOS } from 'containers/App/constants';
79
import { reposLoaded, repoLoadingError } from 'containers/App/actions';
810

app/containers/RepoListItem/RepoListItem.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,12 @@ import './style.scss';
1212

1313
export default class RepoListItem extends React.PureComponent { // eslint-disable-line react/prefer-stateless-function
1414
render() {
15-
const { item } = this.props;
15+
const { item, currentUser } = this.props;
1616
let nameprefix = '';
1717

1818
// If the repository is owned by a different person than we got the data for
1919
// it's a fork and we should show the name of the owner
20-
if (item.owner.login !== this.props.currentUser) {
20+
if (item.owner.login !== currentUser) {
2121
nameprefix = `${item.owner.login}/`;
2222
}
2323

app/utils/injectReducer.js

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,19 +14,20 @@ import getInjectors from './reducerInjectors';
1414
export default ({ key, reducer }) => (WrappedComponent) => {
1515
class ReducerInjector extends React.Component {
1616
static WrappedComponent = WrappedComponent;
17-
static displayName = `withReducer(${(WrappedComponent.displayName || WrappedComponent.name || 'Component')})`;
17+
18+
static displayName = `withReducer(${WrappedComponent.displayName || WrappedComponent.name || 'Component'})`;
19+
1820
static contextTypes = {
19-
store: PropTypes.object.isRequired,
21+
store: PropTypes.object.isRequired
2022
};
2123

24+
injectors = getInjectors(this.context.store); // eslint-disable-line react/destructuring-assignment
25+
2226
componentWillMount() {
2327
const { injectReducer } = this.injectors;
24-
2528
injectReducer(key, reducer);
2629
}
2730

28-
injectors = getInjectors(this.context.store);
29-
3031
render() {
3132
return <WrappedComponent {...this.props} />;
3233
}

app/utils/injectSaga.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -18,25 +18,25 @@ import getInjectors from './sagaInjectors';
1818
export default ({ key, saga, mode }) => (WrappedComponent) => {
1919
class InjectSaga extends React.Component {
2020
static WrappedComponent = WrappedComponent;
21-
static displayName = `withSaga(${(WrappedComponent.displayName || WrappedComponent.name || 'Component')})`;
21+
22+
static displayName = `withSaga(${WrappedComponent.displayName || WrappedComponent.name || 'Component'})`;
23+
2224
static contextTypes = {
23-
store: PropTypes.object.isRequired,
25+
store: PropTypes.object.isRequired
2426
};
2527

28+
injectors = getInjectors(this.context.store); // eslint-disable-line react/destructuring-assignment
29+
2630
componentWillMount() {
2731
const { injectSaga } = this.injectors;
28-
2932
injectSaga(key, { saga, mode }, this.props);
3033
}
3134

3235
componentWillUnmount() {
3336
const { ejectSaga } = this.injectors;
34-
3537
ejectSaga(key);
3638
}
3739

38-
injectors = getInjectors(this.context.store);
39-
4040
render() {
4141
return <WrappedComponent {...this.props} />;
4242
}

server/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
/* eslint consistent-return:0 */
22

33
const express = require('express');
4+
const { resolve } = require('path');
45
const logger = require('./util//logger');
56

67
const argv = require('./util/argv');
78
const port = require('./util//port');
89
const setup = require('./middlewares/frontendMiddleware');
9-
const { resolve } = require('path');
1010

1111
const app = express();
1212

0 commit comments

Comments
 (0)