chore(eslint): payload logger usage (#8578)

Payload uses `pino` for a logger. When using the error logger
`payload.logger.error` it is possible to pass any number of arguments
like this: `payload.logger.error('Some error ocurred', err)`. However,
in this scenario, the full error will not be serialized by `pino`. It
must be passed as the `err` property inside of an object in order to be
properly serialized.

This rule ensures that a user is using this function call to properly serialize the error.
This commit is contained in:
Elliot DeNolf
2024-10-06 13:23:30 -07:00
committed by GitHub
parent d88e0617d6
commit 7aed0d7c2e
4 changed files with 167 additions and 1 deletions

View File

@@ -53,6 +53,7 @@ export const rootEslintConfig = [
'payload/no-relative-monorepo-imports': 'error',
'payload/no-imports-from-exports-dir': 'error',
'payload/no-imports-from-self': 'error',
'payload/proper-payload-logger-usage': 'error',
},
},
{