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