domains / / vercel/next.js
Consistent variable style patterns
Maintain consistent patterns for variable declarations and naming conventions: use const by default for variable declarations, use clear complete words in variable names instead of abbreviations, and for truthiness checks prefer simple boolean conditions unless explicit null/undefined checks are required.
Maintain consistent patterns for variable declarations and naming conventions:
- Use
constby default for variable declarations, only useletwhen the variable needs to be reassigned - Use clear, complete words in variable names instead of abbreviations
- For truthiness checks, prefer simple boolean conditions unless explicit null/undefined checks are required
Example:
// ❌ Inconsistent patterns
let lockFile = findRootLockFile(cwd)
const normChunkPath = '/path'
if (testWasmDir != null) {
// ...
}
// ✅ Consistent patterns
const lockFile = findRootLockFile(cwd)
const normalizedChunkPath = '/path'
if (testWasmDir) {
// ...
}
This promotes code readability and reduces cognitive load by establishing predictable patterns across the codebase.