@tb-dev/eslint-config 4.1.1 → 4.2.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.
package/dist/index.js CHANGED
@@ -1,4 +1,3 @@
1
- import eslintConfigPrettier from "eslint-config-prettier";
2
1
  import process from "node:process";
3
2
  import globals from "globals";
4
3
  var Glob = /* @__PURE__ */ ((Glob2) => {
@@ -26,6 +25,120 @@ async function interopDefault(promise) {
26
25
  function getIgnores() {
27
26
  return Object.values(GlobIgnore);
28
27
  }
28
+ const stylisticRules = {
29
+ "stylistic/array-bracket-newline": ["error", "consistent"],
30
+ "stylistic/array-bracket-spacing": ["error", "never"],
31
+ "stylistic/arrow-parens": ["error", "always"],
32
+ "stylistic/arrow-spacing": "error",
33
+ "stylistic/block-spacing": "error",
34
+ "stylistic/brace-style": ["error", "stroustrup"],
35
+ "stylistic/comma-dangle": ["error", {
36
+ arrays: "always-multiline",
37
+ objects: "always-multiline",
38
+ imports: "always-multiline",
39
+ exports: "always-multiline",
40
+ functions: "always-multiline",
41
+ enums: "always-multiline"
42
+ }],
43
+ "stylistic/comma-spacing": ["error", { before: false, after: true }],
44
+ "stylistic/comma-style": ["error", "last"],
45
+ "stylistic/computed-property-spacing": ["error", "never"],
46
+ "stylistic/dot-location": ["error", "property"],
47
+ "stylistic/eol-last": ["error", "always"],
48
+ "stylistic/function-call-argument-newline": ["error", "consistent"],
49
+ "stylistic/function-call-spacing": ["error", "never"],
50
+ "stylistic/function-paren-newline": ["error", "never"],
51
+ "stylistic/generator-star-spacing": ["error", { before: false, after: true }],
52
+ "stylistic/implicit-arrow-linebreak": ["error", "beside"],
53
+ "stylistic/indent": ["error", 2, { flatTernaryExpressions: true }],
54
+ "stylistic/indent-binary-ops": ["error", 2],
55
+ "stylistic/key-spacing": ["error", { afterColon: true, beforeColon: false, mode: "strict" }],
56
+ "stylistic/keyword-spacing": ["error", { after: true, before: true }],
57
+ "stylistic/line-comment-position": ["error", { position: "above" }],
58
+ "stylistic/linebreak-style": ["error", "unix"],
59
+ "stylistic/lines-between-class-members": ["error", {
60
+ enforce: [
61
+ { blankLine: "always", prev: "method", next: "method" }
62
+ ]
63
+ }],
64
+ "stylistic/max-len": ["error", {
65
+ code: 100,
66
+ tabWidth: 2,
67
+ ignoreComments: true,
68
+ ignoreTrailingComments: true,
69
+ ignoreUrls: true,
70
+ ignoreStrings: true,
71
+ ignoreTemplateLiterals: true,
72
+ ignoreRegExpLiterals: true
73
+ }],
74
+ "stylistic/member-delimiter-style": ["error", {
75
+ multiline: { delimiter: "semi", requireLast: true },
76
+ singleline: { delimiter: "semi", requireLast: true }
77
+ }],
78
+ "stylistic/new-parens": ["error", "always"],
79
+ "stylistic/newline-per-chained-call": ["error", { ignoreChainWithDepth: 2 }],
80
+ "stylistic/no-confusing-arrow": ["error", { allowParens: true }],
81
+ "stylistic/no-extra-parens": ["error", "all", {
82
+ nestedBinaryExpressions: false,
83
+ ternaryOperandBinaryExpressions: false
84
+ }],
85
+ "stylistic/no-extra-semi": "error",
86
+ "stylistic/no-floating-decimal": "error",
87
+ "stylistic/no-mixed-spaces-and-tabs": "error",
88
+ "stylistic/no-multi-spaces": "error",
89
+ "stylistic/no-multiple-empty-lines": ["error", { max: 1, maxBOF: 0 }],
90
+ "stylistic/no-tabs": "error",
91
+ "stylistic/no-trailing-spaces": "error",
92
+ "stylistic/no-whitespace-before-property": "error",
93
+ "stylistic/nonblock-statement-body-position": ["error", "beside"],
94
+ "stylistic/object-curly-newline": ["error", { consistent: true }],
95
+ "stylistic/object-curly-spacing": ["error", "always"],
96
+ "stylistic/object-property-newline": ["error", { allowAllPropertiesOnSameLine: true }],
97
+ "stylistic/operator-linebreak": ["error", "before"],
98
+ "stylistic/padded-blocks": ["error", "never"],
99
+ "stylistic/quote-props": ["error", "as-needed", { unnecessary: true, numbers: true }],
100
+ "stylistic/quotes": ["error", "single", { avoidEscape: true }],
101
+ "stylistic/rest-spread-spacing": ["error", "never"],
102
+ "stylistic/semi": ["error", "always"],
103
+ "stylistic/semi-spacing": ["error", { before: false, after: false }],
104
+ "stylistic/semi-style": ["error", "last"],
105
+ "stylistic/space-before-blocks": ["error", "always"],
106
+ "stylistic/space-before-function-paren": ["error", {
107
+ anonymous: "always",
108
+ named: "never",
109
+ asyncArrow: "always"
110
+ }],
111
+ "stylistic/space-in-parens": ["error", "never"],
112
+ "stylistic/space-infix-ops": "error",
113
+ "stylistic/space-unary-ops": [1, {
114
+ words: true,
115
+ nonwords: false
116
+ }],
117
+ "stylistic/spaced-comment": ["error", "always"],
118
+ "stylistic/switch-colon-spacing": ["error", { after: true, before: false }],
119
+ "stylistic/template-curly-spacing": ["error", "never"],
120
+ "stylistic/template-tag-spacing": ["error", "never"],
121
+ "stylistic/type-annotation-spacing": ["error", { after: true, before: false }],
122
+ "stylistic/type-generic-spacing": "error",
123
+ "stylistic/type-named-tuple-spacing": "error",
124
+ "stylistic/yield-star-spacing": ["error", "after"]
125
+ };
126
+ async function stylistic(options) {
127
+ const { overrides, stylistic: enabled } = options;
128
+ if (!enabled) return {};
129
+ const plugin = await interopDefault(import("@stylistic/eslint-plugin"));
130
+ const files = [Glob.All];
131
+ if (options.vue) files.push(Glob.Vue);
132
+ const rules = {
133
+ ...stylisticRules,
134
+ ...overrides == null ? void 0 : overrides.stylistic
135
+ };
136
+ return {
137
+ files,
138
+ plugins: { stylistic: plugin },
139
+ rules
140
+ };
141
+ }
29
142
  async function vue(options) {
30
143
  const { overrides, vue: enabled } = options;
31
144
  if (!enabled) return [];
@@ -39,97 +152,64 @@ async function vue(options) {
39
152
  ...vuePlugin.configs.base.rules,
40
153
  "vue/attribute-hyphenation": ["error", "always"],
41
154
  "vue/attributes-order": "error",
42
- "vue/block-lang": [
43
- "error",
44
- {
45
- script: {
46
- lang: "ts"
47
- },
48
- style: {
49
- lang: "scss",
50
- allowNoLang: true
51
- }
52
- }
53
- ],
54
- "vue/block-order": [
55
- "error",
56
- {
57
- order: [["script", "template"], "style:not([scoped])", "style[scoped]"]
58
- }
59
- ],
60
- "vue/block-tag-newline": [
61
- "error",
62
- {
63
- singleline: "always",
64
- multiline: "always",
65
- maxEmptyLines: 0
66
- }
67
- ],
155
+ "vue/block-lang": ["error", {
156
+ script: { lang: "ts" },
157
+ style: {
158
+ lang: "scss",
159
+ allowNoLang: true
160
+ }
161
+ }],
162
+ "vue/block-order": ["error", { order: [["script", "template"], "style:not([scoped])", "style[scoped]"] }],
163
+ "vue/block-tag-newline": ["error", {
164
+ singleline: "always",
165
+ multiline: "always",
166
+ maxEmptyLines: 0
167
+ }],
68
168
  "vue/component-api-style": ["error", ["script-setup"]],
69
169
  "vue/component-definition-name-casing": ["error", "PascalCase"],
70
- "vue/component-name-in-template-casing": [
71
- "error",
72
- "kebab-case",
73
- { registeredComponentsOnly: false }
74
- ],
170
+ "vue/component-name-in-template-casing": ["error", "kebab-case", {
171
+ registeredComponentsOnly: false
172
+ }],
75
173
  "vue/custom-event-name-casing": ["error", "kebab-case"],
76
174
  "vue/define-emits-declaration": ["error", "type-based"],
77
- "vue/define-macros-order": [
78
- "error",
79
- {
80
- order: ["defineOptions", "defineProps", "defineModel", "defineEmits", "defineSlots"],
81
- defineExposeLast: true
82
- }
83
- ],
175
+ "vue/define-macros-order": ["error", {
176
+ order: ["defineOptions", "defineProps", "defineModel", "defineEmits", "defineSlots"],
177
+ defineExposeLast: true
178
+ }],
84
179
  "vue/define-props-declaration": ["error", "type-based"],
85
180
  "vue/enforce-style-attribute": ["error", { allow: ["scoped"] }],
86
181
  "vue/first-attribute-linebreak": "off",
87
- "vue/html-button-has-type": [
88
- "error",
89
- {
90
- button: true,
91
- submit: true,
92
- reset: true
93
- }
94
- ],
95
- "vue/html-closing-bracket-newline": [
96
- "error",
97
- {
182
+ "vue/html-button-has-type": ["error", {
183
+ button: true,
184
+ submit: true,
185
+ reset: true
186
+ }],
187
+ "vue/html-closing-bracket-newline": ["error", {
188
+ singleline: "never",
189
+ multiline: "always",
190
+ selfClosingTag: {
98
191
  singleline: "never",
99
- multiline: "always",
100
- selfClosingTag: {
101
- singleline: "never",
102
- multiline: "always"
103
- }
104
- }
105
- ],
106
- "vue/html-closing-bracket-spacing": [
107
- "error",
108
- {
109
- startTag: "never",
110
- endTag: "never",
111
- selfClosingTag: "always"
112
- }
113
- ],
114
- "vue/html-self-closing": [
115
- "error",
116
- {
117
- html: {
118
- void: "never",
119
- normal: "always",
120
- component: "always"
121
- },
122
- svg: "always",
123
- math: "always"
124
- }
125
- ],
126
- "vue/match-component-file-name": [
127
- "off",
128
- {
129
- extensions: ["tsx", "vue"],
130
- shouldMatchCase: false
131
- }
132
- ],
192
+ multiline: "always"
193
+ }
194
+ }],
195
+ "vue/html-closing-bracket-spacing": ["error", {
196
+ startTag: "never",
197
+ endTag: "never",
198
+ selfClosingTag: "always"
199
+ }],
200
+ "vue/html-self-closing": ["error", {
201
+ html: {
202
+ void: "never",
203
+ normal: "always",
204
+ component: "always"
205
+ },
206
+ svg: "always",
207
+ math: "always"
208
+ }],
209
+ "vue/match-component-file-name": ["off", {
210
+ extensions: ["tsx", "vue"],
211
+ shouldMatchCase: false
212
+ }],
133
213
  "vue/match-component-import-name": "error",
134
214
  "vue/multi-word-component-names": "off",
135
215
  "vue/mustache-interpolation-spacing": ["error", "always"],
@@ -139,13 +219,10 @@ async function vue(options) {
139
219
  "vue/no-computed-properties-in-data": "error",
140
220
  "vue/no-dupe-keys": "error",
141
221
  "vue/no-dupe-v-else-if": "error",
142
- "vue/no-duplicate-attributes": [
143
- "error",
144
- {
145
- allowCoexistClass: true,
146
- allowCoexistStyle: true
147
- }
148
- ],
222
+ "vue/no-duplicate-attributes": ["error", {
223
+ allowCoexistClass: true,
224
+ allowCoexistStyle: true
225
+ }],
149
226
  "vue/no-export-in-script-setup": "error",
150
227
  "vue/no-expose-after-await": "error",
151
228
  "vue/no-lifecycle-after-await": "error",
@@ -159,23 +236,13 @@ async function vue(options) {
159
236
  "vue/no-reserved-component-names": "error",
160
237
  "vue/no-reserved-keys": "error",
161
238
  "vue/no-reserved-props": "error",
162
- "vue/no-required-prop-with-default": [
163
- "error",
164
- {
165
- autofix: true
166
- }
167
- ],
239
+ "vue/no-required-prop-with-default": ["error", { autofix: true }],
168
240
  "vue/no-root-v-if": "error",
169
241
  "vue/no-setup-props-reactivity-loss": "error",
170
242
  "vue/no-shared-component-data": "error",
171
243
  "vue/no-side-effects-in-computed-properties": "error",
172
244
  "vue/no-spaces-around-equal-signs-in-attribute": "error",
173
- "vue/no-static-inline-styles": [
174
- "error",
175
- {
176
- allowBinding: false
177
- }
178
- ],
245
+ "vue/no-static-inline-styles": ["error", { allowBinding: false }],
179
246
  "vue/no-template-key": "error",
180
247
  "vue/no-template-shadow": "error",
181
248
  "vue/no-template-target-blank": "error",
@@ -184,22 +251,14 @@ async function vue(options) {
184
251
  "vue/no-unused-emit-declarations": "error",
185
252
  "vue/no-unused-properties": "error",
186
253
  "vue/no-unused-refs": "error",
187
- "vue/no-unused-vars": [
188
- "error",
189
- {
190
- ignorePattern: "^_"
191
- }
192
- ],
254
+ "vue/no-unused-vars": ["error", { ignorePattern: "^_" }],
193
255
  "vue/no-use-computed-property-like-method": "error",
194
256
  "vue/no-use-v-else-with-v-for": "error",
195
257
  "vue/no-use-v-if-with-v-for": "error",
196
- "vue/no-useless-mustaches": [
197
- "error",
198
- {
199
- ignoreIncludesComment: false,
200
- ignoreStringEscape: false
201
- }
202
- ],
258
+ "vue/no-useless-mustaches": ["error", {
259
+ ignoreIncludesComment: false,
260
+ ignoreStringEscape: false
261
+ }],
203
262
  "vue/no-useless-template-attributes": "error",
204
263
  "vue/no-useless-v-bind": "error",
205
264
  "vue/no-v-for-template-key-on-child": "error",
@@ -215,23 +274,15 @@ async function vue(options) {
215
274
  "vue/prop-name-casing": ["error", "camelCase"],
216
275
  "vue/require-component-is": "error",
217
276
  "vue/require-default-prop": "off",
218
- "vue/require-explicit-emits": [
219
- "error",
220
- {
221
- allowProps: false
222
- }
223
- ],
277
+ "vue/require-explicit-emits": ["error", { allowProps: false }],
224
278
  "vue/require-explicit-slots": "error",
225
- "vue/require-macro-variable-name": [
226
- "error",
227
- {
228
- defineProps: "props",
229
- defineEmits: "emit",
230
- defineSlots: "slots",
231
- useSlots: "slots",
232
- useAttrs: "attrs"
233
- }
234
- ],
279
+ "vue/require-macro-variable-name": ["error", {
280
+ defineProps: "props",
281
+ defineEmits: "emit",
282
+ defineSlots: "slots",
283
+ useSlots: "slots",
284
+ useAttrs: "attrs"
285
+ }],
235
286
  "vue/require-prop-types": "error",
236
287
  "vue/require-render-return": "error",
237
288
  "vue/require-slots-as-functions": "error",
@@ -243,24 +294,17 @@ async function vue(options) {
243
294
  "vue/return-in-emits-validator": "error",
244
295
  "vue/this-in-template": ["error", "never"],
245
296
  "vue/use-v-on-exact": "error",
246
- "vue/v-bind-style": [
247
- "error",
248
- "shorthand",
249
- {
250
- sameNameShorthand: "always"
251
- }
252
- ],
297
+ "vue/v-bind-style": ["error", "shorthand", {
298
+ sameNameShorthand: "always"
299
+ }],
253
300
  "vue/v-for-delimiter-style": ["error", "of"],
254
301
  "vue/v-on-handler-style": "off",
255
302
  "vue/v-on-style": ["error", "shorthand"],
256
- "vue/v-slot-style": [
257
- "error",
258
- {
259
- atComponent: "shorthand",
260
- default: "shorthand",
261
- named: "shorthand"
262
- }
263
- ],
303
+ "vue/v-slot-style": ["error", {
304
+ atComponent: "shorthand",
305
+ default: "shorthand",
306
+ named: "shorthand"
307
+ }],
264
308
  "vue/v-on-event-hyphenation": ["error", "always"],
265
309
  "vue/valid-attribute-name": "error",
266
310
  "vue/valid-define-emits": "error",
@@ -285,11 +329,35 @@ async function vue(options) {
285
329
  "vue/valid-v-text": "error",
286
330
  ...overrides == null ? void 0 : overrides.vue
287
331
  };
332
+ if (options.stylistic) {
333
+ const vueStylistic = [
334
+ "vue/array-bracket-newline",
335
+ "vue/array-bracket-spacing",
336
+ "vue/key-spacing",
337
+ "vue/keyword-spacing",
338
+ "vue/max-len",
339
+ "vue/no-extra-parens",
340
+ "vue/object-curly-newline",
341
+ "vue/object-curly-spacing",
342
+ "vue/object-property-newline",
343
+ "vue/operator-linebreak",
344
+ "vue/quote-props",
345
+ "vue/space-in-parens",
346
+ "vue/space-infix-ops",
347
+ "vue/space-unary-ops",
348
+ "vue/template-curly-spacing"
349
+ ];
350
+ Object.assign(rules, vueStylistic.reduce((acc, rule) => {
351
+ const name = rule.replace("vue/", "stylistic/");
352
+ if (Object.hasOwn(stylisticRules, name)) {
353
+ acc[rule] = stylisticRules[name];
354
+ }
355
+ return acc;
356
+ }, {}));
357
+ }
288
358
  return [
289
359
  {
290
- plugins: {
291
- vue: vuePlugin
292
- }
360
+ plugins: { vue: vuePlugin }
293
361
  },
294
362
  {
295
363
  files: [Glob.Vue],
@@ -317,18 +385,11 @@ async function vitest(options) {
317
385
  if (!enabled) return {};
318
386
  const plugin = await interopDefault(import("eslint-plugin-vitest"));
319
387
  return {
320
- plugins: {
321
- vitest: plugin
322
- },
388
+ plugins: { vitest: plugin },
323
389
  files: [Glob.Vitest],
324
390
  rules: {
325
391
  "vitest/consistent-test-it": ["error", { fn: "it", withinDescribe: "it" }],
326
- "vitest/expect-expect": [
327
- "error",
328
- {
329
- assertFunctionNames: ["expect"]
330
- }
331
- ],
392
+ "vitest/expect-expect": ["error", { assertFunctionNames: ["expect"] }],
332
393
  "vitest/max-expects": ["error", { max: 5 }],
333
394
  "vitest/max-nested-describe": ["error", { max: 1 }],
334
395
  "vitest/no-alias-methods": "error",
@@ -355,12 +416,7 @@ async function vitest(options) {
355
416
  "vitest/prefer-to-contain": "error",
356
417
  "vitest/prefer-to-have-length": "error",
357
418
  "vitest/prefer-todo": "error",
358
- "vitest/require-top-level-describe": [
359
- "error",
360
- {
361
- maxNumberOfTopLevelDescribes: 10
362
- }
363
- ],
419
+ "vitest/require-top-level-describe": ["error", { maxNumberOfTopLevelDescribes: 10 }],
364
420
  "vitest/valid-describe-callback": "error",
365
421
  "vitest/valid-expect": "error",
366
422
  ...overrides == null ? void 0 : overrides.vitest
@@ -372,23 +428,11 @@ async function unicorn(options) {
372
428
  if (!enabled) return {};
373
429
  const plugin = await interopDefault(import("eslint-plugin-unicorn"));
374
430
  return {
375
- plugins: {
376
- unicorn: plugin
377
- },
431
+ plugins: { unicorn: plugin },
378
432
  rules: {
379
- "unicorn/catch-error-name": [
380
- "error",
381
- {
382
- name: "err"
383
- }
384
- ],
433
+ "unicorn/catch-error-name": ["error", { name: "err" }],
385
434
  "unicorn/consistent-empty-array-spread": "error",
386
- "unicorn/consistent-function-scoping": [
387
- "error",
388
- {
389
- checkArrowFunctions: true
390
- }
391
- ],
435
+ "unicorn/consistent-function-scoping": ["error", { checkArrowFunctions: true }],
392
436
  "unicorn/custom-error-definition": "error",
393
437
  "unicorn/error-message": "error",
394
438
  "unicorn/no-array-for-each": "off",
@@ -448,13 +492,10 @@ function javascript(options) {
448
492
  },
449
493
  rules: {
450
494
  "accessor-pairs": ["error", { enforceForClassMembers: true, setWithoutGet: true }],
451
- "array-callback-return": [
452
- "error",
453
- {
454
- checkForEach: false,
455
- allowVoid: true
456
- }
457
- ],
495
+ "array-callback-return": ["error", {
496
+ checkForEach: false,
497
+ allowVoid: true
498
+ }],
458
499
  "block-scoped-var": "error",
459
500
  "consistent-this": ["error", "self"],
460
501
  "default-case-last": "error",
@@ -547,13 +588,10 @@ function javascript(options) {
547
588
  "object-shorthand": ["error", "always"],
548
589
  "operator-assignment": ["error", "always"],
549
590
  "prefer-arrow-callback": "error",
550
- "prefer-const": [
551
- "error",
552
- {
553
- destructuring: "all",
554
- ignoreReadBeforeAssign: true
555
- }
556
- ],
591
+ "prefer-const": ["error", {
592
+ destructuring: "all",
593
+ ignoreReadBeforeAssign: true
594
+ }],
557
595
  "prefer-destructuring": "off",
558
596
  "prefer-exponentiation-operator": "error",
559
597
  "prefer-object-has-own": "error",
@@ -563,16 +601,13 @@ function javascript(options) {
563
601
  "prefer-spread": "error",
564
602
  "prefer-template": "error",
565
603
  "require-atomic-updates": ["error", { allowProperties: true }],
566
- "sort-imports": [
567
- "error",
568
- {
569
- allowSeparatedGroups: false,
570
- ignoreCase: false,
571
- ignoreDeclarationSort: true,
572
- ignoreMemberSort: false,
573
- memberSyntaxSortOrder: ["none", "all", "multiple", "single"]
574
- }
575
- ],
604
+ "sort-imports": ["error", {
605
+ allowSeparatedGroups: false,
606
+ ignoreCase: false,
607
+ ignoreDeclarationSort: true,
608
+ ignoreMemberSort: false,
609
+ memberSyntaxSortOrder: ["none", "all", "multiple", "single"]
610
+ }],
576
611
  "symbol-description": "off",
577
612
  "use-isnan": "error",
578
613
  "valid-typeof": "error",
@@ -594,50 +629,41 @@ async function typescript(options) {
594
629
  "no-array-constructor": "off",
595
630
  "@typescript-eslint/no-array-constructor": "error",
596
631
  "@typescript-eslint/array-type": ["error", { default: "array" }],
597
- "@typescript-eslint/ban-ts-comment": [
598
- "error",
599
- {
600
- "ts-expect-error": "allow-with-description",
601
- "ts-ignore": true,
602
- "ts-nocheck": true,
603
- "ts-check": false,
604
- minimumDescriptionLength: 3
605
- }
606
- ],
632
+ "@typescript-eslint/ban-ts-comment": ["error", {
633
+ "ts-expect-error": "allow-with-description",
634
+ "ts-ignore": true,
635
+ "ts-nocheck": true,
636
+ "ts-check": false,
637
+ minimumDescriptionLength: 3
638
+ }],
607
639
  "@typescript-eslint/class-literal-property-style": ["error", "fields"],
608
640
  "class-methods-use-this": "off",
609
- "@typescript-eslint/class-methods-use-this": [
610
- "error",
611
- {
612
- ignoreOverrideMethods: true,
613
- ignoreClassesThatImplementAnInterface: "public-fields"
614
- }
615
- ],
641
+ "@typescript-eslint/class-methods-use-this": ["error", {
642
+ ignoreOverrideMethods: true,
643
+ ignoreClassesThatImplementAnInterface: "public-fields"
644
+ }],
616
645
  "@typescript-eslint/consistent-generic-constructors": ["error", "constructor"],
617
646
  "@typescript-eslint/consistent-indexed-object-style": ["error", "record"],
618
647
  "consistent-return": "off",
619
648
  "@typescript-eslint/consistent-return": "error",
620
- "@typescript-eslint/consistent-type-assertions": [
621
- "error",
622
- { assertionStyle: "as", objectLiteralTypeAssertions: "allow-as-parameter" }
623
- ],
649
+ "@typescript-eslint/consistent-type-assertions": ["error", {
650
+ assertionStyle: "as",
651
+ objectLiteralTypeAssertions: "allow-as-parameter"
652
+ }],
624
653
  "@typescript-eslint/consistent-type-definitions": ["error", "interface"],
625
654
  "dot-notation": "off",
626
655
  "@typescript-eslint/dot-notation": ["error", { allowKeywords: true }],
627
656
  "@typescript-eslint/explicit-function-return-type": "off",
628
- "@typescript-eslint/explicit-member-accessibility": [
629
- "error",
630
- {
631
- accessibility: "explicit",
632
- overrides: {
633
- accessors: "no-public",
634
- constructors: "no-public",
635
- methods: "explicit",
636
- properties: "explicit",
637
- parameterProperties: "explicit"
638
- }
639
- }
640
- ],
657
+ "@typescript-eslint/explicit-member-accessibility": ["error", {
658
+ accessibility: "explicit",
659
+ overrides: {
660
+ accessors: "no-public",
661
+ constructors: "no-public",
662
+ methods: "explicit",
663
+ properties: "explicit",
664
+ parameterProperties: "explicit"
665
+ }
666
+ }],
641
667
  "@typescript-eslint/explicit-module-boundary-types": "off",
642
668
  "@typescript-eslint/method-signature-style": ["error", "property"],
643
669
  camelcase: "off",
@@ -661,66 +687,54 @@ async function typescript(options) {
661
687
  "@typescript-eslint/no-array-delete": "error",
662
688
  "@typescript-eslint/no-base-to-string": "error",
663
689
  "@typescript-eslint/no-confusing-non-null-assertion": "error",
664
- "@typescript-eslint/no-confusing-void-expression": [
665
- "error",
666
- {
667
- ignoreArrowShorthand: true,
668
- ignoreVoidOperator: true
669
- }
670
- ],
690
+ "@typescript-eslint/no-confusing-void-expression": ["error", {
691
+ ignoreArrowShorthand: true,
692
+ ignoreVoidOperator: true
693
+ }],
671
694
  "@typescript-eslint/no-duplicate-enum-values": "error",
672
695
  "@typescript-eslint/no-duplicate-type-constituents": "error",
673
696
  "@typescript-eslint/no-dynamic-delete": "error",
674
697
  "no-empty-function": "off",
675
698
  "@typescript-eslint/no-empty-function": "error",
676
699
  "@typescript-eslint/no-empty-interface": "error",
677
- "@typescript-eslint/no-empty-object-type": [
678
- "error",
679
- { allowInterfaces: "never", allowObjectTypes: "never" }
680
- ],
700
+ "@typescript-eslint/no-empty-object-type": ["error", {
701
+ allowInterfaces: "never",
702
+ allowObjectTypes: "never"
703
+ }],
681
704
  "@typescript-eslint/no-explicit-any": ["error", { fixToUnknown: true }],
682
705
  "@typescript-eslint/no-extra-non-null-assertion": "error",
683
706
  "@typescript-eslint/no-extraneous-class": "error",
684
- "@typescript-eslint/no-floating-promises": [
685
- "error",
686
- {
687
- ignoreIIFE: true,
688
- ignoreVoid: true,
689
- allowForKnownSafePromises: options.knownSafePromises ?? []
690
- }
691
- ],
707
+ "@typescript-eslint/no-floating-promises": ["error", {
708
+ ignoreIIFE: true,
709
+ ignoreVoid: true,
710
+ allowForKnownSafePromises: options.knownSafePromises ?? []
711
+ }],
692
712
  "@typescript-eslint/no-for-in-array": "error",
693
713
  "no-implied-eval": "off",
694
714
  "@typescript-eslint/no-implied-eval": "error",
695
715
  "@typescript-eslint/no-import-type-side-effects": "error",
696
716
  "@typescript-eslint/no-inferrable-types": "error",
697
- "@typescript-eslint/no-invalid-void-type": [
698
- "error",
699
- {
700
- allowInGenericTypeArguments: true,
701
- allowAsThisParameter: true
702
- }
703
- ],
717
+ "@typescript-eslint/no-invalid-void-type": ["error", {
718
+ allowInGenericTypeArguments: true,
719
+ allowAsThisParameter: true
720
+ }],
704
721
  "no-loop-func": "off",
705
722
  "@typescript-eslint/no-loop-func": "error",
706
723
  "no-loss-of-precision": "off",
707
724
  "@typescript-eslint/no-loss-of-precision": "error",
708
725
  "@typescript-eslint/no-meaningless-void-operator": "error",
709
726
  "@typescript-eslint/no-misused-new": "error",
710
- "@typescript-eslint/no-misused-promises": [
711
- "error",
712
- {
713
- checksConditionals: true,
714
- checksSpreads: true,
715
- checksVoidReturn: {
716
- arguments: true,
717
- attributes: true,
718
- properties: true,
719
- returns: true,
720
- variables: true
721
- }
722
- }
723
- ],
727
+ "@typescript-eslint/no-misused-promises": ["error", {
728
+ checksConditionals: true,
729
+ checksSpreads: true,
730
+ checksVoidReturn: {
731
+ arguments: true,
732
+ attributes: true,
733
+ properties: true,
734
+ returns: true,
735
+ variables: true
736
+ }
737
+ }],
724
738
  "@typescript-eslint/no-mixed-enums": "error",
725
739
  "@typescript-eslint/no-namespace": "error",
726
740
  "@typescript-eslint/no-non-null-asserted-nullish-coalescing": "error",
@@ -731,13 +745,10 @@ async function typescript(options) {
731
745
  "no-shadow": "off",
732
746
  "@typescript-eslint/no-shadow": "error",
733
747
  "@typescript-eslint/no-this-alias": "error",
734
- "@typescript-eslint/no-unnecessary-boolean-literal-compare": [
735
- "error",
736
- {
737
- allowComparingNullableBooleansToTrue: false,
738
- allowComparingNullableBooleansToFalse: true
739
- }
740
- ],
748
+ "@typescript-eslint/no-unnecessary-boolean-literal-compare": ["error", {
749
+ allowComparingNullableBooleansToTrue: false,
750
+ allowComparingNullableBooleansToFalse: true
751
+ }],
741
752
  "@typescript-eslint/no-unnecessary-condition": "error",
742
753
  "@typescript-eslint/no-unnecessary-parameter-property-assignment": "error",
743
754
  "@typescript-eslint/no-unnecessary-qualifier": "error",
@@ -755,21 +766,13 @@ async function typescript(options) {
755
766
  "@typescript-eslint/no-unsafe-return": "off",
756
767
  "@typescript-eslint/no-unsafe-unary-minus": "error",
757
768
  "no-unused-expressions": "off",
758
- "@typescript-eslint/no-unused-expressions": [
759
- "error",
760
- {
761
- allowTaggedTemplates: true
762
- }
763
- ],
769
+ "@typescript-eslint/no-unused-expressions": ["error", { allowTaggedTemplates: true }],
764
770
  "no-use-before-define": "off",
765
- "@typescript-eslint/no-use-before-define": [
766
- "error",
767
- {
768
- functions: false,
769
- enums: true,
770
- typedefs: false
771
- }
772
- ],
771
+ "@typescript-eslint/no-use-before-define": ["error", {
772
+ functions: false,
773
+ enums: true,
774
+ typedefs: false
775
+ }],
773
776
  "no-useless-constructor": "off",
774
777
  "@typescript-eslint/no-useless-constructor": "error",
775
778
  "@typescript-eslint/no-useless-empty-export": "error",
@@ -777,13 +780,10 @@ async function typescript(options) {
777
780
  "@typescript-eslint/no-wrapper-object-types": "error",
778
781
  "@typescript-eslint/non-nullable-type-assertion-style": "error",
779
782
  "no-throw-literal": "off",
780
- "@typescript-eslint/only-throw-error": [
781
- "error",
782
- {
783
- allowThrowingAny: false,
784
- allowThrowingUnknown: false
785
- }
786
- ],
783
+ "@typescript-eslint/only-throw-error": ["error", {
784
+ allowThrowingAny: false,
785
+ allowThrowingUnknown: false
786
+ }],
787
787
  "@typescript-eslint/prefer-as-const": "error",
788
788
  "@typescript-eslint/prefer-enum-initializers": "error",
789
789
  "@typescript-eslint/prefer-find": "error",
@@ -791,20 +791,17 @@ async function typescript(options) {
791
791
  "@typescript-eslint/prefer-function-type": "error",
792
792
  "@typescript-eslint/prefer-includes": "error",
793
793
  "@typescript-eslint/prefer-literal-enum-member": "error",
794
- "@typescript-eslint/prefer-nullish-coalescing": [
795
- "error",
796
- {
797
- ignoreTernaryTests: false,
798
- ignoreConditionalTests: false,
799
- ignoreMixedLogicalExpressions: false,
800
- ignorePrimitives: {
801
- bigint: false,
802
- boolean: false,
803
- number: false,
804
- string: false
805
- }
806
- }
807
- ],
794
+ "@typescript-eslint/prefer-nullish-coalescing": ["error", {
795
+ ignoreTernaryTests: false,
796
+ ignoreConditionalTests: false,
797
+ ignoreMixedLogicalExpressions: false,
798
+ ignorePrimitives: {
799
+ bigint: false,
800
+ boolean: false,
801
+ number: false,
802
+ string: false
803
+ }
804
+ }],
808
805
  "@typescript-eslint/prefer-optional-chain": "error",
809
806
  "prefer-promise-reject-errors": "off",
810
807
  "@typescript-eslint/prefer-promise-reject-errors": "error",
@@ -823,19 +820,9 @@ async function typescript(options) {
823
820
  "no-return-await": "off",
824
821
  "@typescript-eslint/return-await": ["error", "in-try-catch"],
825
822
  "@typescript-eslint/strict-boolean-expressions": "off",
826
- "@typescript-eslint/switch-exhaustiveness-check": [
827
- "error",
828
- {
829
- requireDefaultForNonUnion: true
830
- }
831
- ],
823
+ "@typescript-eslint/switch-exhaustiveness-check": ["error", { requireDefaultForNonUnion: true }],
832
824
  "@typescript-eslint/unbound-method": "error",
833
- "@typescript-eslint/unified-signatures": [
834
- "error",
835
- {
836
- ignoreDifferentlyNamedParameters: true
837
- }
838
- ],
825
+ "@typescript-eslint/unified-signatures": ["error", { ignoreDifferentlyNamedParameters: true }],
839
826
  "@typescript-eslint/use-unknown-in-catch-callback-variable": "error",
840
827
  ...overrides == null ? void 0 : overrides.typescript
841
828
  };
@@ -851,9 +838,7 @@ async function typescript(options) {
851
838
  extraFileExtensions: options.vue ? [".vue"] : []
852
839
  }
853
840
  },
854
- plugins: {
855
- "@typescript-eslint": tsPlugin
856
- },
841
+ plugins: { "@typescript-eslint": tsPlugin },
857
842
  rules
858
843
  };
859
844
  }
@@ -862,118 +847,83 @@ async function perfectionist(options) {
862
847
  if (!enabled) return {};
863
848
  const plugin = await interopDefault(import("eslint-plugin-perfectionist"));
864
849
  return {
865
- plugins: {
866
- perfectionist: plugin
867
- },
850
+ plugins: { perfectionist: plugin },
868
851
  rules: {
869
- "perfectionist/sort-array-includes": [
870
- "error",
871
- {
872
- type: "natural",
873
- order: "asc",
874
- ignoreCase: true,
875
- groupKind: "literals-first"
876
- }
877
- ],
878
- "perfectionist/sort-enums": [
879
- "error",
880
- {
881
- type: "natural",
882
- order: "asc"
883
- }
884
- ],
885
- "perfectionist/sort-exports": [
886
- "error",
887
- {
888
- type: "line-length",
889
- order: "asc",
890
- ignoreCase: true
891
- }
892
- ],
893
- "perfectionist/sort-imports": [
894
- "error",
895
- {
896
- type: "line-length",
897
- order: "asc",
898
- ignoreCase: true,
899
- newlinesBetween: "never",
900
- groups: [["side-effect-style", "side-effect"], "unknown"]
901
- }
902
- ],
903
- "perfectionist/sort-interfaces": [
904
- "error",
905
- {
906
- type: "natural",
907
- order: "asc",
908
- partitionByNewLine: true
909
- }
910
- ],
911
- "perfectionist/sort-intersection-types": [
912
- "error",
913
- {
914
- type: "natural",
915
- order: "asc"
916
- }
917
- ],
918
- "perfectionist/sort-maps": [
919
- "error",
920
- {
921
- type: "natural",
922
- order: "asc"
923
- }
924
- ],
925
- "perfectionist/sort-named-exports": [
926
- "error",
927
- {
928
- type: "natural",
929
- order: "asc"
930
- }
931
- ],
852
+ "perfectionist/sort-array-includes": ["error", {
853
+ type: "natural",
854
+ order: "asc",
855
+ ignoreCase: true,
856
+ groupKind: "literals-first"
857
+ }],
858
+ "perfectionist/sort-enums": ["error", {
859
+ type: "natural",
860
+ order: "asc"
861
+ }],
862
+ "perfectionist/sort-exports": ["error", {
863
+ type: "line-length",
864
+ order: "asc",
865
+ ignoreCase: true
866
+ }],
867
+ "perfectionist/sort-imports": ["error", {
868
+ type: "line-length",
869
+ order: "asc",
870
+ ignoreCase: true,
871
+ newlinesBetween: "never",
872
+ groups: [["side-effect-style", "side-effect"], "unknown"]
873
+ }],
874
+ "perfectionist/sort-interfaces": ["error", {
875
+ type: "natural",
876
+ order: "asc",
877
+ partitionByNewLine: true
878
+ }],
879
+ "perfectionist/sort-intersection-types": ["error", {
880
+ type: "natural",
881
+ order: "asc"
882
+ }],
883
+ "perfectionist/sort-maps": ["error", {
884
+ type: "natural",
885
+ order: "asc"
886
+ }],
887
+ "perfectionist/sort-named-exports": ["error", {
888
+ type: "natural",
889
+ order: "asc"
890
+ }],
932
891
  "sort-imports": "off",
933
- "perfectionist/sort-named-imports": [
934
- "error",
935
- {
936
- type: "natural",
937
- order: "asc"
938
- }
939
- ],
892
+ "perfectionist/sort-named-imports": ["error", {
893
+ type: "natural",
894
+ order: "asc"
895
+ }],
940
896
  "@typescript-eslint/adjacent-overload-signatures": "off",
941
- "perfectionist/sort-object-types": [
942
- "error",
943
- {
944
- type: "natural",
945
- order: "asc",
946
- partitionByNewLine: true
947
- }
948
- ],
949
- "perfectionist/sort-switch-case": [
950
- "error",
951
- {
952
- type: "natural",
953
- order: "asc",
954
- ignoreCase: true
955
- }
956
- ],
897
+ "perfectionist/sort-object-types": ["error", {
898
+ type: "natural",
899
+ order: "asc",
900
+ partitionByNewLine: true
901
+ }],
902
+ "perfectionist/sort-switch-case": ["error", {
903
+ type: "natural",
904
+ order: "asc",
905
+ ignoreCase: true
906
+ }],
957
907
  ...overrides == null ? void 0 : overrides.perfectionist
958
908
  }
959
909
  };
960
910
  }
961
- async function config(options) {
962
- const { prettier = true } = options;
963
- const objs = await Promise.all([
911
+ async function defineConfig(options) {
912
+ const ignores = {
913
+ ignores: [...getIgnores(), ...options.ignores ?? []]
914
+ };
915
+ const objects = await Promise.all([
964
916
  javascript(options),
965
917
  typescript(options),
966
918
  ...await vue(options),
967
919
  perfectionist(options),
968
920
  unicorn(options),
921
+ stylistic(options),
969
922
  vitest(options),
970
- prettier ? eslintConfigPrettier : {},
971
- {
972
- ignores: [...getIgnores(), ...options.ignores ?? []]
973
- }
923
+ ignores
974
924
  ]);
975
- return objs;
925
+ return objects;
976
926
  }
977
927
  export {
978
- config as default
928
+ defineConfig as default
979
929
  };