/
index.js
218 lines (217 loc) · 5.55 KB
/
index.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
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
/**
* @prettier
*/
// eslint-disable-next-line immutable/no-mutation
module.exports = {
env: {
browser: true,
es6: true,
'jest/globals': true,
},
extends: [
'airbnb',
'plugin:@typescript-eslint/recommended',
'plugin:import/errors',
'plugin:import/warnings',
'plugin:import/typescript',
'plugin:jest/recommended',
'plugin:jsx-a11y/recommended',
'plugin:lodash/recommended',
'plugin:react/recommended',
'prettier',
'prettier/@typescript-eslint',
],
parser: '@typescript-eslint/parser',
parserOptions: {
ecmaVersion: 2017,
},
plugins: [
'@typescript-eslint',
'disable',
'filenames',
'immutable',
'import',
'jest',
'jsx-a11y',
'lodash',
'new-with-error',
'no-loops',
'prettier',
'promise',
'react',
'react-hooks',
'security',
],
root: true,
rules: {
'@typescript-eslint/explicit-function-return-type': 'error',
'@typescript-eslint/explicit-member-accessibility': 'off',
'@typescript-eslint/indent': 'off',
'comma-dangle': ['error', 'only-multiline'],
'filenames/match-exported': [
'error',
['camel', 'pascal'],
'\\.(config|test)$',
],
'filenames/match-regex': 'off',
'function-paren-newline': 'off',
'immutable/no-let': 'off',
'immutable/no-mutation': 'error',
'immutable/no-this': 'off',
'import/extensions': [
'error',
'never',
{
css: 'always',
json: 'always',
},
],
'import/named': 'error',
'import/namespace': [
'error',
{
allowComputed: true,
},
],
'import/no-duplicates': 'error',
'import/no-extraneous-dependencies': [
'error',
{
devDependencies: ['**/*.config.*', '**/*.test.*', '**/test/**/*.*'],
},
],
'import/no-named-as-default': 'off',
'import/no-unresolved': 'warn',
'import/order': 'off',
'jsx-a11y/href-no-hash': 'off',
'lodash/import-scope': 'off',
'lodash/prefer-lodash-method': 'off',
'new-with-error/new-with-error': 'error',
'no-loops/no-loops': 'error',
'no-underscore-dangle': [
'error',
{
allow: ['__ENV__', '_id', '__typename', '_typename'],
allowAfterThis: true,
},
],
'prefer-destructuring': [
'off',
{
array: true,
object: true,
},
{
enforceForRenamedProperties: true,
},
],
'prettier/prettier': 'error',
'promise/always-return': 'error',
'promise/avoid-new': 'warn',
'promise/catch-or-return': 'error',
'promise/no-callback-in-promise': 'warn',
'promise/no-nesting': 'warn',
'promise/no-promise-in-callback': 'warn',
'promise/no-return-wrap': 'error',
'promise/param-names': 'error',
'promise/prefer-await-to-callbacks': 'warn',
'promise/prefer-await-to-then': 'warn',
'react-hooks/exhaustive-deps': 'warn',
'react-hooks/rules-of-hooks': 'error',
'react/boolean-prop-naming': 'error',
'react/destructuring-assignment': ['error', 'always'],
'react/jsx-filename-extension': [
'warn',
{
extensions: ['.js', '.ts', '.tsx'],
},
],
'react/jsx-fragments': ['error', 'syntax'],
'react/jsx-props-no-multi-spaces': 'warn',
'react/jsx-props-no-spreading': 'off',
'react/jsx-sort-props': [
'error',
{
callbacksLast: false,
ignoreCase: true,
noSortAlphabetically: false,
reservedFirst: false,
shorthandFirst: false,
shorthandLast: false,
},
],
'react/jsx-wrap-multilines': 'off',
'react/no-deprecated': 'error',
'react/no-multi-comp': ['error', { ignoreStateless: true }],
'react/no-this-in-sfc': 'error',
'react/no-typos': 'error',
'react/no-unescaped-entities': 'error',
'react/no-unused-prop-types': 'error',
'react/no-unused-state': 'error',
'react/prefer-stateless-function': 'error',
'react/react-in-jsx-scope': 'error',
'react/require-render-return': 'error',
'react/sort-comp': [
'error',
{
groups: {
lifecycle: [
'childContextTypes',
'constructor',
'getDefaultProps',
'getInitialState',
'getChildContext',
'componentWillMount',
'componentDidMount',
'componentWillReceiveProps',
'shouldComponentUpdate',
'componentWillUpdate',
'componentDidUpdate',
'componentWillUnmount',
],
'static-methods': [
'displayName',
'props',
'state',
'contextType',
'contextTypes',
'defaultProps',
'getInitialProps',
'navigationOptions',
],
},
order: ['static-methods', 'lifecycle', 'everything-else', 'render'],
},
],
'react/state-in-constructor': 'off',
'react/static-property-placement': 'off',
'security/detect-non-literal-regexp': 'error',
'security/detect-non-literal-require': 'error',
'security/detect-object-injection': 'off',
'security/detect-possible-timing-attacks': 'error',
'security/detect-unsafe-regex': 'error',
'sort-keys': [
'error',
'asc',
{
caseSensitive: false,
},
],
},
settings: {
'eslint-plugin-disable': {
paths: {
'@typescript-eslint': ['*.js', '**/*.js'],
},
},
'import/parsers': {
'@typescript-eslint/parser': ['.ts', '.tsx'],
},
jest: {
version: 26,
},
react: {
version: 'detect',
},
},
};