Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 32 additions & 6 deletions .eslintrc
Original file line number Diff line number Diff line change
@@ -1,14 +1,40 @@
{
"extends": ["airbnb", "prettier"],
"plugins": ["prettier"],
"env": {
"browser": true,
"es6": true,
"commonjs": true,
"node": true
},
"extends": ["airbnb", "prettier", "prettier/react"],
"plugins": ["prettier", "react", "jsx-a11y"],
"rules": {
"prettier/prettier": ["error"],
"comma-spacing": ["error", { "before": false, "after": true }],
"indent": ["error", 2],
"linebreak-style": ["error", "unix"],
"func-names": "off",
"prefer-arrow-callback":"off",
"no-use-before-define": "off",
"max-len": [2, 80, 4, {"ignoreUrls": true}]
}
"max-len": [2, 80, 4, {"ignoreUrls": true, "ignoreComments": true, "ignorePattern": "^import\\s.+\\sfrom\\s.+;$", "ignoreStrings": true, "ignoreTemplateLiterals" : true}],
"quotes": [2, "double"],
"import/no-named-as-default": 0,
"import/no-named-as-default-member": 0,
"import/prefer-default-export": 0,
"import/no-extraneous-dependencies": 0,
"consistent-return": "off",
"no-nested-ternary":"off",
"no-param-reassign":"off" ,
"no-shadow":"off",
"no-restricted-syntax":"off",
"no-prototype-builtins": "off",
"no-underscore-dangle":"off",
"react/jsx-filename-extension": [1, { "extensions": [".js", ".jsx"] }],
"react/require-default-props": 0,
"react/forbid-prop-types": 0,
"react/prefer-stateless-function": 0,
"react/jsx-one-expression-per-line": 0,
"react/destructuring-assignment" : 0,
"jsx-a11y/label-has-for": "off",
"jsx-a11y/label-has-associated-control": "off",
"prefer-template":"off"
},
"parser": "babel-eslint"
}
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
"babel-preset-react-app": "^7.0.0",
"case-sensitive-paths-webpack-plugin": "2.1.1",
"chalk": "1.1.3",
"cross-fetch": "^3.0.1",
"css-loader": "0.28.7",
"dotenv": "4.0.0",
"extract-text-webpack-plugin": "3.0.2",
Expand Down
2 changes: 1 addition & 1 deletion src/modules/app/components/App.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import React, { Component } from "react";
import PropTypes from "prop-types";
import { connect } from "react-redux";
import userContext from "../../userContext";
import { Route, Link } from "react-router-dom";
import { ConnectedRouter } from "react-router-redux";
import { OnUpdate } from "rrc";
import userContext from "../../userContext";
import home from "../../../screens/home";
import signin from "../../../screens/sign-in";
import protectedRoute from "../../../screens/protected";
Expand Down
6 changes: 3 additions & 3 deletions src/modules/busyIndicator/components/BusyIndicator.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ import React from "react";
import Indicator from "./indicator.svg";
import "./busyIndicator.css";

const BusyIndicator = () => {
return <img className="loader" src={Indicator} alt="Busy indicator" />;
};
const BusyIndicator = () => (
<img className="loader" src={Indicator} alt="Busy indicator" />
);

