@tb-dev/eslint-config 4.1.1 → 4.2.1

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,126 @@ 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", {
145
+ before: false,
146
+ after: true,
147
+ overrides: {
148
+ arrow: { before: true, after: true }
149
+ }
150
+ }],
151
+ "stylistic/type-generic-spacing": "error",
152
+ "stylistic/type-named-tuple-spacing": "error",
153
+ "stylistic/yield-star-spacing": ["error", "after"]
154
+ };
155
+ async function stylistic(options) {
156
+ const { overrides, stylistic: enabled } = options;
157
+ if (!enabled) return {};
158
+ const plugin = await interopDefault(import("@stylistic/eslint-plugin"));
159
+ const files = [Glob.All];
160
+ if (options.vue) files.push(Glob.Vue);
161
+ const rules = {
162
+ ...stylisticRules,
163
+ ...overrides == null ? void 0 : overrides.stylistic
164
+ };
165
+ return {
166
+ files,
167
+ plugins: { stylistic: plugin },
168
+ rules
169
+ };
170
+ }
52
171
  async function vue(options) {
53
172
  const { overrides, vue: enabled } = options;
54
173
  if (!enabled) return [];
@@ -62,97 +181,64 @@ async function vue(options) {
62
181
  ...vuePlugin.configs.base.rules,
63
182
  "vue/attribute-hyphenation": ["error", "always"],
64
183
  "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
- ],
184
+ "vue/block-lang": ["error", {
185
+ script: { lang: "ts" },
186
+ style: {
187
+ lang: "scss",
188
+ allowNoLang: true
189
+ }
190
+ }],
191
+ "vue/block-order": ["error", { order: [["script", "template"], "style:not([scoped])", "style[scoped]"] }],
192
+ "vue/block-tag-newline": ["error", {
193
+ singleline: "always",
194
+ multiline: "always",
195
+ maxEmptyLines: 0
196
+ }],
91
197
  "vue/component-api-style": ["error", ["script-setup"]],
92
198
  "vue/component-definition-name-casing": ["error", "PascalCase"],
93
- "vue/component-name-in-template-casing": [
94
- "error",
95
- "kebab-case",
96
- { registeredComponentsOnly: false }
97
- ],
199
+ "vue/component-name-in-template-casing": ["error", "kebab-case", {
200
+ registeredComponentsOnly: false
201
+ }],
98
202
  "vue/custom-event-name-casing": ["error", "kebab-case"],
99
203
  "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
- ],
204
+ "vue/define-macros-order": ["error", {
205
+ order: ["defineOptions", "defineProps", "defineModel", "defineEmits", "defineSlots"],
206
+ defineExposeLast: true
207
+ }],
107
208
  "vue/define-props-declaration": ["error", "type-based"],
108
209
  "vue/enforce-style-attribute": ["error", { allow: ["scoped"] }],
109
210
  "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
- {
211
+ "vue/html-button-has-type": ["error", {
212
+ button: true,
213
+ submit: true,
214
+ reset: true
215
+ }],
216
+ "vue/html-closing-bracket-newline": ["error", {
217
+ singleline: "never",
218
+ multiline: "always",
219
+ selfClosingTag: {
121
220
  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
- ],
221
+ multiline: "always"
222
+ }
223
+ }],
224
+ "vue/html-closing-bracket-spacing": ["error", {
225
+ startTag: "never",
226
+ endTag: "never",
227
+ selfClosingTag: "always"
228
+ }],
229
+ "vue/html-self-closing": ["error", {
230
+ html: {
231
+ void: "never",
232
+ normal: "always",
233
+ component: "always"
234
+ },
235
+ svg: "always",
236
+ math: "always"
237
+ }],
238
+ "vue/match-component-file-name": ["off", {
239
+ extensions: ["tsx", "vue"],
240
+ shouldMatchCase: false
241
+ }],
156
242
  "vue/match-component-import-name": "error",
157
243
  "vue/multi-word-component-names": "off",
158
244
  "vue/mustache-interpolation-spacing": ["error", "always"],
