chore: scaffold fixes — React 19 JSX, vitest v3, @types/node, lint scoping
- React 19 dropped global JSX namespace; stub return types removed (TS infer) - vitest 2 pulled vite 5 alongside project vite 6 → upgrade vitest to 3 (dedupes) - Add @types/node to devDeps so vite/vitest configs compile - ESLint flat config: scope strictTypeChecked to src/ + tests/, ignore config files - tsconfig.app.json: include tests/, add vitest/globals to types - vite.config.ts + vitest.config.ts: use import.meta.dirname instead of __dirname - pdf/export + pdf/import: stub returns Promise.reject so require-await rule clears - tests/unit/smoke.test.ts: keep vitest run from exiting 1 with no tests
This commit is contained in:
1 parent
a115e785a7
commit
3fb77c3530
26 files changed
+827
-1150
No files matched your search
+16
-4
@@ -1,18 +1,30 @@
|
|||||||
import js from '@eslint/js';
|
import js from '@eslint/js';
|
||||||
import tseslint from 'typescript-eslint';
|
|
||||||
import reactHooks from 'eslint-plugin-react-hooks';
|
|
||||||
import jsxA11y from 'eslint-plugin-jsx-a11y';
|
|
||||||
import importX from 'eslint-plugin-import-x';
|
import importX from 'eslint-plugin-import-x';
|
||||||
|
import jsxA11y from 'eslint-plugin-jsx-a11y';
|
||||||
|
import reactHooks from 'eslint-plugin-react-hooks';
|
||||||
import prettierConfig from 'eslint-config-prettier';
|
import prettierConfig from 'eslint-config-prettier';
|
||||||
|
import tseslint from 'typescript-eslint';
|
||||||
|
|
||||||
export default tseslint.config(
|
export default tseslint.config(
|
||||||
{
|
{
|
||||||
ignores: ['dist/', 'node_modules/', 'coverage/', 'playwright-report/', 'test-results/'],
|
ignores: [
|
||||||
|
'dist/',
|
||||||
|
'node_modules/',
|
||||||
|
'coverage/',
|
||||||
|
'playwright-report/',
|
||||||
|
'test-results/',
|
||||||
|
'eslint.config.js',
|
||||||
|
'vite.config.ts',
|
||||||
|
'vitest.config.ts',
|
||||||
|
'playwright.config.ts',
|
||||||
|
'tailwind.config.ts',
|
||||||
|
],
|
||||||
},
|
},
|
||||||
js.configs.recommended,
|
js.configs.recommended,
|
||||||
...tseslint.configs.strictTypeChecked,
|
...tseslint.configs.strictTypeChecked,
|
||||||
...tseslint.configs.stylisticTypeChecked,
|
...tseslint.configs.stylisticTypeChecked,
|
||||||
{
|
{
|
||||||
|
files: ['src/**/*.{ts,tsx}', 'tests/**/*.{ts,tsx}'],
|
||||||
languageOptions: {
|
languageOptions: {
|
||||||
parserOptions: {
|
parserOptions: {
|
||||||
project: ['./tsconfig.app.json'],
|
project: ['./tsconfig.app.json'],
|
||||||
|
|||||||
Generated
+769
-1117
File diff suppressed because it is too large.
Load diff
+3
-1
@@ -43,9 +43,11 @@
|
|||||||
"@testing-library/jest-dom": "^6.6.3",
|
"@testing-library/jest-dom": "^6.6.3",
|
||||||
"@testing-library/react": "^16.1.0",
|
"@testing-library/react": "^16.1.0",
|
||||||
"@testing-library/user-event": "^14.5.2",
|
"@testing-library/user-event": "^14.5.2",
|
||||||
|
"@types/node": "^22.19.19",
|
||||||
"@types/react": "^19.0.0",
|
"@types/react": "^19.0.0",
|
||||||
"@types/react-dom": "^19.0.0",
|
"@types/react-dom": "^19.0.0",
|
||||||
"@vitejs/plugin-react": "^4.3.4",
|
"@vitejs/plugin-react": "^4.3.4",
|
||||||
|
"@vitest/coverage-v8": "^3.2.4",
|
||||||
"eslint": "^9.17.0",
|
"eslint": "^9.17.0",
|
||||||
"eslint-config-prettier": "^9.1.0",
|
"eslint-config-prettier": "^9.1.0",
|
||||||
"eslint-plugin-import-x": "^4.5.0",
|
"eslint-plugin-import-x": "^4.5.0",
|
||||||
@@ -60,7 +62,7 @@
|
|||||||
"typescript-eslint": "^8.18.2",
|
"typescript-eslint": "^8.18.2",
|
||||||
"vite": "^6.0.5",
|
"vite": "^6.0.5",
|
||||||
"vite-plugin-svgr": "^4.3.0",
|
"vite-plugin-svgr": "^4.3.0",
|
||||||
"vitest": "^2.1.8"
|
"vitest": "^3.2.4"
|
||||||
},
|
},
|
||||||
"lint-staged": {
|
"lint-staged": {
|
||||||
"*.{ts,tsx}": [
|
"*.{ts,tsx}": [
|
||||||
|
|||||||
+1
-1
@@ -5,7 +5,7 @@ import { HomeRoute } from './routes/HomeRoute';
|
|||||||
import { NewReportRoute } from './routes/NewReportRoute';
|
import { NewReportRoute } from './routes/NewReportRoute';
|
||||||
import { NotFoundRoute } from './routes/NotFoundRoute';
|
import { NotFoundRoute } from './routes/NotFoundRoute';
|
||||||
|
|
||||||
export function App(): JSX.Element {
|
export function App() {
|
||||||
return (
|
return (
|
||||||
<BrowserRouter>
|
<BrowserRouter>
|
||||||
<Routes>
|
<Routes>
|
||||||
|
|||||||
@@ -1,3 +1,3 @@
|
|||||||
export function Brand(): JSX.Element | null {
|
export function Brand() {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
@@ -1,3 +1,3 @@
|
|||||||
export function Footer(): JSX.Element | null {
|
export function Footer() {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
@@ -1,3 +1,3 @@
|
|||||||
export function Header(): JSX.Element | null {
|
export function Header() {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
@@ -1,3 +1,3 @@
|
|||||||
export function AnatomyCanvas(): JSX.Element | null {
|
export function AnatomyCanvas() {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
@@ -1,3 +1,3 @@
|
|||||||
export function AnatomyView(): JSX.Element | null {
|
export function AnatomyView() {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
@@ -1,3 +1,3 @@
|
|||||||
export function ConclusionPanel(): JSX.Element | null {
|
export function ConclusionPanel() {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
@@ -1,3 +1,3 @@
|
|||||||
export function ExportButton(): JSX.Element | null {
|
export function ExportButton() {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
@@ -1,3 +1,3 @@
|
|||||||
export function FindingEditor(): JSX.Element | null {
|
export function FindingEditor() {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
@@ -1,3 +1,3 @@
|
|||||||
export function FindingPanel(): JSX.Element | null {
|
export function FindingPanel() {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
@@ -1,3 +1,3 @@
|
|||||||
export function ZoneSelection(): JSX.Element | null {
|
export function ZoneSelection() {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
@@ -1,3 +1,3 @@
|
|||||||
export function ZoomOverlay(): JSX.Element | null {
|
export function ZoomOverlay() {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
+2
-2
@@ -4,6 +4,6 @@ export interface AnatomyAssets {
|
|||||||
svg: Record<string, string>;
|
svg: Record<string, string>;
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function exportReport(_report: Report, _assets: AnatomyAssets): Promise<Blob> {
|
export function exportReport(_report: Report, _assets: AnatomyAssets): Promise<Blob> {
|
||||||
throw new Error('exportReport not implemented');
|
return Promise.reject(new Error('exportReport not implemented'));
|
||||||
}
|
}
|
||||||
+2
-2
@@ -8,6 +8,6 @@ export type ImportFailure =
|
|||||||
|
|
||||||
export type ImportResult = { ok: true; report: Report } | ImportFailure;
|
export type ImportResult = { ok: true; report: Report } | ImportFailure;
|
||||||
|
|
||||||
export async function importReport(_file: File): Promise<ImportResult> {
|
export function importReport(_file: File): Promise<ImportResult> {
|
||||||
throw new Error('importReport not implemented');
|
return Promise.reject(new Error('importReport not implemented'));
|
||||||
}
|
}
|
||||||
@@ -1,3 +1,3 @@
|
|||||||
export function EditorRoute(): JSX.Element {
|
export function EditorRoute() {
|
||||||
return <div data-route="editor" />;
|
return <div data-route="editor" />;
|
||||||
}
|
}
|
||||||
@@ -1,3 +1,3 @@
|
|||||||
export function HomeRoute(): JSX.Element {
|
export function HomeRoute() {
|
||||||
return <div data-route="home" />;
|
return <div data-route="home" />;
|
||||||
}
|
}
|
||||||
@@ -1,3 +1,3 @@
|
|||||||
export function NewReportRoute(): JSX.Element {
|
export function NewReportRoute() {
|
||||||
return <div data-route="new" />;
|
return <div data-route="new" />;
|
||||||
}
|
}
|
||||||
@@ -1,3 +1,3 @@
|
|||||||
export function NotFoundRoute(): JSX.Element {
|
export function NotFoundRoute() {
|
||||||
return <div data-route="not-found" />;
|
return <div data-route="not-found" />;
|
||||||
}
|
}
|
||||||
@@ -0,0 +1,9 @@
|
|||||||
|
import { describe, expect, it } from 'vitest';
|
||||||
|
|
||||||
|
import { SCHEMA_VERSION } from '@/schema/report';
|
||||||
|
|
||||||
|
describe('scaffold smoke', () => {
|
||||||
|
it('schema version is 1', () => {
|
||||||
|
expect(SCHEMA_VERSION).toBe(1);
|
||||||
|
});
|
||||||
|
});
|
||||||
+3
-2
@@ -27,7 +27,8 @@
|
|||||||
"baseUrl": ".",
|
"baseUrl": ".",
|
||||||
"paths": {
|
"paths": {
|
||||||
"@/*": ["src/*"]
|
"@/*": ["src/*"]
|
||||||
}
|
|
||||||
},
|
},
|
||||||
"include": ["src"]
|
"types": ["vitest/globals"]
|
||||||
|
},
|
||||||
|
"include": ["src", "tests"]
|
||||||
}
|
}
|
||||||
@@ -4,6 +4,7 @@
|
|||||||
"lib": ["ES2022"],
|
"lib": ["ES2022"],
|
||||||
"module": "ESNext",
|
"module": "ESNext",
|
||||||
"skipLibCheck": true,
|
"skipLibCheck": true,
|
||||||
|
"types": ["node"],
|
||||||
|
|
||||||
/* Bundler mode */
|
/* Bundler mode */
|
||||||
"moduleResolution": "bundler",
|
"moduleResolution": "bundler",
|
||||||
|
|||||||
+4
-4
@@ -1,14 +1,14 @@
|
|||||||
import { defineConfig } from 'vite';
|
|
||||||
import react from '@vitejs/plugin-react';
|
|
||||||
import svgr from 'vite-plugin-svgr';
|
|
||||||
import tailwindcss from '@tailwindcss/vite';
|
import tailwindcss from '@tailwindcss/vite';
|
||||||
|
import react from '@vitejs/plugin-react';
|
||||||
import path from 'node:path';
|
import path from 'node:path';
|
||||||
|
import { defineConfig } from 'vite';
|
||||||
|
import svgr from 'vite-plugin-svgr';
|
||||||
|
|
||||||
export default defineConfig({
|
export default defineConfig({
|
||||||
plugins: [react(), svgr(), tailwindcss()],
|
plugins: [react(), svgr(), tailwindcss()],
|
||||||
resolve: {
|
resolve: {
|
||||||
alias: {
|
alias: {
|
||||||
'@': path.resolve(__dirname, 'src'),
|
'@': path.resolve(import.meta.dirname, 'src'),
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
server: {
|
server: {
|
||||||
|
|||||||
+2
-2
@@ -1,12 +1,12 @@
|
|||||||
import { defineConfig } from 'vitest/config';
|
|
||||||
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 'vitest/config';
|
||||||
|
|
||||||
export default defineConfig({
|
export default defineConfig({
|
||||||
plugins: [react()],
|
plugins: [react()],
|
||||||
resolve: {
|
resolve: {
|
||||||
alias: {
|
alias: {
|
||||||
'@': path.resolve(__dirname, 'src'),
|
'@': path.resolve(import.meta.dirname, 'src'),
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
test: {
|
test: {
|
||||||
|
|||||||
Reference in new issue
Block a user