summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Hunteman <michael@huntm.net>2024-04-26 11:51:49 -0700
committerMichael Hunteman <michael@huntm.net>2024-04-26 11:51:49 -0700
commitc67f9987cad34ec1a0a03e72326173d23e3f4360 (patch)
treee785366406fff94d57d17c9a45668b7810b74de9
parentfc07a039bb79cc7647b7ba7edee46e4f019093e0 (diff)
Use bun
-rw-r--r--.gitignore1
-rw-r--r--package.json3
-rw-r--r--src/App.tsx1
-rw-r--r--src/ThemeContextProvider.tsx1
-rw-r--r--src/apiSlice.ts2
-rw-r--r--src/components/Admin.tsx1
-rw-r--r--src/components/Desktop.tsx1
-rw-r--r--src/components/Home.tsx1
-rw-r--r--src/components/Mobile.tsx4
-rw-r--r--src/components/NavBar.tsx1
-rw-r--r--src/components/Registry.tsx2
-rw-r--r--src/components/Rsvp.tsx1
-rw-r--r--src/components/RsvpForm.tsx8
-rw-r--r--src/components/Schedule.tsx4
-rw-r--r--src/features/auth/GuestLogin.tsx4
-rw-r--r--src/features/auth/authSlice.ts2
-rw-r--r--src/main.css4
-rw-r--r--tsconfig.json27
-rw-r--r--tsconfig.node.json11
19 files changed, 44 insertions, 35 deletions
diff --git a/.gitignore b/.gitignore
index a547bf3..0750d47 100644
--- a/.gitignore
+++ b/.gitignore
@@ -11,6 +11,7 @@ node_modules
dist
dist-ssr
*.local
+bun.lockb
# Editor directories and files
.vscode/*
diff --git a/package.json b/package.json
index 3edb6db..fb5ffcd 100644
--- a/package.json
+++ b/package.json
@@ -4,7 +4,7 @@
"version": "0.0.0",
"type": "module",
"scripts": {
- "dev": "vite --host",
+ "dev": "bunx --bun vite",
"build": "tsc && vite build",
"lint": "eslint . --ext ts,tsx --report-unused-disable-directives --max-warnings 0",
"preview": "vite preview"
@@ -26,6 +26,7 @@
},
"devDependencies": {
"@hookform/devtools": "^4.3.1",
+ "@types/bun": "^1.1.0",
"@types/react": "^18.2.55",
"@types/react-dom": "^18.2.19",
"@typescript-eslint/eslint-plugin": "^6.21.0",
diff --git a/src/App.tsx b/src/App.tsx
index 11540b1..27fc180 100644
--- a/src/App.tsx
+++ b/src/App.tsx
@@ -1,3 +1,4 @@
+import React from 'react';
import { Outlet } from 'react-router-dom';
import CssBaseline from '@mui/material/CssBaseline';
import NavBar from './components/NavBar';
diff --git a/src/ThemeContextProvider.tsx b/src/ThemeContextProvider.tsx
index dc3cb89..87b401a 100644
--- a/src/ThemeContextProvider.tsx
+++ b/src/ThemeContextProvider.tsx
@@ -1,3 +1,4 @@
+import React from 'react';
import { ReactNode, createContext, useMemo, useState } from 'react';
import { ThemeProvider, createTheme } from '@mui/material/styles';
import useMediaQuery from '@mui/material/useMediaQuery';
diff --git a/src/apiSlice.ts b/src/apiSlice.ts
index f337fdd..3305dbf 100644
--- a/src/apiSlice.ts
+++ b/src/apiSlice.ts
@@ -1,5 +1,5 @@
import { createApi, fetchBaseQuery } from '@reduxjs/toolkit/query/react';
-import { RootState } from './store';
+import type { RootState } from './store';
export interface LoginRequest {
firstName: string;
diff --git a/src/components/Admin.tsx b/src/components/Admin.tsx
index a3da3fa..1c941a5 100644
--- a/src/components/Admin.tsx
+++ b/src/components/Admin.tsx
@@ -1,3 +1,4 @@
+import React from 'react';
import { useGetGuestsQuery } from '../apiSlice';
function Admin() {
diff --git a/src/components/Desktop.tsx b/src/components/Desktop.tsx
index 983c929..72b583d 100644
--- a/src/components/Desktop.tsx
+++ b/src/components/Desktop.tsx
@@ -1,3 +1,4 @@
+import React from 'react';
import { useContext } from 'react';
import { Link } from 'react-router-dom';
import { Button, IconButton } from '@mui/material';
diff --git a/src/components/Home.tsx b/src/components/Home.tsx
index 4d4428a..839667a 100644
--- a/src/components/Home.tsx
+++ b/src/components/Home.tsx
@@ -1,3 +1,4 @@
+import React from 'react';
import { useEffect, useRef, useState } from 'react';
import './active.css';
diff --git a/src/components/Mobile.tsx b/src/components/Mobile.tsx
index f5502c0..7d790e1 100644
--- a/src/components/Mobile.tsx
+++ b/src/components/Mobile.tsx
@@ -1,6 +1,6 @@
-import { useContext } from 'react';
+import React from 'react';
+import { useContext, useState } from 'react';
import { Link } from 'react-router-dom';
-import { useState } from 'react';
import { Button, IconButton, Menu, MenuItem } from '@mui/material';
import DarkModeIcon from '@mui/icons-material/DarkMode';
import LightModeIcon from '@mui/icons-material/LightMode';
diff --git a/src/components/NavBar.tsx b/src/components/NavBar.tsx
index f050d7a..677828b 100644
--- a/src/components/NavBar.tsx
+++ b/src/components/NavBar.tsx
@@ -1,3 +1,4 @@
+import React from 'react';
import { Link } from 'react-router-dom';
import { AppBar, Toolbar, Typography } from '@mui/material';
import useMediaQuery from '@mui/material/useMediaQuery';
diff --git a/src/components/Registry.tsx b/src/components/Registry.tsx
index 7319560..60a73f9 100644
--- a/src/components/Registry.tsx
+++ b/src/components/Registry.tsx
@@ -1,3 +1,5 @@
+import React from 'react';
+
function Registry() {
return (
<>
diff --git a/src/components/Rsvp.tsx b/src/components/Rsvp.tsx
index 104196f..dad7213 100644
--- a/src/components/Rsvp.tsx
+++ b/src/components/Rsvp.tsx
@@ -1,3 +1,4 @@
+import React from 'react';
import { useMemo } from 'react';
import { useLocation, Navigate, Outlet } from 'react-router-dom';
import { useSelector } from 'react-redux';
diff --git a/src/components/RsvpForm.tsx b/src/components/RsvpForm.tsx
index a6e7036..b9dd991 100644
--- a/src/components/RsvpForm.tsx
+++ b/src/components/RsvpForm.tsx
@@ -1,3 +1,6 @@
+import React from 'react';
+import { useRef } from 'react';
+import { useOutletContext } from 'react-router-dom';
import {
Button,
Container,
@@ -10,9 +13,8 @@ import {
TextField,
} from '@mui/material';
import { useForm, Controller, useFieldArray } from 'react-hook-form';
-import { useOutletContext } from 'react-router-dom';
-import { useUpdateGuestMutation, Guest } from '../apiSlice';
-import { useRef } from 'react';
+import { useUpdateGuestMutation } from '../apiSlice';
+import type { Guest } from '../apiSlice';
type FormValues = {
id: number;
diff --git a/src/components/Schedule.tsx b/src/components/Schedule.tsx
index ef72769..08b10e2 100644
--- a/src/components/Schedule.tsx
+++ b/src/components/Schedule.tsx
@@ -1,3 +1,4 @@
+import React from 'react';
import { Container, Paper } from '@mui/material';
import PlaceIcon from '@mui/icons-material/Place';
@@ -6,8 +7,7 @@ function Schedule() {
<Container
maxWidth="md"
style={{
- height: '80vh',
- marginTop: 80,
+ top: '1800',
display: 'flex',
justifyContent: 'center',
}}
diff --git a/src/features/auth/GuestLogin.tsx b/src/features/auth/GuestLogin.tsx
index 94bad05..4da7e45 100644
--- a/src/features/auth/GuestLogin.tsx
+++ b/src/features/auth/GuestLogin.tsx
@@ -1,9 +1,11 @@
+import React from 'react';
import { useNavigate } from 'react-router-dom';
import { useDispatch } from 'react-redux';
import { Button, Container, TextField, Typography } from '@mui/material';
import { useForm } from 'react-hook-form';
import { setCredentials } from './authSlice';
-import { useLoginMutation, LoginRequest } from '../../apiSlice';
+import { useLoginMutation } from '../../apiSlice';
+import type { LoginRequest } from '../../apiSlice';
function GuestLogin() {
const dispatch = useDispatch();
diff --git a/src/features/auth/authSlice.ts b/src/features/auth/authSlice.ts
index 34ede58..5eccd65 100644
--- a/src/features/auth/authSlice.ts
+++ b/src/features/auth/authSlice.ts
@@ -1,6 +1,6 @@
import { createSlice } from '@reduxjs/toolkit';
import type { RootState } from '../../store';
-import { Guest } from '../../apiSlice';
+import type { Guest } from '../../apiSlice';
type AuthState = {
guest: Guest | null;
diff --git a/src/main.css b/src/main.css
index 13ce153..59456cc 100644
--- a/src/main.css
+++ b/src/main.css
@@ -1,3 +1,5 @@
-#body {
+#root, body {
+ height: 100vh;
+ width: 100vw;
margin: 0
}
diff --git a/tsconfig.json b/tsconfig.json
index a7fc6fb..960b5a6 100644
--- a/tsconfig.json
+++ b/tsconfig.json
@@ -1,25 +1,28 @@
{
"compilerOptions": {
- "target": "ES2020",
- "useDefineForClassFields": true,
- "lib": ["ES2020", "DOM", "DOM.Iterable"],
+ // Enable latest features
+ "lib": ["ESNext"],
+ "target": "ESNext",
"module": "ESNext",
- "skipLibCheck": true,
+ "moduleDetection": "force",
+ "jsx": "react-jsx",
+ "allowJs": true,
- /* Bundler mode */
+ // Bundler mode
"moduleResolution": "bundler",
"allowImportingTsExtensions": true,
- "resolveJsonModule": true,
- "isolatedModules": true,
+ "verbatimModuleSyntax": true,
"noEmit": true,
- "jsx": "react-jsx",
- /* Linting */
+ // Best practices
"strict": true,
+ "skipLibCheck": true,
+ "noFallthroughCasesInSwitch": true,
+
+ // Some stricter flags
"noUnusedLocals": true,
"noUnusedParameters": true,
- "noFallthroughCasesInSwitch": true
+ "noPropertyAccessFromIndexSignature": true
},
- "include": ["src"],
- "references": [{ "path": "./tsconfig.node.json" }]
+ "include": ["vite.config.ts"]
}
diff --git a/tsconfig.node.json b/tsconfig.node.json
deleted file mode 100644
index 97ede7e..0000000
--- a/tsconfig.node.json
+++ /dev/null
@@ -1,11 +0,0 @@
-{
- "compilerOptions": {
- "composite": true,
- "skipLibCheck": true,
- "module": "ESNext",
- "moduleResolution": "bundler",
- "allowSyntheticDefaultImports": true,
- "strict": true
- },
- "include": ["vite.config.ts"]
-}