@noctcore/eslint-plugin-observability
A bad fit if you log through console by design, or your logger has no way to carry a context object, because the fix every rule asks for is to move values out of the message and into one.
Structured logging discipline: context objects, no sensitive fields, no lost error detail, declared PII in audit payloads.
What it solves
Section titled “What it solves”Logs are an interface that nobody type-checks. An interpolated message string cannot be queried, a log call that includes password or token is an incident, and a catch block that logs only e.message throws away the stack and cause you needed.
What it will yell at you about
Section titled “What it will yell at you about”It will yell at you about how you call your logger: a static message plus a context object, never a template literal with values in it. The sensitive-field and PII rules match on names, so they catch user.password but not a secret hiding in a field called data. The rules recognise <logger>.info/warn/error/debug(...) calls on logger names you configure through loggers. It is a bad fit if you log through console by design, or your logger has no way to carry a context object, because the fix every rule asks for is to move values out of the message and into one.
Install and configure
Section titled “Install and configure”npm install --save-dev @noctcore/eslint-plugin-observability @typescript-eslint/parser# or: bun add -D / pnpm add -D @noctcore/eslint-plugin-observability @typescript-eslint/parserThe recommended preset enables 3 of 4 rules. The rules board below builds the flat config: start from a preset, switch single rules between error and off, and copy the result.
Each rule links to its page, with the options it takes and Incorrect and Correct examples. A good first
read is structured-log-arguments.
--fixsuggestionsneeds optionstype infoEach switch sets a rule to error or off.
e.message / String(e) / ${e} — log the error itself so its stack and cause survive.