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-pinoVerified import paths — ran on the pinned version, not inferred.
Shows how to configure the plugin in ESLint and demonstrates the correct-args-position rule with auto-fix.
Ensure your pino logger variable is named `logger` or use TypeScript types for inference.
Replace 'pino/no-undefined-args' with 'pino/correct-args-position' in your ESLint config.
Review auto-fix changes, especially in complex expressions.
If using `require`, ensure Node >=14 or switch to ES import.
Check documentation for additional rules and add them explicitly if needed.
Remove the duplicate plugin entry; keep only in `plugins` array or only in `extends`.
Remove the options object from the rule configuration: just set `"pino/correct-args-position": "error"`.
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.
Replace 'pino/no-undefined-args' with 'pino/correct-args-position'.