Files
payloadcms/eslint.config.js
Alessio Gravili 9bcb7b0d9d feat: bundle types (#14020)
This PR updates the build process to generate a single
`dist/index.bundled.d.ts` file that bundles all `payload` package types.

Having one bundled declaration file makes it easy to load types into the
Monaco editor (e.g. for the new Code block), enabling full type
completion for the `payload` package.

## Example

```ts
 BlocksFeature({
        blocks: [
          CodeBlock({
            slug: 'PayloadCode',
            languages: {
              ts: 'TypeScript',
            },
            typescript: {
              fetchTypes: [
                {
                  filePath: 'file:///node_modules/payload/index.d.ts',
                  url: 'https://unpkg.com/payload@3.59.0-internal.e247081/dist/index.bundled.d.ts', // <= download bundled .d.ts
                },
              ],
              paths: {
                payload: ['file:///node_modules/payload/index.d.ts'],
              },
              typeRoots: ['node_modules/@types', 'node_modules/payload'],
            },
          }),
        ],
      }),
```

<img width="1506" height="866" alt="Screenshot 2025-10-01 at 12 38
54@2x"
src="https://github.com/user-attachments/assets/135b9b69-058a-42b9-afa0-daa328f64f38"
/>




---
- To see the specific tasks where the Asana app for GitHub is being
used, see below:
  - https://app.asana.com/0/0/1211524241290884
2025-10-01 22:05:37 +00:00

98 lines
2.1 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/',
'packages/**/*.spec.ts',
'next-env.d.ts',
'**/app',
'src/**/*.spec.ts',
'**/jest.setup.js',
'packages/payload/rollup.dts.config.mjs',
]
/** @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/**',
],
},
{
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',
},
},
{
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',
},
},
]