Contributing to Pet Tracker โ
Thank you for your interest in contributing to Pet Tracker! This guide will help you get started with contributing to the project.
๐ฏ Ways to Contribute โ
๐ Bug Reports โ
- Report bugs through GitHub Issues
- Use the bug report template
- Include steps to reproduce and screenshots
๐ก Feature Requests โ
- Suggest new features via GitHub Discussions
- Describe the use case and expected behavior
- Consider contributing the implementation
๐ Documentation โ
- Improve existing documentation
- Add missing documentation
- Fix typos and grammar
- Translate to other languages
๐ป Code Contributions โ
- Fix bugs and implement features
- Improve performance and accessibility
- Add tests and improve code coverage
- Refactor and optimize existing code
๐ Getting Started โ
Prerequisites โ
- Node.js 18+ and pnpm
- React Native development environment
- Git knowledge
- TypeScript familiarity
Setup Development Environment โ
Fork the repository on GitHub
Clone your fork:
bashgit clone https://github.com/your-username/pet-tracker.git cd pet-tracker
Add upstream remote:
bashgit remote add upstream https://github.com/yourusername/pet-tracker.git
Install dependencies:
bashpnpm install
Set up environment:
bashcp .env.example .env
Start development server:
bashpnpm start:dev
๐ Development Workflow โ
1. Choose an Issue โ
- Look for issues labeled
good first issue
orhelp wanted
- Comment on the issue to let others know you're working on it
- Ask questions if you need clarification
2. Create a Feature Branch โ
bash
git checkout -b feature/your-feature-name
# or
git checkout -b bugfix/issue-number-description
3. Make Your Changes โ
- Follow our coding standards
- Write tests for new functionality
- Update documentation as needed
- Test your changes thoroughly
4. Commit Your Changes โ
bash
git add .
git commit -m "feat: add new pet photo upload feature"
Use Conventional Commits format:
feat:
new featuresfix:
bug fixesdocs:
documentation changesstyle:
formatting changesrefactor:
code refactoringtest:
adding testschore:
maintenance tasks
5. Stay Updated โ
bash
git fetch upstream
git rebase upstream/main
6. Push and Create PR โ
bash
git push origin feature/your-feature-name
Then create a pull request on GitHub.
๐จ Coding Standards โ
TypeScript โ
- Use strict TypeScript configuration
- Define interfaces for all data structures
- Use type guards for runtime type checking
- Avoid
any
type; useunknown
when necessary
typescript
// Good
interface Pet {
id: string;
name: string;
type: PetType;
}
// Avoid
const pet: any = {};
React Native Components โ
- Use functional components with hooks
- Follow naming conventions (PascalCase for components)
- Keep components small and focused
- Use TypeScript for props and state
typescript
interface PetCardProps {
pet: Pet;
onPress: (petId: string) => void;
}
export default function PetCard({ pet, onPress }: PetCardProps) {
return (
<TouchableOpacity onPress={() => onPress(pet.id)}>
<Text>{pet.name}</Text>
</TouchableOpacity>
);
}
File Organization โ
- Use feature-based folder structure
- Group related files together
- Use barrel exports (index.ts files)
- Follow naming conventions
src/
โโโ components/
โ โโโ PetCard/
โ โ โโโ PetCard.tsx
โ โ โโโ PetCard.test.tsx
โ โ โโโ PetCard.styles.ts
โ โ โโโ index.ts
โ โโโ index.ts
Styling โ
- Use StyleSheet.create() for all styles
- Use design tokens from Theme.ts
- Create responsive designs
- Follow accessibility guidelines
typescript
const styles = StyleSheet.create({
container: {
backgroundColor: COLORS.surface,
padding: SPACING.md,
borderRadius: BORDER_RADIUS.lg,
},
});
State Management โ
- Use Context API for global state
- Use useReducer for complex state logic
- Create custom hooks for business logic
- Keep components focused on UI
Testing โ
- Write unit tests for utilities and services
- Write integration tests for complex flows
- Mock external dependencies
- Aim for good test coverage
typescript
describe('NutritionService', () => {
it('should calculate daily calories correctly', () => {
const result = NutritionService.calculateDailySummary(mockFoodEntries, new Date(), 2000);
expect(result.totalCalories).toBe(1500);
});
});
๐งช Testing โ
Running Tests โ
bash
# Run all tests
pnpm test
# Run tests in watch mode
pnpm test:watch
# Run tests with coverage
pnpm test:coverage
Writing Tests โ
- Test business logic thoroughly
- Mock React Navigation and Expo modules
- Use React Native Testing Library
- Write descriptive test names
Test Structure โ
typescript
describe('Component/Service Name', () => {
beforeEach(() => {
// Setup
});
afterEach(() => {
// Cleanup
});
it('should do something specific', () => {
// Arrange
// Act
// Assert
});
});
๐ฑ Platform Testing โ
iOS Testing โ
bash
pnpm ios:dev
Android Testing โ
bash
pnpm android:dev
Web Testing โ
bash
pnpm web
Test your changes on all platforms before submitting a PR.
๐ Pull Request Guidelines โ
Before Submitting โ
- [ ] Code follows style guidelines
- [ ] Tests pass and coverage is adequate
- [ ] Documentation is updated
- [ ] Changes tested on iOS, Android, and Web
- [ ] No console errors or warnings
- [ ] Git history is clean (squash commits if needed)
PR Description Template โ
markdown
## Description
Brief description of changes
## Type of Change
- [ ] Bug fix
- [ ] New feature
- [ ] Breaking change
- [ ] Documentation update
## Testing
- [ ] Unit tests added/updated
- [ ] Manual testing completed
- [ ] Tested on iOS
- [ ] Tested on Android
- [ ] Tested on Web
## Screenshots/Videos
(If applicable)
## Checklist
- [ ] Code follows style guidelines
- [ ] Self-review completed
- [ ] Documentation updated
- [ ] No new warnings introduced
Review Process โ
- Automated checks must pass (linting, testing, building)
- Code review by maintainers
- Testing on different platforms
- Approval and merge by maintainers
๐จ Design Guidelines โ
UI/UX Principles โ
- Accessibility: Support screen readers and voice control
- Simplicity: Keep interfaces clean and intuitive
- Consistency: Follow established design patterns
- Performance: Optimize for smooth animations and loading
Visual Design โ
- Use colors from the defined Theme
- Maintain consistent spacing and typography
- Follow platform design guidelines (iOS/Android)
- Support dark/light themes
User Experience โ
- Provide clear feedback for user actions
- Handle loading and error states gracefully
- Minimize required user input
- Support offline functionality
๐ Bug Reporting โ
Good Bug Reports Include โ
- Clear title describing the issue
- Steps to reproduce the problem
- Expected behavior vs actual behavior
- Platform/device information (iOS/Android version, device model)
- Screenshots or videos if applicable
- Console logs if relevant
Bug Report Template โ
markdown
**Describe the bug**
A clear description of what the bug is.
**To Reproduce**
Steps to reproduce the behavior:
1. Go to '...'
2. Click on '...'
3. See error
**Expected behavior**
What you expected to happen.
**Screenshots**
If applicable, add screenshots.
**Platform (please complete):**
- Device: [e.g. iPhone 12, Samsung Galaxy S21]
- OS: [e.g. iOS 15.0, Android 11]
- App Version: [e.g. 1.0.0]
**Additional context**
Any other context about the problem.
๐ฌ Communication โ
Where to Get Help โ
- GitHub Discussions for questions and ideas
- GitHub Issues for bugs and feature requests
- Code reviews for implementation feedback
Communication Guidelines โ
- Be respectful and constructive
- Search existing issues before creating new ones
- Provide context and details
- Follow up on your contributions
๐ Resources โ
Documentation โ
Tools โ
๐ Recognition โ
Contributors are recognized in:
- Project README
- Release notes
- Contributors page
- Special mentions for significant contributions
Thank you for contributing to Pet Tracker! ๐พ