forked from Joystream/atlas
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.eslintrc.js
89 lines (86 loc) · 2.4 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
module.exports = {
env: {
browser: true,
node: true,
es6: true,
jest: true,
},
parser: '@typescript-eslint/parser',
extends: [
'plugin:jest-dom/recommended',
'eslint:recommended',
'plugin:@typescript-eslint/recommended',
'plugin:react/recommended',
'plugin:react-hooks/recommended',
'plugin:react/jsx-runtime',
// turns off the rules which may conflict with prettier
'prettier',
],
plugins: ['@emotion', '@typescript-eslint', 'unused-imports'],
settings: {
react: {
version: 'detect',
},
},
rules: {
// force using Logger object
'no-console': ['warn'],
'no-duplicate-imports': ['warn'],
// taken care of by typescript
'react/prop-types': 'off',
// disallow default React import, force destructuring instead
'no-restricted-syntax': [
'error',
{
selector: "ImportDeclaration[source.value='react'][specifiers.0.type='ImportDefaultSpecifier']",
message: 'Default React import not allowed',
},
],
'react/jsx-curly-brace-presence': ['warn', { props: 'never', children: 'never' }],
'react/self-closing-comp': [
'warn',
{
'component': true,
'html': true,
},
],
// add exhaustive deps check to custom hooks
'react-hooks/exhaustive-deps': [
'warn',
{
'additionalHooks': 'useDeepMemo',
},
],
'react/no-unescaped-entities': 'off',
// disable explicit return types
'@typescript-eslint/explicit-module-boundary-types': 'off',
// use plugin for fixing unused imports
'@typescript-eslint/no-unused-vars': 'off',
'unused-imports/no-unused-imports': 'error',
// allow "_" prefixed function arguments
'unused-imports/no-unused-vars': [
'warn',
{ 'args': 'after-used', 'argsIgnorePattern': '^_', 'ignoreRestSiblings': true, 'varsIgnorePattern': '^_+$' },
],
'@typescript-eslint/no-empty-function': 'warn',
'@typescript-eslint/class-name-casing': 'off',
'@typescript-eslint/ban-ts-comment': [
'error',
{
'ts-ignore': 'allow-with-description',
},
],
'@typescript-eslint/ban-types': [
'error',
{
types: {
object: false,
},
},
],
// make sure we use the proper Emotion imports
'@emotion/pkg-renaming': 'error',
'@emotion/no-vanilla': 'error',
'@emotion/syntax-preference': [2, 'string'],
},
}