Style Guide
This style guide helps contributors write consistent, readable, and maintainable code for Devfund.
General Principles
- Use clear, descriptive names for variables, functions, and components
- Prefer functional components and hooks in React
- Write modular, reusable code
- Keep functions small and focused
- Avoid unnecessary complexity
TypeScript
- Use TypeScript for all new code
- Prefer explicit types for props and function arguments
- Use interfaces for component props
- Avoid
anytype unless absolutely necessary
React & Next.js
- Use function components and hooks
- Prefer arrow functions for components
- Use
useState,useEffect, and other hooks for state and lifecycle - Use Next.js routing and conventions for pages and API routes
CSS & Tailwind
- Use Tailwind CSS utility classes for styling
- Prefer responsive and accessible design
- Avoid inline styles unless necessary
- Use consistent spacing and color schemes
Git & Commits
- Use conventional commit messages (e.g.,
feat: add new feature) - Write clear, concise commit messages
- Group related changes in a single commit
- Rebase and squash commits before merging
Documentation
- Document all public functions and components
- Use JSDoc or TypeScript doc comments
- Update documentation with every change
Pull Requests
- Ensure all tests pass before submitting
- Follow the PR template
- Link related issues in PR description
For more details, see Contributing.