Prettier enforces: 4-space indent, single quotes, no semicolons, 120 char width.
See CONTRIBUTING.md for commands.
- PascalCase - Components, classes, types, interfaces
- camelCase - Functions, variables, methods
Use ?? for default values (checks null/undefined only):
const value = input ?? 'default'Use || only when checking all falsy values.
Remove unused variables, imports, and commented-out code immediately.
Explain "why", not "what". Code should be self-documenting.
Use guard clauses to avoid deep nesting:
function process(item) {
if (!item) return
if (!item.isValid) return
// main logic here
}Functions should do one thing. Consider refactoring if exceeding 20-30 lines.
Use named constants:
const STATUS_PRINTING = 3
if (status === STATUS_PRINTING) { ... }Use @Debounce(ms) for inputs triggering API calls.
Use throttle() for resize handlers.
No raw console.log in production code.
For debug output, define a class method with a descriptive prefix:
log(msg: string, obj?: unknown): void {
const message = `[MyFeature] ${msg}`
if (obj) {
window.console.log(message, obj)
return
}
window.console.log(message)
}