repo_description: Payload is the open-source, fullstack Next.js framework, giving you instant backend superpowers. Get a full TypeScript backend and admin panel instantly. Use Payload as a headless CMS or for building powerful applications.
repo_topics: cms content-management content-management-system express graphql headless headless-cms jamstack javascript mit-license mongodb nextjs nodejs open-source payload payloadcms postgres react typescript
code: import payloadEsLintConfig from '@payloadcms/eslint-config'
  import payloadPlugin from '@payloadcms/eslint-plugin'
  import mdxTextParser from '@payloadcms/eslint-plugin/customRules/mdx-text-parser.js'
  
  export const defaultESLintIgnores = [
    '**/.temp',
    '**/.*', // ignore all dotfiles
    '**/.git',
    '**/.hg',
    '**/.pnp.*',
    '**/.svn',
    '**/playwright.config.ts',
    '**/vitest.config.ts',
    '**/vitest.setup.ts',
    '**/tsconfig.tsbuildinfo',
    '**/README.md',
    '**/eslint.config.js',
    '**/payload-types.ts',
    '**/dist/',
    '**/.yarn/',
    '**/build/',
    '**/node_modules/',
    '**/temp/',
    'packages/**/*.spec.ts',
    'next-env.d.ts',
    '**/app',
    'src/**/*.spec.ts',
    'packages/payload/rollup.dts.config.mjs',
    'scripts/**/*.js',
  ]
  
  /** @typedef {import('eslint').Linter.Config} Config */
  
  export const rootParserOptions = {
    sourceType: 'module',
    ecmaVersion: 'latest',
    projectService: true,
  }
  
  /** @type {Config[]} */
  export const rootEslintConfig = [
    ...payloadEsLintConfig,
    {
      ignores: [
        ...defaultESLintIgnores,
        'packages/eslint-*/**',
        'test/live-preview/next-app',
        'packages/**/*.spec.ts',
        'templates/**',
        'examples/**',
        'packages/drizzle/src/postgres/predefinedMigrations/v2-v3/**',
      ],
    },
    {
      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: ['packages/ui/**/*.{ts,tsx}'],
      rules: {
        'no-console': 'error',
      },
    },
    {
      files: ['scripts/**/*.ts'],
      rules: {
        '@typescript-eslint/no-unused-vars': 'off',
        'no-console': 'off',
        'perfectionist/sort-object-types': 'off',
        'perfectionist/sort-objects': 'off',
      },
    },
    {
      files: ['tools/**/*.ts'],
      rules: {
        'no-console': 'off',
        'perfectionist/sort-object-types': 'off',
        'perfectionist/sort-objects': 'off',
        'payload/no-relative-monorepo-imports': 'off',
      },
    },
  ]
  
  export default [
    ...rootEslintConfig,
    {
      files: ['packages/eslint-config/**/*.ts'],
      rules: {
        'perfectionist/sort-objects': 'off',
      },
    },
    {
      files: ['templates/vercel-postgres/**'],
      rules: {
        'no-restricted-exports': 'off',
      },
    },
    // MDX/Markdown documentation linting for code block languages
    {
      files: ['docs/**/*.mdx', 'docs/**/*.md'],
      plugins: {
        payload: payloadPlugin,
      },
      languageOptions: {
        parser: mdxTextParser,
      },
      rules: {
        'payload/valid-code-block-languages': 'error',
      },
    },
  ]
  