{"id":19873,"library":"eslint-plugin-pino","title":"eslint-plugin-pino","description":"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.","status":"active","version":"1.0.3","language":"javascript","source_language":"en","source_url":null,"tags":["javascript","eslint","eslintplugin","pino","logging","linter","typescript"],"install":[{"cmd":"npm install eslint-plugin-pino","lang":"bash","label":"npm"},{"cmd":"yarn add eslint-plugin-pino","lang":"bash","label":"yarn"},{"cmd":"pnpm add eslint-plugin-pino","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"peer dependency, required to use the plugin","package":"eslint","optional":false}],"imports":[{"note":"ESM default import; CommonJS require also works but is less common with TypeScript. The module exports a flat config object.","wrong":"const pinoPlugin = require('eslint-plugin-pino')","symbol":"default","correct":"import pinoPlugin from 'eslint-plugin-pino'"},{"note":"Named export for accessing all rules object (e.g., rules['correct-args-position']).","wrong":"","symbol":"rules","correct":"import { rules } from 'eslint-plugin-pino'"},{"note":"Named export for config presets like 'recommended'. Default import is the plugin object, not configs.","wrong":"import configs from 'eslint-plugin-pino'","symbol":"configs","correct":"import { configs } from 'eslint-plugin-pino'"}],"quickstart":{"code":"// .eslintrc.json\n{\n  \"plugins\": [\"pino\"],\n  \"rules\": {\n    \"pino/correct-args-position\": \"error\"\n  }\n}\n\n// Example file: logger.js\nimport pino from 'pino';\nconst logger = pino();\n\n// ✅ Correct\nlogger.info({userId: 123}, 'User logged in');\n\n// ❌ Incorrect\nlogger.info('User logged in', {userId: 123});\n\n// Run: npx eslint . --fix","lang":"typescript","description":"Shows how to configure the plugin in ESLint and demonstrates the correct-args-position rule with auto-fix."},"warnings":[{"fix":"Ensure your pino logger variable is named `logger` or use TypeScript types for inference.","message":"Rule 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.","severity":"gotcha","affected_versions":">=0.0.0"},{"fix":"Replace 'pino/no-undefined-args' with 'pino/correct-args-position' in your ESLint config.","message":"The rule `no-undefined-args` was deprecated in v0.5.0 and removed in v1.0.0; use `correct-args-position` instead.","severity":"deprecated","affected_versions":">=1.0.0"},{"fix":"Review auto-fix changes, especially in complex expressions.","message":"Auto-fix may reorder arguments incorrectly if there are multiple objects or function calls; manual review recommended.","severity":"gotcha","affected_versions":">=0.0.0"},{"fix":"If using `require`, ensure Node >=14 or switch to ES import.","message":"Plugin now exports as ESM; CommonJS `require()` works but may cause issues in some Node versions prior to v16.","severity":"breaking","affected_versions":">=1.0.0"},{"fix":"Check documentation for additional rules and add them explicitly if needed.","message":"The `recommended` config only includes `correct-args-position`. Other rules must be added manually.","severity":"gotcha","affected_versions":">=0.0.0"}],"env_vars":null,"last_verified":"2026-04-25T00:00:00.000Z","next_check":"2026-07-24T00:00:00.000Z","problems":[{"fix":"Remove the duplicate plugin entry; keep only in `plugins` array or only in `extends`.","cause":"Duplicate plugin declaration in ESLint config (e.g., in both plugins and extends).","error":"Error: Plugin 'pino' was conflicted between '...' and '...'"},{"fix":"Remove the options object from the rule configuration: just set `\"pino/correct-args-position\": \"error\"`.","cause":"The rule does not accept any options in v1.0.0.","error":"Invalid option '...' for rule 'pino/correct-args-position'"},{"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.","cause":"The rule encounters an AST node that is not a CallExpression (e.g., a member expression not followed by call).","error":"TypeError: Cannot read properties of undefined (reading 'type')"},{"fix":"Replace 'pino/no-undefined-args' with 'pino/correct-args-position'.","cause":"Rule was removed in v1.0.0.","error":"ESLint: Configuration for rule 'pino/no-undefined-args' is invalid"}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}