Coding Standards
This repository uses ESLint to enforce Airbnb JavaScript Style Guide.
General Guidelines
- Use consistent indentation (preferably 2 spaces)
- Write descriptive variable and function names
- Keep functions small and focused
- Comment your code when necessary
- Use proper error handling
- Write testable code
JavaScript/TypeScript Guidelines
Variables
// Bad
var foo = 'bar';
let foo = 'bar';
// Good
const foo = 'bar';
Functions
// Bad
function doSomething() {
// ...
}
// Good
const doSomething = () => {
// ...
};
Imports/Exports
// Bad
const myFunction = require('./myFunction');
// Good
import { myFunction } from './myFunction';
Code Quality
- Write unit tests for your code
- Maintain test coverage above 80%
- Use TypeScript for type safety
- Follow SonarQube rules for code quality
- Use proper error handling with try/catch blocks
Git Commit Messages
- Use the present tense ("Add feature" not "Added feature")
- Use the imperative mood ("Move cursor to..." not "Moves cursor to...")
- Limit the first line to 72 characters or less
- Reference issues and pull requests liberally after the first line
Documentation
- Document all public APIs
- Keep documentation up to date
- Use JSDoc comments for function documentation
- Include code examples where appropriate
Code Review Process
- Review for functionality
- Review for code style
- Review for test coverage
- Review for documentation