Skip to main content

What it flags

A nested read such as req.body.user.email, JSON.parse(text).a.b or response.data.x.y on untyped input, or on a find() / Map#get result in files without strictNullChecks, throws a TypeError when the value is missing. Reads under optional chaining, a guard (including map.has(key) before map.get(key), and a guard on the value a const alias was read from), an early return, an assert/invariant call or a try are accepted; typed values are left to the compiler. A project parsing its own package.json is trusted; when the path is relative to the source file (import.meta.url, __dirname or __filename) and read with Node’s fs, a field missing from that file on disk, or read after the parsed object was changed or passed elsewhere, is still reported. A write to another field, such as manifest.main = ... before reading manifest.exports['.'], does not count as a change. The fix adds optional chaining and is marked for review: add a default or answer with a 400, or validate the input first.

Configuration

Set the rule to "off" in loadwise.config.json to drop its findings: