-
Notifications
You must be signed in to change notification settings - Fork 112
/
.eslintrc.js
83 lines (73 loc) · 2.08 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
// @ts-check
module.exports = {
plugins: ['react', 'import', 'react-hooks', '@typescript-eslint'],
extends: ['prettier', 'plugin:@typescript-eslint/recommended'],
parser: '@typescript-eslint/parser',
env: {
node: true,
browser: true,
es6: true
},
globals: {
google: true
},
settings: {
react: {
version: 'detect'
}
},
ignorePatterns: ['node_modules', '**/dist*/**/*.js'],
parserOptions: {
ecmaVersion: 2020,
sourceType: 'module'
},
rules: {
'no-continue': 'off',
'no-console': ['error', {allow: ['warn', 'error']}]
},
overrides: [
{
files: ['examples/**/*'],
rules: {
'no-process-env': 'off'
}
},
{
files: ['./{src,examples}/**/*.{ts,mts,cts,tsx}'],
rules: {
// Some of JS rules don't always work correctly in TS and
// hence need to be reimported as TS rules
'no-redeclare': 'off',
'no-shadow': 'off',
'no-use-before-define': 'off',
'no-dupe-class-members': 'off',
// typescript does a good job tracking return types
'consistent-return': 'off',
'no-undef': 'off',
'react-hooks/rules-of-hooks': 'error',
'react-hooks/exhaustive-deps': [
'error',
{additionalHooks: '(useDeepCompareEffect)'}
],
'react/jsx-no-constructed-context-values': 'error',
// We use function hoisting to put exports at top of file
'@typescript-eslint/no-use-before-define': 'off',
'@typescript-eslint/no-dupe-class-members': ['error'],
// We encourage explicit typing, e.g `field: string = ''`
'@typescript-eslint/no-inferrable-types': 'off',
'@typescript-eslint/no-unused-vars': [
'warn',
{ignoreRestSiblings: true, destructuredArrayIgnorePattern: '^_'}
]
},
parserOptions: {project: ['**/tsconfig.json']}
},
{
files: ['**/__tests__/**/*.{ts,tsx}'],
rules: {
'@typescript-eslint/no-empty-function': 'off',
'@typescript-eslint/no-non-null-assertion': 'off'
}
}
]
};