Skip to content

Commit

Permalink
Fixed linting issue for actions, reducers, stores & themes
Browse files Browse the repository at this point in the history
  • Loading branch information
Proyoyo committed Feb 22, 2018
1 parent 4cd6394 commit ea055ac
Show file tree
Hide file tree
Showing 16 changed files with 32 additions and 44 deletions.
4 changes: 1 addition & 3 deletions app/actions/match_details_act.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,13 +30,11 @@ export function fetchMatchDetails(matchId) {
return dispatch => {
dispatch(requestMatchDetails());

var jsonData;
return fetchAPI(endpoint)
.then((json) => {
dispatch(receiveMatchDetails(json));
})
.catch((error) => {
console.log("Action - FETCH MATCH DETAILS ERROR - " + error);
.catch(() => {
dispatch(receiveEmptyMatchDetails());
});
}
Expand Down
5 changes: 1 addition & 4 deletions app/actions/peers_act.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,17 +29,14 @@ function receiveEmptyPeers() {

export function fetchPeers(playerId) {
var endpoint = "players/" + playerId + "/peers";
console.log(endpoint);
return dispatch => {
dispatch(requestPeers());

var jsonData;
return fetchAPI(endpoint)
.then((json) => {
dispatch(receivePeers(json));
})
.catch((error) => {
console.log("Action - FETCH PEERS ERROR - " + error);
.catch(() => {
dispatch(receiveEmptyPeers());
});
}
Expand Down
7 changes: 2 additions & 5 deletions app/actions/player_heroes_act.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,19 +27,16 @@ function receiveEmptyHeroes() {
};
}

export function fetchHeroes(playerId, limit) {
export function fetchHeroes(playerId) {
var endpoint = "players/" + playerId + "/heroes";
console.log(endpoint);
return dispatch => {
dispatch(requestHeroes());

var jsonData;
return fetchAPI(endpoint)
.then((json) => {
dispatch(receiveHeroes(json));
})
.catch((error) => {
console.log("Action - FETCH MATCHES ERROR - " + error);
.catch(() => {
dispatch(receiveEmptyHeroes());
});
}
Expand Down
7 changes: 2 additions & 5 deletions app/actions/player_matches_act.js
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ export function fetchMatches(playerId, limit, projects, sortCategory, heroId, re
var endpoint = "players/" + playerId + "/matches?limit=" + limit;

if(projects){
for(i = 0; i < projects.length; i++) {
for(let i = 0; i < projects.length; i++) {
endpoint += ("&project=" + projects[i]);
}
}
Expand Down Expand Up @@ -116,17 +116,14 @@ export function fetchMatches(playerId, limit, projects, sortCategory, heroId, re
endpoint += ("&region=" + region);
}

console.log(endpoint);
return dispatch => {
dispatch(requestMatches());

var jsonData;
return fetchAPI(endpoint)
.then((json) => {
dispatch(receiveMatches(json));
})
.catch((error) => {
console.log("Action - FETCH MATCHES ERROR - " + error);
.catch(() => {
dispatch(receiveEmptyMatches());
})
}
Expand Down
8 changes: 2 additions & 6 deletions app/actions/player_overview_act.js
Original file line number Diff line number Diff line change
Expand Up @@ -52,13 +52,11 @@ export function fetchWl(playerId) {
return dispatch => {
dispatch(requestWl());

var jsonData;
return fetchAPI(endpoint)
.then((json) => {
dispatch(receiveWl(json));
})
.catch((error) => {
console.log("Action - FETCH WL ERROR - " + error);
.catch(() => {
dispatch(receiveEmptyWl());
})
}
Expand All @@ -69,13 +67,11 @@ export function fetchOverview(playerId) {
return dispatch => {
dispatch(requestOverview());

var jsonData;
return fetchAPI(endpoint)
.then((json) => {
dispatch(receiveOverview(json));
})
.catch((error) => {
console.log("Action - FETCH OVERVIEW ERROR - " + error);
.catch(() => {
dispatch(receiveEmptyOverview());
});
}
Expand Down
4 changes: 1 addition & 3 deletions app/actions/player_search_act.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ export function fetchPlayers(playerName) {
return dispatch => {
dispatch(requestPlayers());

var jsonData;
return fetchAPI(endpoint)
.then((json) => {
if(json.length == 0) {
Expand All @@ -39,8 +38,7 @@ export function fetchPlayers(playerName) {
dispatch(receivePlayers(json));
}
})
.catch((error) => {
console.log("Action - FETCH PLAYERS ERROR - " + error);
.catch(() => {
dispatch(receiveEmptyPlayers());
})
};
Expand Down
7 changes: 2 additions & 5 deletions app/actions/records_act.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { fetchAPI } from '../utils/fetch';
export const types = {
REQUEST_RECORDS: 'REQUEST_RECORDS',
RECEIVE_RECORDS: 'RECEIVE_RECORDS',
RECEIVE_EMPTY_RECORDS: RECEIVE_EMPTY_RECORDS
RECEIVE_EMPTY_RECORDS: 'RECEIVE_EMPTY_RECORDS'
};

function requestRecords() {
Expand All @@ -27,17 +27,14 @@ function receiveEmptyRecords() {

export function fetchRecords(playerId) {
var endpoint = "players/" + playerId + "/records";
console.log(endpoint);
return dispatch => {
dispatch(requestRecords());

var jsonData;
return fetchAPI(endpoint)
.then((json) => {
dispatch(receiveRecords(json));
})
.catch((error) => {
console.log("Action - FETCH RECORDS ERROR - " + error);
.catch(() => {
dispatch(receiveEmptyRecords());
})
}
Expand Down
2 changes: 0 additions & 2 deletions app/actions/settings_act.js
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,6 @@ export function changeTheme(themeSet) {
secondLegend = Colors.illusionSecondLegend;
legendHex = Colors.illusionLegendHex;
legendTranslucent = Colors.illusionLegendTranslucent;
} else {
console.log(value);
}
return {
type: types.CHANGE_THEME,
Expand Down
7 changes: 6 additions & 1 deletion app/containers/Splash.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,14 @@ class Splash extends Component {
let tracker = new GoogleAnalyticsTracker('UA-107430194-1');
this.props.actions.setGATracker(tracker);
AsyncStorage.getItem("theme").then((value) => {
this.props.actions.changeTheme(value);
if(value) {
this.props.actions.changeTheme(value);
} else {
this.props.actions.changeTheme(1);
}
})
.catch((error) => {
console.log("NOT FOUND");
this.props.actions.changeTheme(1);
})

Expand Down
2 changes: 1 addition & 1 deletion app/reducers/favourites_rdx.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ export default function favouritesState(state = initialState, action = {}) {
return Object.assign({}, state, { favourites: [...state.favourites, action.info] });
case types.REMOVE_FAVOURITES:
var index;
for(i = 0; i < state.favourites.length; i++) {
for(let i = 0; i < state.favourites.length; i++) {
if(state.favourites[i].account_id == action.id) {
index = i;
}
Expand Down
2 changes: 2 additions & 0 deletions app/reducers/navigation_rdx.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ export default function navigationState(state = initialState, action = {}) {
...state,
homeTab: true
};
} else {
return state
}

case "REACT_NATIVE_ROUTER_FLUX_FOCUS":
Expand Down
10 changes: 6 additions & 4 deletions app/reducers/player_matches_rdx.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,18 +21,20 @@ export default function playerMatchesState(state = initialState, action = {}) {
return Object.assign({}, state, { sortField: action.sortField, sortDirection: sortDirection, matches });
case types.SET_MAX_PAGES:
return Object.assign({}, state, {maxPages: action.maxPages});
case types.NAVIGATE_NEXT_MATCHES:
newPage = state.page + action.amount;
case types.NAVIGATE_NEXT_MATCHES: {
let newPage = state.page + action.amount;
if(newPage > state.maxPages) {
newPage = state.maxPages
}
return Object.assign({}, state, { page: newPage });
case types.NAVIGATE_PREVIOUS_MATCHES:
newPage = state.page - action.amount;
}
case types.NAVIGATE_PREVIOUS_MATCHES: {
let newPage = state.page - action.amount;
if(newPage < 1) {
newPage = 1;
}
return Object.assign({}, state, { page: newPage });
}
default:
return state;
}
Expand Down
1 change: 0 additions & 1 deletion app/stores/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,4 @@ if (process.env.NODE_ENV === 'production') {
module.exports = require('./configureStore.prod')
} else {
module.exports = require('./configureStore.dev');
console.log("process.env.NODE_ENV = " + process.env.NODE_ENV)
}
2 changes: 0 additions & 2 deletions app/themes/BaseStyles.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@ import Fonts from './Fonts';
import Metrics from './Metrics';
import Colors from './Colors';

import { Platform } from 'react-native';

const base = {
navbar: {
navBarContainer: {
Expand Down
1 change: 0 additions & 1 deletion app/themes/Metrics.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import React from 'react';
import { Platform, Dimensions } from 'react-native';
import DeviceInfo from 'react-native-device-info';

Expand Down
7 changes: 6 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,12 @@
"scripts": {
"start": "react-native start",
"clear": "npm cache verify && watchman watch-del-all && rm -rf $TMPDIR/react-* && rm -rf $TMPDIR/react-native-packager-cache-* && rm -rf $TMPDIR/metro-bundler-cache-*",
"lint": "eslint app/*"
"lint": "eslint app/*",
"actions-lint": "eslint app/actions",
"themes-lint": "eslint app/themes",
"stores-lint": "eslint app/stores",
"reducers-lint": "eslint app/reducers",
"json-lint": "eslint app/json"
},
"dependencies": {
"appcenter": "^1.1.0",
Expand Down

0 comments on commit ea055ac

Please sign in to comment.