From b46dac66a3eacee0e5ef71581c70395784e571e5 Mon Sep 17 00:00:00 2001 From: Marc Cataford Date: Thu, 21 Dec 2023 23:47:49 -0500 Subject: [PATCH] chore(frontend): resolve imports from src to avoid harder-to-read relative imports --- .../src/components/FileListView/FileListView.test.tsx | 4 ++-- frontend/src/components/FileListView/index.tsx | 8 ++++---- frontend/tsconfig.json | 6 ++++-- 3 files changed, 10 insertions(+), 8 deletions(-) diff --git a/frontend/src/components/FileListView/FileListView.test.tsx b/frontend/src/components/FileListView/FileListView.test.tsx index c44c5a8..9edfd08 100644 --- a/frontend/src/components/FileListView/FileListView.test.tsx +++ b/frontend/src/components/FileListView/FileListView.test.tsx @@ -2,8 +2,8 @@ import { render, screen, waitFor } from "@testing-library/react" import { QueryClientProvider, QueryClient } from "@tanstack/react-query" import AxiosMockAdapter from "axios-mock-adapter" -import axios from "../../axios" -import { LocationContext } from "../../contexts/LocationContext" +import axios from "../axios" +import { LocationContext } from "contexts/LocationContext" import FileListView from "." const routes = { diff --git a/frontend/src/components/FileListView/index.tsx b/frontend/src/components/FileListView/index.tsx index 568dc13..158dbc9 100644 --- a/frontend/src/components/FileListView/index.tsx +++ b/frontend/src/components/FileListView/index.tsx @@ -2,10 +2,10 @@ import React from "react" import Box from "@mui/material/Box" -import FileList from "../FileList" -import FileDetails from "../FileDetails" -import { useOwnFileList } from "../../hooks/files" -import { useLocationContext } from "../../contexts/LocationContext" +import FileList from "components/FileList" +import FileDetails from "components/FileDetails" +import { useOwnFileList } from "hooks/files" +import { useLocationContext } from "contexts/LocationContext" function FileListView() { const { isLoading, data } = useOwnFileList() diff --git a/frontend/tsconfig.json b/frontend/tsconfig.json index 6373fc7..526ac7a 100644 --- a/frontend/tsconfig.json +++ b/frontend/tsconfig.json @@ -3,7 +3,8 @@ "target": "ESNext", "jsx": "react-jsx", "module": "commonjs", - "rootDir": ".", + "baseUrl": "./src", + "rootDir": "./src", "moduleResolution": "node", "allowJs": false, "esModuleInterop": true, @@ -12,5 +13,6 @@ "noImplicitAny": true, "skipLibCheck": true, "types": ["jest"] - } + }, + "include": ["src"] } -- 2.45.2