Contributing Guide
Getting Started
- Fork the repository
- Create a feature branch
- Make your changes
- Submit a pull request
Development Process
1. Setting Up Development Environment
# Clone your fork
git clone https://github.com/YOUR_USERNAME/EyeNetProject.git
cd EyeNetProject
# Add upstream remote
git remote add upstream https://github.com/TadashiJei/EyeNetProject.git
# Install dependencies
cd eyenet/backend && npm install
cd ../frontend && npm install
2. Creating a Feature Branch
git checkout -b feature/your-feature-name
3. Making Changes
- Follow the coding style guide
- Write clear commit messages
- Add tests for new features
- Update documentation
4. Submitting Pull Requests
- Push your changes to your fork
- Create a pull request from your fork to the main repository
- Fill out the pull request template
- Wait for review
Code Style Guidelines
TypeScript
// Use interfaces for type definitions
interface UserConfig {
name: string;
role: 'admin' | 'user';
permissions: string[];
}
// Use proper error handling
try {
await someAsyncOperation();
} catch (error) {
logger.error('Operation failed:', error);
throw new OperationalError('Failed to complete operation');
}
React Components
// Use functional components
const DashboardWidget: React.FC<WidgetProps> = ({ title, data }) => {
const [loading, setLoading] = useState(false);
// Use proper error boundaries
if (!data) {
return <ErrorBoundary fallback={<ErrorMessage />} />;
}
return (
<div className="widget">
<h2>{title}</h2>
<div className="widget-content">
{/* Widget content */}
</div>
</div>
);
};
Testing Guidelines
Unit Tests
describe('NetworkController', () => {
it('should handle device connection', async () => {
const controller = new NetworkController();
const result = await controller.connect();
expect(result.status).toBe('connected');
});
});
Integration Tests
describe('API Integration', () => {
it('should handle authentication flow', async () => {
const response = await request(app)
.post('/api/auth/login')
.send({ username: 'test', password: 'test' });
expect(response.status).toBe(200);
expect(response.body).toHaveProperty('token');
});
});
Documentation Guidelines
Code Documentation
/**
* Manages network device connections and monitoring
* @class NetworkManager
*/
class NetworkManager {
/**
* Connects to a network device
* @param {string} deviceId - The unique identifier of the device
* @returns {Promise<ConnectionResult>} The connection result
* @throws {ConnectionError} If connection fails
*/
async connectDevice(deviceId: string): Promise<ConnectionResult> {
// Implementation
}
}
API Documentation
/**
* @swagger
* /api/devices:
* get:
* summary: Get all network devices
* tags: [Devices]
* responses:
* 200:
* description: List of network devices
* content:
* application/json:
* schema:
* type: array
* items:
* $ref: '#/components/schemas/Device'
*/
Release Process
- Version Bump
npm version patch # or minor or major
- Update Changelog
## [1.0.1] - 2025-01-25
### Added
- New feature X
### Fixed
- Bug in feature Y
- Create Release
git tag v1.0.1
git push origin v1.0.1
Community Guidelines
- Be respectful and inclusive
- Follow the code of conduct
- Help others when possible
- Keep discussions constructive
Support
- GitHub Issues for bug reports
- Discussions for questions
- Pull Requests for contributions
- Documentation for guides