Skip to content
This repository has been archived by the owner on Aug 9, 2020. It is now read-only.

Commit

Permalink
Enable absolute paths setting NODE_PATH, until create-react-app reach…
Browse files Browse the repository at this point in the history
…es v4 when we can use baseUrl instead - facebook/create-react-app#6475
  • Loading branch information
jamescrowley committed Apr 20, 2019
1 parent 4210707 commit f66d201
Show file tree
Hide file tree
Showing 57 changed files with 120 additions and 147 deletions.
4 changes: 1 addition & 3 deletions .eslintrc.json
Expand Up @@ -16,9 +16,7 @@
/* don't allow imports of internal modules */
//"\\./modules/*/**",
/* don't allow relative imports that go up the tree */
//"../**",
/* don't allow ./ imports - instead just use the name */
//"./**"
"../**"
]
}
]
Expand Down
8 changes: 4 additions & 4 deletions package.json
Expand Up @@ -46,10 +46,10 @@
"yarnhook": "^0.4.0"
},
"scripts": {
"start": "react-scripts start",
"build": "react-scripts build",
"test": "react-scripts test --modulePaths=src",
"test-with-coverage": "react-scripts test --modulePaths=src --coverage",
"start": "NODE_PATH=src react-scripts start",
"build": "NODE_PATH=src react-scripts build",
"test": "NODE_PATH=src react-scripts test --modulePaths=src",
"test-with-coverage": "NODE_PATH=src react-scripts test --modulePaths=src --coverage",
"upload-coverage-report": "./node_modules/.bin/codecov",
"eject": "react-scripts eject",
"prettier": "prettier --write \"src/**/*.{js,jsx,json,css}\"",
Expand Down
2 changes: 1 addition & 1 deletion src/__tests__/firestore.rules.test.js
Expand Up @@ -6,7 +6,7 @@ import * as firestore from "expect-firestore";
let describeButSkipIfNoKey = describe;
let serviceAccountKey;
try {
serviceAccountKey = require("../../.service-account-key.json");
serviceAccountKey = require(".service-account-key.json");
} catch (e) {
describeButSkipIfNoKey = describe.skip;
}
Expand Down
6 changes: 3 additions & 3 deletions src/actions/auth.js
@@ -1,6 +1,6 @@
import firebase from "../firebase";
import { handleError } from "../utils";
import { asyncAction, editAction } from "../commons/utils/action-creators";
import { handleError } from "utils";
import { asyncAction, editAction } from "commons/utils/action-creators";
import firebase from "firebase.js";

import { fetchProfile } from "./profile";

Expand Down
4 changes: 2 additions & 2 deletions src/actions/box.js
@@ -1,5 +1,5 @@
import firebase, { firestore } from "../firebase";
import { handleError } from "../utils";
import { handleError } from "utils";
import firebase, { firestore } from "firebase.js";

const BOX_ADD_ = TYPE => `BOX_ADD_${TYPE}`;
export const BOX_ADD_START = BOX_ADD_`START`;
Expand Down
6 changes: 3 additions & 3 deletions src/actions/product.js
@@ -1,11 +1,11 @@
import firebase, { firestore } from "../firebase";
import {
addAction,
listAction,
editAction,
deleteAction
} from "../commons/utils/action-creators";
import { handleError } from "../utils";
} from "commons/utils/action-creators";
import { handleError } from "utils";
import firebase, { firestore } from "firebase.js";

export const PRODUCT_LIST = listAction("product");
export const PRODUCT_ADD = addAction("product");
Expand Down
4 changes: 2 additions & 2 deletions src/actions/profile.js
@@ -1,5 +1,5 @@
import { firestore } from "../firebase";
import { handleError } from "../utils";
import { handleError } from "utils";
import { firestore } from "firebase.js";

const FETCH_PROFILE_ = TYPE => `FETCH_PROFILE_${TYPE}`;
export const FETCH_PROFILE_START = FETCH_PROFILE_`START`;
Expand Down
4 changes: 2 additions & 2 deletions src/commons/HOCs/withAuthentication.js
Expand Up @@ -2,8 +2,8 @@ import React, { PureComponent } from "react";
import { connect } from "react-redux";
import { Redirect } from "react-router-dom";

import { registerAuthStateObserver } from "../../actions/auth";
import Progress from "../../components/Progress";
import { registerAuthStateObserver } from "actions/auth";
import Progress from "components/Progress";

