Skip to content

prelude-shadow ​

A local named like a prelude value that code reads as SAFE-TS's own: unsafe or unsafeAsync anywhere, and q, match, is, err or Result in a file that also uses the prelude's name. Reported in files with the prelude on.

Why: in its scope, the local wins. q(x) there is a plain call, not the early return; unsafe(item) reads like the escape hatch while it calls a parameter; match(...) is a regex result, not the enum match. The code works, and the reader has to find the declaration to know which one it is. The transform and the checks follow the scope (a local q in one function and the prelude's q in another both work, and a parameter named unsafe isn't counted as an unsafe() block), but the reader doesn't get that help.

✕ Rejectedprelude-shadow
ts
export function visibleItems(items: string[], unsafe: (item: string) => boolean): string[] {
  return items.filter((item) => !unsafe(item));
}

✅ Accepted: a name that says what it holds

✓ Accepted0 diagnostics
ts
export function visibleItems(items: string[], isHidden: (item: string) => boolean): string[] {
  return items.filter((item) => !isHidden(item));
}

The same goes for const match = pattern.exec(line) next to match(order, { ... }) (call it found), and a helper named q in a file that uses q(...) (double, query). Where the file never uses the prelude's name, the local is the only meaning there and isn't reported: a q for a point in geometry code is fine. A name imported under one of these is fine too: it is the import's own choice, written at the top of the file.

MIT OR Apache-2.0 · Docs by Gemini 4 Neon Extra