TypeScript · correctness
require-static-next-matcher
eslint:require-static-next-matcher Require Next.js middleware and proxy matcher configuration to contain only build-time literals.
- Default
- error
- Fix
- none
- Languages
- typescript
Why
Next.js must statically analyze matcher values at build time; computed values are ignored.
Fix
Write matcher strings, arrays, and object fields as literals in the exported config.
Before / after
Executed by this rule’s unit tests.
Before
Do not compute the matcher
const matcher = "/api/:path*"; export const config = { matcher }; After
Use a literal matcher
export const config = { matcher: "/api/:path*" }; Message IDs
dynamicMatcher