This repository has been archived by the owner on Jul 9, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 10
/
.eslintrc.js
221 lines (221 loc) · 6.23 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
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
module.exports = {
env: {
// Global variables:
browser: true,
node: true,
es6: true,
// 'jest/globals': true, // Allows 'it', 'describe' etc.
},
extends: [
'airbnb',
'plugin:react/recommended',
'plugin:import/typescript',
// 'plugin:@typescript-eslint/recommended', // Allows for TypeScript-specific linting rules to run.
],
globals: {
PropTypes: false,
React: false,
uiVersion: false,
__VERSION__: false,
$: false,
},
parser: '@typescript-eslint/parser', // Specifies the ESLint parser to use TS.
parserOptions: { // provides extra rules.
ecmaFeatures: {
jsx: true,
},
ecmaVersion: 2018, // Allows for the parsing of modern ECMAScript features.
sourceType: 'module', // Allows for the use of imports.
},
plugins: [
'@typescript-eslint',
'react',
'react-hooks',
'sort-destructure-keys'
// 'jest'
],
rules: {
'array-bracket-newline': ['error', {
'multiline': true,
'minItems': 3,
}],
'array-element-newline': ['warn', {
'multiline': true,
'minItems': 3,
}],
'arrow-body-style': 'off',
'arrow-parens': 'off',
'camelcase': ['warn', {
allow: ["^UNSAFE_", "doc_count", "^active_"],
}],
'comma-dangle': ['warn', 'always-multiline'],
'consistent-return': ['warn', {
treatUndefinedAsUnspecified: true
}],
'func-names': ['warn', 'as-needed'],
'function-paren-newline': ['warn', 'consistent'],
'implicit-arrow-linebreak': 'off',
'indent': ['warn', 2, {
ArrayExpression: 'first',
CallExpression: { arguments: 'first' },
flatTernaryExpressions: true,
FunctionDeclaration: { parameters: 'first' },
FunctionExpression: { parameters: 'first' },
ignoreComments: true,
ignoredNodes: [
'ConditionalExpression',
'JSXAttribute',
'JSXClosingElement',
'JSXElement',
'JSXElement > *',
'JSXEmptyExpression',
'JSXExpressionContainer',
'JSXIdentifier',
'JSXMemberExpression',
'JSXNamespacedName',
'JSXOpeningElement',
'JSXSpreadAttribute',
'JSXSpreadChild',
'JSXText',
'TemplateLiteral > *',
],
ImportDeclaration: 'first',
MemberExpression: 1,
ObjectExpression: 'first',
SwitchCase: 1,
VariableDeclarator: 'first',
}],
'max-len': ['warn', {
code: 100,
ignoreComments: true,
ignoreStrings: true,
ignoreTemplateLiterals: true,
ignoreUrls: true,
}],
'multiline-ternary': ['warn', 'always-multiline'],
'no-console': ['warn', {
allow: [
'info',
'warn',
'error',
]
}],
'no-debugger': 'warn',
'no-fallthrough': ['warn', {
commentPattern: 'break[\\s\\w]*omitted',
}],
'no-nested-ternary': 'off',
'no-unneeded-ternary': 'warn',
'no-unused-expressions': ['warn', {
allowShortCircuit: true,
allowTaggedTemplates: true,
allowTernary: true,
}],
'no-var': 'error', // Must use const or let.
'object-property-newline': ['warn', {
// allowAllPropertiesOnSameLine: false,
}],
'object-curly-newline': 'warn', // ['warn', {
// ObjectExpression: {
// 'multiline': true,
// 'minProperties': 2,
// },
// ObjectPattern: {
// 'multiline': true,
// 'minProperties': 2,
// },
// ImportDeclaration: {
// 'multiline': true,
// 'minProperties': 2,
// },
// ExportDeclaration: {
// 'multiline': true,
// 'minProperties': 2,
// },
// }],
'operator-linebreak': ['warn', 'after', {
overrides: {
'?': 'before',
':': 'before',
}
}],
'padded-blocks': 'error',
'semi': ['warn', 'always'],
'sort-keys': ['warn', 'asc', {
caseSensitive: false,
natural: true,
}],
'quotes': ['warn', 'single'],
'import/no-extraneous-dependencies': ['warn', {
'packageDir': './'
}],
'react/jsx-closing-bracket-location': ['warn', 'props-aligned'],
'react/jsx-filename-extension': ['warn', {
extensions: [
'.js',
'.jsx',
'.tsx',
],
}],
'react/jsx-first-prop-new-line': ['warn', 'multiline'],
'react/jsx-fragments': ['error', 'element'],
'react/jsx-indent': ['warn', 2, {
checkAttributes: true,
indentLogicalExpressions: true,
}],
'react/jsx-indent-props': ['warn', 2],
'react/jsx-max-props-per-line': ['warn', {
maximum: 1,
when: 'multiline',
}],
'react/jsx-no-undef': ['error', {
allowGlobals: true,
}],
'react/jsx-one-expression-per-line': ['warn', {
allow: 'single-child',
}],
'react/jsx-sort-default-props': 'error',
'react/jsx-sort-props': ['warn', {
ignoreCase: true,
}],
'react/jsx-tag-spacing': ['warn', {
closingSlash: 'never',
beforeSelfClosing: 'always',
afterOpening: 'never',
beforeClosing: 'never',
}],
'react/jsx-wrap-multilines': ['error', {
declaration: 'parens-new-line',
assignment: 'parens-new-line',
return: 'parens-new-line',
arrow: 'parens-new-line',
condition: 'parens-new-line',
logical: 'parens-new-line',
prop: 'parens-new-line',
}],
'react/no-did-mount-set-state': 'warn',
'react/no-did-update-set-state': 'warn',
'react/no-direct-mutation-state': 'warn',
'react/no-multi-comp': 'warn',
'react/no-unknown-property': 'warn',
'react/sort-comp': 'warn',
'react/sort-prop-types': 'error',
'react/state-in-constructor': 'off',
'react/prop-types': 'off', // Disable prop-types as TS is used for type checking.
'sort-destructure-keys/sort-destructure-keys': ['warn', {
caseSensitive: false,
}],
'@typescript-eslint/explicit-function-return-type': 'off', // Allows functional components, should be fixed soon: https://github.com/typescript-eslint/typescript-eslint/issues/149
'@typescript-eslint/explicit-member-accessibility': 'off', // Allows not having to set public/private on class properties.
},
settings: {
'import/resolver': {
node: {
paths: ['./src/packages']
},
},
react: {
version: 'detect', // Automatically picks the version you have installed.
},
},
}