-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy patheslint.config.mjs
127 lines (124 loc) · 3.18 KB
/
eslint.config.mjs
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
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
import { FlatCompat } from '@eslint/eslintrc';
const compat = new FlatCompat({
baseDirectory: import.meta.dirname,
});
const eslintConfig = [
{
ignores: ['.next/**/*', 'node_modules/**/*', 'out/**/*', 'tmp_old/**/*', 'public/**/*'],
},
...compat.config({
extends: ['next', 'next/typescript', 'prettier'],
plugins: ['perfectionist'],
rules: {
'perfectionist/sort-imports': [
'error',
{
type: 'natural',
order: 'asc',
groups: [
// Type imports
[
'builtin-type',
'external-type',
'internal-type',
'parent-type',
'sibling-type',
'index-type',
],
// React imports
'react',
// Next.js imports
'next',
// External libraries
['builtin', 'external'],
// Shadcn components
'shadcn',
// Feature components
'features',
// Other components
'components',
// Lib imports
'lib',
// Parent/sibling/index imports
['parent', 'sibling', 'index'],
// Style imports
'style',
],
customGroups: {
value: {
react: ['^react$', '^react-dom$', '^react/(.*)$'],
next: ['^next$', '^next/(.*)$'],
shadcn: ['^@/components/ui/(.*)$'],
features: ['^@/components/features/(.*)$'],
components: ['^@/components/(?!ui/|features/)(.*)$'],
lib: ['^@/lib/(.*)$'],
},
},
newlinesBetween: 'always',
internalPattern: ['^@/.*'],
},
],
'perfectionist/sort-union-types': [
'error',
{
type: 'natural',
order: 'asc',
groups: [
'keyword',
'named',
'literal',
'function',
'import',
'conditional',
'object',
'tuple',
'intersection',
'union',
'nullish',
],
newlinesBetween: 'never',
},
],
'perfectionist/sort-interfaces': [
'error',
{
type: 'natural',
order: 'asc',
groups: [
'index-signature',
'required-property',
'optional-property',
'required-method',
'optional-method',
'required-multiline-member',
'optional-multiline-member',
],
newlinesBetween: 'never',
},
],
'perfectionist/sort-variable-declarations': [
'error',
{
type: 'natural',
order: 'asc',
},
],
'perfectionist/sort-jsx-props': [
'error',
{
type: 'natural',
order: 'asc',
groups: ['multiline', 'callback', 'shorthand', 'unknown'],
customGroups: {
callback: '^on[A-Z]',
},
newlinesBetween: 'always',
},
],
},
}),
{
files: ['src/**/*.ts', 'src/**/*.tsx'],
},
];
export default eslintConfig;