-
Notifications
You must be signed in to change notification settings - Fork 27
/
eslint.config.js
128 lines (124 loc) · 3.76 KB
/
eslint.config.js
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
import eslint from '@eslint/js';
import tsPlugin from '@typescript-eslint/eslint-plugin';
import importPlugin from 'eslint-plugin-import';
import jsxA11yPlugin from 'eslint-plugin-jsx-a11y';
import prettier from 'eslint-plugin-prettier';
import eslintPluginPrettier from 'eslint-plugin-prettier/recommended';
import reactPlugin from 'eslint-plugin-react';
import reactHooks from 'eslint-plugin-react-hooks';
import reactRefresh from 'eslint-plugin-react-refresh';
import globals from 'globals';
import tseslint from 'typescript-eslint';
export default tseslint
.config(
eslint.configs.recommended,
tseslint.configs.recommended,
jsxA11yPlugin.flatConfigs.recommended,
{
files: ['**/*.{js,ts,tsx}'],
ignores: [
'dist/*',
'node_modules/*',
'*.fixture.ts',
'typings.d.ts',
'.cache-loader',
'cypress',
'src/permissions/enums.ts',
'src/EventsEnums.ts',
'src/FeaturesEnums.ts',
'src/SettingsDescription.ts',
'src/features/FeaturesDescription.ts',
'*.spec.tsx',
'*.spec.ts',
'*.fixture.tsx',
'vite-plugin-react-displayname.ts',
],
plugins: {
'@typescript-eslint': tsPlugin,
react: reactPlugin,
'react-hooks': reactHooks,
prettier: prettier,
import: importPlugin,
'react-refresh': reactRefresh,
},
languageOptions: {
parserOptions: {
ecmaVersion: 2020,
},
globals: globals.browser,
},
settings: {
react: {
version: 'detect',
},
'import/resolver': {
alias: {
map: [['@waldur', './src']],
extensions: ['.ts', '.tsx', '.js', '.jsx', '.json'],
},
typescript: {
paths: './tsconfig.json',
},
},
},
rules: {
...reactHooks.configs.recommended.rules,
// React Hooks rules
'react-hooks/rules-of-hooks': 'off',
'react-hooks/exhaustive-deps': 'off',
// Existing rules
'react/jsx-no-useless-fragment': ['error', { allowExpressions: true }],
'react/jsx-curly-brace-presence': [
'error',
{ props: 'never', children: 'never' },
],
'react/self-closing-comp': 'error',
'react-refresh/only-export-components': [
'off',
{ allowConstantExport: true },
],
'@typescript-eslint/explicit-function-return-type': 'off',
'@typescript-eslint/camelcase': 'off',
'@typescript-eslint/no-explicit-any': 'off',
'@typescript-eslint/no-unused-vars': [
'error',
{ varsIgnorePattern: '^_' },
],
'@typescript-eslint/ban-ts-comment': 'off',
'@typescript-eslint/no-empty-object-type': 'off',
'@typescript-eslint/explicit-module-boundary-types': 'off',
'@typescript-eslint/ban-types': 'off',
'@typescript-eslint/no-unused-expressions': 'off',
'import/order': [
'error',
{
'newlines-between': 'always',
pathGroups: [
{
pattern: '@waldur/**',
group: 'internal',
position: 'after',
},
],
groups: [
'builtin',
'external',
'internal',
'parent',
'sibling',
'index',
],
alphabetize: {
order: 'asc',
caseInsensitive: true,
},
},
],
'no-console': 'error',
'import/no-named-as-default': 'error',
'require-await': 'error',
'jsx-a11y/no-autofocus': ['error', { ignoreNonDOM: true }],
},
},
)
.concat(eslintPluginPrettier);