Files
payloadcms/packages/payload/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

32 lines
1.1 KiB
JavaScript

import { rootEslintConfig, rootParserOptions } from '../../eslint.config.js'
/** @typedef {import('eslint').Linter.Config} Config */
/**
* We've removed all eslint.config.js from the packages, but we have to leave this one as an exception.
* The payload package is so large that without its own eslint.config, an M3 Pro (18GB) runs out of
* memory when linting. Interestingly, two days ago when I started this PR, this didn't happen, but it
* started happening when I did a merge from main to update the PR.
* tsc also takes a long time to run. It's likely that at some point we'll need to split the package
* (into payload1, payload2, etc.) and re-export them in payload.
*/
/** @type {Config[]} */
export const index = [
...rootEslintConfig,
{
languageOptions: {
parserOptions: {
...rootParserOptions,
tsconfigRootDir: import.meta.dirname,
projectService: {
// See comment in packages/eslint-config/index.mjs
allowDefaultProject: ['bin.js', 'bundle.js', 'rollup.dts.config.mjs'],
},
},
},
},
]
export default index