Thank you for your interest in contributing! This document provides guidelines for contributing to the project.
If you find a bug, please open an issue on GitHub with:
- A clear, descriptive title
- Steps to reproduce the issue
- Expected behavior vs actual behavior
- Your environment (browser, React version, etc.)
- Any relevant code snippets or error messages
Feature requests are welcome. Please open an issue describing:
- The problem you're trying to solve
- Your proposed solution
- Any alternatives you've considered
- Fork the repository
- Create a feature branch:
git checkout -b feature/your-feature-name - Make your changes
- Run tests:
npm test - Run type checking:
npm run typecheck - Commit with a clear message
- Push to your fork
- Open a pull request
# Clone your fork
git clone https://github.com/YOUR_USERNAME/react-consent-shield.git
cd react-consent-shield
# Install dependencies
npm install
# Run tests
npm test
# Run tests in watch mode
npm run test:watch
# Type check
npm run typecheck
# Build
npm run build- Use TypeScript for all new code
- Follow existing code patterns
- Add JSDoc comments for public APIs
- Keep functions small and focused
- Write descriptive variable names
- Add tests for new features
- Ensure existing tests pass
- Aim for good coverage of edge cases
Use clear, descriptive commit messages:
feat: add support for custom cookie patterns
fix: correct geo-detection fallback behavior
docs: update configuration examples
test: add tests for ConsentScript component
- Update documentation if needed
- Add tests for new functionality
- Ensure all tests pass
- Update CHANGELOG.md if applicable
- Request review from maintainers
- Bug fixes
- New features
- Performance improvements
- Refactoring
- Documentation improvements
- Translation additions
- New service presets
- Bug reports
- Feature suggestions
If you want to add a new service preset:
- Research the cookies used by the service
- Create a preset object in
src/presets/ - Add to the appropriate tier file
- Include cookie patterns with wildcards where appropriate
- Add tests for the new preset
- Update documentation
Example preset structure:
export const myService: ServicePreset = {
id: 'my-service',
name: 'My Service',
category: 'analytics',
domains: ['myservice.com'],
cookies: ['_ms_id', '_ms_session', '_ms_*'],
description: {
en: 'Description in English',
es: 'Descripcion en espanol',
},
};To add a new language:
- Create a translation file in
src/i18n/ - Copy the structure from an existing translation
- Translate all strings
- Add the language to the available locales list
- Test the translation in the demo
If you have questions, feel free to:
- Open an issue on GitHub
- Check existing issues for similar questions
Thank you for contributing!