-
Notifications
You must be signed in to change notification settings - Fork 12
/
.eslintrc.js
122 lines (122 loc) · 3.21 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
module.exports = {
env: {
browser: true,
es6: true,
},
extends: [
'eslint:recommended',
'plugin:import/recommended',
'plugin:import/typescript',
'plugin:react/recommended',
'plugin:react-hooks/recommended',
'plugin:prettier/recommended',
],
globals: {
// Enable webpack require
require: 'readonly',
// Fix for eslint-plugin-flowtype/384 not supporting wildcard
_: 'readonly',
},
parser: '@typescript-eslint/parser',
settings: {
'import/resolver': {
typescript: {},
},
react: {
version: 'detect',
},
},
rules: {
'import/no-extraneous-dependencies': ['error'],
'no-shadow': ['error'],
'padding-line-between-statements': [
'error',
{ blankLine: 'always', prev: '*', next: 'return' },
],
'react/display-name': ['off'],
},
overrides: [
{
files: ['examples/**'],
rules: {
'import/no-extraneous-dependencies': ['off'],
'import/no-unresolved': ['off'],
},
},
{
// Enable a node environment for dot, config, and setup files, and any
// file under the script folder
env: {
node: true,
},
files: ['.*.js', '*.config.js', '*.setup.js', 'scripts/*'],
},
{
// Enable a jest environment for test files
env: {
jest: true,
},
extends: ['plugin:jest/recommended', 'plugin:jest/style'],
files: ['*.test.{js,ts,tsx}'],
rules: {
'jest/consistent-test-it': ['error'],
'jest/expect-expect': ['off'],
},
},
{
// Flow specific rules
extends: ['plugin:flowtype/recommended'],
files: ['*.js.flow', '*.flow.test.js', 'packages/**/*.js'],
plugins: ['flowtype'],
rules: {
'flowtype/generic-spacing': ['off'],
'import/no-extraneous-dependencies': ['off'],
'import/no-unresolved': ['off'],
'no-unused-vars': ['off'],
},
},
{
// TypeScript specific rules
extends: ['plugin:@typescript-eslint/recommended'],
files: ['*.{ts,tsx}'],
rules: {
'@typescript-eslint/ban-ts-comment': [
'error',
{
'ts-expect-error': 'allow-with-description',
'ts-ignore': 'allow-with-description',
},
],
'@typescript-eslint/explicit-function-return-type': 'off',
'@typescript-eslint/explicit-module-boundary-types': 'off',
'@typescript-eslint/no-explicit-any': 'off',
'@typescript-eslint/no-non-null-assertion': 'off',
'@typescript-eslint/no-use-before-define': 'off',
},
},
{
// TypeScript specific rules for type tests
files: ['*.typescript.test.{ts,tsx}'],
rules: {
'@typescript-eslint/no-unused-vars': 'off',
'import/no-extraneous-dependencies': ['off'],
'import/no-unresolved': ['off'],
},
},
// apps within test folders
{
files: ['**/__tests__/app/**', '**/__tests__/apps/**'],
rules: {
'import/no-extraneous-dependencies': ['off'],
},
},
// types folder
{
files: ['types/**'],
rules: {
'import/no-duplicates': ['off'],
'import/no-extraneous-dependencies': ['off'],
},
},
],
};