Thank you for your interest in contributing to SQL Dojo! This document provides guidelines and instructions for contributing.
- Fork the repository
- Clone your fork:
git clone https://github.com/YOUR_USERNAME/sql-practice.git - Create a new branch:
git checkout -b feature/your-feature-name - Install dependencies:
npm install - Start the dev server:
npm run dev
- We use ESLint and Prettier for code formatting
- Run
npm run formatto auto-format your code - Run
npm run lintto check for issues - TypeScript strict mode is enabled - all code must be properly typed
Use clear, descriptive commit messages:
feat: add query export functionalityfix: resolve PGlite memory leakdocs: update README with deployment instructionsrefactor: extract challenge selector componenttest: add unit tests for progress store
- Write unit tests for new utilities and logic (Vitest)
- Add E2E tests for new user-facing features (Playwright)
- Run tests before submitting:
npm run test:all - Ensure all tests pass and coverage remains high
-
New Challenge: Edit
src/lib/data/challenges.ts- Add challenge object with unique ID
- Provide starter SQL and solution SQL
- Test thoroughly in playground mode
-
New Component: Create in
src/lib/components/- Use Svelte 5 runes syntax
- Add TypeScript interfaces for props
- Include ARIA labels for accessibility
- Write basic tests
-
New Store: Create in
src/lib/stores/- Use Svelte 5 store pattern
- Include JSDoc documentation
- Add unit tests
- Handle localStorage carefully with debouncing
-
New Utility: Add to
src/lib/utils/- Write pure functions when possible
- Add JSDoc comments
- Include comprehensive unit tests
Before submitting a PR, ensure:
- Code follows existing patterns and style
- TypeScript types are properly defined
- All tests pass (
npm run test:all) - ESLint and Prettier checks pass (
npm run lint) - New features have tests
- Accessibility considerations are addressed
- Documentation is updated (README, JSDoc, etc.)
- No console.log statements in production code
- Keep components focused and single-purpose
- Use props for configuration, not global state
- Prefer composition over inheritance
- Extract reusable logic to stores or utilities
- Use Svelte 5 stores for shared state
- LocalStorage interactions must be debounced
- Validate data loaded from localStorage
- Provide sensible defaults
- Use PGlite pool for database operations
- Debounce expensive operations
- Avoid unnecessary re-renders
- Keep bundle size in check
- All interactive elements need keyboard support
- Use semantic HTML
- Add ARIA labels where needed
- Test with screen readers when possible
- Update documentation for any changed functionality
- Add tests for new features or bug fixes
- Ensure the build passes:
npm run build - Update CHANGELOG.md if applicable
- Submit PR with clear description of changes
- Link any related issues
## Description
[Clear description of what this PR does]
## Type of Change
- [ ] Bug fix
- [ ] New feature
- [ ] Breaking change
- [ ] Documentation update
## Testing
- [ ] Unit tests added/updated
- [ ] E2E tests added/updated
- [ ] Manual testing performed
## Checklist
- [ ] Code follows project style guidelines
- [ ] Tests pass locally
- [ ] Documentation updated
- [ ] No breaking changes (or documented if necessary)When reporting bugs, please include:
- Clear description of the issue
- Steps to reproduce
- Expected vs actual behavior
- Browser/OS information
- Screenshots if applicable
- Console errors if relevant
For feature requests:
- Describe the use case clearly
- Explain why it would be valuable
- Consider implementation complexity
- Check if similar features exist
Feel free to open an issue for any questions or clarifications.
By contributing, you agree that your contributions will be licensed under the MIT License.