npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

eslint-plugin-pino-logger

v1.0.2

Published

> ESLint rule to enforce structured logging with Pino in Nuxt, Next, and general JS/TS projects. Replaces `console.log`, `console.info`, `console.error`, and `console.warn` with a composable logger pattern, with auto-import and framework-aware fixes. Repo

Readme

eslint-plugin-pino-logger

ESLint rule to enforce structured logging with Pino in Nuxt, Next, and general JS/TS projects. Replaces console.log, console.info, console.error, and console.warn with a composable logger pattern, with auto-import and framework-aware fixes. Reports all other console.* usage as problems (like no-console).

Features

  • Reports all console.* usage as problems (like no-console).
  • Auto-fixes (and quick fixes) for console.log, console.info, console.error, and console.warn to logger.info, logger.error, and logger.warn.
  • Auto-inserts const logger = usePinoLogger() if not present (Nuxt only).
  • Auto-inserts the import for usePinoLogger if not in a Nuxt project (Nuxt auto-imports composables).
  • Detects Nuxt projects by checking for nuxt.config.ts or nuxt.config.js in the project root.
  • Configurable logger variable name, import path, and import name for compatibility with any project structure.
  • Works in Nuxt 3, Next.js, and any JS/TS project (tested in Nuxt, logic is framework-agnostic).
  • Quick fix available in editors (e.g., VSCode).

Installation

npm install --save-dev eslint-plugin-pino-logger
# or
yarn add -D eslint-plugin-pino-logger
# or
bun add -d eslint-plugin-pino-logger

Usage

Add to your ESLint config:

// .eslintrc.js or eslint.config.mjs
{
  plugins: [
    'pino-logger'
  ],
  rules: {
    'pino-logger/no-console-to-pino-logger': 'warn' // or 'error'
  }
}

With Options

'rules': {
  'pino-logger/no-console-to-pino-logger': ['warn', {
    loggerVar: 'logger', // default
    importPath: '~/composables/usePinoLogger', // default for Nuxt
    importName: 'usePinoLogger' // default
  }]
}
  • loggerVar: The variable name to use for the logger (default: logger).
  • importPath: The import path for the logger composable/hook (default: ~/composables/usePinoLogger).
  • importName: The import name for the logger composable/hook (default: usePinoLogger).

How It Works

  • All console.* usage is reported as a problem (like no-console).
  • When you use console.log, console.info, console.error, or console.warn, the rule will:
    • Replace it with logger.info, logger.error, or logger.warn.
    • Insert const logger = usePinoLogger() at the top of the script if not present.
    • Insert the import for usePinoLogger if not in a Nuxt project (Nuxt auto-imports composables).
  • For all other console.* methods (e.g., console.debug, console.table), the rule reports a problem but does not auto-fix.
  • Nuxt detection is done by checking for nuxt.config.ts or nuxt.config.js in the project root.

Example

Before:

console.log('Hello')
console.info('Info!')
console.error('Oops!')
console.table(data)

After (Nuxt):

const logger = usePinoLogger()

logger.info('Hello')
logger.info('Info!')
logger.error('Oops!')
console.table(data) // still reported as a problem, but not auto-fixed

After (Next.js or other):

import { usePinoLogger } from '@/lib/usePinoLogger'
const logger = usePinoLogger()

logger.info('Hello')
logger.info('Info!')
logger.error('Oops!')
console.table(data) // still reported as a problem, but not auto-fixed

Advanced no-console Replacement

  • This rule is a drop-in, advanced replacement for no-console.
  • It reports all console.* usage, but only auto-fixes the most common logging methods to Pino logger equivalents.
  • You should disable the built-in no-console rule when using this plugin.

Framework Support

  • Nuxt 3: Auto-imports composables, so only the logger variable is inserted. → Tested and works.
  • Next.js/Other: Both import and variable are inserted. → Not tested, but should work as it uses the same logic.

License

MIT