-
Notifications
You must be signed in to change notification settings - Fork 0
/
eslint.config.mjs
94 lines (88 loc) · 2.62 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
// @ts-check
import eslint from '@eslint/js'
import tsEslint from 'typescript-eslint'
import globals from 'globals'
import eslintReact from 'eslint-plugin-react'
import eslintReactHooks from 'eslint-plugin-react-hooks'
import eslintTailwindcss from 'eslint-plugin-tailwindcss'
export default tsEslint.config(
{
ignores: ['**/dist/**', '**/.idea/**', '**/node_modules/**'],
},
eslint.configs.recommended,
...tsEslint.configs.strictTypeChecked,
...tsEslint.configs.stylisticTypeChecked,
{
languageOptions: {
ecmaVersion: 2023,
sourceType: 'module',
parserOptions: {
project: true,
tsconfigRootDir: import.meta.dirname,
},
},
// plugins: { reactHooks, reactRefresh, tailwindcss },
rules: {
/* formatting */
indent: ['warn', 2, { 'SwitchCase': 1 }],
quotes: ['warn', 'single'],
semi: ['warn', 'never'],
'comma-dangle': ['warn', {
'arrays': 'always-multiline',
'objects': 'always-multiline',
'imports': 'only-multiline',
'exports': 'only-multiline',
'functions': 'never',
}],
'space-before-blocks': ['warn'],
'space-unary-ops': ['warn'],
'consistent-return': ['warn'],
'eol-last': ['warn'],
'no-else-return': ['warn'],
'no-empty-function': ['warn'],
'no-multiple-empty-lines': ['warn', { max: 1 }],
'no-trailing-spaces': ['warn'],
'object-curly-spacing': ['warn', 'always'],
/* typescript */
'@typescript-eslint/consistent-type-definitions': 'off',
'@typescript-eslint/no-confusing-void-expression': ['error', { ignoreArrowShorthand: true }],
'@typescript-eslint/no-unused-vars': 'off', // enforced by tsconfig
'@typescript-eslint/prefer-readonly': ['warn'],
'@typescript-eslint/switch-exhaustiveness-check': ['warn'],
/* tailwind */
// 'tailwindcss/no-custom-classname': 'off'
},
},
{
files: ['**/*.js', '**/*.mjs'],
...tsEslint.configs.disableTypeChecked,
},
{
files: ['expert-ui/src/**/*.tsx'],
plugins: {
'react': eslintReact,
'react-hooks': eslintReactHooks,
'tailwindcss': eslintTailwindcss,
},
settings: {
'react': {
version: 'detect',
},
},
languageOptions: {
parserOptions: {
ecmaFeatures: { jsx: true },
},
globals: {
...globals.browser,
},
},
rules: {
...eslintReact.configs.recommended.rules,
...eslintReactHooks.configs.recommended.rules,
'react/react-in-jsx-scope': 0,
'react/jsx-uses-react': 0,
...eslintTailwindcss.configs.recommended.rules,
},
}
)