-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy patheslint.config.mjs
139 lines (130 loc) · 3.63 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
128
129
130
131
132
133
134
135
136
137
138
139
// @ts-check
import eslint from '@eslint/js'
import jestPlugin from 'eslint-plugin-jest'
import { flatConfigs as importConfigs } from 'eslint-plugin-import'
import nodePlugin from 'eslint-plugin-n'
import tseslint from 'typescript-eslint'
import eslintConfigPrettier from 'eslint-config-prettier'
import pluginReactHooks from 'eslint-plugin-react-hooks'
import pluginReact from 'eslint-plugin-react'
export default tseslint.config(
{
ignores: ['**/dist'],
},
{
files: ['**/*.js', '**/*.ts', '**/*.tsx'],
extends: [
eslint.configs.recommended,
tseslint.configs.recommended,
jestPlugin.configs['flat/recommended'],
// @ts-ignore
pluginReact.configs.flat.recommended,
// @ts-ignore
pluginReact.configs.flat['jsx-runtime'],
importConfigs.recommended,
importConfigs.typescript,
eslintConfigPrettier,
],
plugins: {
// @ts-ignore
'react-hooks': pluginReactHooks,
},
rules: {
'no-restricted-imports': ['error', { patterns: ['**/shared/**'] }],
'@typescript-eslint/ban-ts-ignore': 'off',
'@typescript-eslint/ban-types': 'off',
'@typescript-eslint/camelcase': 'off',
'@typescript-eslint/explicit-function-return-type': 'off',
'@typescript-eslint/explicit-member-accessibility': 'off',
'@typescript-eslint/no-empty-function': 'off',
'@typescript-eslint/no-explicit-any': 'off',
'@typescript-eslint/no-non-null-assertion': 'off',
'@typescript-eslint/no-object-literal-type-assertion': 'off',
'@typescript-eslint/no-unused-vars': 'off',
'@typescript-eslint/no-use-before-define': [
'error',
{ functions: false },
],
'import/namespace': 'off',
'import/no-duplicates': ['error'],
'import/no-extraneous-dependencies': ['error'],
'import/order': [
'error',
{
'newlines-between': 'always',
},
],
'react/display-name': 'off',
'react/prop-types': 'off',
'react/react-in-jsx-scope': 'off',
...pluginReactHooks.configs.recommended.rules,
'react-hooks/rules-of-hooks': 'error',
'react-hooks/exhaustive-deps': 'error',
'import/no-unresolved': 'off',
},
settings: {
react: {
version: 'detect',
},
'import/resolver': {
typescript: true,
node: true,
},
},
languageOptions: {
ecmaVersion: 'latest',
sourceType: 'module',
globals: jestPlugin.environments.globals.globals,
},
linterOptions: {
reportUnusedDisableDirectives: true,
},
},
{
files: ['*.tsx'],
rules: {
'@typescript-eslint/explicit-module-boundary-types': 'off',
},
},
{
files: ['config/**'],
rules: {
'import/no-extraneous-dependencies': [
'error',
{ devDependencies: false },
],
},
},
{
files: ['shared/**'],
extends: [nodePlugin.configs['flat/recommended-module']],
rules: {
'import/no-nodejs-modules': 'error',
'n/no-missing-import': 'off',
},
},
{
files: ['frontend/**'],
rules: {
'no-restricted-imports': [
'error',
{ patterns: ['**/shared/src/**', '@mdi/js'] },
],
'import/no-nodejs-modules': 'error',
'@typescript-eslint/no-unnecessary-type-constraint': 'off',
},
},
{
files: ['backend/**'],
extends: [nodePlugin.configs['flat/recommended-module']],
rules: {
'import/no-extraneous-dependencies': [
'error',
{ devDependencies: false },
],
'no-process-exit': 'off',
'n/no-missing-import': 'off',
'n/no-unpublished-import': 'off',
},
}
)