use-join
The blank line between a value and the loop, try or function that reads it.
A single-line declaration is followed directly by a loop, try or function declaration that references what it binds.
function readSettings(path: string) {
const fallback = defaults();
try {
return parse(readFileSync(path, "utf8"));
} catch {
return fallback;
}
}Applies when a single-line declaration is followed by a loop (for, for in, for of, while, do), a try or a function declaration that reads a name it binds. Declarations only: an assignment followed by a loop does not join.
For a function declaration, its own body is the reader. function walk() closing over const files joins to it even though nothing has called walk yet. That is the one reader where code inside a function counts.
Outranked by short-body and after-multiline. When the declaration is a let, let-step then puts a blank line above it, so the let and its loop form their own step.
A read inside a callback passed to the loop or try does not count.
A name shadowed inside the loop or try does not count as a read: for (const v of xs) does not read the const v above it.