@tb-dev/eslint-config 1.4.8 → 1.4.10

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.
package/dist/index.mjs DELETED
@@ -1,890 +0,0 @@
1
- import eslintConfigPrettier from 'eslint-config-prettier';
2
- import globals from 'globals';
3
- import process from 'node:process';
4
-
5
- var Glob;
6
- (function (Glob) {
7
- Glob["ALL"] = "**/*.?([cm])[jt]s?(x)";
8
- Glob["JAVASCRIPT"] = "**/*.?([cm])js?(x)";
9
- Glob["TYPESCRIPT"] = "**/*.?([cm])ts?(x)";
10
- Glob["VUE"] = "**/*.vue";
11
- })(Glob || (Glob = {}));
12
- var GlobIgnore;
13
- (function (GlobIgnore) {
14
- GlobIgnore["CACHE"] = "**/cache";
15
- GlobIgnore["DIST"] = "**/dist";
16
- GlobIgnore["LOG"] = "**/log?(s)";
17
- GlobIgnore["NODE_MODULES"] = "**/node_modules";
18
- GlobIgnore["OUT"] = "**/out";
19
- GlobIgnore["TEMP"] = "**/?(.)temp";
20
- })(GlobIgnore || (GlobIgnore = {}));
21
-
22
- /* eslint-disable @typescript-eslint/no-unsafe-return */
23
- /* eslint-disable @typescript-eslint/no-unsafe-member-access */
24
- /* eslint-disable @typescript-eslint/no-explicit-any */
25
- async function interopDefault(promise) {
26
- const result = await promise;
27
- return result.default ?? result;
28
- }
29
- function getIgnores() {
30
- return Object.values(GlobIgnore);
31
- }
32
-
33
- /**
34
- * @see https://eslint.org/docs/latest/rules/
35
- */
36
- function javascript(options) {
37
- const { overrides } = options;
38
- const files = [Glob.ALL];
39
- if (options.vue)
40
- files.push(Glob.VUE);
41
- return {
42
- files,
43
- languageOptions: {
44
- ecmaVersion: 'latest',
45
- sourceType: 'module',
46
- globals: {
47
- ...globals.browser,
48
- ...globals.es2021,
49
- ...globals.node,
50
- document: 'readonly',
51
- window: 'readonly'
52
- }
53
- },
54
- rules: {
55
- 'accessor-pairs': ['error', { enforceForClassMembers: true, setWithoutGet: true }],
56
- 'array-callback-return': [
57
- 'error',
58
- {
59
- checkForEach: true,
60
- allowVoid: true
61
- }
62
- ],
63
- 'block-scoped-var': 'error',
64
- 'consistent-this': ['error', 'self'],
65
- 'default-case-last': 'error',
66
- eqeqeq: ['error', 'always'],
67
- 'for-direction': 'error',
68
- 'func-style': ['error', 'declaration', { allowArrowFunctions: true }],
69
- 'grouped-accessor-pairs': ['error', 'getBeforeSet'],
70
- 'guard-for-in': 'error',
71
- 'init-declarations': 'off',
72
- 'logical-assignment-operators': ['error', 'always', { enforceForIfStatements: true }],
73
- 'max-params': 'off',
74
- 'new-cap': ['error', { newIsCap: true, capIsNew: false, properties: true }],
75
- 'no-alert': 'error',
76
- 'no-async-promise-executor': 'error',
77
- 'no-caller': 'error',
78
- 'no-case-declarations': 'error',
79
- 'no-class-assign': 'error',
80
- 'no-compare-neg-zero': 'error',
81
- 'no-cond-assign': ['error', 'always'],
82
- 'no-constant-binary-expression': 'error',
83
- 'no-constant-condition': 'error',
84
- 'no-constructor-return': 'error',
85
- 'no-control-regex': 'error',
86
- 'no-debugger': 'error',
87
- 'no-delete-var': 'error',
88
- 'no-dupe-else-if': 'error',
89
- 'no-duplicate-case': 'error',
90
- 'no-duplicate-imports': ['error', { includeExports: false }],
91
- 'no-else-return': 'error',
92
- 'no-empty': ['error', { allowEmptyCatch: true }],
93
- 'no-empty-character-class': 'error',
94
- 'no-empty-pattern': 'error',
95
- 'no-empty-static-block': 'error',
96
- 'no-eval': 'error',
97
- 'no-ex-assign': 'error',
98
- 'no-extend-native': 'error',
99
- 'no-extra-bind': 'error',
100
- 'no-extra-boolean-cast': 'error',
101
- 'no-fallthrough': ['error', { allowEmptyCase: true }],
102
- 'no-global-assign': 'error',
103
- 'no-implicit-coercion': ['error', { disallowTemplateShorthand: true }],
104
- 'no-import-assign': 'error',
105
- 'no-inner-declarations': ['error', 'both'],
106
- 'no-invalid-regexp': 'error',
107
- 'no-irregular-whitespace': 'error',
108
- 'no-iterator': 'error',
109
- 'no-labels': ['error', { allowLoop: false, allowSwitch: false }],
110
- 'no-lone-blocks': 'error',
111
- 'no-lonely-if': 'error',
112
- 'no-misleading-character-class': 'error',
113
- 'no-multi-assign': 'error',
114
- 'no-multi-str': 'error',
115
- 'no-new': 'error',
116
- 'no-new-func': 'error',
117
- 'no-new-native-nonconstructor': 'error',
118
- 'no-new-wrappers': 'error',
119
- 'no-nonoctal-decimal-escape': 'error',
120
- 'no-object-constructor': 'error',
121
- 'no-octal': 'error',
122
- 'no-octal-escape': 'error',
123
- 'no-promise-executor-return': ['error', { allowVoid: true }],
124
- 'no-proto': 'error',
125
- 'no-prototype-builtins': 'error',
126
- 'no-regex-spaces': 'error',
127
- 'no-script-url': 'error',
128
- 'no-self-assign': 'error',
129
- 'no-self-compare': 'error',
130
- 'no-sequences': 'error',
131
- 'no-shadow-restricted-names': 'error',
132
- 'no-sparse-arrays': 'error',
133
- 'no-template-curly-in-string': 'error',
134
- 'no-undef-init': 'error',
135
- 'no-undefined': 'error',
136
- 'no-unexpected-multiline': 'error',
137
- 'no-unmodified-loop-condition': 'error',
138
- 'no-unneeded-ternary': ['error', { defaultAssignment: false }],
139
- 'no-unreachable-loop': 'error',
140
- 'no-unsafe-finally': 'error',
141
- 'no-unsafe-optional-chaining': ['error', { disallowArithmeticOperators: true }],
142
- 'no-unused-vars': 'off',
143
- 'no-useless-backreference': 'error',
144
- 'no-useless-call': 'error',
145
- 'no-useless-catch': 'error',
146
- 'no-useless-computed-key': 'error',
147
- 'no-useless-concat': 'error',
148
- 'no-useless-rename': 'error',
149
- 'no-useless-return': 'error',
150
- 'no-var': 'error',
151
- 'no-with': 'error',
152
- 'object-shorthand': ['error', 'always'],
153
- 'operator-assignment': ['error', 'always'],
154
- 'prefer-arrow-callback': 'error',
155
- 'prefer-const': [
156
- 'error',
157
- {
158
- destructuring: 'all',
159
- ignoreReadBeforeAssign: true
160
- }
161
- ],
162
- 'prefer-destructuring': 'off',
163
- 'prefer-exponentiation-operator': 'error',
164
- 'prefer-object-has-own': 'error',
165
- 'prefer-object-spread': 'error',
166
- 'prefer-promise-reject-errors': 'error',
167
- 'prefer-regex-literals': ['error', { disallowRedundantWrapping: true }],
168
- 'prefer-rest-params': 'error',
169
- 'prefer-spread': 'error',
170
- 'prefer-template': 'error',
171
- 'require-atomic-updates': 'error',
172
- 'sort-imports': [
173
- 'error',
174
- {
175
- allowSeparatedGroups: false,
176
- ignoreCase: false,
177
- ignoreDeclarationSort: true,
178
- ignoreMemberSort: false,
179
- memberSyntaxSortOrder: ['none', 'all', 'multiple', 'single']
180
- }
181
- ],
182
- 'symbol-description': 'error',
183
- 'use-isnan': 'error',
184
- 'valid-typeof': 'error',
185
- yoda: ['error', 'never'],
186
- ...overrides?.javascript
187
- }
188
- };
189
- }
190
-
191
- /**
192
- * @see https://eslint-plugin-perfectionist.azat.io/rules/
193
- */
194
- async function perfectionist(options) {
195
- const { overrides, perfectionist: enabled = true } = options;
196
- if (!enabled)
197
- return {};
198
- const plugin = await interopDefault(import('eslint-plugin-perfectionist'));
199
- return {
200
- plugins: {
201
- perfectionist: plugin
202
- },
203
- rules: {
204
- 'perfectionist/sort-classes': [
205
- 'error',
206
- {
207
- type: 'natural',
208
- order: 'asc',
209
- groups: [
210
- 'index-signature',
211
- 'property',
212
- 'private-property',
213
- 'constructor',
214
- 'method',
215
- 'private-method',
216
- ['get-method', 'set-method'],
217
- 'static-property',
218
- 'static-method',
219
- 'static-private-method',
220
- 'unknown'
221
- ]
222
- }
223
- ],
224
- 'perfectionist/sort-enums': [
225
- 'error',
226
- {
227
- type: 'natural',
228
- order: 'asc'
229
- }
230
- ],
231
- 'perfectionist/sort-exports': [
232
- 'error',
233
- {
234
- type: 'line-length',
235
- order: 'asc'
236
- }
237
- ],
238
- 'perfectionist/sort-imports': [
239
- 'error',
240
- {
241
- type: 'line-length',
242
- order: 'asc',
243
- 'newlines-between': 'never',
244
- groups: [
245
- ['style', 'side-effect'],
246
- ['builtin', 'builtin-type'],
247
- ['external', 'external-type'],
248
- ['internal', 'internal-type'],
249
- 'unknown'
250
- ]
251
- }
252
- ],
253
- 'perfectionist/sort-interfaces': [
254
- 'error',
255
- {
256
- type: 'natural',
257
- order: 'asc',
258
- 'partition-by-new-line': true
259
- }
260
- ],
261
- 'perfectionist/sort-maps': [
262
- 'error',
263
- {
264
- type: 'natural',
265
- order: 'asc'
266
- }
267
- ],
268
- 'perfectionist/sort-named-exports': [
269
- 'error',
270
- {
271
- type: 'natural',
272
- order: 'asc'
273
- }
274
- ],
275
- 'sort-imports': 'off',
276
- 'perfectionist/sort-named-imports': [
277
- 'error',
278
- {
279
- type: 'natural',
280
- order: 'asc'
281
- }
282
- ],
283
- '@typescript-eslint/adjacent-overload-signatures': 'off',
284
- 'perfectionist/sort-object-types': [
285
- 'error',
286
- {
287
- type: 'natural',
288
- order: 'asc',
289
- 'partition-by-new-line': true
290
- }
291
- ],
292
- ...overrides?.perfectionist
293
- }
294
- };
295
- }
296
-
297
- /**
298
- * @see https://typescript-eslint.io/rules/
299
- */
300
- async function typescript(options) {
301
- const { project, overrides } = options;
302
- const [tsParser, tsPlugin] = await Promise.all([
303
- await interopDefault(import('@typescript-eslint/parser')),
304
- await interopDefault(import('@typescript-eslint/eslint-plugin'))
305
- ]);
306
- const files = [Glob.TYPESCRIPT];
307
- if (options.vue)
308
- files.push(Glob.VUE);
309
- const rules = {
310
- '@typescript-eslint/adjacent-overload-signatures': 'error',
311
- 'no-array-constructor': 'off',
312
- '@typescript-eslint/no-array-constructor': 'error',
313
- '@typescript-eslint/array-type': ['error', { default: 'array' }],
314
- '@typescript-eslint/ban-ts-comment': [
315
- 'error',
316
- {
317
- 'ts-expect-error': 'allow-with-description',
318
- 'ts-ignore': true,
319
- 'ts-nocheck': true,
320
- 'ts-check': false,
321
- minimumDescriptionLength: 3
322
- }
323
- ],
324
- '@typescript-eslint/class-literal-property-style': ['error', 'fields'],
325
- 'class-methods-use-this': 'off',
326
- '@typescript-eslint/class-methods-use-this': [
327
- 'error',
328
- {
329
- ignoreOverrideMethods: true,
330
- ignoreClassesThatImplementAnInterface: 'public-fields'
331
- }
332
- ],
333
- '@typescript-eslint/consistent-generic-constructors': ['error', 'constructor'],
334
- '@typescript-eslint/consistent-indexed-object-style': ['error', 'record'],
335
- '@typescript-eslint/consistent-type-assertions': [
336
- 'error',
337
- { assertionStyle: 'as', objectLiteralTypeAssertions: 'allow-as-parameter' }
338
- ],
339
- '@typescript-eslint/consistent-type-definitions': ['error', 'interface'],
340
- 'dot-notation': 'off',
341
- '@typescript-eslint/dot-notation': ['error', { allowKeywords: true }],
342
- '@typescript-eslint/explicit-function-return-type': 'off',
343
- '@typescript-eslint/explicit-member-accessibility': [
344
- 'error',
345
- {
346
- accessibility: 'explicit',
347
- overrides: {
348
- accessors: 'no-public',
349
- constructors: 'no-public',
350
- methods: 'explicit',
351
- properties: 'explicit',
352
- parameterProperties: 'explicit'
353
- }
354
- }
355
- ],
356
- '@typescript-eslint/explicit-module-boundary-types': 'off',
357
- '@typescript-eslint/method-signature-style': ['error', 'property'],
358
- '@typescript-eslint/no-base-to-string': 'error',
359
- '@typescript-eslint/no-confusing-non-null-assertion': 'error',
360
- '@typescript-eslint/no-confusing-void-expression': [
361
- 'error',
362
- {
363
- ignoreArrowShorthand: true,
364
- ignoreVoidOperator: true
365
- }
366
- ],
367
- '@typescript-eslint/no-duplicate-enum-values': 'error',
368
- '@typescript-eslint/no-duplicate-type-constituents': 'error',
369
- '@typescript-eslint/no-dynamic-delete': 'error',
370
- 'no-empty-function': 'off',
371
- '@typescript-eslint/no-empty-function': 'error',
372
- '@typescript-eslint/no-empty-interface': 'error',
373
- '@typescript-eslint/no-explicit-any': ['error', { fixToUnknown: true }],
374
- '@typescript-eslint/no-extra-non-null-assertion': 'error',
375
- '@typescript-eslint/no-extraneous-class': 'error',
376
- '@typescript-eslint/no-floating-promises': ['error', { ignoreVoid: true }],
377
- '@typescript-eslint/no-for-in-array': 'error',
378
- 'no-implied-eval': 'off',
379
- '@typescript-eslint/no-implied-eval': 'error',
380
- '@typescript-eslint/no-import-type-side-effects': 'error',
381
- '@typescript-eslint/no-inferrable-types': 'error',
382
- '@typescript-eslint/no-invalid-void-type': [
383
- 'error',
384
- {
385
- allowInGenericTypeArguments: true,
386
- allowAsThisParameter: true
387
- }
388
- ],
389
- 'no-loop-func': 'off',
390
- '@typescript-eslint/no-loop-func': 'error',
391
- 'no-loss-of-precision': 'off',
392
- '@typescript-eslint/no-loss-of-precision': 'error',
393
- '@typescript-eslint/no-meaningless-void-operator': 'error',
394
- '@typescript-eslint/no-misused-new': 'error',
395
- '@typescript-eslint/no-misused-promises': [
396
- 'error',
397
- {
398
- checksConditionals: true,
399
- checksSpreads: true,
400
- checksVoidReturn: {
401
- arguments: true,
402
- attributes: true,
403
- properties: true,
404
- returns: true,
405
- variables: true
406
- }
407
- }
408
- ],
409
- '@typescript-eslint/no-mixed-enums': 'error',
410
- '@typescript-eslint/no-namespace': 'error',
411
- '@typescript-eslint/no-non-null-asserted-nullish-coalescing': 'error',
412
- '@typescript-eslint/no-non-null-asserted-optional-chain': 'error',
413
- '@typescript-eslint/no-non-null-assertion': 'error',
414
- '@typescript-eslint/no-redundant-type-constituents': 'error',
415
- '@typescript-eslint/no-require-imports': 'error',
416
- 'no-shadow': 'off',
417
- '@typescript-eslint/no-shadow': 'error',
418
- '@typescript-eslint/no-this-alias': 'error',
419
- 'no-throw-literal': 'off',
420
- '@typescript-eslint/no-throw-literal': 'error',
421
- '@typescript-eslint/no-unnecessary-boolean-literal-compare': [
422
- 'error',
423
- {
424
- allowComparingNullableBooleansToTrue: false,
425
- allowComparingNullableBooleansToFalse: true
426
- }
427
- ],
428
- '@typescript-eslint/no-unnecessary-condition': 'error',
429
- '@typescript-eslint/no-unnecessary-qualifier': 'error',
430
- '@typescript-eslint/no-unnecessary-type-arguments': 'error',
431
- '@typescript-eslint/no-unnecessary-type-assertion': 'error',
432
- '@typescript-eslint/no-unnecessary-type-constraint': 'error',
433
- '@typescript-eslint/no-unsafe-argument': 'off',
434
- '@typescript-eslint/no-unsafe-assignment': 'error',
435
- '@typescript-eslint/no-unsafe-call': 'error',
436
- '@typescript-eslint/no-unsafe-declaration-merging': 'error',
437
- '@typescript-eslint/no-unsafe-enum-comparison': 'off',
438
- '@typescript-eslint/no-unsafe-member-access': 'error',
439
- '@typescript-eslint/no-unsafe-return': 'error',
440
- '@typescript-eslint/no-unsafe-unary-minus': 'error',
441
- 'no-unused-expressions': 'off',
442
- '@typescript-eslint/no-unused-expressions': [
443
- 'error',
444
- {
445
- allowTaggedTemplates: true
446
- }
447
- ],
448
- 'no-use-before-define': 'off',
449
- '@typescript-eslint/no-use-before-define': [
450
- 'error',
451
- {
452
- functions: false,
453
- enums: true,
454
- typedefs: false
455
- }
456
- ],
457
- 'no-useless-constructor': 'off',
458
- '@typescript-eslint/no-useless-constructor': 'error',
459
- '@typescript-eslint/no-useless-empty-export': 'error',
460
- '@typescript-eslint/non-nullable-type-assertion-style': 'error',
461
- '@typescript-eslint/prefer-as-const': 'error',
462
- '@typescript-eslint/prefer-enum-initializers': 'error',
463
- '@typescript-eslint/prefer-for-of': 'error',
464
- '@typescript-eslint/prefer-function-type': 'error',
465
- '@typescript-eslint/prefer-includes': 'error',
466
- '@typescript-eslint/prefer-literal-enum-member': 'error',
467
- '@typescript-eslint/prefer-nullish-coalescing': [
468
- 'error',
469
- {
470
- ignoreTernaryTests: false,
471
- ignoreConditionalTests: false,
472
- ignoreMixedLogicalExpressions: false,
473
- ignorePrimitives: {
474
- bigint: false,
475
- boolean: false,
476
- number: false,
477
- string: false
478
- }
479
- }
480
- ],
481
- '@typescript-eslint/prefer-optional-chain': 'error',
482
- '@typescript-eslint/prefer-readonly': 'error',
483
- '@typescript-eslint/prefer-readonly-parameter-types': 'off',
484
- '@typescript-eslint/prefer-reduce-type-parameter': 'error',
485
- '@typescript-eslint/prefer-regexp-exec': 'error',
486
- '@typescript-eslint/prefer-return-this-type': 'error',
487
- '@typescript-eslint/prefer-string-starts-ends-with': 'error',
488
- '@typescript-eslint/prefer-ts-expect-error': 'error',
489
- '@typescript-eslint/promise-function-async': 'off',
490
- '@typescript-eslint/require-array-sort-compare': 'error',
491
- 'require-await': 'off',
492
- '@typescript-eslint/require-await': 'error',
493
- '@typescript-eslint/restrict-plus-operands': 'error',
494
- '@typescript-eslint/restrict-template-expressions': 'error',
495
- '@typescript-eslint/strict-boolean-expressions': 'off',
496
- '@typescript-eslint/switch-exhaustiveness-check': [
497
- 'error',
498
- {
499
- requireDefaultForNonUnion: true
500
- }
501
- ],
502
- '@typescript-eslint/unbound-method': 'error',
503
- '@typescript-eslint/unified-signatures': [
504
- 'error',
505
- {
506
- ignoreDifferentlyNamedParameters: true
507
- }
508
- ],
509
- ...overrides?.typescript
510
- };
511
- return {
512
- files,
513
- languageOptions: {
514
- ecmaVersion: 'latest',
515
- sourceType: 'module',
516
- parser: tsParser,
517
- parserOptions: {
518
- project,
519
- tsconfigRootDir: process.cwd(),
520
- extraFileExtensions: options.vue ? ['.vue'] : []
521
- }
522
- },
523
- plugins: {
524
- '@typescript-eslint': tsPlugin
525
- },
526
- rules
527
- };
528
- }
529
-
530
- /**
531
- * @see https://github.com/sindresorhus/eslint-plugin-unicorn#rules
532
- */
533
- async function unicorn(options) {
534
- const { overrides, unicorn: enabled = true } = options;
535
- if (!enabled)
536
- return {};
537
- const plugin = await interopDefault(import('eslint-plugin-unicorn'));
538
- return {
539
- plugins: {
540
- unicorn: plugin
541
- },
542
- rules: {
543
- 'unicorn/catch-error-name': [
544
- 'error',
545
- {
546
- name: 'err'
547
- }
548
- ],
549
- 'unicorn/consistent-function-scoping': [
550
- 'error',
551
- {
552
- checkArrowFunctions: true
553
- }
554
- ],
555
- 'unicorn/custom-error-definition': 'error',
556
- 'unicorn/error-message': 'error',
557
- 'unicorn/no-array-for-each': 'error',
558
- 'unicorn/no-array-method-this-argument': 'error',
559
- 'unicorn/no-array-push-push': 'error',
560
- 'unicorn/no-await-expression-member': 'error',
561
- 'unicorn/no-invalid-remove-event-listener': 'error',
562
- 'unicorn/no-thenable': 'error',
563
- 'unicorn/no-typeof-undefined': 'error',
564
- 'unicorn/no-useless-fallback-in-spread': 'error',
565
- 'unicorn/no-useless-length-check': 'error',
566
- 'unicorn/no-useless-promise-resolve-reject': 'error',
567
- 'unicorn/prefer-at': 'error',
568
- 'unicorn/prefer-date-now': 'error',
569
- 'unicorn/prefer-dom-node-append': 'error',
570
- 'unicorn/prefer-dom-node-dataset': 'error',
571
- 'unicorn/prefer-dom-node-remove': 'error',
572
- 'unicorn/prefer-dom-node-text-content': 'error',
573
- 'unicorn/prefer-modern-dom-apis': 'error',
574
- 'unicorn/prefer-node-protocol': 'error',
575
- 'unicorn/prefer-number-properties': 'error',
576
- 'unicorn/prefer-object-from-entries': 'error',
577
- 'unicorn/prefer-prototype-methods': 'error',
578
- 'unicorn/prefer-query-selector': 'error',
579
- 'unicorn/prefer-reflect-apply': 'error',
580
- 'unicorn/prefer-regexp-test': 'error',
581
- 'unicorn/prefer-string-slice': 'error',
582
- 'unicorn/prefer-type-error': 'error',
583
- 'unicorn/relative-url-style': ['error', 'never'],
584
- ...overrides?.unicorn
585
- }
586
- };
587
- }
588
-
589
- /* eslint-disable @typescript-eslint/no-explicit-any */
590
- /* eslint-disable @typescript-eslint/no-unsafe-assignment */
591
- /* eslint-disable @typescript-eslint/no-unsafe-member-access */
592
- /**
593
- * @see https://eslint.vuejs.org/rules/
594
- */
595
- async function vue(options) {
596
- const { overrides, vue: enabled } = options;
597
- if (!enabled)
598
- return [];
599
- const [vuePlugin, vueParser, tsParser] = await Promise.all([
600
- // @ts-expect-error no types
601
- await interopDefault(import('eslint-plugin-vue')),
602
- await interopDefault(import('vue-eslint-parser')),
603
- await interopDefault(import('@typescript-eslint/parser'))
604
- ]);
605
- const rules = {
606
- ...vuePlugin.configs.base.rules,
607
- 'vue/attribute-hyphenation': ['error', 'always'],
608
- 'vue/attributes-order': 'error',
609
- 'vue/block-lang': [
610
- 'error',
611
- {
612
- script: {
613
- lang: 'ts'
614
- },
615
- style: {
616
- lang: 'scss',
617
- allowNoLang: true
618
- }
619
- }
620
- ],
621
- 'vue/block-order': [
622
- 'error',
623
- {
624
- order: [['script', 'template'], 'style:not([scoped])', 'style[scoped]']
625
- }
626
- ],
627
- 'vue/block-tag-newline': [
628
- 'error',
629
- {
630
- singleline: 'always',
631
- multiline: 'always',
632
- maxEmptyLines: 0
633
- }
634
- ],
635
- 'vue/component-api-style': ['error', ['script-setup']],
636
- 'vue/component-definition-name-casing': ['error', 'PascalCase'],
637
- 'vue/component-name-in-template-casing': ['error', 'PascalCase'],
638
- 'vue/custom-event-name-casing': ['error', 'camelCase'],
639
- 'vue/define-emits-declaration': ['error', 'type-based'],
640
- 'vue/define-macros-order': [
641
- 'error',
642
- {
643
- order: ['defineProps', 'defineEmits']
644
- }
645
- ],
646
- 'vue/define-props-declaration': ['error', 'type-based'],
647
- 'vue/first-attribute-linebreak': 'off',
648
- 'vue/html-button-has-type': [
649
- 'error',
650
- {
651
- button: true,
652
- submit: true,
653
- reset: true
654
- }
655
- ],
656
- 'vue/html-closing-bracket-newline': [
657
- 'error',
658
- {
659
- singleline: 'never',
660
- multiline: 'always'
661
- }
662
- ],
663
- 'vue/html-closing-bracket-spacing': [
664
- 'error',
665
- {
666
- startTag: 'never',
667
- endTag: 'never',
668
- selfClosingTag: 'always'
669
- }
670
- ],
671
- 'vue/html-self-closing': [
672
- 'error',
673
- {
674
- html: {
675
- void: 'never',
676
- normal: 'always',
677
- component: 'always'
678
- },
679
- svg: 'always',
680
- math: 'always'
681
- }
682
- ],
683
- 'vue/match-component-file-name': [
684
- 'error',
685
- {
686
- extensions: ['tsx', 'vue'],
687
- shouldMatchCase: false
688
- }
689
- ],
690
- 'vue/match-component-import-name': 'error',
691
- 'vue/multi-word-component-names': 'off',
692
- 'vue/mustache-interpolation-spacing': ['error', 'always'],
693
- 'vue/no-arrow-functions-in-watch': 'off',
694
- 'vue/no-async-in-computed-properties': 'error',
695
- 'vue/no-boolean-default': ['error', 'no-default'],
696
- 'vue/no-computed-properties-in-data': 'error',
697
- 'vue/no-dupe-keys': 'error',
698
- 'vue/no-dupe-v-else-if': 'error',
699
- 'vue/no-duplicate-attributes': [
700
- 'error',
701
- {
702
- allowCoexistClass: true,
703
- allowCoexistStyle: true
704
- }
705
- ],
706
- 'vue/no-export-in-script-setup': 'error',
707
- 'vue/no-expose-after-await': 'error',
708
- 'vue/no-lifecycle-after-await': 'error',
709
- 'vue/no-lone-template': 'error',
710
- 'vue/no-multi-spaces': 'error',
711
- 'vue/no-multiple-objects-in-class': 'error',
712
- 'vue/no-mutating-props': 'error',
713
- 'vue/no-parsing-error': 'error',
714
- 'vue/no-ref-as-operand': 'error',
715
- 'vue/no-ref-object-reactivity-loss': 'error',
716
- 'vue/no-reserved-component-names': 'error',
717
- 'vue/no-reserved-keys': 'error',
718
- 'vue/no-reserved-props': 'error',
719
- 'vue/no-required-prop-with-default': [
720
- 'error',
721
- {
722
- autofix: true
723
- }
724
- ],
725
- 'vue/no-root-v-if': 'error',
726
- 'vue/no-setup-props-reactivity-loss': 'error',
727
- 'vue/no-shared-component-data': 'error',
728
- 'vue/no-side-effects-in-computed-properties': 'error',
729
- 'vue/no-spaces-around-equal-signs-in-attribute': 'error',
730
- 'vue/no-static-inline-styles': [
731
- 'error',
732
- {
733
- allowBinding: false
734
- }
735
- ],
736
- 'vue/no-template-key': 'error',
737
- 'vue/no-template-shadow': 'error',
738
- 'vue/no-template-target-blank': 'error',
739
- 'vue/no-textarea-mustache': 'error',
740
- 'vue/no-unused-components': 'error',
741
- 'vue/no-unused-emit-declarations': 'error',
742
- 'vue/no-unused-properties': 'error',
743
- 'vue/no-unused-refs': 'error',
744
- 'vue/no-unused-vars': [
745
- 'error',
746
- {
747
- ignorePattern: '^_'
748
- }
749
- ],
750
- 'vue/no-use-computed-property-like-method': 'error',
751
- 'vue/no-use-v-else-with-v-for': 'error',
752
- 'vue/no-use-v-if-with-v-for': 'error',
753
- 'vue/no-useless-mustaches': [
754
- 'error',
755
- {
756
- ignoreIncludesComment: false,
757
- ignoreStringEscape: false
758
- }
759
- ],
760
- 'vue/no-useless-template-attributes': 'error',
761
- 'vue/no-useless-v-bind': 'error',
762
- 'vue/no-v-for-template-key-on-child': 'error',
763
- 'vue/no-v-text-v-html-on-component': 'error',
764
- 'vue/no-v-html': 'off',
765
- 'vue/no-watch-after-await': 'error',
766
- 'vue/order-in-components': 'error',
767
- 'vue/padding-line-between-blocks': ['error', 'always'],
768
- 'vue/prefer-define-options': 'error',
769
- 'vue/prefer-import-from-vue': 'error',
770
- 'vue/prefer-separate-static-class': 'error',
771
- 'vue/prefer-true-attribute-shorthand': 'error',
772
- 'vue/prop-name-casing': ['error', 'camelCase'],
773
- 'vue/require-component-is': 'error',
774
- 'vue/require-default-prop': 'off',
775
- 'vue/require-explicit-emits': [
776
- 'error',
777
- {
778
- allowProps: false
779
- }
780
- ],
781
- 'vue/require-macro-variable-name': [
782
- 'error',
783
- {
784
- defineProps: 'props',
785
- defineEmits: 'emit',
786
- defineSlots: 'slots',
787
- useSlots: 'slots',
788
- useAttrs: 'attrs'
789
- }
790
- ],
791
- 'vue/require-prop-types': 'error',
792
- 'vue/require-render-return': 'error',
793
- 'vue/require-slots-as-functions': 'error',
794
- 'vue/require-toggle-inside-transition': 'error',
795
- 'vue/require-typed-ref': 'error',
796
- 'vue/require-v-for-key': 'error',
797
- 'vue/require-valid-default-prop': 'error',
798
- 'vue/return-in-computed-property': 'error',
799
- 'vue/return-in-emits-validator': 'error',
800
- 'vue/this-in-template': ['error', 'never'],
801
- 'vue/use-v-on-exact': 'error',
802
- 'vue/v-bind-style': ['error', 'shorthand'],
803
- 'vue/v-for-delimiter-style': ['error', 'of'],
804
- 'vue/v-on-handler-style': [
805
- 'error',
806
- ['method', 'inline-function'],
807
- {
808
- ignoreIncludesComment: false
809
- }
810
- ],
811
- 'vue/v-on-style': ['error', 'shorthand'],
812
- 'vue/v-slot-style': [
813
- 'error',
814
- {
815
- atComponent: 'shorthand',
816
- default: 'shorthand',
817
- named: 'shorthand'
818
- }
819
- ],
820
- 'vue/v-on-event-hyphenation': ['error', 'always'],
821
- 'vue/valid-attribute-name': 'error',
822
- 'vue/valid-define-emits': 'error',
823
- 'vue/valid-define-options': 'error',
824
- 'vue/valid-define-props': 'error',
825
- 'vue/valid-next-tick': 'error',
826
- 'vue/valid-template-root': 'error',
827
- 'vue/valid-v-bind': 'error',
828
- 'vue/valid-v-cloak': 'error',
829
- 'vue/valid-v-else-if': 'error',
830
- 'vue/valid-v-else': 'error',
831
- 'vue/valid-v-for': 'error',
832
- 'vue/valid-v-html': 'error',
833
- 'vue/valid-v-if': 'error',
834
- 'vue/valid-v-memo': 'error',
835
- 'vue/valid-v-model': 'error',
836
- 'vue/valid-v-on': 'error',
837
- 'vue/valid-v-once': 'error',
838
- 'vue/valid-v-pre': 'error',
839
- 'vue/valid-v-show': 'error',
840
- 'vue/valid-v-slot': 'error',
841
- 'vue/valid-v-text': 'error',
842
- ...overrides?.vue
843
- };
844
- return [
845
- {
846
- plugins: {
847
- vue: vuePlugin
848
- }
849
- },
850
- {
851
- files: [Glob.VUE],
852
- languageOptions: {
853
- parser: vueParser,
854
- parserOptions: {
855
- parser: tsParser,
856
- project: options.project,
857
- tsconfigRootDir: process.cwd(),
858
- extraFileExtensions: ['.vue'],
859
- sourceType: 'module',
860
- ecmaVersion: 'latest'
861
- }
862
- }
863
- },
864
- {
865
- // @ts-expect-error no types
866
- processor: vuePlugin.processors['.vue'],
867
- rules
868
- }
869
- ];
870
- }
871
-
872
- /* eslint-disable @typescript-eslint/no-explicit-any */
873
- /* eslint-disable @typescript-eslint/no-unsafe-return */
874
- async function config(options) {
875
- const { prettier = true } = options;
876
- const objs = await Promise.all([
877
- javascript(options),
878
- typescript(options),
879
- ...(await vue(options)),
880
- perfectionist(options),
881
- unicorn(options),
882
- prettier ? eslintConfigPrettier : {},
883
- {
884
- ignores: [...getIgnores(), ...(options.ignores ?? [])]
885
- }
886
- ]);
887
- return objs;
888
- }
889
-
890
- export { config as default };