AI-coding hygiene
no-prod-console
Forbid `console.log`/`debug`/`info`/`dir`/`trace`/`table`/`time*` in production source.
Differs from ESLint's stock `no-console` in three ways tuned for AI-coding: test/spec/fixture/e2e/script directories are auto-exempted by filename; `console.error` and `console.warn` are allowed (they're production logging channels); the default forbidden set targets `log`/`debug`/`info`/`dir`/`trace`/`table`/`time*` — the methods AI tools leave behind from "let me print this to understand what's happening" mid-build sessions.
Behavior
- Fixable: No.
- Suggestions: No.
Examples
Bad:
console.log("got here", payload);Good:
logger.info({ payload }, "request received");Related rules
no-empty-catchForbid empty `catch` blocks (`catch {}`, `catch (e) {}`, `catch (e) { /* TODO */ }`).no-leaked-stack-traceForbid HTTP responses that include a stack trace or the raw caught-exception object.no-placeholder-codeFlag `throw new Error("not implemented")` and TODO/FIXME stubs the AI left behind.
Use it
Enable no-prod-console in your eslint.config.js:
import deslint from '@deslint/eslint-plugin';
export default [
{
plugins: { deslint },
rules: {
'deslint/no-prod-console': 'error',
},
},
];Found a false positive? Report it on GitHub →