From 41c205c809805402d087f385de17c5652afec974 Mon Sep 17 00:00:00 2001 From: wont-stream <143244075+wont-stream@users.noreply.github.com> Date: Thu, 10 Apr 2025 19:27:18 -0400 Subject: [PATCH] auto-lint --- biome.json | 2 +- package.json | 46 ++++++------ src/components/app.tsx | 20 ++--- src/components/container/index.tsx | 77 ++++++++++--------- src/components/heart/index.css | 3 +- src/components/heart/index.tsx | 117 +++++++++++++++-------------- src/components/navbar/index.tsx | 67 +++++++++++------ src/main.tsx | 13 ++-- tsconfig.app.json | 62 +++++++-------- tsconfig.json | 20 ++--- tsconfig.node.json | 42 +++++------ vite.config.ts | 40 +++++----- 12 files changed, 263 insertions(+), 246 deletions(-) diff --git a/biome.json b/biome.json index 640ccfa..921a7a5 100644 --- a/biome.json +++ b/biome.json @@ -32,4 +32,4 @@ "semicolons": "always" } } -} \ No newline at end of file +} diff --git a/package.json b/package.json index 9df96bb..b0d31ee 100644 --- a/package.json +++ b/package.json @@ -1,24 +1,24 @@ { - "name": "ipv4.army-vite", - "private": true, - "version": "0.0.0", - "type": "module", - "scripts": { - "dev": "bunx --bun vite", - "build": "bunx --bun tsc -b && bunx --bun vite build", - "preview": "bunx --bun vite preview" - }, - "dependencies": { - "halfmoon": "^2.0.2", - "lucide-preact": "^0.487.0", - "preact": "^10.26.2" - }, - "devDependencies": { - "@biomejs/biome": "1.9.4", - "@fullhuman/postcss-purgecss": "^7.0.2", - "@preact/preset-vite": "^2.10.1", - "lightningcss": "^1.29.3", - "typescript": "~5.7.2", - "vite": "^6.2.0" - } -} \ No newline at end of file + "name": "ipv4.army-vite", + "private": true, + "version": "0.0.0", + "type": "module", + "scripts": { + "dev": "bunx --bun vite", + "build": "bunx --bun tsc -b && bunx --bun vite build", + "preview": "bunx --bun vite preview" + }, + "dependencies": { + "halfmoon": "^2.0.2", + "lucide-preact": "^0.487.0", + "preact": "^10.26.2" + }, + "devDependencies": { + "@biomejs/biome": "1.9.4", + "@fullhuman/postcss-purgecss": "^7.0.2", + "@preact/preset-vite": "^2.10.1", + "lightningcss": "^1.29.3", + "typescript": "~5.7.2", + "vite": "^6.2.0" + } +} diff --git a/src/components/app.tsx b/src/components/app.tsx index 56caeda..70e257b 100644 --- a/src/components/app.tsx +++ b/src/components/app.tsx @@ -1,13 +1,13 @@ -import Navbar from './navbar'; -import Container from './container'; +import Container from "./container"; +import Navbar from "./navbar"; -import './app.css'; +import "./app.css"; export default () => { - return ( - <> - - - - ) -} + return ( + <> + + + + ); +}; diff --git a/src/components/container/index.tsx b/src/components/container/index.tsx index 071ce4d..19c5864 100644 --- a/src/components/container/index.tsx +++ b/src/components/container/index.tsx @@ -1,42 +1,49 @@ -import { useState } from 'preact/hooks'; +import { useState } from "preact/hooks"; -import Heart from '../heart'; +import Heart from "../heart"; const statusMap = { - online: "border-success-subtle", - idle: "border-warning-subtle", - dnd: "border-danger-subtle", - offline: "border-light-subtle", -} + online: "border-success-subtle", + idle: "border-warning-subtle", + dnd: "border-danger-subtle", + offline: "border-light-subtle", +}; export default () => { - const [status, setStatus] = useState('offline'); + const [status, setStatus] = useState("offline"); - fetch("https://lanyard.creations.works/v1/users/1273447359417942128") - .then(req => req.json()) - .then((res) => { - if (res.data.discord_status) { - setStatus(res.data.discord_status); - } else { - setStatus('offline'); - } - }) + fetch("https://lanyard.creations.works/v1/users/1273447359417942128") + .then((req) => req.json()) + .then((res) => { + if (res.data.discord_status) { + setStatus(res.data.discord_status); + } else { + setStatus("offline"); + } + }); - return ( - <> -
- ... -
-

Seth

-

Dedicated Backend Developer -
-
- - With a passsion for high-fidelity audio, gaming, and web development - -

- -
- - ) -} \ No newline at end of file + return ( + <> +
+ ... +
+

Seth

+

+ Dedicated Backend Developer +
+
+ + With a passsion for high-fidelity audio, gaming, and web development + +

+ +
+ + ); +}; diff --git a/src/components/heart/index.css b/src/components/heart/index.css index 5a42f48..c3912ba 100644 --- a/src/components/heart/index.css +++ b/src/components/heart/index.css @@ -3,7 +3,6 @@ } @keyframes pulse { - 0%, 100% { transform: scale(1); @@ -16,4 +15,4 @@ .heart { animation: pulse calc(60s / var(--bpm)) infinite ease; -} \ No newline at end of file +} diff --git a/src/components/heart/index.tsx b/src/components/heart/index.tsx index 2f5af6a..5c99b02 100644 --- a/src/components/heart/index.tsx +++ b/src/components/heart/index.tsx @@ -1,68 +1,71 @@ -import { useState } from 'preact/hooks'; - -import './index.css'; +import { useState } from "preact/hooks"; +import "./index.css"; export default () => { - const [heartrate, setHeartrate] = useState(0); + const [heartrate, setHeartrate] = useState(0); - const ws = new WebSocket("wss://app.hyperate.io/socket/websocket?token=wv39nM6iyrNJulvpmMQrimYPIXy2dVrYRjkuHpbRapKT2VSh65ngDGHdCdCtmEN9"); + const ws = new WebSocket( + "wss://app.hyperate.io/socket/websocket?token=wv39nM6iyrNJulvpmMQrimYPIXy2dVrYRjkuHpbRapKT2VSh65ngDGHdCdCtmEN9", + ); - let hrTimeout: ReturnType; + let hrTimeout: ReturnType; - const setHrInterval = () => { - hrTimeout = setTimeout(() => { - return setHeartrate(0); - }, 6000); - }; + const setHrInterval = () => { + hrTimeout = setTimeout(() => { + return setHeartrate(0); + }, 6000); + }; - ws.onopen = () => { - ws.send( - JSON.stringify({ - topic: "hr:0BCA", - event: "phx_join", - payload: {}, - ref: 0, - }), - ); + ws.onopen = () => { + ws.send( + JSON.stringify({ + topic: "hr:0BCA", + event: "phx_join", + payload: {}, + ref: 0, + }), + ); - setInterval(() => { - ws.send( - JSON.stringify({ - topic: "phoenix", - event: "heartbeat", - payload: {}, - ref: 0, - }), - ); - }, 10000); + setInterval(() => { + ws.send( + JSON.stringify({ + topic: "phoenix", + event: "heartbeat", + payload: {}, + ref: 0, + }), + ); + }, 10000); - return setHrInterval(); - }; + return setHrInterval(); + }; + ws.onmessage = ({ data }) => { + const { event, payload } = JSON.parse(data); + switch (event) { + case "hr_update": { + clearTimeout(hrTimeout); + setHrInterval(); + setHeartrate(payload.hr); + break; + } + default: { + break; + } + } + }; - ws.onmessage = ({ data }) => { - const { event, payload } = JSON.parse(data); - switch (event) { - case "hr_update": { - clearTimeout(hrTimeout); - setHrInterval(); - setHeartrate(payload.hr); - break; - } - default: { - break; - } - } - }; - - return ( - <> -
- ♥️ -
- {heartrate} BPM -
- - ) -} \ No newline at end of file + return ( + <> +
+ ♥️ +
+ {heartrate} BPM +
+ + ); +}; diff --git a/src/components/navbar/index.tsx b/src/components/navbar/index.tsx index 771b5d1..25958c2 100644 --- a/src/components/navbar/index.tsx +++ b/src/components/navbar/index.tsx @@ -1,29 +1,46 @@ -import { Minus, Minimize, X } from 'lucide-preact'; +import { Minimize, Minus, X } from "lucide-preact"; const close = () => { - window.close(); - window.history.back(); -} + window.close(); + window.history.back(); +}; export default () => { - return ( - <> - - - ) -} \ No newline at end of file + return ( + <> + + + ); +}; diff --git a/src/main.tsx b/src/main.tsx index 280d27e..8b4285d 100644 --- a/src/main.tsx +++ b/src/main.tsx @@ -1,6 +1,9 @@ -import { render } from 'preact' -import './index.css' -import 'halfmoon/css/halfmoon.min.css'; -import App from './components/app.tsx' +import { render } from "preact"; +import "./index.css"; +import "halfmoon/css/halfmoon.min.css"; +import App from "./components/app.tsx"; -render(, document.getElementById('app') as HTMLElement || document.body) +render( + , + (document.getElementById("app") as HTMLElement) || document.body, +); diff --git a/tsconfig.app.json b/tsconfig.app.json index 7bf2d3e..613d3c5 100644 --- a/tsconfig.app.json +++ b/tsconfig.app.json @@ -1,37 +1,27 @@ { - "compilerOptions": { - "tsBuildInfoFile": "./node_modules/.tmp/tsconfig.app.tsbuildinfo", - "target": "ES2020", - "useDefineForClassFields": true, - "module": "ESNext", - "lib": [ - "ES2020", - "DOM", - "DOM.Iterable" - ], - "skipLibCheck": true, - "paths": { - "react": [ - "./node_modules/preact/compat/" - ], - "react-dom": [ - "./node_modules/preact/compat/" - ] - }, - "moduleResolution": "bundler", - "allowImportingTsExtensions": true, - "isolatedModules": true, - "moduleDetection": "force", - "noEmit": true, - "jsx": "react-jsx", - "jsxImportSource": "preact", - "strict": true, - "noUnusedLocals": true, - "noUnusedParameters": true, - "noFallthroughCasesInSwitch": true, - "noUncheckedSideEffectImports": true - }, - "include": [ - "src" - ] -} \ No newline at end of file + "compilerOptions": { + "tsBuildInfoFile": "./node_modules/.tmp/tsconfig.app.tsbuildinfo", + "target": "ES2020", + "useDefineForClassFields": true, + "module": "ESNext", + "lib": ["ES2020", "DOM", "DOM.Iterable"], + "skipLibCheck": true, + "paths": { + "react": ["./node_modules/preact/compat/"], + "react-dom": ["./node_modules/preact/compat/"] + }, + "moduleResolution": "bundler", + "allowImportingTsExtensions": true, + "isolatedModules": true, + "moduleDetection": "force", + "noEmit": true, + "jsx": "react-jsx", + "jsxImportSource": "preact", + "strict": true, + "noUnusedLocals": true, + "noUnusedParameters": true, + "noFallthroughCasesInSwitch": true, + "noUncheckedSideEffectImports": true + }, + "include": ["src"] +} diff --git a/tsconfig.json b/tsconfig.json index 65f670c..a5b06bf 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -1,11 +1,11 @@ { - "files": [], - "references": [ - { - "path": "./tsconfig.app.json" - }, - { - "path": "./tsconfig.node.json" - } - ] -} \ No newline at end of file + "files": [], + "references": [ + { + "path": "./tsconfig.app.json" + }, + { + "path": "./tsconfig.node.json" + } + ] +} diff --git a/tsconfig.node.json b/tsconfig.node.json index 73aa84f..5a2a3a0 100644 --- a/tsconfig.node.json +++ b/tsconfig.node.json @@ -1,24 +1,20 @@ { - "compilerOptions": { - "tsBuildInfoFile": "./node_modules/.tmp/tsconfig.node.tsbuildinfo", - "target": "ES2022", - "lib": [ - "ES2023" - ], - "module": "ESNext", - "skipLibCheck": true, - "moduleResolution": "bundler", - "allowImportingTsExtensions": true, - "isolatedModules": true, - "moduleDetection": "force", - "noEmit": true, - "strict": true, - "noUnusedLocals": true, - "noUnusedParameters": true, - "noFallthroughCasesInSwitch": true, - "noUncheckedSideEffectImports": true - }, - "include": [ - "vite.config.ts" - ] -} \ No newline at end of file + "compilerOptions": { + "tsBuildInfoFile": "./node_modules/.tmp/tsconfig.node.tsbuildinfo", + "target": "ES2022", + "lib": ["ES2023"], + "module": "ESNext", + "skipLibCheck": true, + "moduleResolution": "bundler", + "allowImportingTsExtensions": true, + "isolatedModules": true, + "moduleDetection": "force", + "noEmit": true, + "strict": true, + "noUnusedLocals": true, + "noUnusedParameters": true, + "noFallthroughCasesInSwitch": true, + "noUncheckedSideEffectImports": true + }, + "include": ["vite.config.ts"] +} diff --git a/vite.config.ts b/vite.config.ts index 4ea209f..e02958b 100644 --- a/vite.config.ts +++ b/vite.config.ts @@ -1,26 +1,28 @@ /// -import { defineConfig } from 'vite' -import preact from '@preact/preset-vite' +import preact from "@preact/preset-vite"; +import { defineConfig } from "vite"; import postCSSPurgeCSS from "@fullhuman/postcss-purgecss"; // https://vite.dev/config/ export default defineConfig({ - css: { - ...(import.meta.env.NODE_ENV === "production") ? { - transformer: "postcss", - postcss: { - plugins: [ - postCSSPurgeCSS({ - content: ["./index.html", "./src/**/*.{ts,tsx}"], - }) - ] - } - } : { transformer: "lightningcss" } - }, - build: { - cssMinify: "lightningcss", - }, - plugins: [preact()], -}) + css: { + ...(import.meta.env.NODE_ENV === "production" + ? { + transformer: "postcss", + postcss: { + plugins: [ + postCSSPurgeCSS({ + content: ["./index.html", "./src/**/*.{ts,tsx}"], + }), + ], + }, + } + : { transformer: "lightningcss" }), + }, + build: { + cssMinify: "lightningcss", + }, + plugins: [preact()], +});