Skip to main content

Contributing Guide

Guidelines for contributing to TrendGate.

Getting Started

Before Contributing

  1. Read the Code of Conduct
  2. Check existing issues and PRs
  3. Set up your development environment

Contribution Types

  • 🐛 Bug fixes
  • ✨ New features
  • 📝 Documentation
  • 🎨 UI/UX improvements
  • ⚡ Performance optimizations
  • ✅ Tests

Development Process

1. Create an Issue

  • Use issue templates
  • Provide clear description
  • Include reproduction steps
  • Add relevant labels

2. Fork & Branch

# Fork the repository
git clone https://github.com/your-username/v0-swim-instructor.git

# Create feature branch
git checkout -b feature/your-feature-name

3. Make Changes

  • Follow coding standards
  • Write tests
  • Update documentation
  • Keep commits atomic

4. Submit PR

  • Fill out PR template
  • Link related issues
  • Request reviews
  • Address feedback

Coding Standards

TypeScript

// Use explicit types
interface UserProps {
id: string;
name: string;
role: UserRole;
}

// Prefer const assertions
const ROLES = ["admin", "instructor", "user"] as const;

// Use proper error handling
try {
await performAction();
} catch (error) {
handleError(error);
}

React Components

// Use function components
export function UserCard({ user }: UserCardProps) {
return <div>{user.name}</div>;
}

// Use proper prop types
interface ButtonProps {
onClick: () => void;
children: React.ReactNode;
variant?: "primary" | "secondary";
}

Testing

Unit Tests

describe("UserService", () => {
it("should create a user", async () => {
const user = await createUser(data);
expect(user).toBeDefined();
expect(user.email).toBe(data.email);
});
});

Integration Tests

  • Test complete flows
  • Mock external services
  • Use test database
  • Clean up after tests

Documentation

Code Comments

/**
* Calculates the total price including fees
* @param basePrice - Base session price
* @param fees - Additional fees
* @returns Total price with fees
*/
function calculateTotal(basePrice: number, fees: number): number {
return basePrice + fees;
}

README Updates

  • Update feature list
  • Add configuration steps
  • Include examples
  • Keep current

Review Process

PR Requirements

  • ✅ All tests pass
  • ✅ No linting errors
  • ✅ Documentation updated
  • ✅ Changelog entry added

Review Checklist

  • Code quality
  • Performance impact
  • Security considerations
  • Accessibility
  • Mobile responsiveness