|
1 | | -# React + TypeScript + Vite |
2 | | - |
3 | | -This template provides a minimal setup to get React working in Vite with HMR and some ESLint rules. |
4 | | - |
5 | | -Currently, two official plugins are available: |
6 | | - |
7 | | -- [@vitejs/plugin-react](https://github.com/vitejs/vite-plugin-react/blob/main/packages/plugin-react/README.md) uses [Babel](https://babeljs.io/) for Fast Refresh |
8 | | -- [@vitejs/plugin-react-swc](https://github.com/vitejs/vite-plugin-react-swc) uses [SWC](https://swc.rs/) for Fast Refresh |
9 | | - |
10 | | -## Expanding the ESLint configuration |
11 | | - |
12 | | -If you are developing a production application, we recommend updating the configuration to enable type-aware lint rules: |
13 | | - |
14 | | -```js |
15 | | -export default tseslint.config({ |
16 | | - extends: [ |
17 | | - // Remove ...tseslint.configs.recommended and replace with this |
18 | | - ...tseslint.configs.recommendedTypeChecked, |
19 | | - // Alternatively, use this for stricter rules |
20 | | - ...tseslint.configs.strictTypeChecked, |
21 | | - // Optionally, add this for stylistic rules |
22 | | - ...tseslint.configs.stylisticTypeChecked, |
23 | | - ], |
24 | | - languageOptions: { |
25 | | - // other options... |
26 | | - parserOptions: { |
27 | | - project: ['./tsconfig.node.json', './tsconfig.app.json'], |
28 | | - tsconfigRootDir: import.meta.dirname, |
29 | | - }, |
30 | | - }, |
31 | | -}) |
| 1 | +# Vite + React v19 + TypeScript Template |
| 2 | + |
| 3 | +A template to kickstart modern React projects with the latest technologies and best practices. |
| 4 | + |
| 5 | +## 🚀 Features |
| 6 | + |
| 7 | +- ⚡️ [Vite](https://vitejs.dev/) - Ultra-fast build tool |
| 8 | +- ⚛️ [React 19](https://react.dev/) - Latest React version with new features |
| 9 | +- 📝 [TypeScript](https://www.typescriptlang.org/) - Static typing for JavaScript |
| 10 | +- 🛣️ [React Router](https://reactrouter.com/) - Routing for React |
| 11 | +- 💅 [Tailwind CSS](https://tailwindcss.com/) - Utility-first CSS framework |
| 12 | +- 📏 [ESLint](https://eslint.org/) - Linter for JavaScript and TypeScript |
| 13 | +- 💖 [Prettier](https://prettier.io/) - Code formatter |
| 14 | +- ✅ Testing Suite: |
| 15 | + - [Vitest](https://vitest.dev/) - Unit Testing |
| 16 | + - [Testing Library](https://testing-library.com/) - Component Testing |
| 17 | + - [Playwright](https://playwright.dev/) - E2E Testing |
| 18 | +- 🔄 CI/CD: |
| 19 | + - [GitHub Actions](https://github.com/features/actions) - Automated workflows |
| 20 | + - [Husky](https://typicode.github.io/husky/) - Git hooks made easy |
| 21 | + |
| 22 | +## 🛠️ Prerequisites |
| 23 | + |
| 24 | +- Node.js 20+ |
| 25 | +- npm |
| 26 | + |
| 27 | +## 📦 Installation |
| 28 | + |
| 29 | +```bash |
| 30 | +npx degit carlosazaustre/vite-template-react-czstr my-react-app |
| 31 | +cd my-react-app |
| 32 | +npm install |
32 | 33 | ``` |
33 | 34 |
|
34 | | -You can also install [eslint-plugin-react-x](https://github.com/Rel1cx/eslint-react/tree/main/packages/plugins/eslint-plugin-react-x) and [eslint-plugin-react-dom](https://github.com/Rel1cx/eslint-react/tree/main/packages/plugins/eslint-plugin-react-dom) for React-specific lint rules: |
35 | | - |
36 | | -```js |
37 | | -// eslint.config.js |
38 | | -import reactX from 'eslint-plugin-react-x' |
39 | | -import reactDom from 'eslint-plugin-react-dom' |
40 | | - |
41 | | -export default tseslint.config({ |
42 | | - plugins: { |
43 | | - // Add the react-x and react-dom plugins |
44 | | - 'react-x': reactX, |
45 | | - 'react-dom': reactDom, |
46 | | - }, |
47 | | - rules: { |
48 | | - // other rules... |
49 | | - // Enable its recommended typescript rules |
50 | | - ...reactX.configs['recommended-typescript'].rules, |
51 | | - ...reactDom.configs.recommended.rules, |
52 | | - }, |
53 | | -}) |
| 35 | +## 🚀 Available Scripts |
| 36 | + |
| 37 | +```bash |
| 38 | +npm run dev # Start development server |
| 39 | +npm run build # Build for production |
| 40 | +npm run preview # Preview production build |
| 41 | +npm run test # Run unit tests |
| 42 | +npm run test:e2e # Run end-to-end tests |
| 43 | +npm run lint # Run linter |
54 | 44 | ``` |
| 45 | + |
| 46 | +## ⚙️ Configuration |
| 47 | + |
| 48 | +The project includes configuration for: |
| 49 | + |
| 50 | +- TypeScript (`tsconfig.json`) |
| 51 | +- ESLint (`.eslintrc.cjs`) |
| 52 | +- Prettier (`.prettierrc`) |
| 53 | +- Vite (`vite.config.ts`) |
| 54 | +- Tailwind CSS (`tailwind.config.js`) |
| 55 | +- Vitest (`vitest.config.ts`) |
| 56 | +- Playwright (`playwright.config.ts`) |
| 57 | +- GitHub Actions (`.github/workflows/ci.yml`) |
| 58 | +- Husky (`.husky/`) |
| 59 | + |
| 60 | +## 🔄 Continuous Integration |
| 61 | + |
| 62 | +This template includes GitHub Actions workflows that automatically run on push to main and pull requests: |
| 63 | + |
| 64 | +- Runs unit tests with Vitest |
| 65 | +- Runs component tests with Testing Library |
| 66 | +- Runs E2E tests with Playwright in headless mode |
| 67 | +- Ensures code style with ESLint and Prettier |
| 68 | + |
| 69 | +## 🪝 Git Hooks |
| 70 | + |
| 71 | +Using Husky, the following Git hooks are configured: |
| 72 | + |
| 73 | +- pre-commit: Runs ESLint and Prettier |
| 74 | + |
| 75 | +## 📝 License |
| 76 | + |
| 77 | +This project is licensed under the MIT License. See the [LICENSE](LICENSE) file for details. |
| 78 | + |
| 79 | +## 🤝 Contributing |
| 80 | + |
| 81 | +Contributions are welcome. Please open an issue or submit a pull request. |
| 82 | + |
| 83 | +1. Fork the repository |
| 84 | +2. Create your feature branch (`git checkout -b feature/amazing-feature`) |
| 85 | +3. Commit your changes (`git commit -m 'feat: add amazing feature'`) |
| 86 | +4. Push to the branch (`git push origin feature/amazing-feature`) |
| 87 | +5. Open a Pull Request |
0 commit comments