From 40b0b7047ec99bcf2b447c08e232f6058fea1584 Mon Sep 17 00:00:00 2001 From: Jeremy Kahn Date: Tue, 16 Aug 2022 09:21:33 -0500 Subject: [PATCH] refactor: use absolute module paths --- src/components/Room/Room.tsx | 4 ++-- src/hooks/usePeerRoom/usePeerRoom.ts | 2 +- src/index.tsx | 8 ++++---- src/pages/PublicRoom/PublicRoom.tsx | 2 +- src/services/PeerRoom/PeerRoom.ts | 2 +- tsconfig.json | 3 ++- 6 files changed, 11 insertions(+), 10 deletions(-) diff --git a/src/components/Room/Room.tsx b/src/components/Room/Room.tsx index bf52311..6e15e05 100644 --- a/src/components/Room/Room.tsx +++ b/src/components/Room/Room.tsx @@ -3,8 +3,8 @@ import { useParams } from 'react-router-dom' import Button from '@mui/material/Button' import Typography from '@mui/material/Typography' -import { usePeerRoom } from '../../hooks/usePeerRoom' -import { PeerRoom } from '../../services/PeerRoom' +import { usePeerRoom } from 'hooks/usePeerRoom' +import { PeerRoom } from 'services/PeerRoom' enum PeerActions { MESSAGE = 'MESSAGE', diff --git a/src/hooks/usePeerRoom/usePeerRoom.ts b/src/hooks/usePeerRoom/usePeerRoom.ts index 8745e44..ac9fc02 100644 --- a/src/hooks/usePeerRoom/usePeerRoom.ts +++ b/src/hooks/usePeerRoom/usePeerRoom.ts @@ -1,6 +1,6 @@ import { useEffect, useState } from 'react' -import { PeerRoom, getPeerRoom } from '../../services/PeerRoom' +import { PeerRoom, getPeerRoom } from 'services/PeerRoom' interface PeerRoomProps { appId: string diff --git a/src/index.tsx b/src/index.tsx index 4824997..bc2f7e5 100644 --- a/src/index.tsx +++ b/src/index.tsx @@ -4,10 +4,10 @@ import { BrowserRouter as Router } from 'react-router-dom' import { ThemeProvider, createTheme } from '@mui/material/styles' import CssBaseline from '@mui/material/CssBaseline' -import * as serviceWorkerRegistration from './serviceWorkerRegistration' -import './index.sass' -import Bootstrap from './Bootstrap' -import reportWebVitals from './reportWebVitals' +import * as serviceWorkerRegistration from 'serviceWorkerRegistration' +import 'index.sass' +import Bootstrap from 'Bootstrap' +import reportWebVitals from 'reportWebVitals' const darkTheme = createTheme({ palette: { diff --git a/src/pages/PublicRoom/PublicRoom.tsx b/src/pages/PublicRoom/PublicRoom.tsx index 5044cdf..1e805ed 100644 --- a/src/pages/PublicRoom/PublicRoom.tsx +++ b/src/pages/PublicRoom/PublicRoom.tsx @@ -1,4 +1,4 @@ -import { Room } from '../../components/Room' +import { Room } from 'components/Room' export function PublicRoom() { return diff --git a/src/services/PeerRoom/PeerRoom.ts b/src/services/PeerRoom/PeerRoom.ts index ad38d27..bf758c6 100644 --- a/src/services/PeerRoom/PeerRoom.ts +++ b/src/services/PeerRoom/PeerRoom.ts @@ -1,6 +1,6 @@ import { joinRoom, Room, RoomConfig } from 'trystero' -import { sleep } from '../../utils' +import { sleep } from 'utils' export class PeerRoom { private room: Room diff --git a/tsconfig.json b/tsconfig.json index 9d379a3..5452a6d 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -14,7 +14,8 @@ "resolveJsonModule": true, "isolatedModules": true, "noEmit": true, - "jsx": "react-jsx" + "jsx": "react-jsx", + "baseUrl": "src" }, "include": ["src"] }