35 lines
981 B
JavaScript
35 lines
981 B
JavaScript
import { defineConfig, globalIgnores } from 'eslint/config';
|
|
import nextVitals from 'eslint-config-next/core-web-vitals';
|
|
import nextTs from 'eslint-config-next/typescript';
|
|
|
|
const eslintConfig = defineConfig([
|
|
...nextVitals,
|
|
...nextTs,
|
|
|
|
// Ban raw fetch() for internal /api/ routes — prevents API envelope mismatch bugs
|
|
{
|
|
rules: {
|
|
'react-hooks/set-state-in-effect': 'off',
|
|
'no-restricted-syntax': [
|
|
'error',
|
|
{
|
|
selector: "CallExpression[callee.type='MemberExpression'][callee.object.name='fetch']",
|
|
message:
|
|
'Use fetchApi<T>() from @/lib/api-fetch instead of raw fetch(). Internal API routes return {data, success} envelope that must be unwrapped.',
|
|
},
|
|
],
|
|
},
|
|
},
|
|
|
|
// Override default ignores of eslint-config-next.
|
|
globalIgnores([
|
|
// Default ignores of eslint-config-next:
|
|
'.next/**',
|
|
'out/**',
|
|
'build/**',
|
|
'next-env.d.ts',
|
|
]),
|
|
]);
|
|
|
|
export default eslintConfig;
|