Ground Rules
Before contributing, please keep these principles in mind:- Keep changes focused and small - Single-purpose PRs are easier to review and merge
- Prefer clear, typed, and testable code - Use TypeScript features and write self-documenting code
- Do not break the CSV import/export contract - The CSV schema is a core feature that users depend on
Development Setup
1. Fork and Clone
2. Install Dependencies
package.json.
3. Start Development Server
http://localhost:5173 with hot module replacement (HMR) enabled.
4. Validate Build
Before pushing changes, always ensure the build passes:tsc -b) followed by Vite’s production build.
Branching Strategy
Create Feature Branches
Always create a new branch frommain for your changes:
Branch Naming Conventions
Use descriptive branch names with a category prefix:feat/- New features (e.g.,feat/grid-snapping)fix/- Bug fixes (e.g.,fix/canvas-resize-glitch)docs/- Documentation updates (e.g.,docs/improve-readme)refactor/- Code refactoring (e.g.,refactor/extract-canvas-logic)chore/- Tooling and configuration (e.g.,chore/update-deps)
Code Style
TypeScript Guidelines
- Use strict typing - Avoid
any; use proper types fromsrc/features/labelwise/types.ts - Prefer explicit return types - Document function contracts
- Use const assertions - For readonly arrays and objects
- Enable all strict checks - The project uses strict mode in
tsconfig.app.json
ESLint Configuration
The project uses a flat ESLint config (eslint.config.js) with:
@eslint/jsrecommended rulestypescript-eslintrecommended ruleseslint-plugin-react-hooksfor React Hooks validationeslint-plugin-react-refreshfor fast refresh compatibility
React Best Practices
- Use functional components - No class components
- Follow Hooks rules - Hooks must be called at the top level
- Memoize expensive computations - Use
useMemofor derived state - Clean up side effects - Return cleanup functions from
useEffect - Avoid inline function definitions - Extract event handlers when they grow complex
Styling Guidelines
The project uses Tailwind CSS v4 with utility classes:- Use Tailwind utilities instead of custom CSS when possible
- Follow mobile-first responsive design (use
md:,lg:breakpoints) - Use CSS variables for theme colors (
bg-background,text-foreground) - Keep utility classes in readable order: layout → spacing → colors → typography
Commit Message Format
Use clear, concise commit messages following this pattern:Types
feat- New featurefix- Bug fixdocs- Documentation changesrefactor- Code refactoring (no functional changes)style- Formatting, missing semicolons, etc.test- Adding or updating testschore- Build process, dependencies, tooling
Examples
Pull Requests
Before Submitting
-
npm run buildpasses without errors -
npm run lintpasses without errors - No unrelated file changes (check
git diff) - UI changes validated in both Canvas and CSV views
- Test with multiple images and edge cases
PR Description Template
Include the following information in your PR:Review Process
- Maintainers will review your PR for code quality and functionality
- Address any requested changes
- Once approved, your PR will be merged into
main
Reporting Issues
When opening issues, please include:For Bugs
- Steps to reproduce - Detailed steps to trigger the bug
- Expected behavior - What should happen
- Actual behavior - What actually happens
- Environment - Browser, OS, and screen size
- Sample data - CSV file or images if relevant (ensure no sensitive data)
For Feature Requests
- Use case - Why is this feature needed?
- Proposed solution - How should it work?
- Alternatives considered - Other approaches you’ve thought about
- Additional context - Screenshots, mockups, or examples
Testing Guidelines
Currently, labelWise does not have a formal test suite. When contributing:Manual Testing
- Test all annotation operations (create, move, resize, delete)
- Test multi-selection with
Ctrl/Cmd + click - Test copy/paste functionality (
Ctrl/Cmd + C/V) - Test CSV export and import with your changes
- Test zoom and pan interactions
- Test with images of various sizes and aspect ratios
Edge Cases
- Empty state (no images loaded)
- Single image workflow
- Large number of annotations (100+)
- Very small or very large images
- CSV with missing or invalid data
- Browser compatibility (Chrome, Firefox, Safari)
Security
If you discover a security vulnerability:- Do not open a public issue
- Contact the repository maintainers privately
- Provide detailed information about the vulnerability
- Allow time for a fix before public disclosure
Code of Conduct
- Be respectful and constructive in discussions
- Focus on the code and ideas, not the person
- Welcome newcomers and help them get started
- Assume good intentions
Getting Help
If you need help with your contribution:- Check existing issues and PRs for similar work
- Review the Architecture documentation
- Ask questions in PR comments or open a discussion
- Refer to the Local Setup guide for environment issues