-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy patheslint.config.mjs
More file actions
82 lines (72 loc) · 2.9 KB
/
eslint.config.mjs
File metadata and controls
82 lines (72 loc) · 2.9 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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
import nextConfig from 'eslint-config-next'
import prettierConfig from 'eslint-config-prettier'
import pluginReact from 'eslint-plugin-react'
import simpleImportSort from 'eslint-plugin-simple-import-sort'
const config = [
// Ignore auto-generated and build output files
{
ignores: [
'.contentlayer/**',
'.next/**',
'node_modules/**',
'public/**',
],
},
// Next.js rules (includes react, react-hooks, import, jsx-a11y, @next/next)
...nextConfig,
// React recommended rules (flat config variant)
pluginReact.configs.flat.recommended,
// React 17+ JSX transform: no need to import React in scope
pluginReact.configs.flat['jsx-runtime'],
// Prettier: disables formatting rules that conflict with prettier
prettierConfig,
// Project-specific overrides
{
plugins: {
'simple-import-sort': simpleImportSort,
},
rules: {
'@next/next/no-img-element': 'off',
// Project does not use PropTypes (no TS either); disable the rule
'react/prop-types': 'off',
// New rules from react-hooks v7 (React Compiler patterns).
// Downgraded to warn: these are pre-existing issues, not regressions.
'react-hooks/static-components': 'warn',
'react-hooks/immutability': 'warn',
'react-hooks/preserve-manual-memoization': 'warn',
// ── Import organisation ──────────────────────────────────────────
// Disable the weaker built-in rule so simple-import-sort owns this
'import/order': 'off',
'sort-imports': 'off',
'simple-import-sort/imports': [
'error',
{
groups: [
// 1. React (core framework)
['^react$', '^react/'],
// 2. Next.js (meta-framework)
['^next$', '^next/'],
// 3. External npm packages
// @mui/*, other @-scoped, and unscoped packages
['^@mui/', '^@(?!pog|data)[^/]+', '^[a-z]'],
// 4. Internal project aliases (@pog/*)
['^@pog/'],
// 5. Data layer (@data/*, contentlayer)
['^@data/', '^contentlayer'],
// 6. Relative imports (./foo, ../foo)
['^\\.'],
// 7. Side-effect imports (CSS, global styles)
['^\\u0000'],
],
},
],
'simple-import-sort/exports': 'error',
},
settings: {
react: {
version: 'detect',
},
},
},
]
export default config