-
Notifications
You must be signed in to change notification settings - Fork 5
/
.eslintrc.js
129 lines (121 loc) · 3.88 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
module.exports = {
parser: '@typescript-eslint/parser',
plugins: ['@typescript-eslint', 'jest', 'jsx-expressions', 'prefer-arrow', 'react', 'react-hooks'],
extends: [
'airbnb',
'airbnb/hooks',
'plugin:@typescript-eslint/recommended',
'plugin:react/recommended',
'plugin:react-hooks/recommended',
'prettier',
'plugin:jest/recommended',
'plugin:jest/style',
],
env: {
es6: true,
'jest/globals': true,
},
ignorePatterns: [
'**/reports/',
'**/node_modules/',
'**/ios/',
'**/dist/',
'**/lib-dist/',
'**/patchfiles/',
'.eslintrc.js',
'babel.config.js',
'metro.config.js',
],
rules: {
// Overly strict rules (for now)
'no-shadow': 'off',
'react/display-name': 'off',
// Unwanted
'lines-between-class-members': 'off',
'import/extensions': 'off',
'import/prefer-default-export': 'off',
'react/require-default-props': 'off',
'jest/expect-expect': 'off',
'jsx-a11y/anchor-is-valid': 'off',
// Disabling since better @typescript-eslint rules available or they make no sense for ts projects
'default-case': 'off',
'no-use-before-define': 'off',
'import/no-unresolved': 'off',
'react/jsx-filename-extension': 'off',
curly: ['error', 'all'],
'func-names': 'error',
'no-magic-numbers': [
'error',
{
ignore: [-1, 0, 1, 2, 3, 4],
ignoreArrayIndexes: true,
},
],
'prefer-destructuring': ['error', { array: false }],
'prefer-object-spread': 'error',
'no-console': 'error',
'react/function-component-definition': [
'error',
{
namedComponents: 'arrow-function',
unnamedComponents: 'arrow-function',
},
],
'react/jsx-no-useless-fragment': ['error', { allowExpressions: true }],
'react/no-did-mount-set-state': 'error',
'react/no-unused-prop-types': 'warn',
'react-hooks/exhaustive-deps': 'error',
'@typescript-eslint/await-thenable': 'error',
'@typescript-eslint/ban-ts-comment': 'warn',
'@typescript-eslint/consistent-type-definitions': ['error', 'type'],
'@typescript-eslint/explicit-module-boundary-types': 'error',
'@typescript-eslint/no-empty-function': 'error',
'@typescript-eslint/no-explicit-any': 'error',
'@typescript-eslint/no-floating-promises': 'error',
'@typescript-eslint/no-unnecessary-condition': 'error',
'@typescript-eslint/no-unused-vars': [
'error',
{
argsIgnorePattern: '_(unused)?',
varsIgnorePattern: '_(unused)?',
ignoreRestSiblings: true,
},
],
'@typescript-eslint/no-use-before-define': 'error',
'@typescript-eslint/prefer-nullish-coalescing': 'error',
'@typescript-eslint/prefer-ts-expect-error': 'error',
'@typescript-eslint/restrict-template-expressions': 'error',
'@typescript-eslint/switch-exhaustiveness-check': 'error',
'jest/consistent-test-it': 'error',
'jest/no-alias-methods': 'error',
'prefer-arrow/prefer-arrow-functions': 'error',
'jsx-expressions/strict-logical-expressions': 'error',
},
parserOptions: {
project: './tsconfig.json',
},
overrides: [
{
files: ['*.spec.{ts,tsx}', '**/__mocks__/*.{ts,tsx}', '**/testing/*.{ts,tsx}', 'jest.setup.ts', 'jest.config.ts'],
rules: {
'global-require': 'off',
'no-console': 'off',
'no-magic-numbers': 'off',
'@typescript-eslint/no-var-requires': 'off',
'@typescript-eslint/no-non-null-assertion': 'off',
'@typescript-eslint/no-floating-promises': 'off',
'import/no-extraneous-dependencies': 'off',
'jsx-a11y/click-events-have-key-events': 'off',
'jsx-a11y/no-static-element-interactions': 'off',
'react/jsx-props-no-spreading': 'off',
},
},
{
files: ['**/tools/**'],
rules: {
'no-console': 'off',
'import/no-extraneous-dependencies': 'off',
},
},
],
}