-
Notifications
You must be signed in to change notification settings - Fork 24
/
Copy path.eslintrc.js
103 lines (103 loc) · 3.42 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
module.exports = {
extends: [
'react-app',
'eslint:recommended',
'plugin:@typescript-eslint/eslint-recommended',
'plugin:i18next/recommended',
'prettier',
],
plugins: ['es', '@typescript-eslint'],
rules: {
'i18next/no-literal-string': 'off',
'arrow-parens': 'error',
'brace-style': 'error',
curly: ['error'],
'es/no-dynamic-import': 'error',
'jsx-a11y/no-access-key': 'off',
'no-useless-escape': 'off',
quotes: [2, 'single'],
'keyword-spacing': [
'error',
{
before: true,
after: true,
},
],
'no-duplicate-imports': ['error', { includeExports: true }],
'eol-last': ['error', 'always'],
semi: ['error', 'always'],
'no-console': 'off',
'no-extra-boolean-cast': 'off',
'no-extra-semi': 'off',
'no-irregular-whitespace': 'off',
'import/named': ['error', 'always'],
'max-statements-per-line': ['error', { max: 1 }],
'no-process-env': ['error'],
'no-restricted-globals': [
'error',
{
name: 'URLSearchParams',
message: 'Use `query-string` package instead',
},
],
'no-restricted-syntax': [
'error',
{
selector: `VariableDeclarator[id.type='ObjectPattern'] Property[key.name='searchParams']`,
message:
'URL.searchParams is not allowed, Use `query-string` package instead',
},
{
selector: `CallExpression[callee.name='useSelector'] MemberExpression[object.name='state']`,
message:
'Please use a selector for any state accesses within useSelector',
},
{
selector: `CallExpression[callee.name='useSelector'] VariableDeclarator[id.type='ObjectPattern'][init.name='state']`,
message:
'Please use a selector for any state accesses within useSelector',
},
{
selector: `CallExpression[callee.name='useSelector'] *[type=/FunctionExpression$/][params.0.type='ObjectPattern']`,
message:
'Please use a selector for any state accesses within useSelector',
},
],
'react/jsx-wrap-multilines': [
'error',
{
arrow: 'parens',
condition: 'parens-new-line',
declaration: 'parens-new-line',
logical: 'parens-new-line',
return: 'parens-new-line',
},
],
'space-before-blocks': ['error'],
},
parser: '@typescript-eslint/parser',
settings: {
'import/ignore': ['packages/frontend/src/config/*'],
},
overrides: [
{
files: [
'packages/frontend/src/config/configFromEnvironment.ts',
'packages/frontend/ci/config.js',
'packages/e2e-tests/**',
],
rules: {
'no-process-env': ['off'],
},
},
{
files: ['*.ts', '*.tsx'],
rules: {
'no-undef': 'off',
'no-unused-vars': 'off',
'@typescript-eslint/no-unused-vars': 'error',
},
},
],
root: true,
};