Merge pull request #473 from rschamp/feature/lint

Lint JSON and all of our .js and .scss
This commit is contained in:
Ray Schamp 2016-05-17 16:01:55 -04:00
commit f7e9b7ca38
6 changed files with 27 additions and 30 deletions

4
.eslintignore Normal file
View file

@ -0,0 +1,4 @@
node_modules/*
static/*
build/*
intl/*

View file

@ -25,7 +25,8 @@
"jsx": true
},
"plugins": [
"react"
"react",
"json"
],
"extends": "eslint:recommended"
}

View file

@ -62,18 +62,9 @@ test:
@echo ""
lint:
$(ESLINT) ./*.js
$(ESLINT) ./dev-server/*.js
$(ESLINT) ./bin/**/*.js
$(ESLINT) ./src/*.js
$(ESLINT) ./src/mixins/*.jsx
$(ESLINT) ./src/views/**/*.jsx
$(ESLINT) ./src/components/**/*.jsx
$(ESLINT) ./src/components/**/**/*.jsx
$(ESLINT) . --ext .js,.jsx,.json
$(SASSLINT) ./src/*.scss
$(SASSLINT) ./src/views/**/*.scss
$(SASSLINT) ./src/components/**/*.scss
$(SASSLINT) ./src/components/**/**/*.scss
$(SASSLINT) ./src/**/*.scss
unit:
$(TAP) ./test/unit/*.js

View file

@ -38,6 +38,7 @@
"copy-webpack-plugin": "0.2.0",
"css-loader": "0.23.1",
"eslint": "1.3.1",
"eslint-plugin-json": "1.2.0",
"eslint-plugin-react": "3.3.1",
"exenv": "1.2.0",
"fastly": "1.2.1",

View file

@ -17,14 +17,14 @@ var Actions = {
return {
type: Types.SET_SESSION_ERROR,
error: error
}
};
},
setSession: function (session) {
return {
type: Types.SET_SESSION,
session: session
}
};
},
refreshSession: function () {
@ -37,7 +37,7 @@ var Actions = {
if (typeof body !== 'undefined') {
if (body.banned) {
return window.location = url;
return window.location = body.redirectUrl;
} else {
dispatch(Actions.getToken());
dispatch(Actions.setSession(body));
@ -62,7 +62,7 @@ var Actions = {
return dispatch(Actions.setToken(sessionData.token));
});
});
}
};
},
setToken: function (token) {

View file

@ -9,13 +9,13 @@ var sessionReducer = function (state, action) {
state = {};
}
switch (action.type) {
case actionTypes.SET_SESSION:
return action.session;
case actionTypes.SET_SESSION_ERROR:
// TODO: do something with action.error
return state;
default:
return state;
case actionTypes.SET_SESSION:
return action.session;
case actionTypes.SET_SESSION_ERROR:
// TODO: do something with action.error
return state;
default:
return state;
}
};
@ -25,13 +25,13 @@ var tokenReducer = function (state, action) {
state = '';
}
switch (action.type) {
case actionTypes.SET_TOKEN:
return action.token;
case actionTypes.SET_TOKEN_ERROR:
// TODO: do something with the error
return state;
default:
return state;
case actionTypes.SET_TOKEN:
return action.token;
case actionTypes.SET_TOKEN_ERROR:
// TODO: do something with the error
return state;
default:
return state;
}
};