-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy patheslint.config.mjs
More file actions
62 lines (60 loc) · 1.74 KB
/
Copy patheslint.config.mjs
File metadata and controls
62 lines (60 loc) · 1.74 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
import { defineConfig, globalIgnores } from 'eslint/config';
import nextVitals from 'eslint-config-next/core-web-vitals';
import nextTypescript from 'eslint-config-next/typescript';
import prettierConfig from 'eslint-config-prettier';
import storybook from 'eslint-plugin-storybook';
const eslintConfig = defineConfig([
...nextVitals,
...nextTypescript,
...storybook.configs['flat/recommended'],
// Turn off rules that might conflict with Prettier formatting
prettierConfig,
// Restrict importing server-only logger from non-server files
{
files: ['**/*.{ts,tsx}'],
rules: {
'no-restricted-imports': [
'error',
{
paths: [
{
name: '@/lib/logger.server',
message:
'Use "@/lib/logger.client" in browser/client code. Server logger is allowed only in server contexts (app/actions, server utilities).',
},
],
},
],
},
},
// Allow server logger in explicit server contexts
{
files: [
'app/actions/**/*.{ts,tsx}',
'lib/**/*.ts',
'lib/**/*.tsx',
'!lib/**/*.client.ts',
'!lib/**/*.client.tsx',
'lib/**/*server*.{ts,tsx}',
'lib/api/**/*.{ts,tsx}',
'lib/protopedia-client.ts',
],
rules: {
'no-restricted-imports': 'off',
},
},
// eslint-plugin-react (bundled by eslint-config-next) auto-detects the React
// version via context.getFilename(), which ESLint 10 removed. Pinning the
// version explicitly skips that detection path and avoids the crash.
{
settings: { react: { version: '19.2.7' } },
},
globalIgnores([
'.next/**',
'out/**',
'build/**',
'storybook-static/**',
'next-env.d.ts',
]),
]);
export default eslintConfig;