From 753b480bdd081aa726337fb92781233cd81b06db Mon Sep 17 00:00:00 2001 From: DTTerastar Date: Sun, 29 Dec 2024 17:17:17 -0500 Subject: [PATCH] Misc fixes --- src/ui/.eslintrc.cjs | 30 ------------- src/ui/.vscode/settings.json | 2 +- src/ui/eslint.config.js | 67 +++++++++++++----------------- src/ui/package-lock.json | 11 ----- src/ui/package.json | 1 - src/ui/postcss.config.cjs | 6 +-- src/ui/src/app.postcss | 5 ++- src/ui/src/lib/DevicesTable.svelte | 2 +- src/ui/src/lib/Map.svelte | 16 +++---- src/ui/svelte.config.js | 28 ++++++------- src/ui/tailwind.config.ts | 23 +++++----- src/ui/vite.config.ts | 4 +- 12 files changed, 70 insertions(+), 125 deletions(-) delete mode 100644 src/ui/.eslintrc.cjs diff --git a/src/ui/.eslintrc.cjs b/src/ui/.eslintrc.cjs deleted file mode 100644 index ebc19589..00000000 --- a/src/ui/.eslintrc.cjs +++ /dev/null @@ -1,30 +0,0 @@ -module.exports = { - root: true, - extends: [ - 'eslint:recommended', - 'plugin:@typescript-eslint/recommended', - 'plugin:svelte/recommended', - 'prettier' - ], - parser: '@typescript-eslint/parser', - plugins: ['@typescript-eslint'], - parserOptions: { - sourceType: 'module', - ecmaVersion: 2020, - extraFileExtensions: ['.svelte'] - }, - env: { - browser: true, - es2017: true, - node: true - }, - overrides: [ - { - files: ['*.svelte'], - parser: 'svelte-eslint-parser', - parserOptions: { - parser: '@typescript-eslint/parser' - } - } - ] -}; diff --git a/src/ui/.vscode/settings.json b/src/ui/.vscode/settings.json index 90beffd6..54a4399e 100644 --- a/src/ui/.vscode/settings.json +++ b/src/ui/.vscode/settings.json @@ -74,4 +74,4 @@ "track", "width" ] -} \ No newline at end of file +} diff --git a/src/ui/eslint.config.js b/src/ui/eslint.config.js index feea30bc..7b94fe3f 100644 --- a/src/ui/eslint.config.js +++ b/src/ui/eslint.config.js @@ -1,40 +1,33 @@ -import js from "@eslint/js"; -import eslintConfigPrettier from "eslint-config-prettier"; -import eslintPluginSvelte from "eslint-plugin-svelte"; -import globals from "globals"; -import tsEslint from "typescript-eslint"; -import vitest from "eslint-plugin-vitest"; -import playwright from "eslint-plugin-playwright"; +import js from '@eslint/js'; +import eslintConfigPrettier from 'eslint-config-prettier'; +import eslintPluginSvelte from 'eslint-plugin-svelte'; +import globals from 'globals'; +import tsEslint from 'typescript-eslint'; +import vitest from 'eslint-plugin-vitest'; +import playwright from 'eslint-plugin-playwright'; export default [ - js.configs.recommended, - ...tsEslint.configs.recommended, - ...eslintPluginSvelte.configs["flat/recommended"], - eslintConfigPrettier, - { - ...playwright.configs["flat/playwright"], - files: ["tests/**"] - }, - vitest.configs.recommended, - ...eslintPluginSvelte.configs["flat/prettier"], - { - languageOptions: { - ecmaVersion: "latest", - sourceType: "module", - globals: { ...globals.node, ...globals.browser }, - parserOptions: { - extraFileExtensions: [".svelte"] - } - } - }, - { - ignores: [ - ".svelte-kit", - "build", - "package", - "coverage", - "node_modules", - "playwright.config.js" - ] - } + js.configs.recommended, + ...tsEslint.configs.recommended, + ...eslintPluginSvelte.configs['flat/recommended'], + eslintConfigPrettier, + { + ...playwright.configs['flat/playwright'], + files: ['tests/**'] + }, + vitest.configs.recommended, + ...eslintPluginSvelte.configs['flat/prettier'], + { + languageOptions: { + ecmaVersion: 'latest', + sourceType: 'module', + globals: { ...globals.node, ...globals.browser }, + parserOptions: { + extraFileExtensions: ['.svelte'] + } + } + }, + { + ignores: ['.svelte-kit', 'build', 'package', 'coverage', 'node_modules', 'playwright.config.js'] + } ]; diff --git a/src/ui/package-lock.json b/src/ui/package-lock.json index 59fa8065..83b79e2a 100644 --- a/src/ui/package-lock.json +++ b/src/ui/package-lock.json @@ -16,7 +16,6 @@ "@sveltejs/kit": "^2.15.1", "@sveltejs/vite-plugin-svelte": "^3.1.2", "@tailwindcss/forms": "^0.5.9", - "@types/cookie": "^1.0.0", "@types/d3": "^7.4.3", "@types/node": "^22.9.1", "@typescript-eslint/eslint-plugin": "^8.15.0", @@ -1194,16 +1193,6 @@ "tailwindcss": ">=3.0.0 || >= 3.0.0-alpha.1 || >= 4.0.0-alpha.20" } }, - "node_modules/@types/cookie": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/@types/cookie/-/cookie-1.0.0.tgz", - "integrity": "sha512-mGFXbkDQJ6kAXByHS7QAggRXgols0mAdP4MuXgloGY1tXokvzaFFM4SMqWvf7AH0oafI7zlFJwoGWzmhDqTZ9w==", - "deprecated": "This is a stub types definition. cookie provides its own type definitions, so you do not need this installed.", - "dev": true, - "dependencies": { - "cookie": "*" - } - }, "node_modules/@types/d3": { "version": "7.4.3", "resolved": "https://registry.npmjs.org/@types/d3/-/d3-7.4.3.tgz", diff --git a/src/ui/package.json b/src/ui/package.json index dca03475..51a16eec 100644 --- a/src/ui/package.json +++ b/src/ui/package.json @@ -21,7 +21,6 @@ "@sveltejs/kit": "^2.15.1", "@sveltejs/vite-plugin-svelte": "^3.1.2", "@tailwindcss/forms": "^0.5.9", - "@types/cookie": "^1.0.0", "@types/d3": "^7.4.3", "@types/node": "^22.9.1", "@typescript-eslint/eslint-plugin": "^8.15.0", diff --git a/src/ui/postcss.config.cjs b/src/ui/postcss.config.cjs index 16dce0bc..054c147c 100644 --- a/src/ui/postcss.config.cjs +++ b/src/ui/postcss.config.cjs @@ -1,6 +1,6 @@ module.exports = { plugins: { tailwindcss: {}, - autoprefixer: {}, - }, -} \ No newline at end of file + autoprefixer: {} + } +}; diff --git a/src/ui/src/app.postcss b/src/ui/src/app.postcss index 34b43c26..70001246 100644 --- a/src/ui/src/app.postcss +++ b/src/ui/src/app.postcss @@ -4,4 +4,7 @@ @tailwind variants; /*place global styles here */ -html, body { @apply h-full overflow-hidden; } \ No newline at end of file +html, +body { + @apply h-full overflow-hidden; +} diff --git a/src/ui/src/lib/DevicesTable.svelte b/src/ui/src/lib/DevicesTable.svelte index 04969fd0..374c0416 100644 --- a/src/ui/src/lib/DevicesTable.svelte +++ b/src/ui/src/lib/DevicesTable.svelte @@ -23,7 +23,7 @@ { key: 'fixes', title: 'Fixes', value: (d) => d.fixes ?? 'n/a', sortable: true }, { key: 'scale', title: 'Scale', value: (d) => d.scale?.toFixed(3) ?? 'n/a', sortable: true }, { key: 'confidence', title: 'Confidence', value: (d) => d.confidence ?? 'n/a', sortable: true }, - { key: 'lastHit', title: 'LastHit', value: (d) => ((d.lastHit ?? '') == '' ? 'n/a' : ago(new Date(d.lastHit)) ?? 'n/a'), sortable: true } + { key: 'lastHit', title: 'LastHit', value: (d) => ((d.lastHit ?? '') == '' ? 'n/a' : (ago(new Date(d.lastHit)) ?? 'n/a')), sortable: true } ]; function onRowClick(e) { diff --git a/src/ui/src/lib/Map.svelte b/src/ui/src/lib/Map.svelte index f7002545..0b830009 100644 --- a/src/ui/src/lib/Map.svelte +++ b/src/ui/src/lib/Map.svelte @@ -36,7 +36,9 @@ const handler = zoom() .scaleExtent([0.5, 40]) - .wheelDelta((event) => { return -(event.deltaY + event.deltaX * 0.25) * 0.002; }) + .wheelDelta((event) => { + return -(event.deltaY + event.deltaX * 0.25) * 0.002; + }) .on('zoom', (e) => { transform = e.transform; }); @@ -52,12 +54,11 @@ } function handleKeyboard(event: KeyboardEvent) { - const zoomFactor = event.shiftKey ? 1.005 : 1.1; const translateAmount = event.shiftKey ? 1 : 50; let newTransform = transform; - switch(event.key) { + switch (event.key) { case '0': event.preventDefault(); newTransform = zoomIdentity.translate(transform.x, transform.y); @@ -117,14 +118,7 @@ {#if bounds} - + diff --git a/src/ui/svelte.config.js b/src/ui/svelte.config.js index 13703c03..4b5eca9a 100644 --- a/src/ui/svelte.config.js +++ b/src/ui/svelte.config.js @@ -4,29 +4,29 @@ import { vitePreprocess } from '@sveltejs/vite-plugin-svelte'; /** @type {import('@sveltejs/kit').Config} */ const config = { - extensions: ['.svelte'], + extensions: ['.svelte'], - preprocess: [vitePreprocess()], + preprocess: [vitePreprocess()], - relative: true, + relative: true, vitePlugin: { - inspector: true, - }, + inspector: true + }, - kit: { - embedded: true, - inlineStyleThreshold: 4096, + kit: { + embedded: true, + inlineStyleThreshold: 4096, prerender: { crawl: false - }, + }, adapter: adapter({ strict: false - }), - version: { - name: child_process.execSync('git rev-parse HEAD').toString().trim(), - pollInterval: 5000 - }, + }), + version: { + name: child_process.execSync('git rev-parse HEAD').toString().trim(), + pollInterval: 5000 + } } }; diff --git a/src/ui/tailwind.config.ts b/src/ui/tailwind.config.ts index ca173795..f27b6519 100644 --- a/src/ui/tailwind.config.ts +++ b/src/ui/tailwind.config.ts @@ -8,13 +8,10 @@ const config = { content: [ './src/**/*.{html,js,svelte,ts}', // 3. Append the path to the Skeleton package - join(require.resolve( - '@skeletonlabs/skeleton'), - '../**/*.{html,js,svelte,ts}' - ) + join(require.resolve('@skeletonlabs/skeleton'), '../**/*.{html,js,svelte,ts}') ], theme: { - extend: {}, + extend: {} }, plugins: [ forms, @@ -23,16 +20,16 @@ const config = { preset: [ { name: 'skeleton', - enhancements: true, + enhancements: true }, { name: 'crimson', - enhancements: true, - }, - ], - }, - }), - ], + enhancements: true + } + ] + } + }) + ] } satisfies Config; -export default config; \ No newline at end of file +export default config; diff --git a/src/ui/vite.config.ts b/src/ui/vite.config.ts index 2c6deca6..7e38ae6d 100644 --- a/src/ui/vite.config.ts +++ b/src/ui/vite.config.ts @@ -16,8 +16,8 @@ export default defineConfig({ '/ws': { target: 'ws://localhost:5279', ws: true - }, + } }, host: true - }, + } });