tooling-setup
Tooling Setup for React 19 Projects
Production-ready configuration for modern frontend tooling with Vite, TypeScript, Biome, and Vitest.
1. Vite + React 19 + React Compiler
// vite.config.ts
import { defineConfig } from 'vite'
import react from '@vitejs/plugin-react'
export default defineConfig({
plugins: [
react({
babel: {
// React Compiler must run first:
plugins: ['babel-plugin-react-compiler'],
},
}),
],
})
Verify: Check DevTools for "Memo ✨" badge on optimized components.
2. TypeScript (strict + bundler mode)
// tsconfig.json
{
"compilerOptions": {
"target": "ES2020",
"module": "ESNext",
"moduleResolution": "bundler",
"jsx": "react-jsx",
"verbatimModuleSyntax": true,
"isolatedModules": true,
"strict": true,
"noUncheckedIndexedAccess": true,
"exactOptionalPropertyTypes": true,
"noFallthroughCasesInSwitch": true,
"types": ["vite/client", "vitest"]
},
"include": ["src", "vitest-setup.ts"]
}
Key Settings:
moduleResolution: "bundler"- Optimized for Vitestrict: true- Enable all strict type checksnoUncheckedIndexedAccess: true- Safer array/object accessverbatimModuleSyntax: true- Explicit import/export
3. Biome (formatter + linter)
npx @biomejs/biome init
npx @biomejs/biome check --write .
// biome.json
{
"formatter": { "enabled": true, "lineWidth": 100 },
"linter": {
"enabled": true,
"rules": {
"style": { "noUnusedVariables": "error" }
}
}
}
Usage:
npx biome check .- Check for issuesnpx biome check --write .- Auto-fix issues- Replaces ESLint + Prettier with one fast tool
4. Environment Variables
- Read via
import.meta.env - Prefix all app-exposed vars with
VITE_ - Never place secrets in the client bundle
// Access environment variables
const apiUrl = import.meta.env.VITE_API_URL
const isDev = import.meta.env.DEV
const isProd = import.meta.env.PROD
// .env.local (not committed)
VITE_API_URL=https://api.example.com
VITE_ANALYTICS_ID=UA-12345-1
5. Testing Setup (Vitest)
// vitest-setup.ts
import '@testing-library/jest-dom/vitest'
// vitest.config.ts
import { defineConfig } from 'vitest/config'
import react from '@vitejs/plugin-react'
export default defineConfig({
plugins: [react()],
test: {
environment: 'jsdom',
setupFiles: ['./vitest-setup.ts'],
coverage: { reporter: ['text', 'html'] }
}
})
Setup Notes:
- Use React Testing Library for DOM assertions
- Use MSW for API mocks (see tanstack-query skill for MSW patterns)
- Add
types: ["vitest", "vitest/jsdom"]for jsdom globals in tsconfig.json
Run Tests:
npx vitest # Run in watch mode
npx vitest run # Run once
npx vitest --coverage # Generate coverage report
Package Installation
# Core
pnpm add react@rc react-dom@rc
pnpm add -D vite @vitejs/plugin-react typescript
# Biome (replaces ESLint + Prettier)
pnpm add -D @biomejs/biome
# React Compiler
pnpm add -D babel-plugin-react-compiler
# Testing
pnpm add -D vitest @testing-library/react @testing-library/jest-dom
pnpm add -D @testing-library/user-event jsdom
pnpm add -D msw
# TanStack
pnpm add @tanstack/react-query @tanstack/react-router
pnpm add -D @tanstack/router-plugin @tanstack/react-query-devtools
# Utilities
pnpm add axios zod
Project Scripts
{
"scripts": {
"dev": "vite",
"build": "tsc --noEmit && vite build",
"preview": "vite preview",
"test": "vitest",
"test:run": "vitest run",
"test:coverage": "vitest --coverage",
"lint": "biome check .",
"lint:fix": "biome check --write .",
"format": "biome format --write ."
}
}
IDE Setup
VSCode Extensions:
- Biome (biomejs.biome)
- TypeScript (built-in)
- Vite (antfu.vite)
VSCode Settings:
{
"editor.defaultFormatter": "biomejs.biome",
"editor.formatOnSave": true,
"[typescript]": {
"editor.defaultFormatter": "biomejs.biome"
},
"[typescriptreact]": {
"editor.defaultFormatter": "biomejs.biome"
}
}
Related Skills
- core-principles - Project structure and best practices
- react-patterns - React 19 specific features
- testing-strategy - Advanced testing patterns with MSW
More from madappgang/claude-code
tailwindcss
|
3tanstack-router
TanStack Router patterns for type-safe, file-based routing. Covers installation, route configuration, typed params/search, layouts, and navigation. Use when setting up routes, implementing navigation, or configuring route loaders.
2tanstack-query
Comprehensive TanStack Query v5 patterns for async state management. Covers breaking changes, query key factories, data transformation, mutations, optimistic updates, authentication, testing with MSW, and anti-patterns. Use for all server state management, data fetching, and cache invalidation tasks.
2ui-implementer
Implements UI components from scratch based on design references (Figma, screenshots, mockups) with intelligent validation and adaptive agent switching. Use when user provides a design and wants pixel-perfect UI implementation with design fidelity validation. Triggers automatically when user mentions Figma links, design screenshots, or wants to implement UI from designs.
2browser-debugger
Systematically tests UI functionality, validates design fidelity with AI visual analysis, monitors console output, tracks network requests, and provides debugging reports using Chrome DevTools MCP. Use after implementing UI features, for design validation, when investigating console errors, for regression testing, or when user mentions testing, browser bugs, console errors, or UI verification.
1api-integration
Use when integrating Apidog + OpenAPI specifications with your React app. Covers MCP server setup, type generation, and query layer integration. Use when setting up API clients, generating types from OpenAPI, or integrating with Apidog MCP.
1