diff --git a/geneit_app/eslint.config.js b/geneit_app/eslint.config.js new file mode 100644 index 0000000..092408a --- /dev/null +++ b/geneit_app/eslint.config.js @@ -0,0 +1,28 @@ +import js from '@eslint/js' +import globals from 'globals' +import reactHooks from 'eslint-plugin-react-hooks' +import reactRefresh from 'eslint-plugin-react-refresh' +import tseslint from 'typescript-eslint' + +export default tseslint.config( + { ignores: ['dist'] }, + { + extends: [js.configs.recommended, ...tseslint.configs.recommended], + files: ['**/*.{ts,tsx}'], + languageOptions: { + ecmaVersion: 2020, + globals: globals.browser, + }, + plugins: { + 'react-hooks': reactHooks, + 'react-refresh': reactRefresh, + }, + rules: { + ...reactHooks.configs.recommended.rules, + 'react-refresh/only-export-components': [ + 'warn', + { allowConstantExport: true }, + ], + }, + }, +) diff --git a/geneit_app/package.json b/geneit_app/package.json index 45ee633..994fdf7 100644 --- a/geneit_app/package.json +++ b/geneit_app/package.json @@ -3,8 +3,13 @@ "version": "0.1.0", "private": true, "type": "module", + "scripts": { + "dev": "vite", + "build": "tsc -b && vite build", + "lint": "eslint .", + "preview": "vite preview" + }, "dependencies": { - "@babel/plugin-proposal-private-property-in-object": "^7.21.11", "@emotion/react": "^11.13.3", "@emotion/styled": "^11.13.0", "@fontsource/roboto": "^5.2.5", @@ -21,13 +26,6 @@ "@mui/x-data-grid": "^7.28.2", "@mui/x-date-pickers": "^7.28.2", "@mui/x-tree-view": "^7.28.1", - "@testing-library/jest-dom": "^6.5.0", - "@testing-library/react": "^16.0.1", - "@testing-library/user-event": "^14.6.1", - "@types/jest": "^29.5.13", - "@types/react": "^19.0.12", - "@types/react-dom": "^19.0.4", - "@vitejs/plugin-react": "^4.3.2", "date-and-time": "^3.6.0", "dayjs": "^1.11.13", "email-validator": "^2.0.4", @@ -40,32 +38,19 @@ "react-qr-code": "^2.0.14", "react-router-dom": "^7.4.0", "react-zoom-pan-pinch": "^3.7.0", - "svg2pdf.js": "^2.5.0", + "svg2pdf.js": "^2.5.0" + }, + "devDependencies": { + "@eslint/js": "^9.21.0", + "@types/react": "^19.0.12", + "@types/react-dom": "^19.0.4", + "@vitejs/plugin-react": "^4.3.4", + "eslint": "^9.21.0", + "eslint-plugin-react-hooks": "^5.1.0", + "eslint-plugin-react-refresh": "^0.4.19", + "globals": "^15.15.0", "typescript": "^5.8.2", - "vite": "^6.2.3", - "vite-tsconfig-paths": "^5.0.1" - }, - "scripts": { - "start": "vite", - "build": "tsc && vite build", - "preview": "vite preview" - }, - "eslintConfig": { - "extends": [ - "react-app", - "react-app/jest" - ] - }, - "browserslist": { - "production": [ - ">0.2%", - "not dead", - "not op_mini all" - ], - "development": [ - "last 1 chrome version", - "last 1 firefox version", - "last 1 safari version" - ] + "typescript-eslint": "^8.24.1", + "vite": "^6.2.3" } } diff --git a/geneit_app/src/routes/family/genealogy/FamilyHomeRoute.tsx b/geneit_app/src/routes/family/genealogy/FamilyHomeRoute.tsx index 4a66382..27e8dc1 100644 --- a/geneit_app/src/routes/family/genealogy/FamilyHomeRoute.tsx +++ b/geneit_app/src/routes/family/genealogy/FamilyHomeRoute.tsx @@ -1,4 +1,3 @@ -import { useFamily } from "../../../widgets/BaseFamilyRoute"; import { FamilyPageTitle } from "../../../widgets/FamilyPageTitle"; export function FamilyHomeRoute(): React.ReactElement { diff --git a/geneit_app/vite-env.d.ts b/geneit_app/src/vite-env.d.ts similarity index 100% rename from geneit_app/vite-env.d.ts rename to geneit_app/src/vite-env.d.ts diff --git a/geneit_app/tsconfig.app.json b/geneit_app/tsconfig.app.json new file mode 100644 index 0000000..358ca9b --- /dev/null +++ b/geneit_app/tsconfig.app.json @@ -0,0 +1,26 @@ +{ + "compilerOptions": { + "tsBuildInfoFile": "./node_modules/.tmp/tsconfig.app.tsbuildinfo", + "target": "ES2020", + "useDefineForClassFields": true, + "lib": ["ES2020", "DOM", "DOM.Iterable"], + "module": "ESNext", + "skipLibCheck": true, + + /* Bundler mode */ + "moduleResolution": "bundler", + "allowImportingTsExtensions": true, + "isolatedModules": true, + "moduleDetection": "force", + "noEmit": true, + "jsx": "react-jsx", + + /* Linting */ + "strict": true, + "noUnusedLocals": true, + "noUnusedParameters": true, + "noFallthroughCasesInSwitch": true, + "noUncheckedSideEffectImports": true + }, + "include": ["src"] +} diff --git a/geneit_app/tsconfig.json b/geneit_app/tsconfig.json index f6a362c..1ffef60 100644 --- a/geneit_app/tsconfig.json +++ b/geneit_app/tsconfig.json @@ -1,21 +1,7 @@ { - "compilerOptions": { - "target": "ESNext", - "lib": ["dom", "dom.iterable", "esnext"], - "types": ["vite/client"], - "allowJs": true, - "skipLibCheck": true, - "esModuleInterop": true, - "allowSyntheticDefaultImports": true, - "strict": true, - "forceConsistentCasingInFileNames": true, - "noFallthroughCasesInSwitch": true, - "module": "esnext", - "moduleResolution": "node", - "resolveJsonModule": true, - "isolatedModules": true, - "noEmit": true, - "jsx": "react-jsx" - }, - "include": ["src"] + "files": [], + "references": [ + { "path": "./tsconfig.app.json" }, + { "path": "./tsconfig.node.json" } + ] } diff --git a/geneit_app/tsconfig.node.json b/geneit_app/tsconfig.node.json new file mode 100644 index 0000000..db0becc --- /dev/null +++ b/geneit_app/tsconfig.node.json @@ -0,0 +1,24 @@ +{ + "compilerOptions": { + "tsBuildInfoFile": "./node_modules/.tmp/tsconfig.node.tsbuildinfo", + "target": "ES2022", + "lib": ["ES2023"], + "module": "ESNext", + "skipLibCheck": true, + + /* Bundler mode */ + "moduleResolution": "bundler", + "allowImportingTsExtensions": true, + "isolatedModules": true, + "moduleDetection": "force", + "noEmit": true, + + /* Linting */ + "strict": true, + "noUnusedLocals": true, + "noUnusedParameters": true, + "noFallthroughCasesInSwitch": true, + "noUncheckedSideEffectImports": true + }, + "include": ["vite.config.ts"] +} diff --git a/geneit_app/vite.config.ts b/geneit_app/vite.config.ts index 61c21e6..8b0f57b 100644 --- a/geneit_app/vite.config.ts +++ b/geneit_app/vite.config.ts @@ -1,15 +1,7 @@ -import { defineConfig } from "vite"; -import react from "@vitejs/plugin-react"; -import viteTsconfigPaths from "vite-tsconfig-paths"; +import { defineConfig } from 'vite' +import react from '@vitejs/plugin-react' +// https://vite.dev/config/ export default defineConfig({ - // depending on your application, base can also be "/" - base: "/", - plugins: [react(), viteTsconfigPaths()], - server: { - // this ensures that the browser opens upon server start - open: true, - // this sets a default port to 3000 - port: 3000, - }, -}); + plugins: [react()], +})