refactor: simplify tsconfig with @tsconfig/bases for vite react, move 'features' into 'components'

This commit is contained in:
Ryan Walters
2025-08-21 22:00:24 -05:00
parent 18ee2c8342
commit f83fc24d13
7 changed files with 30 additions and 30 deletions

View File

@@ -24,6 +24,7 @@
}, },
"devDependencies": { "devDependencies": {
"@tauri-apps/cli": "^2", "@tauri-apps/cli": "^2",
"@tsconfig/vite-react": "^7.0.0",
"@types/react": "^18.3.1", "@types/react": "^18.3.1",
"@types/react-dom": "^18.3.1", "@types/react-dom": "^18.3.1",
"@vitejs/plugin-react": "^4.3.4", "@vitejs/plugin-react": "^4.3.4",

8
pnpm-lock.yaml generated
View File

@@ -42,6 +42,9 @@ importers:
'@tauri-apps/cli': '@tauri-apps/cli':
specifier: ^2 specifier: ^2
version: 2.6.2 version: 2.6.2
'@tsconfig/vite-react':
specifier: ^7.0.0
version: 7.0.0
'@types/react': '@types/react':
specifier: ^18.3.1 specifier: ^18.3.1
version: 18.3.23 version: 18.3.23
@@ -679,6 +682,9 @@ packages:
'@tauri-apps/plugin-opener@2.4.0': '@tauri-apps/plugin-opener@2.4.0':
resolution: {integrity: sha512-43VyN8JJtvKWJY72WI/KNZszTpDpzHULFxQs0CJBIYUdCRowQ6Q1feWTDb979N7nldqSuDOaBupZ6wz2nvuWwQ==} resolution: {integrity: sha512-43VyN8JJtvKWJY72WI/KNZszTpDpzHULFxQs0CJBIYUdCRowQ6Q1feWTDb979N7nldqSuDOaBupZ6wz2nvuWwQ==}
'@tsconfig/vite-react@7.0.0':
resolution: {integrity: sha512-fiuTviENxttMlo8BHuVWgPe/DRwcuU722oVvQ/HLfI3pxXfX4uBjvj9tHm1fbj5+iYbcPmdGENXOUks6yKF2Ug==}
'@types/babel__core@7.20.5': '@types/babel__core@7.20.5':
resolution: {integrity: sha512-qoQprZvz5wQFJwMDqeseRXWv3rqMvhgpbXFfVyWhbx9X47POIA6i/+dXefEmZKoAgOaTdaIgNSMqMIU61yRyzA==} resolution: {integrity: sha512-qoQprZvz5wQFJwMDqeseRXWv3rqMvhgpbXFfVyWhbx9X47POIA6i/+dXefEmZKoAgOaTdaIgNSMqMIU61yRyzA==}
@@ -1863,6 +1869,8 @@ snapshots:
dependencies: dependencies:
'@tauri-apps/api': 2.6.0 '@tauri-apps/api': 2.6.0
'@tsconfig/vite-react@7.0.0': {}
'@types/babel__core@7.20.5': '@types/babel__core@7.20.5':
dependencies: dependencies:
'@babel/parser': 7.28.0 '@babel/parser': 7.28.0

View File

@@ -1,7 +1,7 @@
import { useDragDropPaths } from "./hooks/useDragDropPaths.js"; import { useDragDropPaths } from "./hooks/useDragDropPaths";
import Graph from "./features/graph/graph.js"; import Graph from "./components/graph";
import DropOverlay from "./features/drop/drop-overlay.js"; import DropOverlay from "./components/drop-overlay";
import type { Frame } from "./types/graph.js"; import type { Frame } from "./types/graph";
function App() { function App() {
const data: Frame[] = []; const data: Frame[] = [];

View File

@@ -1,4 +1,4 @@
import { ReactNode, useEffect, useRef, useState } from "react"; import { type ReactNode, useEffect, useRef, useState } from "react";
import { match, P } from "ts-pattern"; import { match, P } from "ts-pattern";
import { import {
CheckCircle, CheckCircle,
@@ -10,8 +10,8 @@ import {
Music, Music,
XCircle, XCircle,
} from "lucide-react"; } from "lucide-react";
import { commands } from "../../bindings"; import { commands } from "../bindings";
import type { MediaType, StreamDetail } from "../../bindings"; import type { MediaType, StreamDetail } from "../bindings";
type DropOverlayProps = { type DropOverlayProps = {
paths: string[]; paths: string[];

View File

@@ -1,6 +1,6 @@
import { ResponsiveLine } from "@nivo/line"; import { ResponsiveLine } from "@nivo/line";
import { formatBytes } from "../../lib/format.js"; import { formatBytes } from "@/lib/format";
import type { Frame } from "../../types/graph.js"; import type { Frame } from "@/types/graph";
type GraphProps = { type GraphProps = {
data: Frame[]; data: Frame[];

View File

@@ -1,25 +1,10 @@
{ {
"extends": "@tsconfig/vite-react/tsconfig.json",
"compilerOptions": { "compilerOptions": {
"target": "ES2020", /* Paths */
"useDefineForClassFields": true, "paths": {
"lib": ["ES2020", "DOM", "DOM.Iterable"], "@/*": ["./src/*"]
"module": "ESNext", }
"skipLibCheck": true,
/* Bundler mode */
"moduleResolution": "bundler",
"allowImportingTsExtensions": true,
"resolveJsonModule": true,
"isolatedModules": true,
"noEmit": true,
"jsx": "react-jsx",
/* Linting */
"strict": true,
"noUnusedLocals": true,
"noUnusedParameters": true,
"noFallthroughCasesInSwitch": true
}, },
"include": ["src"], "include": ["src"]
"references": [{ "path": "./tsconfig.node.json" }]
} }

View File

@@ -1,6 +1,7 @@
import { defineConfig } from "vite"; import { defineConfig } from "vite";
import react from "@vitejs/plugin-react"; import react from "@vitejs/plugin-react";
import tailwindcss from "@tailwindcss/vite"; import tailwindcss from "@tailwindcss/vite";
import path from "path";
// @ts-expect-error process is a nodejs global // @ts-expect-error process is a nodejs global
const host = process.env.TAURI_DEV_HOST; const host = process.env.TAURI_DEV_HOST;
@@ -8,6 +9,11 @@ const host = process.env.TAURI_DEV_HOST;
// https://vite.dev/config/ // https://vite.dev/config/
export default defineConfig(async () => ({ export default defineConfig(async () => ({
plugins: [react(), tailwindcss()], plugins: [react(), tailwindcss()],
resolve: {
alias: {
"@": path.resolve(__dirname, "src"),
},
},
// Vite options tailored for Tauri development and only applied in `tauri dev` or `tauri build` // Vite options tailored for Tauri development and only applied in `tauri dev` or `tauri build`
// //