Skip to content

Commit

Permalink
Update Project import system (PalisadoesFoundation#166)
Browse files Browse the repository at this point in the history
__Issue__: Relative path imports made it harder to know where in the
given project that a module was being imported from, as well as,
comprised code readability.

__Fix__: Utilize `jsconfig.json` convention that allows for the
specification of root files and options. [jsconfig.json
overview](https://code.visualstudio.com/docs/languages/jsconfig)

__Minor__: Omission of `Create-React-App` readme file.
  • Loading branch information
Dev-Dominic committed Sep 27, 2020
1 parent b187cf1 commit b266592
Show file tree
Hide file tree
Showing 8 changed files with 20 additions and 81 deletions.
68 changes: 0 additions & 68 deletions README.md

This file was deleted.

7 changes: 7 additions & 0 deletions jsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"compilerOptions": {
"baseUrl": "src"
},
"include": ["src"],
"exclude": ["node_modules", "docs", "setup", "README.rst"]
}
4 changes: 2 additions & 2 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@ import ReactDOM from "react-dom";
import { BrowserRouter } from "react-router-dom";

/* Styles Imports */
import "./styles/main.css";
import "styles/main.css";

/* Routes Imports */
import RouteClient from "./routes/routeClient";
import RouteClient from "routes/routeClient";

function App() {
return <RouteClient />;
Expand Down
8 changes: 4 additions & 4 deletions src/routes/dashboard/dashboard.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@
import React, { useState, useEffect } from "react";

/* Components Import */
import DashboardComponent from "../../components/Dashboard";
import DashboardComponent from "components/Dashboard";

/* Querying */
import query from "../../utils/query";
import { userFavorite } from "../../utils/api";
import query from "utils/query";
import { userFavorite } from "utils/api";

/* Tailwind css build */
import "../../styles/main.css";
import "styles/main.css";

function parseFavoriteCharts(response) {
return response.data.data.allFavorite.edges
Expand Down
2 changes: 1 addition & 1 deletion src/routes/index.js
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
import RoutesClient from "./routeClient";
import RoutesClient from "routes/routeClient";
export default RoutesClient;
4 changes: 2 additions & 2 deletions src/routes/login/login.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@ import React, { useState } from "react";
import { useHistory } from "react-router-dom";

/* Authentication method imports */
import { authenticate } from "../../utils/query";
import { authenticate } from "utils/query";

/* Components */
import LoginComponent from "../../components/Login";
import LoginComponent from "components/Login";

function Login() {
const history = useHistory();
Expand Down
4 changes: 2 additions & 2 deletions src/routes/routeClient/routesClient.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ import React from "react";
import { Route, Switch, Redirect } from "react-router-dom";

/* Route components */
import Login from "../login";
import Dashboard from "../dashboard";
import Login from "routes/login";
import Dashboard from "routes/dashboard";

function ProtectedRoute({ component: Component, ...props }) {
return (
Expand Down
4 changes: 2 additions & 2 deletions src/utils/query/query.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
/* Authentication query */
import { userAuth } from "../api";
import { userAuth } from "utils/api";

/* Imports */
const axios = require("axios").default;
import axios from "axios";

const serverUrl = "http://localhost:20202/pattoo/api/v1/web/graphql";

Expand Down

0 comments on commit b266592

Please sign in to comment.