@@ -162,13 +248,10 @@ async function vue(options) {
162
248
  "vue/no-computed-properties-in-data": "error",
163
249
  "vue/no-dupe-keys": "error",
164
250
  "vue/no-dupe-v-else-if": "error",
165
- "vue/no-duplicate-attributes": [
166
- "error",
167
- {
168
- allowCoexistClass: true,
169
- allowCoexistStyle: true
170
- }
171
- ],
251
+ "vue/no-duplicate-attributes": ["error", {
252
+ allowCoexistClass: true,
253
+ allowCoexistStyle: true
254
+ }],
172
255
  "vue/no-export-in-script-setup": "error",
173
256
  "vue/no-expose-after-await": "error",
174
257
  "vue/no-lifecycle-after-await": "error",
@@ -182,23 +265,13 @@ async function vue(options) {
182
265
  "vue/no-reserved-component-names": "error",
183
266
  "vue/no-reserved-keys": "error",
184
267
  "vue/no-reserved-props": "error",
185
- "vue/no-required-prop-with-default": [
186
- "error",
187
- {
188
- autofix: true
189
- }
190
- ],
268
+ "vue/no-required-prop-with-default": ["error", { autofix: true }],
191
269
  "vue/no-root-v-if": "error",
192
270
  "vue/no-setup-props-reactivity-loss": "error",
193
271
  "vue/no-shared-component-data": "error",
194
272
  "vue/no-side-effects-in-computed-properties": "error",
195
273
  "vue/no-spaces-around-equal-signs-in-attribute": "error",
196
- "vue/no-static-inline-styles": [
197
- "error",
198
- {
199
- allowBinding: false
200
- }
201
- ],
274
+ "vue/no-static-inline-styles": ["error", { allowBinding: false }],
202
275
  "vue/no-template-key": "error",
203
276
  "vue/no-template-shadow": "error",
204
277
  "vue/no-template-target-blank": "error",
@@ -207,22 +280,14 @@ async function vue(options) {
207
280
  "vue/no-unused-emit-declarations": "error",
208
281
  "vue/no-unused-properties": "error",
209
282
  "vue/no-unused-refs": "error",
210
- "vue/no-unused-vars": [
211
- "error",
212
- {
213
- ignorePattern: "^_"
214
- }
215
- ],
283
+ "vue/no-unused-vars": ["error", { ignorePattern: "^_" }],
216
284
  "vue/no-use-computed-property-like-method": "error",
217
285
  "vue/no-use-v-else-with-v-for": "error",
218
286
  "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
- ],
287
+ "vue/no-useless-mustaches": ["error", {
288
+ ignoreIncludesComment: false,
289
+ ignoreStringEscape: false
290
+ }],
226
291
  "vue/no-useless-template-attributes": "error",
227
292
  "vue/no-useless-v-bind": "error",
228
293
  "vue/no-v-for-template-key-on-child": "error",
@@ -238,23 +303,15 @@ async function vue(options) {
238
303
  "vue/prop-name-casing": ["error", "camelCase"],
239
304
  "vue/require-component-is": "error",
240
305
  "vue/require-default-prop": "off",
241
- "vue/require-explicit-emits": [
242
- "error",
243
- {
244
- allowProps: false
245
- }
246
- ],
306
+ "vue/require-explicit-emits": ["error", { allowProps: false }],
247
307
  "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
- ],
308
+ "vue/require-macro-variable-name": ["error", {
309
+ defineProps: "props",
310
+ defineEmits: "emit",
311
+ defineSlots: "slots",
312
+ useSlots: "slots",
313
+ useAttrs: "attrs"
314
+ }],
258
315
  "vue/require-prop-types": "error",
259
316
  "vue/require-render-return": "error",
260
317
  "vue/require-slots-as-functions": "error",
@@ -266,24 +323,17 @@ async function vue(options) {
266
323
  "vue/return-in-emits-validator": "error",
267
324
  "vue/this-in-template": ["error", "never"],
268
325
  "vue/use-v-on-exact": "error",
269
- "vue/v-bind-style": [
270
- "error",
271
- "shorthand",
272
- {
273
- sameNameShorthand: "always"
274
- }
275
- ],
326
+ "vue/v-bind-style": ["error", "shorthand", {
327
+ sameNameShorthand: "always"
328
+ }],
276
329
  "vue/v-for-delimiter-style": ["error", "of"],
277
330
  "vue/v-on-handler-style": "off",
278
331
  "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
- ],
332
+ "vue/v-slot-style": ["error", {
333
+ atComponent: "shorthand",
334
+ default: "shorthand",
335
+ named: "shorthand"
336
+ }],
287
337
  "vue/v-on-event-hyphenation": ["error", "always"],
288
338
  "vue/valid-attribute-name": "error",
289
339
  "vue/valid-define-emits": "error",
@@ -308,11 +358,35 @@ async function vue(options) {
308
358
  "vue/valid-v-text": "error",
309
359
  ...overrides == null ? void 0 : overrides.vue
310
360
  };
361
+ if (options.stylistic) {
362
+ const vueStylistic = [
363
+ "vue/array-bracket-newline",
364
+ "vue/array-bracket-spacing",
365
+ "vue/key-spacing",
366
+ "vue/keyword-spacing",
367
+ "vue/max-len",
368
+ "vue/no-extra-parens",
369
+ "vue/object-curly-newline",
370
+ "vue/object-curly-spacing",
371
+ "vue/object-property-newline",
372
+ "vue/operator-linebreak",
373
+ "vue/quote-props",
374
+ "vue/space-in-parens",
375
+ "vue/space-infix-ops",
376
+ "vue/space-unary-ops",
377
+ "vue/template-curly-spacing"
378
+ ];
379
+ Object.assign(rules, vueStylistic.reduce((acc, rule) => {
380
+ const name = rule.replace("vue/", "stylistic/");
381
+ if (Object.hasOwn(stylisticRules, name)) {
382
+ acc[rule] = stylisticRules[name];
383
+ }
384
+ return acc;
385
+ }, {}));
386
+ }
311
387
  return [
312
388
  {
313
- plugins: {
314
- vue: vuePlugin
315
- }
389
+ plugins: { vue: vuePlugin }
316
390
  },
317
391
  {
318
392
  files: [Glob.Vue],
@@ -340,18 +414,11 @@ async function vitest(options) {
340
414
  if (!enabled) return {};
341
415
  const plugin = await interopDefault(import("eslint-plugin-vitest"));
342
416
  return {
343
- plugins: {
344
- vitest: plugin
345
- },
417
+ plugins: { vitest: plugin },
346
418
  files: [Glob.Vitest],
347
419
  rules: {
348
420
  "vitest/consistent-test-it": ["error", { fn: "it", withinDescribe: "it" }],
349
- "vitest/expect-expect": [
350
- "error",
351
- {
352
- assertFunctionNames: ["expect"]
353
- }
354
- ],
421
+ "vitest/expect-expect": ["error", { assertFunctionNames: ["expect"] }],
355
422
  "vitest/max-expects": ["error", { max: 5 }],
356
423
  "vitest/max-nested-describe": ["error", { max: 1 }],
357
424
  "vitest/no-alias-methods": "error",
@@ -378,12 +445,7 @@ async function vitest(options) {
378
445
  "vitest/prefer-to-contain": "error",
379
446
  "vitest/prefer-to-have-length": "error",
380
447
  "vitest/prefer-todo": "error",
381
- "vitest/require-top-level-describe": [
382
- "error",
383
- {
384
- maxNumberOfTopLevelDescribes: 10
385
- }
386
- ],
448
+ "vitest/require-top-level-describe": ["error", { maxNumberOfTopLevelDescribes: 10 }],
387
449
  "vitest/valid-describe-callback": "error",
388
450
  "vitest/valid-expect": "error",
389
451
  ...overrides == null ? void 0 : overrides.vitest
@@ -395,23 +457,11 @@ async function unicorn(options) {
395
457
  if (!enabled) return {};
396
458
  const plugin = await interopDefault(import("eslint-plugin-unicorn"));
397
459
  return {
398
- plugins: {
399
- unicorn: plugin
400
- },
460
+ plugins: { unicorn: plugin },
401
461
  rules: {
402
- "unicorn/catch-error-name": [
403
- "error",
404
- {
405
- name: "err"
406
- }
407
- ],
462
+ "unicorn/catch-error-name": ["error", { name: "err" }],
408
463
  "unicorn/consistent-empty-array-spread": "error",
409
- "unicorn/consistent-function-scoping": [
410
- "error",
411
- {
412
- checkArrowFunctions: true
413
- }
414
- ],
464
+ "unicorn/consistent-function-scoping": ["error", { checkArrowFunctions: true }],
415
465
  "unicorn/custom-error-definition": "error",
416
466
  "unicorn/error-message": "error",
417
467
  "unicorn/no-array-for-each": "off",
@@ -471,13 +521,10 @@ function javascript(options) {
471
521
  },
472
522
  rules: {
473
523
  "accessor-pairs": ["error", { enforceForClassMembers: true, setWithoutGet: true }],
474
- "array-callback-return": [
475
- "error",
476
- {
477
- checkForEach: false,
478
- allowVoid: true
479
- }
480
- ],
524
+ "array-callback-return": ["error", {
525
+ checkForEach: false,
526
+ allowVoid: true
527
+ }],
481
528
  "block-scoped-var": "error",
482
529
  "consistent-this": ["error", "self"],
483
530
  "default-case-last": "error",
@@ -570,13 +617,10 @@ function javascript(options) {
570
617
  "object-shorthand": ["error", "always"],
571
618
  "operator-assignment": ["error", "always"],
572
619
  "prefer-arrow-callback": "error",
573
- "prefer-const": [
574
- "error",
575
- {
576
- destructuring: "all",
577
- ignoreReadBeforeAssign: true
578
- }
579
- ],
620
+ "prefer-const": ["error", {
621
+ destructuring: "all",
622
+ ignoreReadBeforeAssign: true
623
+ }],
580
624
  "prefer-destructuring": "off",
581
625
  "prefer-exponentiation-operator": "error",
582
626
  "prefer-object-has-own": "error",
@@ -586,16 +630,13 @@ function javascript(options) {
586
630
  "prefer-spread": "error",
587
631
  "prefer-template": "error",
588
632
  "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
- ],
633
+ "sort-imports": ["error", {
634
+ allowSeparatedGroups: false,
635
+ ignoreCase: false,
636
+ ignoreDeclarationSort: true,
637
+ ignoreMemberSort: false,
638
+ memberSyntaxSortOrder: ["none", "all", "multiple", "single"]
639
+ }],
599
640
  "symbol-description": "off",
600
641
  "use-isnan": "error",
601
642
  "valid-typeof": "error",
@@ -617,50 +658,41 @@ async function typescript(options) {
617
658
  "no-array-constructor": "off",
618
659
  "@typescript-eslint/no-array-constructor": "error",
619
660
  "@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
- ],
661
+ "@typescript-eslint/ban-ts-comment": ["error", {
662
+ "ts-expect-error": "allow-with-description",
663
+ "ts-ignore": true,
664
+ "ts-nocheck": true,
665
+ "ts-check": false,
666
+ minimumDescriptionLength: 3
667
+ }],
630
668
  "@typescript-eslint/class-literal-property-style": ["error", "fields"],
631
669
  "class-methods-use-this": "off",
632
- "@typescript-eslint/class-methods-use-this": [
633
- "error",
634
- {
635
- ignoreOverrideMethods: true,
636
- ignoreClassesThatImplementAnInterface: "public-fields"
637
- }
638
- ],
670
+ "@typescript-eslint/class-methods-use-this": ["error", {
671
+ ignoreOverrideMethods: true,
672
+ ignoreClassesThatImplementAnInterface: "public-fields"
673
+ }],
639
674
  "@typescript-eslint/consistent-generic-constructors": ["error", "constructor"],
640
675
  "@typescript-eslint/consistent-indexed-object-style": ["error", "record"],
641
676
  "consistent-return": "off",
642
677
  "@typescript-eslint/consistent-return": "error",
643
- "@typescript-eslint/consistent-type-assertions": [
644
- "error",
645
- { assertionStyle: "as", objectLiteralTypeAssertions: "allow-as-parameter" }
646
- ],
678
+ "@typescript-eslint/consistent-type-assertions": ["error", {
679
+ assertionStyle: "as",
680
+ objectLiteralTypeAssertions: "allow-as-parameter"
681
+ }],
647
682
  "@typescript-eslint/consistent-type-definitions": ["error", "interface"],
648
683
  "dot-notation": "off",
649
684
  "@typescript-eslint/dot-notation": ["error", { allowKeywords: true }],
650
685
  "@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
- ],
686
+ "@typescript-eslint/explicit-member-accessibility": ["error", {
687
+ accessibility: "explicit",
688
+ overrides: {
689
+ accessors: "no-public",
690
+ constructors: "no-public",
691
+ methods: "explicit",
692
+ properties: "explicit",
693
+ parameterProperties: "explicit"
694
+ }
695
+ }],
664
696
  "@typescript-eslint/explicit-module-boundary-types": "off",
665
697
  "@typescript-eslint/method-signature-style": ["error", "property"],
666
698
  camelcase: "off",
@@ -684,66 +716,54 @@ async function typescript(options) {
684
716
  "@typescript-eslint/no-array-delete": "error",
685
717
  "@typescript-eslint/no-base-to-string": "error",
686
718
  "@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
- ],
719
+ "@typescript-eslint/no-confusing-void-expression": ["error", {
720
+ ignoreArrowShorthand: true,
721
+ ignoreVoidOperator: true
722
+ }],
694
723
  "@typescript-eslint/no-duplicate-enum-values": "error",
695
724
  "@typescript-eslint/no-duplicate-type-constituents": "error",
696
725
  "@typescript-eslint/no-dynamic-delete": "error",
697
726
  "no-empty-function": "off",
698
727
  "@typescript-eslint/no-empty-function": "error",
699
728
  "@typescript-eslint/no-empty-interface": "error",
700
- "@typescript-eslint/no-empty-object-type": [
701
- "error",
702
- { allowInterfaces: "never", allowObjectTypes: "never" }
703
- ],
729
+ "@typescript-eslint/no-empty-object-type": ["error", {
730
+ allowInterfaces: "never",
731
+ allowObjectTypes: "never"
732
+ }],
704
733
  "@typescript-eslint/no-explicit-any": ["error", { fixToUnknown: true }],
705
734
  "@typescript-eslint/no-extra-non-null-assertion": "error",
706
735
  "@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
- ],
736
+ "@typescript-eslint/no-floating-promises": ["error", {
737
+ ignoreIIFE: true,
738
+ ignoreVoid: true,
739
+ allowForKnownSafePromises: options.knownSafePromises ?? []
740
+ }],
715
741
  "@typescript-eslint/no-for-in-array": "error",
716
742
  "no-implied-eval": "off",
717
743
  "@typescript-eslint/no-implied-eval": "error",
718
744
  "@typescript-eslint/no-import-type-side-effects": "error",
719
745
  "@typescript-eslint/no-inferrable-types": "error",
720
- "@typescript-eslint/no-invalid-void-type": [
721
- "error",
722
- {
723
- allowInGenericTypeArguments: true,
724
- allowAsThisParameter: true
725
- }
726
- ],
746
+ "@typescript-eslint/no-invalid-void-type": ["error", {
747
+ allowInGenericTypeArguments: true,
748
+ allowAsThisParameter: true
749
+ }],
727
750
  "no-loop-func": "off",
728
751
  "@typescript-eslint/no-loop-func": "error",
729
752
  "no-loss-of-precision": "off",
730
753
  "@typescript-eslint/no-loss-of-precision": "error",
731
754
  "@typescript-eslint/no-meaningless-void-operator": "error",
732
755
  "@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
- ],
756
+ "@typescript-eslint/no-misused-promises": ["error", {
757
+ checksConditionals: true,
758
+ checksSpreads: true,
759
+ checksVoidReturn: {
760
+ arguments: true,
761
+ attributes: true,
762
+ properties: true,
763
+ returns: true,
764
+ variables: true
765
+ }
766
+ }],
747
767
  "@typescript-eslint/no-mixed-enums": "error",
748
768
  "@typescript-eslint/no-namespace": "error",
749
769
  "@typescript-eslint/no-non-null-asserted-nullish-coalescing": "error",
@@ -754,13 +774,10 @@ async function typescript(options) {
754
774
  "no-shadow": "off",
755
775
  "@typescript-eslint/no-shadow": "error",
756
776
  "@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
- ],
777
+ "@typescript-eslint/no-unnecessary-boolean-literal-compare": ["error", {
778
+ allowComparingNullableBooleansToTrue: false,
779
+ allowComparingNullableBooleansToFalse: true
780
+ }],
764
781
  "@typescript-eslint/no-unnecessary-condition": "error",
765
782
  "@typescript-eslint/no-unnecessary-parameter-property-assignment": "error",
766
783
  "@typescript-eslint/no-unnecessary-qualifier": "error",
@@ -778,21 +795,13 @@ async function typescript(options) {
778
795
  "@typescript-eslint/no-unsafe-return": "off",
779
796
  "@typescript-eslint/no-unsafe-unary-minus": "error",
780
797
  "no-unused-expressions": "off",
781
- "@typescript-eslint/no-unused-expressions": [
782
- "error",
783
- {
784
- allowTaggedTemplates: true
785
- }
786
- ],
798
+ "@typescript-eslint/no-unused-expressions": ["error", { allowTaggedTemplates: true }],
787
799
  "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
- ],
800
+ "@typescript-eslint/no-use-before-define": ["error", {
801
+ functions: false,
802
+ enums: true,
803
+ typedefs: false
804
+ }],
796
805
  "no-useless-constructor": "off",
797
806
  "@typescript-eslint/no-useless-constructor": "error",
798
807
  "@typescript-eslint/no-useless-empty-export": "error",
@@ -800,13 +809,10 @@ async function typescript(options) {
800
809
  "@typescript-eslint/no-wrapper-object-types": "error",
801
810
  "@typescript-eslint/non-nullable-type-assertion-style": "error",
802
811
  "no-throw-literal": "off",
803
- "@typescript-eslint/only-throw-error": [
804
- "error",
805
- {
806
- allowThrowingAny: false,
807
- allowThrowingUnknown: false
808
- }
809
- ],
812
+ "@typescript-eslint/only-throw-error": ["error", {
813
+ allowThrowingAny: false,
814
+ allowThrowingUnknown: false
815
+ }],
810
816
  "@typescript-eslint/prefer-as-const": "error",
811
817
  "@typescript-eslint/prefer-enum-initializers": "error",
812
818
  "@typescript-eslint/prefer-find": "error",
@@ -814,20 +820,17 @@ async function typescript(options) {
814
820
  "@typescript-eslint/prefer-function-type": "error",
815
821
  "@typescript-eslint/prefer-includes": "error",
816
822
  "@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
- ],
823
+ "@typescript-eslint/prefer-nullish-coalescing": ["error", {
824
+ ignoreTernaryTests: false,
825
+ ignoreConditionalTests: false,
826
+ ignoreMixedLogicalExpressions: false,
827
+ ignorePrimitives: {
828
+ bigint: false,
829
+ boolean: false,
830
+ number: false,
831
+ string: false
832
+ }
833
+ }],
831
834
  "@typescript-eslint/prefer-optional-chain": "error",
832
835
  "prefer-promise-reject-errors": "off",
833
836
  "@typescript-eslint/prefer-promise-reject-errors": "error",
@@ -846,19 +849,9 @@ async function typescript(options) {
846
849
  "no-return-await": "off",
847
850
  "@typescript-eslint/return-await": ["error", "in-try-catch"],
848
851
  "@typescript-eslint/strict-boolean-expressions": "off",
849
- "@typescript-eslint/switch-exhaustiveness-check": [
850
- "error",
851
- {
852
- requireDefaultForNonUnion: true
853
- }
854
- ],
852
+ "@typescript-eslint/switch-exhaustiveness-check": ["error", { requireDefaultForNonUnion: true }],
855
853
  "@typescript-eslint/unbound-method": "error",
856
- "@typescript-eslint/unified-signatures": [
857
- "error",
858
- {
859
- ignoreDifferentlyNamedParameters: true
860
- }
861
- ],
854
+ "@typescript-eslint/unified-signatures": ["error", { ignoreDifferentlyNamedParameters: true }],
862
855
  "@typescript-eslint/use-unknown-in-catch-callback-variable": "error",
863
856
  ...overrides == null ? void 0 : overrides.typescript
864
857
  };
@@ -874,9 +867,7 @@ async function typescript(options) {
874
867
  extraFileExtensions: options.vue ? [".vue"] : []
875
868
  }
876
869
  },
877
- plugins: {
878
- "@typescript-eslint": tsPlugin
879
- },
870
+ plugins: { "@typescript-eslint": tsPlugin },
880
871
  rules
881
872
  };
882
873
  }
@@ -885,116 +876,81 @@ async function perfectionist(options) {
885
876
  if (!enabled) return {};
886
877
  const plugin = await interopDefault(import("eslint-plugin-perfectionist"));
887
878
  return {
888
- plugins: {
889
- perfectionist: plugin
890
- },
879
+ plugins: { perfectionist: plugin },
891
880
  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
- ],
881
+ "perfectionist/sort-array-includes": ["error", {
882
+ type: "natural",
883
+ order: "asc",
884
+ ignoreCase: true,
885
+ groupKind: "literals-first"
886
+ }],
887
+ "perfectionist/sort-enums": ["error", {
888
+ type: "natural",
889
+ order: "asc"
890
+ }],
891
+ "perfectionist/sort-exports": ["error", {
892
+ type: "line-length",
893
+ order: "asc",
894
+ ignoreCase: true
895
+ }],
896
+ "perfectionist/sort-imports": ["error", {
897
+ type: "line-length",
898
+ order: "asc",
899
+ ignoreCase: true,
900
+ newlinesBetween: "never",
901
+ groups: [["side-effect-style", "side-effect"], "unknown"]
902
+ }],
903
+ "perfectionist/sort-interfaces": ["error", {
904
+ type: "natural",
905
+ order: "asc",
906
+ partitionByNewLine: true
907
+ }],
908
+ "perfectionist/sort-intersection-types": ["error", {
909
+ type: "natural",
910
+ order: "asc"
911
+ }],
912
+ "perfectionist/sort-maps": ["error", {
913
+ type: "natural",
914
+ order: "asc"
915
+ }],
916
+ "perfectionist/sort-named-exports": ["error", {
917
+ type: "natural",
918
+ order: "asc"
919
+ }],
955
920
  "sort-imports": "off",
956
- "perfectionist/sort-named-imports": [
957
- "error",
958
- {
959
- type: "natural",
960
- order: "asc"
961
- }
962
- ],
921
+ "perfectionist/sort-named-imports": ["error", {
922
+ type: "natural",
923
+ order: "asc"
924
+ }],
963
925
  "@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
- ],
926
+ "perfectionist/sort-object-types": ["error", {
927
+ type: "natural",
928
+ order: "asc",
929
+ partitionByNewLine: true
930
+ }],
931
+ "perfectionist/sort-switch-case": ["error", {
932
+ type: "natural",
933
+ order: "asc",
934
+ ignoreCase: true
935
+ }],
980
936
  ...overrides == null ? void 0 : overrides.perfectionist
981
937
  }
982
938
  };
983
939
  }
984
- async function config(options) {
985
- const { prettier = true } = options;
986
- const objs = await Promise.all([
940
+ async function defineConfig(options) {
941
+ const ignores = {
942
+ ignores: [...getIgnores(), ...options.ignores ?? []]
943
+ };
944
+ const objects = await Promise.all([
987
945
  javascript(options),
988
946
  typescript(options),
989
947
  ...await vue(options),
990
948
  perfectionist(options),
991
949
  unicorn(options),
950
+ stylistic(options),
992
951
  vitest(options),
993
- prettier ? eslintConfigPrettier : {},
994
- {
995
- ignores: [...getIgnores(), ...options.ignores ?? []]
996
- }
952
+ ignores
997
953
  ]);
998
- return objs;
954
+ return objects;
999
955
  }
1000
- module.exports = config;
956
+ module.exports = defineConfig;