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:
const
by default for variable declarations, only use let
when the variable needs to be reassignedExample:
// โ 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.
Enter the URL of a public GitHub repository