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.
94 lines
2.0 KiB
JavaScript
94 lines
2.0 KiB
JavaScript
import payloadEsLintConfig from '@payloadcms/eslint-config'
|
|
import payloadPlugin from '@payloadcms/eslint-plugin'
|
|
|
|
export const defaultESLintIgnores = [
|
|
'**/.temp',
|
|
'**/.*', // ignore all dotfiles
|
|
'**/.git',
|
|
'**/.hg',
|
|
'**/.pnp.*',
|
|
'**/.svn',
|
|
'**/playwright.config.ts',
|
|
'**/jest.config.js',
|
|
'**/tsconfig.tsbuildinfo',
|
|
'**/README.md',
|
|
'**/eslint.config.js',
|
|
'**/payload-types.ts',
|
|
'**/dist/',
|
|
'**/.yarn/',
|
|
'**/build/',
|
|
'**/node_modules/',
|
|
'**/temp/',
|
|
]
|
|
|
|
/** @typedef {import('eslint').Linter.Config} Config */
|
|
|
|
export const rootParserOptions = {
|
|
sourceType: 'module',
|
|
ecmaVersion: 'latest',
|
|
projectService: {
|
|
maximumDefaultProjectFileMatchCount_THIS_WILL_SLOW_DOWN_LINTING: 40,
|
|
allowDefaultProject: ['scripts/*.ts', '*.js', '*.mjs', '*.spec.ts', '*.d.ts'],
|
|
},
|
|
}
|
|
|
|
/** @type {Config[]} */
|
|
export const rootEslintConfig = [
|
|
...payloadEsLintConfig,
|
|
{
|
|
ignores: [
|
|
...defaultESLintIgnores,
|
|
'packages/eslint-*/**',
|
|
'test/live-preview/next-app',
|
|
'packages/**/*.spec.ts',
|
|
'templates/**',
|
|
],
|
|
},
|
|
{
|
|
plugins: {
|
|
payload: payloadPlugin,
|
|
},
|
|
rules: {
|
|
'payload/no-jsx-import-statements': 'warn',
|
|
'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',
|
|
},
|
|
},
|
|
{
|
|
files: ['scripts/**/*.ts'],
|
|
rules: {
|
|
'@typescript-eslint/no-unused-vars': 'off',
|
|
'no-console': 'off',
|
|
'perfectionist/sort-object-types': 'off',
|
|
'perfectionist/sort-objects': 'off',
|
|
},
|
|
},
|
|
]
|
|
|
|
export default [
|
|
...rootEslintConfig,
|
|
{
|
|
languageOptions: {
|
|
parserOptions: {
|
|
...rootParserOptions,
|
|
projectService: true,
|
|
tsconfigRootDir: import.meta.dirname,
|
|
},
|
|
},
|
|
},
|
|
{
|
|
files: ['packages/eslint-config/**/*.ts'],
|
|
rules: {
|
|
'perfectionist/sort-objects': 'off',
|
|
},
|
|
},
|
|
{
|
|
files: ['templates/vercel-postgres/**'],
|
|
rules: {
|
|
'no-restricted-exports': 'off',
|
|
},
|
|
},
|
|
]
|