/
.eslintrc.js
137 lines (137 loc) · 3.28 KB
/
.eslintrc.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
129
130
131
132
133
134
135
136
137
module.exports = {
env: {
browser: true,
es2022: true,
node: true,
worker: true,
},
extends: [
'eslint:recommended',
'plugin:@typescript-eslint/eslint-recommended',
'plugin:@typescript-eslint/recommended',
'plugin:react/recommended',
'plugin:react/jsx-runtime',
'plugin:import/recommended',
'plugin:import/typescript',
'plugin:jsx-a11y/recommended',
'plugin:playwright/playwright-test',
'plugin:sonarjs/recommended',
'plugin:typescript-sort-keys/recommended',
// HINT: prettier must be the last extension to work
'plugin:prettier/recommended',
],
ignorePatterns: ['build', 'dist', 'docker', 'node_modules', 'openshift', 'public'],
overrides: [
{
files: ['*.ts', '*.tsx'],
rules: {
'no-undef': 'off',
'no-unused-vars': 'off',
},
},
],
parser: '@typescript-eslint/parser',
plugins: [
'@typescript-eslint',
'jsx-a11y',
'react-hooks',
'react',
'sonarjs',
'sort-keys-fix',
'typescript-sort-keys',
'no-type-assertion',
// HINT: prettier must be the last plugin to work
'prettier',
],
rules: {
'@typescript-eslint/no-unused-vars': [
'warn',
{
argsIgnorePattern: '^_',
caughtErrorsIgnorePattern: '^_',
varsIgnorePattern: '^_',
},
],
'@typescript-eslint/sort-type-union-intersection-members': 'error',
camelcase: 'warn',
curly: 'error',
'import/no-unused-modules': [
'error',
{
ignoreExports: [
'playwright/index.ts',
'src/index.tsx',
'src/**/*.d.ts',
'src/**/*.{spec,test}.{ts,tsx}',
'*.{js,ts}', // mostly configuration files
],
missingExports: true,
src: ['.'],
unusedExports: true,
},
],
'import/order': [
'error',
{
alphabetize: {
caseInsensitive: true,
order: 'asc',
},
groups: ['builtin', 'external', 'internal'],
pathGroups: [
{
group: 'external',
pattern: 'react',
position: 'before',
},
],
pathGroupsExcludedImportTypes: ['react'],
},
],
'import/prefer-default-export': 'off',
'no-console': ['warn', { allow: ['warn', 'error'] }],
'no-type-assertion/no-type-assertion': 'error',
'prettier/prettier': 'error',
'react/jsx-sort-default-props': 'error',
'react/jsx-sort-props': [
'error',
{
callbacksLast: true,
ignoreCase: true,
noSortAlphabetically: false,
reservedFirst: true,
shorthandFirst: false,
shorthandLast: false,
},
],
'react-hooks/exhaustive-deps': 'error',
'react-hooks/rules-of-hooks': 'error',
'sort-imports': [
'error',
{
ignoreCase: true,
ignoreDeclarationSort: true,
ignoreMemberSort: false,
},
],
// Required to fix sort-keys automatically, since this is not done by default.
'sort-keys-fix/sort-keys-fix': [
'error',
'asc',
{
caseSensitive: false,
natural: true,
},
],
},
settings: {
'import/resolver': {
typescript: {
alwaysTryTypes: true,
},
},
react: {
version: 'detect',
},
},
};