Thank you for your interest in contributing to AI DIAL UI Kit! This document provides guidelines and information for contributors.
- Development Workflow
- Component Development
- PR Guidelines
- Testing
- Code Style
- Pull Request Process
- Release Process
We follow a simple branching strategy:
development- main branch for integrating development code<custom name>- feature development branches
git checkout development
git pull origin development
git checkout -b your-feature-nameFollow rules from pull request template
-
File Structure: Each component should have its own directory with:
ComponentName.tsx- Main componentComponentName.spec.tsx- Unit testsComponentName.stories.tsx- Storybook stories
-
TypeScript: Use proper TypeScript with:
- Explicit interface definitions for props
- Generic types where appropriate
- Proper export patterns
-
Styling:
- Use Tailwind CSS classes
- Create reusable SCSS mixins when needed
- Follow design system
- Do not write inline styles
- Do not use hardcoded custom values like hex colors, font sizes, etc
- Use
dialprefix for custom css classes
-
Update policy:
- Do not make breaking changes to existing UI components. Use Open-Close principle from SOLID
-
Documentation:
- Add JsDoc for Component
-
Naming
- Use
Dialprefix for the components
- Use
Every component must have Storybook stories. See src\components\Button\Button.stories.tsx as an example.
- Coverage: Minimum 70% code coverage required
- Unit Tests: Every component must have unit tests
- Test Framework: Vitest with React Testing Library
- Consult documentation: (react testing library)[https://testing-library.com/docs/react-testing-library/intro/]
- Prefer roles over tags/text/testId.
- Prefer to test layout/callbacks.
- Prefer to move complex logic to utils and test separately.
We use ESLint and Prettier for code consistency:
# Check linting and fix issues
npm run lint
# Check formatting and fix issues
npm run format-fix- Use functional components with hooks
- Prefer explicit typing over
any - Use destructuring for props
- Keep components small and focused
- Use meaningful variable and function names
- Add JSDoc comments for complex functions
-
Run Quality Checks Do not skip pre-commit and pre-push hooks. They'll run:
npm run lint npm run format npm run test -
Update Documentation
- Update Storybook stories if needed
- Add/update README sections
- Document breaking changes
- All PRs require at least one approval
- Automated checks must pass
- Address review feedback
- Keep PRs focused and reasonably sized
We follow Semantic Versioning:
- MAJOR: Breaking changes
- MINOR: New features (backward compatible)
- PATCH: Bug fixes (backward compatible)
For detailed information on DIAL project contributing guidelines, see the main contributing documentation.