Thank you for your interest in contributing to React Quick Starter! This document provides guidelines and instructions for contributing.
- Code of Conduct
- Getting Started
- Development Setup
- Making Changes
- Commit Guidelines
- Pull Request Process
- Coding Standards
- Testing
- Documentation
See CODE_OF_CONDUCT.md.
- Fork the repository on GitHub
- Clone your fork locally:
git clone https://github.com/YOUR_USERNAME/react-quick-starter.git cd react-quick-starter - Add the upstream remote:
git remote add upstream https://github.com/AstroAir/react-quick-starter.git
- Node.js 20.x or later
- pnpm 10.x or later
No native toolchain is required — pnpm install downloads the Electron binary automatically (whitelisted via pnpm.onlyBuiltDependencies).
# Install dependencies (also fetches the Electron binary)
pnpm install
# Start development server (web only)
pnpm dev
# For Electron desktop development (concurrently runs Next.js + Electron)
pnpm electron:dev# Run linting, type-check, and tests
pnpm lint
pnpm typecheck
pnpm test
# Sanity-check the Electron compile pipeline
pnpm electron:compileCreate a feature branch from main:
git checkout main
git pull upstream main
git checkout -b <type>/<description>Branch types:
feat/- New featuresfix/- Bug fixesdocs/- Documentation changesrefactor/- Code refactoringtest/- Test additions or modificationschore/- Maintenance tasks
Examples:
feat/add-dark-mode-togglefix/navigation-scroll-issuedocs/update-installation-guide
git fetch upstream
git checkout main
git merge upstream/mainWe follow Conventional Commits specification.
<type>(<scope>): <description>
[optional body]
[optional footer(s)]
| Type | Description |
|---|---|
feat |
New feature |
fix |
Bug fix |
docs |
Documentation only |
style |
Code style (formatting, semicolons, etc.) |
refactor |
Code change that neither fixes a bug nor adds a feature |
perf |
Performance improvement |
test |
Adding or updating tests |
build |
Build system or external dependencies |
ci |
CI/CD configuration |
chore |
Other changes that don't modify src or test files |
revert |
Reverts a previous commit |
feat(ui): add Button component variants
fix(auth): resolve token refresh loop
docs(readme): update installation instructions
refactor(utils): simplify cn helper function
test(button): add accessibility tests- Update your branch with the latest upstream changes
- Run all checks locally:
pnpm lint pnpm test pnpm build - Push your branch to your fork
- Create a Pull Request against
main - Fill out the PR template completely
- Request review from maintainers
- Address feedback and make requested changes
- Squash commits if requested
- Code follows project style guidelines
- Self-reviewed the code
- Added/updated tests as needed
- Updated documentation as needed
- All CI checks pass
- Linked related issues
Tooling enforcement (auto-runs on commit):
- Prettier formats staged files via
lint-staged - ESLint --fix runs on staged TS/JS files
- commitlint validates commit messages against Conventional Commits
First-time setup: pnpm install — the prepare script installs git hooks via Husky. If hooks don't fire, run pnpm exec husky manually.
- Use TypeScript for all new code
- Enable strict mode
- Avoid
anytype; use proper typing - Export types from dedicated type files when shared
- Use functional components with hooks
- Follow React 19 best practices
- Keep components small and focused
- Use proper prop typing
- Use Tailwind CSS utility classes
- Follow the existing design system
- Use CSS variables for theming
- Avoid inline styles
components/
├── ui/ # shadcn/ui components
│ └── button.tsx
├── feature/ # Feature-specific components
│ └── header.tsx
└── index.ts # Barrel exports
| Type | Convention | Example |
|---|---|---|
| Components | PascalCase | UserProfile.tsx |
| Hooks | camelCase with use prefix |
useAuth.ts |
| Utilities | camelCase | formatDate.ts |
| Types/Interfaces | PascalCase | UserData |
| Constants | SCREAMING_SNAKE_CASE | MAX_RETRIES |
# Run all tests
pnpm test
# Run tests in watch mode
pnpm test:watch
# Run with coverage
pnpm test:coverage- Place tests next to source files:
Component.test.tsx - Use React Testing Library for component tests
- Test behavior, not implementation details
- Aim for meaningful coverage, not 100%
import { render, screen } from '@testing-library/react'
import { Button } from './button'
describe('Button', () => {
it('renders children correctly', () => {
render(<Button>Click me</Button>)
expect(screen.getByRole('button')).toHaveTextContent('Click me')
})
it('handles click events', async () => {
const handleClick = jest.fn()
render(<Button onClick={handleClick}>Click</Button>)
await userEvent.click(screen.getByRole('button'))
expect(handleClick).toHaveBeenCalledTimes(1)
})
})- Adding new features
- Changing existing behavior
- Updating dependencies
- Modifying configuration
README.md- Project overview and quick startREADME_zh.md- Chinese documentationCONTRIBUTING.md- This fileCI_CD.md- CI/CD setup guideTESTING.md- Testing guide
- Use JSDoc for public APIs
- Explain "why", not "what"
- Keep comments up to date
If you have questions, feel free to:
- Check existing Issues
- Open a new issue for discussion
- Reach out to maintainers
Thank you for contributing! 🎉