feat: add React + TypeScript frontend with Vite, routing, tests and Docker setup
M3 frontend infrastructure for the newzy news application: - Vite + React 18 + TypeScript project (Node >=18) in frontend/ - React Router v6: BrowserRouter in App.tsx, routes for /, /articles, /articles/:id and /categories, Link/NavLink-based navigation - lucide-react icons (Home, FileText, Settings, Search, ...) in the responsive Header (desktop + mobile menu) and article components - Reusable components: ArticleCard, AuthorAvatar, CategoryBadge (CVA), Layout shell with backend API status indicator in the footer - Typed API client (fetch wrapper, ApiError, endpoint helpers) with types matching the backend models; sample-data fallback until the backend article endpoints exist - Tailwind CSS global/component styles, cn() helper (clsx + tailwind-merge) - Unit tests: Vitest + React Testing Library (23 tests, 100% statement coverage on components) - E2E tests: Playwright (9 tests) covering page shell, feed rendering, client-side navigation, article route and API interactions - ESLint (react + react-hooks + typescript) configured and passing - Multi-stage Dockerfile (Vite build -> Nginx) with SPA fallback and an /api/ proxy to the backend service; docker-compose frontend service on port 3000 in both frontend/ and the root docker-compose.yml - README with setup, API documentation, testing and Docker instructions
This commit is contained in:
1 parent
cbeac5e16b
commit
ffe19272b3
45 files changed
+9843
-4
No files matched your search
@@ -0,0 +1,56 @@
|
||||
/* ESLint configuration for the newzy frontend.
|
||||
*
|
||||
* Covers:
|
||||
* - core ESLint recommended rules
|
||||
* - TypeScript (@typescript-eslint recommended)
|
||||
* - React (eslint-plugin-react recommended)
|
||||
* - React Hooks (eslint-plugin-react-hooks)
|
||||
*
|
||||
* React Router best practices are enforced by convention + review (see
|
||||
* README.md):
|
||||
* - use react-router-dom <Link>/<NavLink> for in-app navigation (never
|
||||
* plain <a> tags) so navigation stays client-side
|
||||
* - use useParams/useSearchParams for dynamic segments
|
||||
* - route definitions live in src/App.tsx only
|
||||
*/
|
||||
module.exports = {
|
||||
root: true,
|
||||
env: {
|
||||
browser: true,
|
||||
es2022: true,
|
||||
node: true,
|
||||
},
|
||||
parser: '@typescript-eslint/parser',
|
||||
parserOptions: {
|
||||
ecmaVersion: 'latest',
|
||||
sourceType: 'module',
|
||||
ecmaFeatures: { jsx: true },
|
||||
},
|
||||
plugins: ['@typescript-eslint', 'react', 'react-hooks'],
|
||||
extends: [
|
||||
'eslint:recommended',
|
||||
'plugin:@typescript-eslint/recommended',
|
||||
'plugin:react/recommended',
|
||||
'plugin:react-hooks/recommended',
|
||||
],
|
||||
settings: {
|
||||
react: { version: 'detect' },
|
||||
},
|
||||
rules: {
|
||||
// TypeScript provides prop typing — no need for JS prop types.
|
||||
'react/prop-types': 'off',
|
||||
// React 17+ JSX transform — no need to import React for JSX.
|
||||
'react/react-in-jsx-scope': 'off',
|
||||
// Router navigation must never open new tabs by accident.
|
||||
'react/jsx-no-target-blank': 'error',
|
||||
'@typescript-eslint/no-unused-vars': ['error', { argsIgnorePattern: '^_' }],
|
||||
},
|
||||
ignorePatterns: [
|
||||
'dist/',
|
||||
'node_modules/',
|
||||
'coverage/',
|
||||
'playwright-report/',
|
||||
'test-results/',
|
||||
'playwright/.cache/',
|
||||
],
|
||||
};
|
||||
Reference in new issue
Block a user