@ololoepepe/eslint-config-typescript 0.0.10 → 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -96,6 +96,10 @@ export default {
96
96
  allowDestructuring: true,
97
97
  allowedNames: []
98
98
  }],
99
+ '@typescript-eslint/no-unnecessary-boolean-literal-compare': ['error', {
100
+ allowComparingNullableBooleansToFalse: true,
101
+ allowComparingNullableBooleansToTrue: true
102
+ }],
99
103
  '@typescript-eslint/no-unnecessary-condition': ['error', {
100
104
  allowConstantLoopConditions: 'only-allowed-literals',
101
105
  checkTypePredicates: false
@@ -145,6 +149,7 @@ export default {
145
149
  variables: true
146
150
  }],
147
151
  '@typescript-eslint/no-useless-constructor': 'error',
152
+ '@typescript-eslint/no-useless-default-assignment': 'error',
148
153
  '@typescript-eslint/no-useless-empty-export': 'error',
149
154
  '@typescript-eslint/no-wrapper-object-types': 'error'
150
155
  };
@@ -0,0 +1,329 @@
1
+ export default {
2
+ rules: {
3
+ 'unicorn/better-dom-traversing': 'error',
4
+ 'unicorn/catch-error-name': 'error',
5
+ 'unicorn/class-reference-in-static-methods': 'error',
6
+ 'unicorn/comment-content': 'off',
7
+ 'unicorn/consistent-assert': 'error',
8
+ 'unicorn/consistent-boolean-name': 'error',
9
+ 'unicorn/consistent-class-member-order': 'error',
10
+ 'unicorn/consistent-compound-words': 'error',
11
+ 'unicorn/consistent-conditional-object-spread': 'error',
12
+ 'unicorn/consistent-date-clone': 'error',
13
+ 'unicorn/consistent-destructuring': 'off',
14
+ 'unicorn/consistent-empty-array-spread': 'error',
15
+ 'unicorn/consistent-existence-index-check': 'error',
16
+ 'unicorn/consistent-export-decorator-position': 'error',
17
+ 'unicorn/consistent-function-scoping': 'error',
18
+ 'unicorn/consistent-function-style': 'off',
19
+ 'unicorn/consistent-json-file-read': 'error',
20
+ 'unicorn/consistent-optional-chaining': 'error',
21
+ 'unicorn/consistent-template-literal-escape': 'error',
22
+ 'unicorn/consistent-tuple-labels': 'error',
23
+ 'unicorn/custom-error-definition': 'off',
24
+ 'unicorn/default-export-style': 'error',
25
+ 'unicorn/dom-node-dataset': 'error',
26
+ 'unicorn/empty-brace-spaces': 'error',
27
+ 'unicorn/error-message': 'error',
28
+ 'unicorn/escape-case': 'error',
29
+ 'unicorn/expiring-todo-comments': 'error',
30
+ 'unicorn/explicit-length-check': 'error',
31
+ 'unicorn/explicit-timer-delay': 'error',
32
+ 'unicorn/filename-case': ['error', {
33
+ case: 'kebabCase'
34
+ }],
35
+ 'unicorn/id-match': 'off',
36
+ 'unicorn/import-style': 'off',
37
+ 'unicorn/isolated-functions': 'error',
38
+ // NOTE: Disabled — core `logical-assignment-operators` owns this concern.
39
+ 'unicorn/logical-assignment-operators': 'off',
40
+ 'unicorn/max-nested-calls': 'error',
41
+ 'unicorn/name-replacements': 'error',
42
+ 'unicorn/new-for-builtins': 'error',
43
+ 'unicorn/no-abusive-eslint-disable': 'error',
44
+ 'unicorn/no-accessor-recursion': 'error',
45
+ 'unicorn/no-accidental-bitwise-operator': 'error',
46
+ 'unicorn/no-anonymous-default-export': 'error',
47
+ 'unicorn/no-array-callback-reference': 'off',
48
+ 'unicorn/no-array-concat-in-loop': 'error',
49
+ 'unicorn/no-array-fill-with-reference-type': 'error',
50
+ 'unicorn/no-array-from-fill': 'error',
51
+ 'unicorn/no-array-front-mutation': 'off',
52
+ 'unicorn/no-array-method-this-argument': 'error',
53
+ 'unicorn/no-array-reduce': 'off',
54
+ 'unicorn/no-array-reverse': 'error',
55
+ 'unicorn/no-array-sort': 'error',
56
+ 'unicorn/no-array-sort-for-min-max': 'error',
57
+ 'unicorn/no-array-splice': 'error',
58
+ 'unicorn/no-asterisk-prefix-in-documentation-comments': 'off',
59
+ 'unicorn/no-await-expression-member': 'error',
60
+ 'unicorn/no-await-in-promise-methods': 'error',
61
+ 'unicorn/no-blob-to-file': 'error',
62
+ 'unicorn/no-boolean-sort-comparator': 'error',
63
+ 'unicorn/no-break-in-nested-loop': 'error',
64
+ 'unicorn/no-canvas-to-image': 'error',
65
+ 'unicorn/no-chained-comparison': 'error',
66
+ 'unicorn/no-collection-bracket-access': 'error',
67
+ 'unicorn/no-computed-property-existence-check': 'error',
68
+ 'unicorn/no-confusing-array-splice': 'error',
69
+ 'unicorn/no-confusing-array-with': 'error',
70
+ 'unicorn/no-console-spaces': 'error',
71
+ 'unicorn/no-constant-zero-expression': 'error',
72
+ 'unicorn/no-declarations-before-early-exit': 'error',
73
+ 'unicorn/no-document-cookie': 'error',
74
+ 'unicorn/no-double-comparison': 'error',
75
+ 'unicorn/no-duplicate-if-branches': 'error',
76
+ 'unicorn/no-duplicate-logical-operands': 'error',
77
+ 'unicorn/no-duplicate-loops': 'error',
78
+ 'unicorn/no-duplicate-set-values': 'error',
79
+ 'unicorn/no-empty-file': 'error',
80
+ 'unicorn/no-error-property-assignment': 'error',
81
+ 'unicorn/no-exports-in-scripts': 'error',
82
+ 'unicorn/no-for-each': 'error',
83
+ 'unicorn/no-for-loop': 'error',
84
+ 'unicorn/no-global-object-property-assignment': 'error',
85
+ 'unicorn/no-immediate-mutation': 'error',
86
+ 'unicorn/no-impossible-length-comparison': 'error',
87
+ 'unicorn/no-incorrect-query-selector': 'error',
88
+ 'unicorn/no-incorrect-template-string-interpolation': 'error',
89
+ 'unicorn/no-instanceof-builtins': 'error',
90
+ 'unicorn/no-invalid-argument-count': 'error',
91
+ 'unicorn/no-invalid-character-comparison': 'error',
92
+ 'unicorn/no-invalid-fetch-options': 'error',
93
+ 'unicorn/no-invalid-file-input-accept': 'off',
94
+ 'unicorn/no-invalid-remove-event-listener': 'error',
95
+ 'unicorn/no-invalid-well-known-symbol-methods': 'error',
96
+ 'unicorn/no-keyword-prefix': 'off',
97
+ 'unicorn/no-late-current-target-access': 'error',
98
+ 'unicorn/no-late-event-control': 'error',
99
+ // NOTE: Disabled — core `no-lonely-if` owns this concern.
100
+ 'unicorn/no-lonely-if': 'off',
101
+ 'unicorn/no-loop-iterable-mutation': 'error',
102
+ 'unicorn/no-magic-array-flat-depth': 'error',
103
+ 'unicorn/no-manually-wrapped-comments': 'off',
104
+ 'unicorn/no-mismatched-map-key': 'error',
105
+ 'unicorn/no-misrefactored-assignment': 'error',
106
+ 'unicorn/no-named-default': 'error',
107
+ 'unicorn/no-negated-array-predicate': 'error',
108
+ 'unicorn/no-negated-comparison': 'error',
109
+ // NOTE: Disabled — core `no-negated-condition` owns this concern.
110
+ 'unicorn/no-negated-condition': 'off',
111
+ 'unicorn/no-negation-in-equality-check': 'error',
112
+ 'unicorn/no-nested-ternary': 'off',
113
+ 'unicorn/no-new-array': 'error',
114
+ 'unicorn/no-new-buffer': 'error',
115
+ 'unicorn/no-non-function-verb-prefix': 'error',
116
+ 'unicorn/no-nonstandard-builtin-properties': 'error',
117
+ 'unicorn/no-null': 'off',
118
+ 'unicorn/no-object-as-default-parameter': 'error',
119
+ 'unicorn/no-object-methods-with-collections': 'error',
120
+ 'unicorn/no-optional-chaining-on-undeclared-variable': 'error',
121
+ 'unicorn/no-process-exit': 'off',
122
+ 'unicorn/no-redundant-comparison': 'error',
123
+ 'unicorn/no-return-array-push': 'error',
124
+ 'unicorn/no-selector-as-dom-name': 'error',
125
+ 'unicorn/no-single-promise-in-promise-methods': 'error',
126
+ 'unicorn/no-static-only-class': 'error',
127
+ 'unicorn/no-subtraction-comparison': 'error',
128
+ 'unicorn/no-thenable': 'error',
129
+ 'unicorn/no-this-assignment': 'error',
130
+ 'unicorn/no-this-outside-of-class': 'error',
131
+ 'unicorn/no-top-level-assignment-in-function': 'error',
132
+ 'unicorn/no-top-level-side-effects': 'off',
133
+ 'unicorn/no-typeof-undefined': 'error',
134
+ 'unicorn/no-uncalled-method': 'error',
135
+ 'unicorn/no-undeclared-class-members': 'error',
136
+ 'unicorn/no-unnecessary-array-flat-depth': 'error',
137
+ 'unicorn/no-unnecessary-array-splice-count': 'error',
138
+ 'unicorn/no-unnecessary-await': 'error',
139
+ 'unicorn/no-unnecessary-boolean-comparison': 'error',
140
+ 'unicorn/no-unnecessary-global-this': 'error',
141
+ 'unicorn/no-unnecessary-nested-ternary': 'error',
142
+ 'unicorn/no-unnecessary-polyfills': 'error',
143
+ 'unicorn/no-unnecessary-slice-end': 'error',
144
+ 'unicorn/no-unnecessary-splice': 'error',
145
+ 'unicorn/no-unreadable-array-destructuring': 'error',
146
+ 'unicorn/no-unreadable-for-of-expression': 'error',
147
+ 'unicorn/no-unreadable-iife': 'error',
148
+ 'unicorn/no-unreadable-new-expression': 'off',
149
+ 'unicorn/no-unreadable-object-destructuring': 'error',
150
+ 'unicorn/no-unsafe-buffer-conversion': 'error',
151
+ 'unicorn/no-unsafe-dom-html': 'off',
152
+ 'unicorn/no-unsafe-property-key': 'error',
153
+ 'unicorn/no-unsafe-string-replacement': 'error',
154
+ 'unicorn/no-unused-array-method-return': 'error',
155
+ 'unicorn/no-unused-properties': 'off',
156
+ 'unicorn/no-useless-boolean-cast': 'error',
157
+ 'unicorn/no-useless-coercion': 'error',
158
+ 'unicorn/no-useless-collection-argument': 'error',
159
+ 'unicorn/no-useless-compound-assignment': 'error',
160
+ // NOTE: Disabled — core `no-useless-concat` owns this concern.
161
+ 'unicorn/no-useless-concat': 'off',
162
+ 'unicorn/no-useless-continue': 'error',
163
+ 'unicorn/no-useless-delete-check': 'error',
164
+ 'unicorn/no-useless-else': 'error',
165
+ 'unicorn/no-useless-error-capture-stack-trace': 'error',
166
+ 'unicorn/no-useless-fallback-in-spread': 'error',
167
+ 'unicorn/no-useless-iterator-to-array': 'error',
168
+ 'unicorn/no-useless-length-check': 'error',
169
+ 'unicorn/no-useless-logical-operand': 'error',
170
+ 'unicorn/no-useless-override': 'error',
171
+ 'unicorn/no-useless-promise-resolve-reject': 'error',
172
+ 'unicorn/no-useless-recursion': 'error',
173
+ 'unicorn/no-useless-spread': 'error',
174
+ 'unicorn/no-useless-switch-case': 'error',
175
+ 'unicorn/no-useless-template-literals': 'error',
176
+ 'unicorn/no-useless-undefined': 'error',
177
+ 'unicorn/no-xor-as-exponentiation': 'error',
178
+ 'unicorn/no-zero-fractions': 'error',
179
+ 'unicorn/number-literal-case': 'error',
180
+ 'unicorn/numeric-separators-style': 'error',
181
+ // NOTE: Disabled — core `operator-assignment` owns this concern.
182
+ 'unicorn/operator-assignment': 'off',
183
+ 'unicorn/prefer-abort-signal-timeout': 'error',
184
+ 'unicorn/prefer-add-event-listener': 'error',
185
+ 'unicorn/prefer-add-event-listener-options': 'error',
186
+ 'unicorn/prefer-aggregate-error': 'error',
187
+ 'unicorn/prefer-array-find': 'error',
188
+ 'unicorn/prefer-array-flat': 'error',
189
+ 'unicorn/prefer-array-flat-map': 'error',
190
+ 'unicorn/prefer-array-from-async': 'error',
191
+ 'unicorn/prefer-array-from-map': 'error',
192
+ 'unicorn/prefer-array-index-of': 'error',
193
+ 'unicorn/prefer-array-iterable-methods': 'error',
194
+ 'unicorn/prefer-array-last-methods': 'error',
195
+ 'unicorn/prefer-array-slice': 'error',
196
+ 'unicorn/prefer-array-some': 'error',
197
+ 'unicorn/prefer-at': 'error',
198
+ 'unicorn/prefer-await': 'error',
199
+ 'unicorn/prefer-bigint-literals': 'error',
200
+ 'unicorn/prefer-blob-reading-methods': 'error',
201
+ 'unicorn/prefer-boolean-return': 'error',
202
+ 'unicorn/prefer-class-fields': 'error',
203
+ 'unicorn/prefer-classlist-toggle': 'error',
204
+ 'unicorn/prefer-code-point': 'error',
205
+ 'unicorn/prefer-continue': 'error',
206
+ 'unicorn/prefer-date-now': 'error',
207
+ 'unicorn/prefer-default-parameters': 'error',
208
+ 'unicorn/prefer-direct-iteration': 'error',
209
+ 'unicorn/prefer-dispose': 'off',
210
+ 'unicorn/prefer-dom-node-append': 'error',
211
+ 'unicorn/prefer-dom-node-html-methods': 'off',
212
+ 'unicorn/prefer-dom-node-remove': 'error',
213
+ 'unicorn/prefer-dom-node-replace-children': 'error',
214
+ 'unicorn/prefer-dom-node-text-content': 'error',
215
+ 'unicorn/prefer-early-return': 'error',
216
+ 'unicorn/prefer-else-if': 'error',
217
+ 'unicorn/prefer-error-is-error': 'off',
218
+ 'unicorn/prefer-event-target': 'error',
219
+ 'unicorn/prefer-export-from': 'error',
220
+ 'unicorn/prefer-flat-math-min-max': 'error',
221
+ 'unicorn/prefer-get-or-insert-computed': 'error',
222
+ 'unicorn/prefer-global-number-constants': 'error',
223
+ 'unicorn/prefer-global-this': 'error',
224
+ 'unicorn/prefer-has-check': 'error',
225
+ 'unicorn/prefer-hoisting-branch-code': 'error',
226
+ 'unicorn/prefer-https': 'error',
227
+ 'unicorn/prefer-identifier-import-export-specifiers': 'error',
228
+ 'unicorn/prefer-import-meta-properties': 'off',
229
+ // NOTE: Disabled — typed `@typescript-eslint/prefer-includes` owns this concern.
230
+ 'unicorn/prefer-includes': 'off',
231
+ 'unicorn/prefer-includes-over-repeated-comparisons': 'error',
232
+ 'unicorn/prefer-iterable-in-constructor': 'error',
233
+ 'unicorn/prefer-iterator-concat': 'off',
234
+ 'unicorn/prefer-iterator-to-array': 'error',
235
+ 'unicorn/prefer-iterator-to-array-at-end': 'error',
236
+ 'unicorn/prefer-keyboard-event-key': 'error',
237
+ 'unicorn/prefer-location-assign': 'error',
238
+ 'unicorn/prefer-logical-operator-over-ternary': 'error',
239
+ 'unicorn/prefer-map-from-entries': 'error',
240
+ 'unicorn/prefer-math-abs': 'error',
241
+ 'unicorn/prefer-math-constants': 'error',
242
+ 'unicorn/prefer-math-min-max': 'error',
243
+ 'unicorn/prefer-math-trunc': 'error',
244
+ 'unicorn/prefer-minimal-ternary': 'error',
245
+ 'unicorn/prefer-modern-dom-apis': 'error',
246
+ 'unicorn/prefer-modern-math-apis': 'error',
247
+ 'unicorn/prefer-module': 'error',
248
+ 'unicorn/prefer-native-coercion-functions': 'error',
249
+ 'unicorn/prefer-negative-index': 'error',
250
+ 'unicorn/prefer-node-protocol': 'off',
251
+ 'unicorn/prefer-number-coercion': 'error',
252
+ 'unicorn/prefer-number-is-safe-integer': 'error',
253
+ 'unicorn/prefer-number-properties': 'error',
254
+ 'unicorn/prefer-object-define-properties': 'error',
255
+ 'unicorn/prefer-object-destructuring-defaults': 'error',
256
+ 'unicorn/prefer-object-from-entries': 'error',
257
+ 'unicorn/prefer-object-iterable-methods': 'error',
258
+ 'unicorn/prefer-observer-apis': 'error',
259
+ 'unicorn/prefer-optional-catch-binding': 'error',
260
+ 'unicorn/prefer-path2d': 'error',
261
+ 'unicorn/prefer-private-class-fields': 'error',
262
+ 'unicorn/prefer-promise-try': 'error',
263
+ 'unicorn/prefer-promise-with-resolvers': 'error',
264
+ 'unicorn/prefer-prototype-methods': 'error',
265
+ 'unicorn/prefer-query-selector': 'error',
266
+ 'unicorn/prefer-queue-microtask': 'error',
267
+ 'unicorn/prefer-reflect-apply': 'error',
268
+ 'unicorn/prefer-regexp-escape': 'off',
269
+ // NOTE: Disabled — `eslint-plugin-regexp` owns regular-expression concerns.
270
+ 'unicorn/prefer-regexp-test': 'off',
271
+ 'unicorn/prefer-response-static-json': 'error',
272
+ 'unicorn/prefer-scoped-selector': 'error',
273
+ 'unicorn/prefer-set-has': 'error',
274
+ 'unicorn/prefer-set-methods': 'error',
275
+ 'unicorn/prefer-set-size': 'error',
276
+ 'unicorn/prefer-short-arrow-method': 'off',
277
+ 'unicorn/prefer-simple-condition-first': 'error',
278
+ 'unicorn/prefer-simple-sort-comparator': 'error',
279
+ 'unicorn/prefer-single-array-predicate': 'error',
280
+ 'unicorn/prefer-single-call': 'error',
281
+ 'unicorn/prefer-single-object-destructuring': 'error',
282
+ 'unicorn/prefer-single-replace': 'error',
283
+ 'unicorn/prefer-smaller-scope': 'error',
284
+ 'unicorn/prefer-split-limit': 'error',
285
+ 'unicorn/prefer-spread': 'error',
286
+ 'unicorn/prefer-string-match-all': 'error',
287
+ 'unicorn/prefer-string-pad-start-end': 'error',
288
+ 'unicorn/prefer-string-raw': 'error',
289
+ 'unicorn/prefer-string-repeat': 'error',
290
+ 'unicorn/prefer-string-replace-all': 'error',
291
+ 'unicorn/prefer-string-slice': 'error',
292
+ // NOTE: Disabled — typed `@typescript-eslint/prefer-string-starts-ends-with` owns this concern.
293
+ 'unicorn/prefer-string-starts-ends-with': 'off',
294
+ 'unicorn/prefer-string-trim-start-end': 'error',
295
+ 'unicorn/prefer-structured-clone': 'error',
296
+ 'unicorn/prefer-switch': 'error',
297
+ 'unicorn/prefer-temporal': 'off',
298
+ 'unicorn/prefer-ternary': 'error',
299
+ 'unicorn/prefer-toggle-attribute': 'error',
300
+ 'unicorn/prefer-top-level-await': 'error',
301
+ 'unicorn/prefer-type-error': 'error',
302
+ 'unicorn/prefer-type-literal-last': 'error',
303
+ 'unicorn/prefer-uint8array-base64': 'error',
304
+ 'unicorn/prefer-unary-minus': 'error',
305
+ 'unicorn/prefer-unicode-code-point-escapes': 'error',
306
+ 'unicorn/prefer-url-can-parse': 'error',
307
+ 'unicorn/prefer-url-href': 'error',
308
+ 'unicorn/prefer-url-search-parameters': 'error',
309
+ 'unicorn/prefer-while-loop-condition': 'error',
310
+ 'unicorn/relative-url-style': 'error',
311
+ 'unicorn/require-array-join-separator': 'error',
312
+ // NOTE: Disabled — typed `@typescript-eslint/require-array-sort-compare` owns this concern.
313
+ 'unicorn/require-array-sort-compare': 'off',
314
+ 'unicorn/require-css-escape': 'error',
315
+ 'unicorn/require-module-attributes': 'error',
316
+ 'unicorn/require-module-specifiers': 'error',
317
+ 'unicorn/require-number-to-fixed-digits-argument': 'error',
318
+ 'unicorn/require-passive-events': 'error',
319
+ 'unicorn/require-post-message-target-origin': 'off',
320
+ 'unicorn/require-proxy-trap-boolean-return': 'error',
321
+ 'unicorn/string-content': 'off',
322
+ 'unicorn/switch-case-braces': 'error',
323
+ 'unicorn/switch-case-break-position': 'error',
324
+ 'unicorn/template-indent': 'error',
325
+ 'unicorn/text-encoding-identifier-case': 'error',
326
+ 'unicorn/throw-new-error': 'error',
327
+ 'unicorn/try-complexity': 'off'
328
+ }
329
+ };
package/src/react.js ADDED
@@ -0,0 +1,48 @@
1
+ /* eslint-disable @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-unsafe-member-access --
2
+ The ESLint plugins and globals registered in this wiring file are untyped
3
+ third-party modules, so the typed-linting rules treat them as `any`. Suppress
4
+ the unsafe-access reports for the whole file. */
5
+ import eslintReact from '@eslint-react/eslint-plugin';
6
+ import stylistic from '@stylistic/eslint-plugin';
7
+ import reactHooks from 'eslint-plugin-react-hooks';
8
+ import globals from 'globals';
9
+
10
+ import base from '#src/index.js';
11
+ import pluginReactHooks from '#src/plugins/react-hooks.js';
12
+ import pluginReact from '#src/plugins/react.js';
13
+ import rulesJsxStylistic from '#src/rules/jsx-stylistic.js';
14
+
15
+ export default [
16
+ ...base,
17
+ {
18
+ files: ['**/*.tsx', '**/*.jsx'],
19
+ languageOptions: {
20
+ globals: {
21
+ ...globals.browser
22
+ },
23
+ parserOptions: {
24
+ ecmaFeatures: {
25
+ jsx: true
26
+ }
27
+ }
28
+ },
29
+ name: '@ololoepepe/eslint-config-typescript/react',
30
+ plugins: {
31
+ '@eslint-react': eslintReact,
32
+ '@stylistic': stylistic,
33
+ 'react-hooks': reactHooks
34
+ },
35
+ rules: {
36
+ ...rulesJsxStylistic.rules,
37
+ ...pluginReact.rules,
38
+ ...pluginReactHooks.rules
39
+ },
40
+ settings: {
41
+ 'react-x': {
42
+ importSource: 'react',
43
+ polymorphicPropName: 'as',
44
+ version: 'detect'
45
+ }
46
+ }
47
+ }
48
+ ];
@@ -0,0 +1,126 @@
1
+ export default {
2
+ 'accessor-pairs': ['warn', {
3
+ enforceForClassMembers: true,
4
+ getWithoutSet: false,
5
+ setWithoutGet: true
6
+ }],
7
+ 'array-callback-return': ['error', {
8
+ allowImplicit: false,
9
+ checkForEach: false
10
+ }],
11
+ 'arrow-body-style': ['error', 'as-needed'],
12
+ 'block-scoped-var': 'error',
13
+ camelcase: ['error', {
14
+ ignoreDestructuring: false,
15
+ ignoreGlobals: true,
16
+ ignoreImports: false,
17
+ properties: 'never'
18
+ }],
19
+ 'capitalized-comments': ['error', 'always', {
20
+ ignoreConsecutiveComments: true,
21
+ ignoreInlineComments: false,
22
+ ignorePattern: 'webpackChunkName'
23
+ }],
24
+ 'class-methods-use-this': 'off',
25
+ complexity: ['warn', 20],
26
+ 'consistent-return': 'off',
27
+ 'consistent-this': ['error', 'self'],
28
+ 'constructor-super': 'error',
29
+ curly: ['error', 'all'],
30
+ 'default-case': 'off',
31
+ 'default-case-last': 'error',
32
+ 'default-param-last': 'off', // NOTE: See TypeScript rule extending this one
33
+ 'dot-notation': 'off', // NOTE: See TypeScript rule extending this one
34
+ eqeqeq: ['error', 'always'],
35
+ 'for-direction': 'error',
36
+ 'func-name-matching': ['warn', 'always'],
37
+ 'func-names': ['error', 'never', {
38
+ generators: 'never'
39
+ }],
40
+ 'func-style': ['error', 'declaration', {
41
+ allowArrowFunctions: true
42
+ }],
43
+ 'getter-return': ['error', {
44
+ allowImplicit: false
45
+ }],
46
+ 'grouped-accessor-pairs': ['error', 'getBeforeSet'],
47
+ 'guard-for-in': 'error',
48
+ 'id-denylist': 'off',
49
+ 'id-length': 'off',
50
+ 'id-match': 'off',
51
+ 'init-declarations': 'off', // NOTE: See TypeScript rule extending this one
52
+ 'logical-assignment-operators': ['error', 'always', {
53
+ enforceForIfStatements: false
54
+ }],
55
+ 'max-classes-per-file': 'off',
56
+ 'max-depth': ['warn', 5],
57
+ 'max-lines': ['warn', {
58
+ max: 500,
59
+ skipBlankLines: true,
60
+ skipComments: true
61
+ }],
62
+ 'max-lines-per-function': ['warn', {
63
+ IIFEs: true,
64
+ max: 100,
65
+ skipBlankLines: true,
66
+ skipComments: true
67
+ }],
68
+ 'max-nested-callbacks': ['warn', 5],
69
+ 'max-params': 'off', // NOTE: See TypeScript rule extending this one
70
+ 'max-statements': 'off',
71
+ 'new-cap': ['error', {
72
+ capIsNew: true,
73
+ newIsCap: true,
74
+ properties: true
75
+ }],
76
+ 'object-shorthand': ['error', 'always', {
77
+ avoidExplicitReturnArrows: false,
78
+ avoidQuotes: true,
79
+ ignoreConstructors: false
80
+ }],
81
+ 'one-var': ['error', 'never'],
82
+ 'operator-assignment': ['error', 'always'],
83
+ 'prefer-arrow-callback': ['error', {
84
+ allowNamedFunctions: false,
85
+ allowUnboundThis: true
86
+ }],
87
+ 'prefer-const': ['error', {
88
+ destructuring: 'all',
89
+ ignoreReadBeforeAssign: true
90
+ }],
91
+ 'prefer-destructuring': 'off', // NOTE: See TypeScript rule extending this one
92
+ 'prefer-exponentiation-operator': 'error',
93
+ 'prefer-named-capture-group': 'warn',
94
+ 'prefer-numeric-literals': 'error',
95
+ 'prefer-object-has-own': 'off',
96
+ 'prefer-object-spread': 'error',
97
+ 'prefer-promise-reject-errors': 'off', // NOTE: See TypeScript rule extending this one
98
+ 'prefer-regex-literals': ['error', {
99
+ disallowRedundantWrapping: true
100
+ }],
101
+ 'prefer-rest-params': 'error',
102
+ 'prefer-spread': 'error',
103
+ 'prefer-template': 'error',
104
+ radix: ['error', 'as-needed'],
105
+ 'require-atomic-updates': 'error',
106
+ 'require-await': 'off', // NOTE: See TypeScript rule extending this one
107
+ 'require-unicode-regexp': 'error',
108
+ 'require-yield': 'off',
109
+ 'sort-imports': 'off',
110
+ 'sort-keys': 'off',
111
+ 'sort-vars': ['error', {
112
+ ignoreCase: true
113
+ }],
114
+ strict: ['error', 'never'],
115
+ 'symbol-description': 'error',
116
+ 'unicode-bom': ['error', 'never'],
117
+ 'use-isnan': ['error', {
118
+ enforceForIndexOf: true,
119
+ enforceForSwitchCase: true
120
+ }],
121
+ 'valid-typeof': ['error', {
122
+ requireStringLiterals: false
123
+ }],
124
+ 'vars-on-top': 'error',
125
+ yoda: ['error', 'never']
126
+ };
@@ -0,0 +1,62 @@
1
+ // JSX formatting rules. These live in @stylistic (the base config turns them
2
+ // off because it is environment-neutral); the React layer turns them on with
3
+ // the project's JSX style. JSX indentation is handled by @stylistic/indent in
4
+ // the base, so there is no separate jsx-indent rule here.
5
+ export default {
6
+ rules: {
7
+ '@stylistic/jsx-child-element-spacing': 'error',
8
+ '@stylistic/jsx-closing-bracket-location': ['error', {
9
+ nonEmpty: 'tag-aligned',
10
+ selfClosing: false
11
+ }],
12
+ '@stylistic/jsx-closing-tag-location': 'error',
13
+ '@stylistic/jsx-curly-brace-presence': ['error', {
14
+ children: 'never',
15
+ propElementValues: 'always',
16
+ props: 'never'
17
+ }],
18
+ '@stylistic/jsx-curly-newline': ['error', {
19
+ multiline: 'consistent',
20
+ singleline: 'forbid'
21
+ }],
22
+ '@stylistic/jsx-curly-spacing': ['error', {
23
+ when: 'never'
24
+ }],
25
+ '@stylistic/jsx-equals-spacing': ['error', 'never'],
26
+ '@stylistic/jsx-first-prop-new-line': ['error', 'multiline-multiprop'],
27
+ '@stylistic/jsx-function-call-newline': ['error', 'multiline'],
28
+ '@stylistic/jsx-indent-props': ['error', 2],
29
+ '@stylistic/jsx-max-props-per-line': ['error', {
30
+ maximum: 1,
31
+ when: 'multiline'
32
+ }],
33
+ '@stylistic/jsx-newline': ['error', {
34
+ allowMultilines: false,
35
+ prevent: true
36
+ }],
37
+ '@stylistic/jsx-pascal-case': ['error', {
38
+ allowAllCaps: false,
39
+ allowLeadingUnderscore: false,
40
+ allowNamespace: false
41
+ }],
42
+ '@stylistic/jsx-self-closing-comp': ['error', {
43
+ component: true,
44
+ html: true
45
+ }],
46
+ '@stylistic/jsx-tag-spacing': ['error', {
47
+ afterOpening: 'never',
48
+ beforeClosing: 'never',
49
+ beforeSelfClosing: 'never',
50
+ closingSlash: 'never'
51
+ }],
52
+ '@stylistic/jsx-wrap-multilines': ['error', {
53
+ arrow: 'parens-new-line',
54
+ assignment: 'parens-new-line',
55
+ condition: 'parens-new-line',
56
+ declaration: 'parens-new-line',
57
+ logical: 'parens-new-line',
58
+ prop: 'parens-new-line',
59
+ return: 'parens-new-line'
60
+ }]
61
+ }
62
+ };