export default BusyIndicator;
2 changes: 1 addition & 1 deletion src/modules/doAsync/doAsyncLogic.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ export function handleError(
logError(dispatch, actionType, httpMethod, url, httpConfig, {
exception,
errorMessage: `${errorMessage}.
An error occurred when trying to dispatch results of ajax call to Redux.`
An error occurred when trying to dispatch results of ajax call to Redux.`
});
}

Expand Down
22 changes: 12 additions & 10 deletions src/modules/http/http.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,14 @@ import localStorage from "localStorage";
import { API_URL } from "./http.constants";
// import { getJwtToken } from "../../modules/userContext/userContext.selectors";
// import { getState } from "../store";
import * as actionTypes from "../userContext/userContext.actionTypes";
// import * as actionTypes from "../userContext/userContext.actionTypes";

export default {
get,
post,
put
put,
patch,
delete: callDelete
};

const ASYNC_DELAY = 1000;
Expand Down Expand Up @@ -87,7 +89,7 @@ function doFetch(url, config, { stubSuccess, stubError } = {}) {
const authHeader = response.headers.get("Authorization");

setJwtTokenFromHeaderResponse(authHeader);
updateSessionToken(parseJwtTokenFromHeader(authHeader));
// updateSessionToken(parseJwtTokenFromHeader(authHeader));
}

if (response.ok) {
Expand Down Expand Up @@ -150,10 +152,10 @@ function parseJwtTokenFromHeader(authorizationHeader) {
return tokens.length > 1 ? tokens[1] : null;
}

const updateSessionToken = token => dispatch => {
// TODO: Do we need this?
// dispatch({
// type: actionTypes.JWT_TOKEN_ASYNC.RECEIVED,
// payload: token
// });
};
// const updateSessionToken = token => dispatch => {
// TODO: Do we need this?
// dispatch({
// type: actionTypes.JWT_TOKEN_ASYNC.RECEIVED,
// payload: token
// });
// };
84 changes: 41 additions & 43 deletions src/modules/notificationPopup/notificationPopup.actions.js
Original file line number Diff line number Diff line change
@@ -1,43 +1,41 @@
import { NOTIFY_SUCCESS, RESET } from "./notificationPopup.actionTypes";

// We are using let so that we can assign fakes in tests. Might be a better way to do this :P
export let handleError = (
type,
{ errorMessage, message, stack, componentStack }
) => {
if (!type) {
throw new Error(
"You must specify a type argument which is a redux action type to be used with your error"
);
}

console.log(`${errorMessage}:${message}:${stack}
${componentStack ? `componentStack: ` + componentStack : ""}
`);

return {
type,
payload: {
errorMessage,
message,
stack
}
};
};

export const notifySuccess = (successMessage, { title, config } = {}) => {
return {
type: NOTIFY_SUCCESS,
payload: {
successMessage,
config: {
...config,
title
}
}
};
};

export const resetError = () => ({
type: RESET
});
import { NOTIFY_SUCCESS, RESET } from "./notificationPopup.actionTypes";

// We are using let so that we can assign fakes in tests. Might be a better way to do this :P
export const handleError = (
type,
{ errorMessage, message, stack, componentStack }
) => {
if (!type) {
throw new Error(
"You must specify a type argument which is a redux action type to be used with your error"
);
}

console.log(`${errorMessage}:${message}:${stack}
${componentStack ? "componentStack: " + componentStack : ""}
`);

return {
type,
payload: {
errorMessage,
message,
stack
}
};
};

export const notifySuccess = (successMessage, { title, config } = {}) => ({
type: NOTIFY_SUCCESS,
payload: {
successMessage,
config: {
...config,
title
}
}
});

export const resetError = () => ({
type: RESET
});
22 changes: 11 additions & 11 deletions src/modules/pendingRequest/index.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import * as constants from "./pendingRequest.constants";
import reducer from "./pendingRequest.reducer";
import * as selectors from "./pendingRequest.selectors";
import * as actions from "./pendingRequest.actions";
export default {
actions,
constants,
reducer,
selectors
};
import * as constants from "./pendingRequest.constants";
import reducer from "./pendingRequest.reducer";
import * as selectors from "./pendingRequest.selectors";
import * as actions from "./pendingRequest.actions";

export default {
actions,
constants,
reducer,
selectors
};
24 changes: 12 additions & 12 deletions src/modules/pendingRequest/pendingRequest.actionTypes.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import { buildActionType } from "../utilities/reduxUtilities";
export const CANCEL = buildActionType("pendingRequest", "CANCEL");
export const ADD = buildActionType("pendingRequest", "ADD");
export const DELETE = buildActionType("pendingRequest", "DELETE");
export const SET_BUSY_SPINNER = buildActionType(
"pendingRequest",
"SET_BUSY_SPINNER"
);
import { buildActionType } from "../utilities/reduxUtilities";

export const CANCEL = buildActionType("pendingRequest", "CANCEL");

export const ADD = buildActionType("pendingRequest", "ADD");

export const DELETE = buildActionType("pendingRequest", "DELETE");

export const SET_BUSY_SPINNER = buildActionType(
"pendingRequest",
"SET_BUSY_SPINNER"
);
62 changes: 31 additions & 31 deletions src/modules/pendingRequest/pendingRequest.actions.js
Original file line number Diff line number Diff line change
@@ -1,31 +1,31 @@
import {
CANCEL,
ADD,
DELETE,
SET_BUSY_SPINNER
} from "./pendingRequest.actionTypes";
export const cancelPendingRequest = () => ({
type: CANCEL
});
export const addPendingRequest = requestedActionType => ({
type: ADD,
payload: {
requestedActionType
}
});
export const setBusySpinner = (requestedActionType, turnSpinnerOff) => ({
type: SET_BUSY_SPINNER,
payload: {
requestedActionType,
turnSpinnerOff
}
});
export const deletePendingRequest = requestedActionType => ({
type: DELETE,
payload: {
requestedActionType
}
});
import {
CANCEL,
ADD,
DELETE,
SET_BUSY_SPINNER
} from "./pendingRequest.actionTypes";

export const cancelPendingRequest = () => ({
type: CANCEL
});

export const addPendingRequest = requestedActionType => ({
type: ADD,
payload: {
requestedActionType
}
});

export const setBusySpinner = (requestedActionType, turnSpinnerOff) => ({
type: SET_BUSY_SPINNER,
payload: {
requestedActionType,
turnSpinnerOff
}
});
export const deletePendingRequest = requestedActionType => ({
type: DELETE,
payload: {
requestedActionType
}
});
Loading