Task 6.1 - Consistent loading/error/empty states across all charts: - Add ChartStateWrapper shared component with Spinner, error MessageBar + Retry button, and friendly empty message - Expose reload() in useBanTrend, useJailDistribution, useDashboardCountryData hooks - Update BanTrendChart and JailDistributionChart to use ChartStateWrapper - Add empty state to TopCountriesBarChart and TopCountriesPieChart - Replace manual loading/error logic in DashboardPage with ChartStateWrapper Task 6.2 - Frontend tests (5 files, 20 tests): - Install Vitest v4, jsdom, @testing-library/react, @testing-library/jest-dom - Add vitest.config.ts (separate from vite.config.ts to avoid Vite v5/v7 clash) - Add src/setupTests.ts with jest-dom matchers and ResizeObserver/matchMedia stubs - Tests: ChartStateWrapper (7), BanTrendChart (4), JailDistributionChart (4), TopCountriesPieChart (2), TopCountriesBarChart (3) Task 6.3 - Full QA: - ruff: clean - mypy --strict: 52 files, no issues - pytest: 497 passed - tsc --noEmit: clean - eslint: clean (added test-file override for explicit-function-return-type) - vite build: success
35 lines
1.0 KiB
TypeScript
35 lines
1.0 KiB
TypeScript
import js from "@eslint/js";
|
|
import tseslint from "typescript-eslint";
|
|
import reactHooks from "eslint-plugin-react-hooks";
|
|
import prettierConfig from "eslint-config-prettier";
|
|
|
|
export default tseslint.config(
|
|
{ ignores: ["dist", "eslint.config.ts"] },
|
|
{
|
|
extends: [js.configs.recommended, ...tseslint.configs.strictTypeChecked],
|
|
files: ["**/*.{ts,tsx}"],
|
|
languageOptions: {
|
|
parserOptions: {
|
|
project: ["./tsconfig.json", "./tsconfig.node.json"],
|
|
tsconfigRootDir: import.meta.dirname,
|
|
},
|
|
},
|
|
plugins: {
|
|
"react-hooks": reactHooks,
|
|
},
|
|
rules: {
|
|
...reactHooks.configs.recommended.rules,
|
|
"@typescript-eslint/no-explicit-any": "error",
|
|
"@typescript-eslint/explicit-function-return-type": "warn",
|
|
"@typescript-eslint/no-unused-vars": ["error", { argsIgnorePattern: "^_" }],
|
|
},
|
|
},
|
|
prettierConfig,
|
|
{
|
|
files: ["src/**/*.test.{ts,tsx}", "src/setupTests.ts"],
|
|
rules: {
|
|
"@typescript-eslint/explicit-function-return-type": "off",
|
|
},
|
|
},
|
|
);
|