export default function withAuthentication(Comp, FallbackComp) {
const mapStateToProps = ({ user, profile }) => ({ user, profile });
Expand Down
2 changes: 1 addition & 1 deletion src/components/AddBoxDialog.js
Expand Up @@ -2,7 +2,7 @@ import React, { PureComponent } from "react";
import { bool, func } from "prop-types";
import Dialog from "@material-ui/core/Dialog";

import { ProductsCollection } from "../queries/products";
import { ProductsCollection } from "queries/products";

import AddBoxForm from "./AddBoxForm";
import AddBoxDone from "./AddBoxDone";
Expand Down
2 changes: 1 addition & 1 deletion src/components/AppDrawer.js
Expand Up @@ -10,7 +10,7 @@ import Divider from "@material-ui/core/Divider";
import Hidden from "@material-ui/core/Hidden";
import { Link } from "react-router-dom";

import AppDrawerAuthContainer from "../containers/components/AppDrawerAuth";
import AppDrawerAuthContainer from "containers/components/AppDrawerAuth";

const styles = theme => ({
logo: {
Expand Down
2 changes: 1 addition & 1 deletion src/components/AppFrame.js
Expand Up @@ -7,7 +7,7 @@ import Toolbar from "@material-ui/core/Toolbar";
import IconButton from "@material-ui/core/IconButton";
import MenuIcon from "@material-ui/icons/Menu";

import { drawerTheme } from "../theme";
import { drawerTheme } from "theme";

import AppDrawer from "./AppDrawer";

Expand Down
4 changes: 2 additions & 2 deletions src/components/BoxListContainer.js
Expand Up @@ -2,8 +2,8 @@ import React from "react";
import { connect } from "react-redux";
import { FirestoreCollection } from "react-firestore";

import { ProductsCollection } from "../queries/products";
import { firestore } from "../firebase";
import { ProductsCollection } from "queries/products";
import { firestore } from "firebase.js";

import BoxList from "./BoxList";

Expand Down
2 changes: 1 addition & 1 deletion src/components/CategorySelector.js
@@ -1,6 +1,6 @@
import React from "react";

import ProductButton from "../components/ProductButton";
import ProductButton from "components/ProductButton";

const CategorySelector = () => {
return (
Expand Down
6 changes: 3 additions & 3 deletions src/components/CreateOrganizationFlow.js
Expand Up @@ -2,9 +2,9 @@ import React from "react";
import Typography from "@material-ui/core/Typography";
import Button from "@material-ui/core/Button";

import { addOrganization } from "../queries/organizations";
import { createUserAndProfile } from "../auth";
import { handleError } from "../utils";
import { addOrganization } from "queries/organizations";
import { createUserAndProfile } from "auth";
import { handleError } from "utils";

import CreateOrganizationForm from "./CreateOrganizationForm";
import SignUpForm from "./SignUpForm";
Expand Down
4 changes: 2 additions & 2 deletions src/components/InviteLink.js
Expand Up @@ -7,8 +7,8 @@ import TextField from "@material-ui/core/TextField";
import Button from "@material-ui/core/Button";
import Snackbar from "@material-ui/core/Snackbar";

import { getOrAddInvite, createInviteLink } from "../queries/invites";
import { waitForProfile, handleError } from "../utils";
import { getOrAddInvite, createInviteLink } from "queries/invites";
import { waitForProfile, handleError } from "utils";

import Progress from "./Progress.js";

Expand Down
14 changes: 8 additions & 6 deletions src/components/NotFound.js
@@ -1,14 +1,12 @@
/* eslint-disable */

import React from "react";
import AppFrame from "../components/AppFrame";
import Page from "../components/Page";
import Typography from "@material-ui/core/Typography";

import { withStyles } from "@material-ui/core/styles";
import Grid from "@material-ui/core/Grid";
import Paper from "@material-ui/core/Paper";

import Page from "components/Page";
import AppFrame from "components/AppFrame";

const styles = theme => ({
div: {
display: "block",
Expand Down Expand Up @@ -39,7 +37,11 @@ class NotFound extends React.Component {
<Page>
<Grid container>
<Paper className={classes.paper}>
<img src="/images/empty-box.png" className={classes.image} />
<img
src="/images/empty-box.png"
alt="empty box"
className={classes.image}
/>
<Typography variant="h5" paragraph>
There is nothing here
</Typography>
Expand Down
2 changes: 1 addition & 1 deletion src/components/PasswordChangeForm.js
Expand Up @@ -4,7 +4,7 @@ import { withStyles } from "@material-ui/core/styles";
import { TextField } from "formik-material-ui";
import Typography from "@material-ui/core/Typography";

import { handleError } from "../utils";
import { handleError } from "utils";

import ButtonWithProgress from "./ButtonWithProgress";

Expand Down
4 changes: 2 additions & 2 deletions src/components/ProductDialog.js
@@ -1,3 +1,5 @@
import { CATEGORIES } from "constants/product";

import React from "react";
import PropTypes from "prop-types";
import { Formik, Field } from "formik";
Expand All @@ -11,8 +13,6 @@ import Typography from "@material-ui/core/Typography";
import withMobileDialog from "@material-ui/core/withMobileDialog";
import Slide from "@material-ui/core/Slide";

import { CATEGORIES } from "../constants/product";

import DialogToolbar from "./DialogToolbar";

const styles = theme => ({
Expand Down
2 changes: 1 addition & 1 deletion src/components/ProductSelectorMockup.js
@@ -1,6 +1,6 @@
import React from "react";

import ProductButton from "../components/ProductButton";
import ProductButton from "components/ProductButton";

const ProductSelectorMockup = () => {
return (
Expand Down
4 changes: 2 additions & 2 deletions src/components/ProductTable.js
Expand Up @@ -9,8 +9,8 @@ import IconButton from "@material-ui/core/IconButton";
import EditIcon from "@material-ui/icons/Edit";
import DeleteIcon from "@material-ui/icons/Delete";

import EditProductDialog from "../containers/components/EditProductDialog";
import ProductDeleteConfirm from "../containers/components/ProductDeleteConfirm.js";
import EditProductDialog from "containers/components/EditProductDialog";
import ProductDeleteConfirm from "containers/components/ProductDeleteConfirm.js";

import Progress from "./Progress.js";

Expand Down
4 changes: 2 additions & 2 deletions src/components/ResetPasswordForm.test.js
@@ -1,10 +1,10 @@
import React from "react";
import { mount } from "enzyme";

import ResetPassword from "./ResetPasswordForm";

import { setInputFieldValue } from "commons/utils/test-util";

import ResetPassword from "./ResetPasswordForm";

describe("ResetPasswordForm", () => {
const resetPassword = jest.fn(({ email }) => {
Promise.resolve();
Expand Down
2 changes: 1 addition & 1 deletion src/components/SignInForm.js
Expand Up @@ -3,7 +3,7 @@ import { withStyles } from "@material-ui/core/styles";
import TextField from "@material-ui/core/TextField";
import FormHelperText from "@material-ui/core/FormHelperText";

import { useMaterialUIForm } from "../hooks/forms";
import { useMaterialUIForm } from "hooks/forms";

import ButtonWithProgress from "./ButtonWithProgress";

Expand Down
4 changes: 2 additions & 2 deletions src/components/SignInForm.test.js
@@ -1,10 +1,10 @@
import React from "react";
import { mount } from "enzyme";

import SignInFormUnconnected from "./SignInForm";

import { setInputFieldValue } from "commons/utils/test-util";

import SignInFormUnconnected from "./SignInForm";

describe("SignInForm", () => {
let component;
const userSignIn = jest.fn(({ email, password }) => {
Expand Down
4 changes: 2 additions & 2 deletions src/components/SignUpForm.test.js
@@ -1,10 +1,10 @@
import React from "react";
import { mount } from "enzyme";

import SignUpFormUnconnected from "./SignUpForm";

import { setInputFieldValue } from "commons/utils/test-util";

import SignUpFormUnconnected from "./SignUpForm";

describe("SignUpForm", () => {
const onSubmit = jest.fn(({ name, email, password }) => {
Promise.resolve();
Expand Down
4 changes: 2 additions & 2 deletions src/containers/components/AddBoxDialog.js
@@ -1,7 +1,7 @@
import { connect } from "react-redux";

import AddBoxDialog from "../../components/AddBoxDialog";
import { addBox } from "../../actions/box";
import AddBoxDialog from "components/AddBoxDialog";
import { addBox } from "actions/box";

const mapStateToProps = ({ profile }) => ({ profile });
const mapDispatchToProps = { addBox };
Expand Down
4 changes: 2 additions & 2 deletions src/containers/components/AddProductDialog.js
@@ -1,7 +1,7 @@
import { connect } from "react-redux";

import ProductDialog from "../../components/ProductDialog";
import { productAdd } from "../../actions/product";
import ProductDialog from "components/ProductDialog";
import { productAdd } from "actions/product";

const mapDispatchToProps = { productAdd };
const mergeProps = (stateProps, { productAdd }, { onClose, ...props }) => ({
Expand Down
4 changes: 2 additions & 2 deletions src/containers/components/AppDrawerAuth.js
@@ -1,7 +1,7 @@
import { connect } from "react-redux";

import AppDrawerAuth from "../../components/AppDrawerAuth";
import { firebaseSignOut } from "../../actions/auth";
import AppDrawerAuth from "components/AppDrawerAuth";
import { firebaseSignOut } from "actions/auth";

const mapStateToProps = ({ profile, user }) => ({ profile, user });
const mapDispatchToProps = dispatch => ({
Expand Down
4 changes: 2 additions & 2 deletions src/containers/components/EditProductDialog.js
@@ -1,7 +1,7 @@
import { connect } from "react-redux";

import ProductDialog from "../../components/ProductDialog";
import { productEdit } from "../../actions/product";
import ProductDialog from "components/ProductDialog";
import { productEdit } from "actions/product";

const mapDispatchToProps = { productEdit };
const mergeProps = (
Expand Down
4 changes: 2 additions & 2 deletions src/containers/components/PasswordChangeForm.js
@@ -1,7 +1,7 @@
import { connect } from "react-redux";

import { userPasswordChange } from "../../actions/auth";
import PasswordChangeForm from "../../components/PasswordChangeForm";
import { userPasswordChange } from "actions/auth";
import PasswordChangeForm from "components/PasswordChangeForm";

const mapStateToProps = ({ user }) => ({ user });
const mapDispatchToProps = { userPasswordChange };
Expand Down
4 changes: 2 additions & 2 deletions src/containers/components/ProductDeleteConfirm.js
@@ -1,7 +1,7 @@
import { connect } from "react-redux";

import ConfirmDeleteAlert from "../../components/ConfirmDeleteAlert";
import { productDelete, productDeleteCancel } from "../../actions/product";
import ConfirmDeleteAlert from "components/ConfirmDeleteAlert";
import { productDelete, productDeleteCancel } from "actions/product";

const mapStateToProps = ({ products: { confirmDeleteOf } }) => ({
confirmDeleteOf
Expand Down
4 changes: 2 additions & 2 deletions src/containers/components/ProductTable.js
@@ -1,7 +1,7 @@
import { connect } from "react-redux";

import ProductTableWrapper from "../../components/ProductTable";
import { productDeleteConfirm, productList } from "../../actions/product";
import ProductTableWrapper from "components/ProductTable";
import { productDeleteConfirm, productList } from "actions/product";

const mapStateToProps = ({ products }) => ({ products });
const mapDispatchToProps = { productDeleteConfirm, productList };
Expand Down
4 changes: 2 additions & 2 deletions src/containers/components/ResetPasswordForm.js
@@ -1,7 +1,7 @@
import { connect } from "react-redux";

import { resetPassword } from "../../actions/auth";
import ResetPasswordForm from "../../components/ResetPasswordForm";
import { resetPassword } from "actions/auth";
import ResetPasswordForm from "components/ResetPasswordForm";

const mapStateToProps = ({ user: { loading } }) => ({ loading });
const mapDispatchToProps = { resetPassword };
Expand Down
4 changes: 2 additions & 2 deletions src/containers/components/SignInForm.js
@@ -1,7 +1,7 @@
import { connect } from "react-redux";

import { userSignIn } from "../../actions/auth";
import SignInForm from "../../components/SignInForm";
import { userSignIn } from "actions/auth";
import SignInForm from "components/SignInForm";

const mapStateToProps = ({ user: { error, loading } }) => ({
serverError: error,
Expand Down
2 changes: 1 addition & 1 deletion src/containers/pages/PasswordChangeForm.js
@@ -1,7 +1,7 @@
import { connect } from "react-redux";
import { withRouter } from "react-router-dom";

import PasswordChangePage from "../../pages/PasswordChangePage";
import PasswordChangePage from "pages/PasswordChangePage";

const mapStateToProps = ({ user }) => ({ user });
export default connect(mapStateToProps)(withRouter(PasswordChangePage));
2 changes: 1 addition & 1 deletion src/containers/pages/ResetPasswordPage.js
@@ -1,7 +1,7 @@
import { connect } from "react-redux";
import { withRouter } from "react-router-dom";

import ResetPasswordPage from "../../pages/ResetPasswordPage";
import ResetPasswordPage from "pages/ResetPasswordPage";

const mapStateToProps = ({ user }) => ({ user });
export default connect(mapStateToProps)(withRouter(ResetPasswordPage));
2 changes: 1 addition & 1 deletion src/containers/pages/SignInPage.js
@@ -1,7 +1,7 @@
import { connect } from "react-redux";
import { withRouter } from "react-router-dom";

import SignInPage from "../../pages/SignInPage";
import SignInPage from "pages/SignInPage";

const mapStateToProps = ({ user }) => ({ user });
export default connect(mapStateToProps)(withRouter(SignInPage));

0 comments on commit f66d201

Please sign in to comment.