What is the documentation issue?
Per
|
`rewrites` is an async function that expects to return either an array or an object of arrays (see below) holding objects with `source` and `destination` properties: |
and the type definition (
|
rewrites?: () => Promise< |
),
rewrites is an async function. The examples, however, neither
await anything, nor explicitly return a promise.
JavaScript of course wraps the return value in a promise, so this works, but it may be considered bad form. And some of us have our linters turned up to 11.
Is there any context that might help us understand?
I ran an automated installation script for PostHog, which added this configuration and produced an eslint failure, and that led me to noticing this in the Next.js documentation.

I know that it's trivial to work around and I have done so, but I thought it might be worth considering changing the docs.
Does the docs page already exist? Please link to it.
https://nextjs.org/docs/app/api-reference/config/next-config-js/rewrites
What is the documentation issue?
Per
next.js/docs/01-app/04-api-reference/05-config/01-next-config-js/rewrites.mdx
Line 39 in a41152e
next.js/packages/next/src/server/config-shared.ts
Line 727 in a41152e
rewritesis an async function. The examples, however, neitherawaitanything, nor explicitly return a promise.JavaScript of course wraps the return value in a promise, so this works, but it may be considered bad form. And some of us have our linters turned up to 11.
Is there any context that might help us understand?
I ran an automated installation script for PostHog, which added this configuration and produced an eslint failure, and that led me to noticing this in the Next.js documentation.
I know that it's trivial to work around and I have done so, but I thought it might be worth considering changing the docs.
Does the docs page already exist? Please link to it.
https://nextjs.org/docs/app/api-reference/config/next-config-js/rewrites