-
Notifications
You must be signed in to change notification settings - Fork 11
/
eslint.config.mjs
80 lines (78 loc) · 1.93 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
// @ts-check
import eslint from '@eslint/js';
import globals from 'globals';
import tseslint from 'typescript-eslint';
import prettier from 'eslint-config-prettier';
import jest from 'eslint-plugin-jest';
import react from 'eslint-plugin-react';
import reactHooks from 'eslint-plugin-react-hooks';
import reactHooksAddons from 'eslint-plugin-react-hooks-addons';
export default tseslint.config(
eslint.configs.recommended,
...tseslint.configs.recommendedTypeChecked,
jest.configs['flat/recommended'],
jest.configs['flat/style'],
react.configs.flat.recommended,
reactHooksAddons.configs.recommended,
// @ts-ignore
prettier,
{
files: ['**/*.js', '**/*.mjs'],
...tseslint.configs.disableTypeChecked
},
{
ignores: [
'**/coverage/',
'**/dist/',
'**/example/',
'**/types/',
'**/build/',
'**/static/',
'**/.docusaurus/'
]
},
{
languageOptions: {
ecmaVersion: 'latest',
sourceType: 'module',
parserOptions: {
projectService: {
allowDefaultProject: ['*.js', '*.mjs']
},
tsconfigRootDir: import.meta.dirname,
ecmaFeatures: {
jsx: true
}
},
globals: {
...globals.browser,
...globals.node,
...globals.jest
}
},
plugins: {
jest,
react,
'react-hooks': reactHooks
},
settings: {
react: {
version: 'detect'
}
},
rules: {
'no-console': ['error', { allow: ['warn', 'error'] }],
'react/react-in-jsx-scope': 0,
'react/jsx-uses-react': 0,
'react/prop-types': 0,
'react-hooks/rules-of-hooks': 'error',
'react-hooks/exhaustive-deps': 'error',
'react-hooks-addons/no-unused-deps': 'error',
'@typescript-eslint/ban-ts-comment': 0,
'@typescript-eslint/no-unused-expressions': [
'error',
{ allowShortCircuit: true, allowTernary: true }
]
}
}
);