forked from flyteorg/flyteconsole
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.eslintrc.js
168 lines (160 loc) · 4.74 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
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
module.exports = {
root: true,
env: {
browser: true,
es2021: true,
jest: true,
},
globals: {
// global variables, that should be assumed by eslint as defined
JSX: true,
RequiredNonNullable: true,
Dictionary: true,
},
parser: '@typescript-eslint/parser',
parserOptions: {
ecmaFeatures: {
jsx: true,
},
ecmaVersion: 'latest',
sourceType: 'module',
},
extends: ['plugin:react/recommended', 'airbnb', 'prettier'],
plugins: ['react', '@typescript-eslint'],
settings: {
'import/resolver': {
node: {
extensions: ['.js', '.jsx', '.ts', '.tsx'],
},
},
},
rules: {
/**
* Rules we don't want to be enabled
* "off" or 0: turn off the rule completely; "warn" or 1; "error" or 2
*/
'arrow-body-style': 'off',
'import/extensions': 'off',
'import/no-unresolved': 'off',
'import/prefer-default-export': 'off',
'react/jsx-boolean-value': 'off',
'react/jsx-filename-extension': [2, { extensions: ['.jsx', '.tsx'] }],
'lines-between-class-members': [
'error',
'always',
{ exceptAfterSingleLine: true },
],
// disabled to let "@typescript-eslint/*" rules do it's job
'no-unused-vars': 'off',
'@typescript-eslint/no-unused-vars': ['warn', { argsIgnorePattern: '^_' }],
'no-redeclare': 'off',
'@typescript-eslint/no-redeclare': [
'warn',
{ ignoreDeclarationMerge: true },
], // still will warn on exporting enums :(
/**
* Up for discussion
* */
'react/function-component-definition': 'off',
'react/destructuring-assignment': 'off',
/**
* temporarily off or warn
* */
// some setup of eslint or prettier needed
'import/no-extraneous-dependencies': 'off', // 715 - !important
'react/jsx-props-no-spreading': 'off', // 119
// classic
'no-use-before-define': 'off', // 49
'no-shadow': 'off', // 104
'no-param-reassign': 'off', // 28
'no-unused-expressions': 'warn', // 5
'prefer-destructuring': 'off', // 34
'no-empty-function': 'off',
'no-useless-constructor': 'warn', // 1
'no-useless-computed-key': 'off',
'no-restricted-syntax': 'off',
'no-else-return': 'off',
'no-plusplus': 'off',
'no-var': 'off',
'no-continue': 'off',
'no-unsafe-optional-chaining': 'off',
'no-throw-literal': 'off',
'no-lonely-if': 'off',
'no-useless-return': 'off',
'no-return-await': 'off',
'no-nested-ternary': 'off',
'no-restricted-globals': 'off',
'no-return-assign': 'off',
'no-await-in-loop': 'off',
'no-undef-init': 'off',
'no-unneeded-ternary': 'off',
'no-underscore-dangle': 'off',
'prefer-object-spread': 'off',
'prefer-template': 'off',
'default-case': 'off',
'valid-typeof': 'off',
'object-shorthand': 'off',
'operator-assignment': 'off',
'array-callback-return': 'off',
'global-require': 'off',
'dot-notation': 'off',
'guard-for-in': 'off',
'one-var': 'off',
'vars-on-top': 'off',
'consistent-return': 'off',
'prefer-promise-reject-errors': 'off',
'prefer-arrow-callback': 'off',
'func-names': 'off',
eqeqeq: 'warn', // 12
// import
'import/no-dynamic-require': 'warn', // 1
// react
'react/button-has-type': 'off', // 5
'react/jsx-no-useless-fragment': 'off', // 15
'react/no-access-state-in-setstate': 'warn', // 2
'react/jsx-no-bind': 'warn', // 3
'react/prop-types': 'off', // 69
'react/self-closing-comp': 'off',
'react/jsx-no-constructed-context-values': 'off',
'react/no-unstable-nested-components': 'off',
'react/no-unescaped-entities': 'off',
'react/require-default-props': 'off',
'react/no-unused-prop-types': 'off', // 15
'react/no-array-index-key': 'warn', // 2
'react/static-property-placement': 'warn', // 1
'react/state-in-constructor': 'warn', // 2
'react/no-children-prop': 'warn', // 1
// jsx-a11y
'jsx-a11y/anchor-is-valid': 'off', // 4
'jsx-a11y/no-noninteractive-element-interactions': 'off', // 1
'jsx-a11y/click-events-have-key-events': 'off', // 7
'jsx-a11y/no-static-element-interactions': 'off', // 6
},
overrides: [
{
// overrides for test files
files: [
'*.spec.*',
'*.test.*',
'*.stories.*',
'src/**/test/*',
'src/**/mocks/*',
],
rules: {
camelcase: 'off',
'@typescript-eslint/no-explicit-any': 'off',
'import/no-extraneous-dependencies': 'off',
'no-console': 'off',
'jsx-a11y/aria-role': 'off',
'jsx-a11y/control-has-associated-label': 'off',
},
},
{
// rules which not make sense for TS files
files: ['*.ts', '*.tsx'],
rules: {
'no-undef': 'off',
},
},
],
};