Thank you for your interest in contributing to rnxJS! We welcome all contributions, from bug reports and documentation improvements to new components and features.
This project is governed by the Contributor Covenant Code of Conduct. All participants are expected to uphold this code in all interactions.
- Node.js 16+ and npm
- Basic knowledge of JavaScript and Bootstrap
-
Fork and clone the repository:
git clone https://github.com/your-username/rnxjs.git cd rnxjs npm install -
Create a feature branch:
git checkout -b feature/my-feature
-
Make your changes and test locally:
npm test # Run all tests npm run test:watch # Run tests in watch mode npm run build # Build the project
Before reporting, please search existing issues to avoid duplicates.
When reporting, include:
- Clear description of the bug
- Steps to reproduce
- Expected vs. actual behavior
- Browser/Node.js versions
- Code example or minimal reproduction
Open an issue describing:
- What the feature should do
- Why it would be useful
- Example usage or implementation ideas
- Create component file in
components/YourComponent/YourComponent.js - Document the component in
docs/COMPONENTS.md(add a section under the appropriate category) with:- A one-paragraph description of what it does
- One representative usage example
- All props with types, defaults, and descriptions (as a table)
- Available methods
- Add unit tests in
tests/unit/YourComponent_*.test.js - Update
components/index.jswith export - Add CSS styles to
css/bootstrap-m3-theme.cssif needed - Update main
README.mdwith component mention
- Add a test case that reproduces the bug
- Fix the bug
- Verify the test now passes
- Add any necessary documentation updates
- Use clear, concise language
- Include code examples
- Test that examples work
- Follow existing formatting styles
- Include proper links to related sections
rnxJS follows these conventions:
- Formatting: 2-space indentation, semicolons required
- Naming: camelCase for variables/functions, PascalCase for components/classes
- JSDoc: Add comments for complex functions (not required for obvious code)
- No build step: Keep components runnable with CDN/imports as-is
- Security: Always escape user content with
escapeHtml()fromutils/security.js
Example Component Structure:
export function MyComponent({ label, variant = 'primary' }) {
const template = (state) => `
<div class="my-component">
<span>${escapeHtml(label)}</span>
</div>
`;
return createComponent(template);
}- All new code must include tests
- Tests should cover:
- Normal operation
- Edge cases
- Error handling
- Integration with other components
Test Structure:
import { describe, it, expect, beforeEach, afterEach, vi } from 'vitest';
import { MyComponent } from '../../components/MyComponent/MyComponent.js';
describe('MyComponent', () => {
let container;
beforeEach(() => {
container = document.createElement('div');
document.body.appendChild(container);
});
afterEach(() => {
container.remove();
});
it('should render with label', (done) => {
const component = MyComponent({ label: 'Test' });
container.appendChild(component);
setTimeout(() => {
expect(container.textContent).toContain('Test');
done();
}, 50);
});
});# ComponentName
Brief one-line description.
## Installation
Already included in rnxJS v0.4.0+
## Basic Usage
import { ComponentName } from '@arnelirobles/rnxjs';
// ... example code
## Props
| Prop | Type | Default | Description |
|------|------|---------|-------------|
## Methods
## Features
- Feature 1
- Feature 2
## Examples
### Example 1
### Example 2
## Styling
## Browser Support
## Related ComponentsWhen submitting a PR that includes new features:
### Version X.Y.Z (Feature Name) - Month Year
- **Category**: Feature description
- **Category**: Another feature- Update relevant documentation and tests
- Run
npm testand ensure all tests pass - Run
npm run buildand verify no build errors - Write a clear PR title and description
- Reference any related issues with "Closes #123"
- Ensure your branch is up-to-date with main
- Submit the PR and respond to reviews promptly
PR Template:
## Description
Brief description of changes
## Type of Change
- [ ] Bug fix
- [ ] New feature
- [ ] Documentation update
- [ ] Performance improvement
## Testing
Description of how this was tested
## Checklist
- [ ] Tests added/updated
- [ ] Documentation updated
- [ ] No breaking changes (or documented)
- [ ] Build passes (npm run build)
- [ ] All tests pass (npm test)By contributing, you agree that your contributions will be licensed under the Mozilla Public License v2.0.
- Check existing discussions
- Open a GitHub discussion for questions
- Review documentation in README.md
Contributors are recognized in:
- GitHub contributors page
- Release notes for significant contributions
- Project documentation as appropriate
Thank you for contributing to rnxJS! Your help makes this project better for everyone.