This template provides a minimal setup to get React working in Vite with HMR. Additional support :
- Eslint on precommit hook
- Prettier support is also added for onsave in VSC
- Vitest and React Test Library for testing
- Tailwind CSS v4 with shadcn/ui components and Radix UI
- DevContainer for VS Code
- GitHub Actions CI pipeline
npm install && npx husky init && echo npx lint-staged > .husky/pre-commit
npm install npm run dev
For personal ESLint overrides that shouldn't be committed to the repository, create an optional eslint.config.local.js
file:
// eslint.config.local.js - not checked into git
export const localIgnores = ['my-temp-folder/', 'experimental/**'];
export const localRules = {
'no-console': 'off',
'@typescript-eslint/no-unused-vars': 'warn',
};
This file is automatically imported by the main ESLint config and allows you to:
- Add personal ignore patterns without affecting the team
- Override specific rules for your development workflow
- Keep experimental or temporary configurations local
The file is optional - ESLint will work normally if it doesn't exist.
- Vite - Fast build tool with HMR (Hot Module Replacement)
- TypeScript - Type safety with path aliases (
@/
maps tosrc/
) - ESLint - Code linting with React and TypeScript rules
- Prettier - Code formatting with Tailwind CSS plugin
- Husky - Git hooks for pre-commit linting and formatting
- Tailwind CSS v4 - Utility-first CSS framework
- shadcn/ui - High-quality React components with design tokens
- Radix UI - Accessible component primitives
- Lucide React - Beautiful icon library
- Vitest - Fast unit testing framework
- React Testing Library - Component testing utilities
- jsdom - DOM environment for testing
- @testing-library/jest-dom - Custom Jest matchers
- GitHub Actions - Automated CI pipeline with:
- Dependency installation
- Code linting
- Build verification
- Test execution
- PR failure notifications
- DevContainer - VS Code development container setup
- Docker - Containerized development environment
- Auto-install - Dependencies and dev server auto-start
Environment variables are type-safe through src/vite-env.d.ts
. Add new variables to the ImportMetaEnv
interface:
interface ImportMetaEnv {
readonly VITE_APP_NAME: string;
readonly VITE_API_URL: string; // Add new variables here
}
Env vars are loaded by Vite in the following order
[mode] = test / development
.env.[mode].local
- Highest Priority. Development mode only. Never committed, used for secrets..env.[mode]
- Development or Test mode (can be committed, common team or mock settings).env.local
- Always loaded useful for local secrets, never commit..env
- Base settings, lowest priority and always loaded. Can be committed.
npm run dev
- Start development server with debug outputnpm run build
- Build for productionnpm run preview
- Preview production buildnpm run lint
- Run ESLintnpm run test
- Run tests oncenpm run test:watch
- Run tests in watch mode
- Prettier - Format on save enabled
- Tailwind CSS - IntelliSense and syntax highlighting
- TypeScript - Full language support with path aliases
- ESLint - Real-time linting with auto-fix