Skip to content
This repository was archived by the owner on Sep 8, 2021. It is now read-only.

Commit 16e498f

Browse files
authored
Merge pull request #53 from foopang/fix-warnings
Fix warnings
2 parents 0a0c8f6 + 225f2d9 commit 16e498f

27 files changed

+31
-57
lines changed

src/agent.js

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
'use strict';
2-
31
import superagentPromise from 'superagent-promise';
42
import _superagent from 'superagent';
53

src/components/Article/ArticleMeta.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ const ArticleMeta = props => {
77
return (
88
<div className="article-meta">
99
<Link to={`@${article.author.username}`}>
10-
<img src={article.author.image} />
10+
<img src={article.author.image} alt={article.author.username} />
1111
</Link>
1212

1313
<div className="info">

src/components/Article/Comment.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ const Comment = props => {
1515
<Link
1616
to={`@${comment.author.username}`}
1717
className="comment-author">
18-
<img src={comment.author.image} className="comment-author-img" />
18+
<img src={comment.author.image} className="comment-author-img" alt={comment.author.username} />
1919
</Link>
2020
&nbsp;
2121
<Link

src/components/Article/CommentInput.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,8 @@ class CommentInput extends React.Component {
4242
<div className="card-footer">
4343
<img
4444
src={this.props.currentUser.image}
45-
className="comment-author-img" />
45+
className="comment-author-img"
46+
alt={this.props.currentUser.username} />
4647
<button
4748
className="btn btn-sm btn-primary"
4849
type="submit">

src/components/Article/index.js

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,5 @@
1-
'use strict';
2-
31
import ArticleMeta from './ArticleMeta';
42
import CommentContainer from './CommentContainer';
5-
import { Link } from 'react-router';
63
import React from 'react';
74
import agent from '../../agent';
85
import { connect } from 'react-redux';

src/components/ArticleList.js

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
'use strict';
2-
31
import ArticlePreview from './ArticlePreview';
42
import ListPagination from './ListPagination';
53
import React from 'react';

src/components/ArticlePreview.js

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
'use strict';
2-
31
import React from 'react';
42
import { Link } from 'react-router';
53
import agent from '../agent';
@@ -39,7 +37,7 @@ const ArticlePreview = props => {
3937
<div className="article-preview">
4038
<div className="article-meta">
4139
<Link to={`@${article.author.username}`}>
42-
<img src={article.author.image} />
40+
<img src={article.author.image} alt={article.author.username} />
4341
</Link>
4442

4543
<div className="info">

src/components/Editor.js

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
'use strict';
2-
31
import ListErrors from './ListErrors';
42
import React from 'react';
53
import agent from '../agent';

src/components/Header.js

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
'use strict';
2-
31
import React from 'react';
42
import { Link } from 'react-router';
53

@@ -59,7 +57,7 @@ const LoggedInView = props => {
5957
<Link
6058
to={`@${props.currentUser.username}`}
6159
className="nav-link">
62-
<img src={props.currentUser.image} className="user-pic" />
60+
<img src={props.currentUser.image} className="user-pic" alt={props.currentUser.username} />
6361
{props.currentUser.username}
6462
</Link>
6563
</li>

src/components/Home/MainView.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ const mapStateToProps = state => ({
6262
});
6363

6464
const mapDispatchToProps = dispatch => ({
65-
onTabClick: (tab, pager, payload) => dispatch({ type: 'CHANGE_TAB', tab, pager, payload })
65+
onTabClick: (tab, pager, payload) => dispatch({ type: CHANGE_TAB, tab, pager, payload })
6666
});
6767

6868
const MainView = props => {

src/components/Home/index.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,9 @@ const mapStateToProps = state => ({
2020

2121
const mapDispatchToProps = dispatch => ({
2222
onClickTag: (tag, pager, payload) =>
23-
dispatch({ type: 'APPLY_TAG_FILTER', tag, pager, payload }),
23+
dispatch({ type: APPLY_TAG_FILTER, tag, pager, payload }),
2424
onLoad: (tab, pager, payload) =>
25-
dispatch({ type: 'HOME_PAGE_LOADED', tab, pager, payload }),
25+
dispatch({ type: HOME_PAGE_LOADED, tab, pager, payload }),
2626
onUnload: () =>
2727
dispatch({ type: HOME_PAGE_UNLOADED })
2828
});

src/components/ListErrors.js

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
'use strict';
2-
31
import React from 'react';
42

53
class ListErrors extends React.Component {

src/components/Profile.js

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
'use strict';
2-
31
import ArticleList from './ArticleList';
42
import React from 'react';
53
import { Link } from 'react-router';
@@ -127,7 +125,7 @@ class Profile extends React.Component {
127125
<div className="row">
128126
<div className="col-xs-12 col-md-10 offset-md-1">
129127

130-
<img src={profile.image} className="user-img" />
128+
<img src={profile.image} className="user-img" alt={profile.username} />
131129
<h4>{profile.username}</h4>
132130
<p>{profile.bio}</p>
133131

@@ -169,4 +167,4 @@ class Profile extends React.Component {
169167
}
170168

171169
export default connect(mapStateToProps, mapDispatchToProps)(Profile);
172-
export { Profile as Profile, mapStateToProps as mapStateToProps };
170+
export { Profile, mapStateToProps };

src/components/ProfileFavorites.js

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
'use strict';
2-
31
import { Profile, mapStateToProps } from './Profile';
42
import React from 'react';
53
import { Link } from 'react-router';
@@ -12,7 +10,7 @@ import {
1210

1311
const mapDispatchToProps = dispatch => ({
1412
onLoad: (pager, payload) =>
15-
dispatch({ type: 'PROFILE_FAVORITES_PAGE_LOADED', pager, payload }),
13+
dispatch({ type: PROFILE_FAVORITES_PAGE_LOADED, pager, payload }),
1614
onUnload: () =>
1715
dispatch({ type: PROFILE_FAVORITES_PAGE_UNLOADED })
1816
});

src/components/Settings.js

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,7 @@
11
import ListErrors from './ListErrors';
22
import React from 'react';
3-
import { Link } from 'react-router';
43
import agent from '../agent';
54
import { connect } from 'react-redux';
6-
import store from '../store';
75
import {
86
SETTINGS_SAVED,
97
SETTINGS_PAGE_UNLOADED,

src/index.js

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,12 @@
1-
'use strict';
2-
31
import ReactDOM from 'react-dom';
42
import { Provider } from 'react-redux';
53
import React from 'react';
64
import { Router, Route, IndexRoute, hashHistory } from 'react-router';
7-
import agent from './agent';
8-
import history from 'history';
95
import store from './store';
106

117
import App from './components/App';
128
import Article from './components/Article';
139
import Editor from './components/Editor';
14-
import Header from './components/Header';
1510
import Home from './components/Home';
1611
import Login from './components/Login';
1712
import Profile from './components/Profile';

src/middleware.js

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
'use strict';
2-
31
import agent from './agent';
42
import {
53
ASYNC_START,

src/reducer.js

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
'use strict';
2-
31
import article from './reducers/article';
42
import articleList from './reducers/articleList';
53
import auth from './reducers/auth';

src/reducers/article.js

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ export default (state = {}, action) => {
1313
article: action.payload[0].article,
1414
comments: action.payload[1].comments
1515
};
16-
break;
1716
case ARTICLE_PAGE_UNLOADED:
1817
return {};
1918
case ADD_COMMENT:
@@ -30,7 +29,7 @@ export default (state = {}, action) => {
3029
...state,
3130
comments: state.comments.filter(comment => comment.id !== commentId)
3231
};
32+
default:
33+
return state;
3334
}
34-
35-
return state;
3635
};

src/reducers/articleList.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ export default (state = {}, action) => {
8080
case PROFILE_PAGE_UNLOADED:
8181
case PROFILE_FAVORITES_PAGE_UNLOADED:
8282
return {};
83+
default:
84+
return state;
8385
}
84-
85-
return state;
8686
};

src/reducers/auth.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,12 +20,14 @@ export default (state = {}, action) => {
2020
case REGISTER_PAGE_UNLOADED:
2121
return {};
2222
case ASYNC_START:
23-
if (action.subtype === 'LOGIN' || action.subtype === 'REGISTER') {
23+
if (action.subtype === LOGIN || action.subtype === REGISTER) {
2424
return { ...state, inProgress: true };
2525
}
2626
break;
2727
case UPDATE_FIELD_AUTH:
2828
return { ...state, [action.key]: action.value };
29+
default:
30+
return state;
2931
}
3032

3133
return state;

src/reducers/common.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ export default (state = defaultState, action) => {
6464
case LOGIN_PAGE_UNLOADED:
6565
case REGISTER_PAGE_UNLOADED:
6666
return { ...state, viewChangeCounter: state.viewChangeCounter + 1 };
67+
default:
68+
return state;
6769
}
68-
69-
return state;
7070
};

src/reducers/editor.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,8 @@ export default (state = {}, action) => {
4646
};
4747
case UPDATE_FIELD_EDITOR:
4848
return { ...state, [action.key]: action.value };
49+
default:
50+
return state;
4951
}
5052

5153
return state;

src/reducers/home.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ export default (state = {}, action) => {
99
};
1010
case HOME_PAGE_UNLOADED:
1111
return {};
12+
default:
13+
return state;
1214
}
13-
14-
return state;
1515
};

src/reducers/profile.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ export default (state = {}, action) => {
1818
return {
1919
...action.payload.profile
2020
};
21+
default:
22+
return state;
2123
}
22-
23-
return state;
2424
};

src/reducers/profileFavorites.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ export default (state = {}, action) => {
1111
};
1212
case PROFILE_FAVORITES_PAGE_UNLOADED:
1313
return {};
14+
default:
15+
return state;
1416
}
15-
16-
return state;
1717
};

src/reducers/settings.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ export default (state = {}, action) => {
1919
...state,
2020
inProgress: true
2121
};
22+
default:
23+
return state;
2224
}
23-
24-
return state;
2525
};

0 commit comments

Comments
 (0)