57 lines
1.6 KiB
JavaScript
57 lines
1.6 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.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;
|