Split webui tooling into separate configs

- Move Vite, Vitest, Oxfmt, and Oxlint into standalone config files
- Replace vite-plus scripts and test imports with direct tools
- Keep the generated route tree out of formatter and linter checks
This commit is contained in:
Antti Kettunen 2026-05-03 13:41:29 +03:00
parent adb6426a2f
commit ce1fb16b76
No known key found for this signature in database
GPG key ID: C6B2A3D250359BD7
13 changed files with 889 additions and 734 deletions

18
webui/.oxfmtrc.json Normal file
View file

@ -0,0 +1,18 @@
{
"$schema": "./node_modules/oxfmt/configuration_schema.json",
"ignorePatterns": ["src/routeTree.gen.ts"],
"singleQuote": true,
"sortImports": {
"groups": [
"type-import",
["value-builtin", "value-external"],
"type-internal",
"value-internal",
["type-parent", "type-sibling", "type-index"],
["value-parent", "value-sibling", "value-index"],
"unknown"
]
},
"sortPackageJson": true,
"trailingComma": "all"
}

8
webui/.oxlintrc.json Normal file
View file

@ -0,0 +1,8 @@
{
"$schema": "./node_modules/oxlint/configuration_schema.json",
"ignorePatterns": ["src/routeTree.gen.ts"],
"options": {
"typeAware": true,
"typeCheck": true
}
}

1502
webui/package-lock.json generated

File diff suppressed because it is too large Load diff

View file

@ -3,12 +3,12 @@
"private": true, "private": true,
"type": "module", "type": "module",
"scripts": { "scripts": {
"check": "vp check src", "check": "oxfmt --check src && oxlint --type-check src",
"dev": "vp dev", "dev": "vite",
"fix": "vp check --fix src", "fix": "oxfmt src && oxlint --type-check src --fix",
"build": "vp build", "build": "vite build",
"test": "vp test run", "test": "vitest run",
"test:watch": "vp test", "test:watch": "vitest",
"test:e2e": "playwright test" "test:e2e": "playwright test"
}, },
"dependencies": { "dependencies": {
@ -30,18 +30,14 @@
"@types/react": "^19.2.14", "@types/react": "^19.2.14",
"@types/react-dom": "^19.2.3", "@types/react-dom": "^19.2.3",
"@vitejs/plugin-react": "^6.0.1", "@vitejs/plugin-react": "^6.0.1",
"@voidzero-dev/vite-plus-core": "^0.1.19",
"@voidzero-dev/vite-plus-test": "^0.1.19",
"jsdom": "^29.0.2", "jsdom": "^29.0.2",
"msw": "^2.14.2", "msw": "^2.14.2",
"oxfmt": "^0.47.0",
"oxlint": "^1.62.0",
"oxlint-tsgolint": "^0.22.1",
"typescript": "^6.0.3", "typescript": "^6.0.3",
"vite": "npm:@voidzero-dev/vite-plus-core@^0.1.19", "vite": "^8.0.10",
"vite-plus": "^0.1.19", "vitest": "^4.1.5"
"vitest": "npm:@voidzero-dev/vite-plus-test@^0.1.19"
}, },
"packageManager": "npm@11.13.0", "packageManager": "npm@11.13.0"
"overrides": {
"vite": "npm:@voidzero-dev/vite-plus-core@^0.1.19",
"vitest": "npm:@voidzero-dev/vite-plus-test@^0.1.19"
}
} }

View file

@ -1,7 +1,7 @@
import type { ResponsePromise } from 'ky'; import type { ResponsePromise } from 'ky';
import { HTTPError } from 'ky'; import { HTTPError } from 'ky';
import { describe, expect, it, vi } from 'vite-plus/test'; import { describe, expect, it, vi } from 'vitest';
import { readJson } from './api-client'; import { readJson } from './api-client';

View file

