-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy patheslint.config.mjs
114 lines (107 loc) · 2.76 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
import eslint from '@eslint/js'
import importPlugin from 'eslint-plugin-import'
import eslintPluginReact from 'eslint-plugin-react'
import eslintPluginReactHooks from 'eslint-plugin-react-hooks'
import eslintPluginReactRefresh from 'eslint-plugin-react-refresh'
import eslintPluginUnicorn from 'eslint-plugin-unicorn'
import tseslint from 'typescript-eslint'
export default tseslint.config(
{
ignores: [
'**/dist',
'**/vite.config.ts',
'tailwind.config.js',
'eslint.config.mjs',
'postcss.config.js',
],
},
{
languageOptions: {
parserOptions: {
project: ['./tsconfig.app.json'],
tsconfigRootDir: import.meta.dirname,
},
},
settings: {
react: {
version: 'detect',
},
},
},
eslint.configs.recommended,
...tseslint.configs.recommended,
...tseslint.configs.stylisticTypeChecked,
...tseslint.configs.strictTypeChecked,
importPlugin.flatConfigs.recommended,
eslintPluginReact.configs.flat.recommended,
{
plugins: {
'react-hooks': eslintPluginReactHooks,
},
rules: eslintPluginReactHooks.configs.recommended.rules,
},
eslintPluginUnicorn.configs['flat/recommended'],
{
// in main config for TSX/JSX source files
plugins: {
'react-refresh': eslintPluginReactRefresh,
},
rules: {},
},
{
rules: {
'no-console': [
'warn',
{
allow: ['error', 'warn'],
},
],
curly: 'error',
'@typescript-eslint/consistent-type-imports': 'error',
'@typescript-eslint/restrict-template-expressions': 'off',
'@typescript-eslint/no-non-null-assertion': 'off',
'unicorn/prefer-global-this': 'off',
'unicorn/prevent-abbreviations': 'off',
'unicorn/no-null': 'off',
'unicorn/no-nested-ternary': 'off',
'unicorn/filename-case': 'off',
'react/react-in-jsx-scope': 'off',
'import/no-unresolved': 'off',
'import/order': [
'error',
{
named: true,
'newlines-between': 'always',
alphabetize: {
order: 'asc',
},
groups: [
'builtin',
['external', 'internal'],
['parent', 'sibling', 'index', 'object'],
'type',
],
pathGroups: [
{
group: 'builtin',
pattern: 'react',
position: 'before',
},
{
group: 'external',
pattern: '@mui/icons-material',
position: 'after',
},
],
pathGroupsExcludedImportTypes: ['react'],
},
],
'react-refresh/only-export-components': [
'warn',
{
allowConstantExport: true,
},
],
},
},
)