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

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 →

Back to all rules