Files
2026-08-13 23:20:22 +07:00

61 lines
1.8 KiB
JavaScript

import { reactConfig } from './react.js';
/**
* Next.js App Router config.
*
* Note: the App Router *requires* default exports for `page`/`layout`/`route`
* and friends, so the workspace-wide `no-default-export` rule is relaxed for
* those files only — everywhere else named exports remain mandatory.
*
* @type {import("eslint").Linter.Config[]}
*/
export const nextConfig = [
...reactConfig,
{
files: [
'src/app/**/{page,layout,template,loading,error,not-found,default,route,global-error,sitemap,robots,opengraph-image,icon,apple-icon,manifest}.{ts,tsx}',
'src/middleware.ts',
// Next.js 16 renamed the middleware convention to `proxy`.
'src/proxy.ts',
// next-intl requires a default export from its request config.
'src/i18n/request.ts',
'next.config.{ts,mjs,js}',
'instrumentation.ts',
],
rules: {
'import-x/no-default-export': 'off',
},
},
{
files: ['src/**/*.{ts,tsx}'],
rules: {
// The storefront and admin must reach the backend only through the
// generated API client — never with ad-hoc fetch calls or a DB driver.
'no-restricted-imports': [
'error',
{
paths: [
{
name: '@prisma/client',
message:
'Frontend apps must never talk to the database. Use @sport/api-client instead.',
},
{
name: 'ioredis',
message: 'Frontend apps must never talk to Redis. Use @sport/api-client instead.',
},
],
patterns: [
{
group: ['@sport/api/*', '@sport/api'],
message: 'Frontend apps must not import backend code. Use @sport/api-client.',
},
],
},
],
},
},
];
export default nextConfig;