Registry / testing / eslint-plugin-pino

eslint-plugin-pino

JSON →
library1.0.3jsnpmunverified

ESLint plugin for enforcing correct pino logger usage patterns in Node.js applications. Currently at version 1.0.3 (released Oct 2024), maintained actively, with TypeScript type declarations included. Unlike generic ESLint rules, this plugin targets pino-specific conventions such as requiring object arguments before message strings in logging calls. It provides auto-fixable rules and a recommended configuration. Requires ESLint >=7.0.0 and Node >=14.0.0.

npm install eslint-plugin-pino
INSTALL
IMPORT
SIG · ESLINT-PLUGIN-PINO
E
eslint-plugin-pino
testingjavascriptv1.0.3
Install
Import
Disk
Pass rate
0/ 6
Env Coverage0 / 6
glibc
1822
musl
1822
Install & Compatibility
Where this runs
tested against v? · npm install
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
node 18226 runs
build_error
glibc
node 18226 runs
build_error
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

default
import pinoPlugin from 'eslint-plugin-pino'
const pinoPlugin = require('eslint-plugin-pino')
ESM default import; CommonJS require also works but is less common with TypeScript. The module exports a flat config object.
rules
import { rules } from 'eslint-plugin-pino'
Named export for accessing all rules object (e.g., rules['correct-args-position']).
configs
import { configs } from 'eslint-plugin-pino'
import configs from 'eslint-plugin-pino'
Named export for config presets like 'recommended'. Default import is the plugin object, not configs.

Shows how to configure the plugin in ESLint and demonstrates the correct-args-position rule with auto-fix.

// .eslintrc.json { "plugins": ["pino"], "rules": { "pino/correct-args-position": "error" } } // Example file: logger.js import pino from 'pino'; const logger = pino(); // ✅ Correct logger.info({userId: 123}, 'User logged in'); // ❌ Incorrect logger.info('User logged in', {userId: 123}); // Run: npx eslint . --fix
Debug
Known issues
gotchaRule only checks calls on pino logger instances; it cannot detect if a variable is a pino logger unless it's named 'logger' or recognized via type inference.
fix
Ensure your pino logger variable is named `logger` or use TypeScript types for inference.
affects: >=0.0.0
deprecatedThe rule `no-undefined-args` was deprecated in v0.5.0 and removed in v1.0.0; use `correct-args-position` instead.
fix
Replace 'pino/no-undefined-args' with 'pino/correct-args-position' in your ESLint config.
affects: >=1.0.0
gotchaAuto-fix may reorder arguments incorrectly if there are multiple objects or function calls; manual review recommended.
fix
Review auto-fix changes, especially in complex expressions.
affects: >=0.0.0
breakingPlugin now exports as ESM; CommonJS `require()` works but may cause issues in some Node versions prior to v16.
fix
If using `require`, ensure Node >=14 or switch to ES import.
affects: >=1.0.0
gotchaThe `recommended` config only includes `correct-args-position`. Other rules must be added manually.
fix
Check documentation for additional rules and add them explicitly if needed.
affects: >=0.0.0
Errors
Common errors & fixes
Error: Plugin 'pino' was conflicted between '...' and '...'
Duplicate plugin declaration in ESLint config (e.g., in both plugins and extends).
fix
Remove the duplicate plugin entry; keep only in `plugins` array or only in `extends`.
Invalid option '...' for rule 'pino/correct-args-position'
The rule does not accept any options in v1.0.0.
fix
Remove the options object from the rule configuration: just set `"pino/correct-args-position": "error"`.
TypeError: Cannot read properties of undefined (reading 'type')
The rule encounters an AST node that is not a CallExpression (e.g., a member expression not followed by call).
fix
Ensure the logger method is called with parentheses; e.g., `logger.info` without parentheses will be ignored but may cause unexpected errors in older versions.
ESLint: Configuration for rule 'pino/no-undefined-args' is invalid
Rule was removed in v1.0.0.
fix
Replace 'pino/no-undefined-args' with 'pino/correct-args-position'.
Upgrade
Version history
1.0.3latest on npm
Audit
Dependencies
eslintrequiredpeer dependency, required to use the plugin
Agent activity
19 hits · last 30 days
node
14
OpenAI (training)
3
Resources
eslint-plugin-pino — npm install eslint-plugin-pino · libregistry