Skip to main content

No Logger.dev

Flag Logger.dev calls so dev-only logging statements get caught before they ship to production.

Summary

The no-logger-dev rule reports any call to .dev() on Logger, Logger.customize(), or variables assigned from Logger.customize().

Use Logger.debug instead if you want to keep the log.

Why Use This Rule?

  1. Prevents dev-only log statements from leaking into production builds.
  2. Catches scoped loggers too, not just direct Logger.dev() calls.
  3. Keeps the codebase clean by making dev logging intentionally noisy during linting.

Examples

Configuration

Options

warning

ignoreFiles is an escape hatch for files where this rule genuinely does not apply. It is not intended for routine use.

OptionTypeDefaultDescription
ignoreFilesstring[][]File names to skip. Supports a leading-* suffix (*.test.ts), an exact path, or a trailing path segment; ** globs are not supported.

Autofix

Autofix is not available for this rule. Flagged code must be updated manually.

Troubleshooting

  • Warning fires on a .dev() call that isn't Logger — The rule only flags calls on identifiers named Logger or variables traced back to Logger.customize(). Other objects with a .dev() method are ignored.
  • Bracket access is not flagged — The rule only matches dot access (Logger.dev(...)). Computed forms like Logger['dev'](...) are intentionally ignored and will not be reported.
  • Only direct assignments are traced — A variable is flagged only when it is declared and initialized directly from Logger.customize(...) (e.g. const log = Logger.customize(...)). Aliases of aliases, later re-assignments, function parameters, and destructured loggers are not tracked.
  • Want to keep the log? — Replace Logger.dev with Logger.debug. Debug logs are gated by LOG_LEVEL and stay silent in production by default.