@ -5,6 +5,7 @@ import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest';
import { import {
SHELL_PROFILE_CONTEXT_CHANGED_EVENT, SHELL_PROFILE_CONTEXT_CHANGED_EVENT,
type ShellBridge, type ShellBridge,
type ShellProfileContext,
type ShellPageId, type ShellPageId,
} from '@/platform/shell/bridge'; } from '@/platform/shell/bridge';
@ -138,7 +139,7 @@ describe('createAppRouter', () => {
}); });
it('waits for profile context before rendering React routes', async () => { it('waits for profile context before rendering React routes', async () => {
const getCurrentProfileContext = vi.fn(() => null); const getCurrentProfileContext = vi.fn<() => ShellProfileContext | null>(() => null);
window.SoulSyncWebShellBridge = createShellBridge({ window.SoulSyncWebShellBridge = createShellBridge({
getCurrentProfileContext, getCurrentProfileContext,
}); });

View file

@ -1,4 +1,4 @@
import { describe, expect, it } from 'vite-plus/test'; import { describe, expect, it } from 'vitest';
import { import {
getShellRouteByPageId, getShellRouteByPageId,

View file

@ -1,4 +1,4 @@
import { describe, expect, it } from 'vite-plus/test'; import { describe, expect, it } from 'vitest';
import { HttpResponse, http, server } from '@/test/msw'; import { HttpResponse, http, server } from '@/test/msw';

View file

@ -1,4 +1,4 @@
import { describe, expect, it } from 'vite-plus/test'; import { describe, expect, it } from 'vitest';
import { ISSUE_CATEGORY_META, normalizeIssuesSearch } from './-issues.helpers'; import { ISSUE_CATEGORY_META, normalizeIssuesSearch } from './-issues.helpers';

View file

@ -1,6 +1,6 @@
import { createMemoryHistory } from '@tanstack/react-router'; import { createMemoryHistory } from '@tanstack/react-router';
import { act, fireEvent, render, screen, waitFor } from '@testing-library/react'; import { act, fireEvent, render, screen, waitFor } from '@testing-library/react';
import { afterEach, beforeEach, describe, expect, it, vi } from 'vite-plus/test'; import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest';
import type { ShellBridge, ShellPageId } from '@/platform/shell/bridge'; import type { ShellBridge, ShellPageId } from '@/platform/shell/bridge';

View file

@ -18,6 +18,13 @@
"noEmit": true, "noEmit": true,
"types": ["node", "vitest/globals", "@testing-library/jest-dom", "react", "react-dom"] "types": ["node", "vitest/globals", "@testing-library/jest-dom", "react", "react-dom"]
}, },
"include": ["./src", "./tests", "./vitest.setup.ts", "./vite.config.ts", "./playwright.config.ts"], "include": [
"./src",
"./tests",
"./vitest.setup.ts",
"./vite.config.ts",
"./vitest.config.ts",
"./playwright.config.ts"
],
"references": [] "references": []
} }

View file

@ -1,25 +1,9 @@
import { tanstackRouter } from '@tanstack/router-plugin/vite'; import { tanstackRouter } from '@tanstack/router-plugin/vite';
import react from '@vitejs/plugin-react'; import react from '@vitejs/plugin-react';
import path from 'node:path'; import path from 'node:path';
import { defineConfig } from 'vite-plus'; import { defineConfig } from 'vite';
export default defineConfig({ export default defineConfig({
fmt: {
singleQuote: true,
sortImports: {
groups: [
'type-import',
['value-builtin', 'value-external'],
'type-internal',
'value-internal',
['type-parent', 'type-sibling', 'type-index'],
['value-parent', 'value-sibling', 'value-index'],
'unknown',
],
},
sortPackageJson: true,
trailingComma: 'all',
},
plugins: [ plugins: [
tanstackRouter({ tanstackRouter({
target: 'react', target: 'react',
@ -44,13 +28,4 @@ export default defineConfig({
input: [path.resolve(import.meta.dirname, 'src/app/main.tsx')], input: [path.resolve(import.meta.dirname, 'src/app/main.tsx')],
}, },
}, },
test: {
include: ['src/**/*.test.ts', 'src/**/*.test.tsx', 'src/**/*.spec.ts', 'src/**/*.spec.tsx'],
exclude: ['tests/**'],
environment: 'jsdom',
globals: true,
setupFiles: ['./vitest.setup.ts'],
css: true,
restoreMocks: true,
},
}); });

18
webui/vitest.config.ts Normal file
View file

@ -0,0 +1,18 @@
import { mergeConfig, defineConfig } from 'vitest/config';
import viteConfig from './vite.config';
export default mergeConfig(
viteConfig,
defineConfig({
test: {
include: ['src/**/*.test.ts', 'src/**/*.test.tsx', 'src/**/*.spec.ts', 'src/**/*.spec.tsx'],
exclude: ['tests/**'],
environment: 'jsdom',
globals: true,
setupFiles: ['./vitest.setup.ts'],
css: true,
restoreMocks: true,
},
}),
);