@unshared/eslint-config 0.0.1 → 0.0.3

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 ADDED
@@ -0,0 +1,1378 @@
1
+ import vueParser from "vue-eslint-parser";
2
+ import tslint from "typescript-eslint";
3
+ import vueProcessorBlocks from "eslint-processor-vue-blocks";
4
+ import vuePlugin from "eslint-plugin-vue";
5
+ import { mergeProcessors } from "eslint-merge-processors";
6
+ import { cwd } from "node:process";
7
+ import perfectionist from "eslint-plugin-perfectionist";
8
+ import { toArray } from "@unshared/collection/toArray";
9
+ import stylistic from "@stylistic/eslint-plugin";
10
+ import javascript from "@eslint/js";
11
+ import vitestPlugin from "eslint-plugin-vitest";
12
+ import unicornPlugin from "eslint-plugin-unicorn";
13
+ import { FlatCompat } from "@eslint/eslintrc";
14
+ import nodePlugin from "eslint-plugin-n";
15
+ import jsonc from "eslint-plugin-jsonc";
16
+ import pluginJsdoc from "eslint-plugin-jsdoc";
17
+ import eslintCommentsPlugin from "eslint-plugin-eslint-comments";
18
+ import pluginAntfu from "eslint-plugin-antfu";
19
+ function getConfigRules(config) {
20
+ const rules = toArray(config).flat().map((x) => x.rules);
21
+ return Object.assign({}, ...rules);
22
+ }
23
+ function typescript(options) {
24
+ return [
25
+ javascript.configs.recommended,
26
+ {
27
+ languageOptions: {
28
+ // @ts-expect-error: ignore
29
+ parser: tslint.parser,
30
+ parserOptions: {
31
+ ecmaVersion: "latest",
32
+ sourceType: "module",
33
+ project: toArray(options.tsConfigPath ?? "./tsconfig.json"),
34
+ tsconfigRootDir: cwd()
35
+ }
36
+ },
37
+ plugins: {
38
+ "@typescript-eslint": tslint.plugin,
39
+ "@stylistic": stylistic,
40
+ perfectionist
41
+ },
42
+ files: [
43
+ "**/*.{ts,tsx,cts,mts}",
44
+ "**/*.{js,jsx,cjs,mjs}"
45
+ ],
46
+ rules: {
47
+ /**
48
+ * Inherit all recommended rules from the `@eslint/js` plugin. This is the base
49
+ * configuration for JavaScript files.
50
+ */
51
+ ...getConfigRules(tslint.configs.recommendedTypeChecked),
52
+ ...getConfigRules(tslint.configs.stylisticTypeChecked),
53
+ /**
54
+ * Age-old debate over how to style braces. This rule aims to reduce the
55
+ * cognitive load of reasoning about code by enforcing a consistent style.
56
+ *
57
+ * @see https://eslint.style/rules/default/brace-style
58
+ */
59
+ "brace-style": "off",
60
+ "@typescript-eslint/brace-style": "off",
61
+ "@stylistic/brace-style": ["error", "stroustrup", {
62
+ allowSingleLine: !0
63
+ }],
64
+ /**
65
+ * Enforce an indent of 2 spaces. Aims to reduce visual noise and maintain
66
+ * readability of code when viewed on GitHub or GitLab.
67
+ *
68
+ * @see https://eslint.style/rules/default/no-tabs
69
+ * @see https://eslint.style/rules/default/indent
70
+ * @see https://eslint.style/rules/default/indent-binary-ops
71
+ */
72
+ "no-tabs": "off",
73
+ indent: "off",
74
+ "indent-binary-ops": "off",
75
+ "@typescript-eslint/no-tabs": "off",
76
+ "@typescript-eslint/indent": "off",
77
+ "@typescript-eslint/indent-binary-ops": "off",
78
+ "@stylistic/no-tabs": "error",
79
+ "@stylistic/indent": ["error", 2],
80
+ "@stylistic/indent-binary-ops": ["error", 2],
81
+ /**
82
+ * Enforce no semi-colons. This rule aims to maintain consistency around the
83
+ * use or omission of trailing semicolons. Helps reduce the visual noise in
84
+ * the codebase. Also helps to prevent errors when refactoring and adding
85
+ * new lines.
86
+ *
87
+ * @see https://eslint.style/rules/default/semi
88
+ */
89
+ semi: "off",
90
+ "@typescript-eslint/semi": "off",
91
+ "@stylistic/semi": ["error", "never"],
92
+ /**
93
+ * Enforce a consistent linebreak style and ensure no leading line breaks
94
+ * and a single trailing line break. This rule aims to maintain consistency
95
+ * around the use of line breaks in the codebase and reduce the amount of
96
+ * diff churn when making changes.
97
+ *
98
+ * @see https://eslint.style/rules/default/linebreak-style
99
+ */
100
+ "eol-last": "off",
101
+ "no-multiple-empty-lines": "off",
102
+ "@stylistic/eol-last": ["error", "always"],
103
+ "@stylistic/no-multiple-empty-lines": ["error", {
104
+ max: 1,
105
+ maxBOF: 0,
106
+ maxEOF: 0
107
+ }],
108
+ /**
109
+ * Enforce a trailing comma after the last element or property in a multiline
110
+ * list of properties or elements. This rule improves the clarity of diffs
111
+ * when an item is added or removed from an object or array.
112
+ *
113
+ * @see https://eslint.style/rules/default/comma-dangle
114
+ * @see https://eslint.style/rules/default/comma-spacing
115
+ */
116
+ "comma-dangle": "off",
117
+ "@typescript-eslint/comma-dangle": "off",
118
+ "@stylistic/comma-dangle": ["error", "always-multiline"],
119
+ /**
120
+ * This rule requires empty lines before and/or after comments. It is disabled
121
+ * however when in an object literal, array, or type literal.
122
+ *
123
+ * @see https://eslint.style/rules/default/lines-around-comment
124
+ */
125
+ /**
126
+ * Normalize type declaration and definition. This reduces the cognitive load
127
+ * of reasoning about code by enforcing a consistent style.
128
+ *
129
+ * @see https://typescript-eslint.io/rules/consistent-indexed-object-style
130
+ */
131
+ "@typescript-eslint/consistent-indexed-object-style": ["error", "record"],
132
+ "@typescript-eslint/consistent-type-definitions": ["error", "interface"],
133
+ "@typescript-eslint/member-delimiter-style": ["error", { multiline: { delimiter: "none" } }],
134
+ "@typescript-eslint/array-type": ["error", { default: "array-simple", readonly: "array-simple" }],
135
+ /**
136
+ * Enforce sequential declarations in the same block. This rule aims to
137
+ * enforce a top to bottom ordering of variable and type declarations.
138
+ * This reduces the likelihood of a developer skipping over a declaration
139
+ * when modifying code.
140
+ *
141
+ * @see https://typescript-eslint.io/rules/no-use-before-define
142
+ */
143
+ "no-use-before-define": "off",
144
+ "@typescript-eslint/no-use-before-define": ["error", {
145
+ enums: !0,
146
+ classes: !1,
147
+ typedefs: !0,
148
+ variables: !0,
149
+ functions: !1,
150
+ ignoreTypeReferences: !0
151
+ }],
152
+ /**
153
+ * Enforce a consistent spacing around various places where spaces are optional.
154
+ * This rule aims to maintain consistency around the use of spaces in the codebase
155
+ * and reduce the amount of diff churn when making changes.
156
+ *
157
+ * @see https://eslint.style/rules/default/key-spacing
158
+ * @see https://eslint.style/rules/default/comma-spacing
159
+ * @see https://eslint.style/rules/default/block-spacing
160
+ * @see https://eslint.style/rules/default/arrow-spacing
161
+ * @see https://eslint.style/rules/default/object-curly-spacing
162
+ */
163
+ "key-spacing": "off",
164
+ "comma-spacing": "off",
165
+ "block-spacing": "off",
166
+ "arrow-spacing": "off",
167
+ "spaced-comment": "off",
168
+ "no-multi-spaces": "off",
169
+ "space-before-blocks": "off",
170
+ "lines-around-comment": "off",
171
+ "object-curly-spacing": "off",
172
+ "array-bracket-spacing": "off",
173
+ "array-bracket-newline": "off",
174
+ "function-call-spacing": "off",
175
+ "generator-star-spacing": "off",
176
+ "template-curly-spacing": "off",
177
+ "object-property-newline ": "off",
178
+ "newline-per-chained-call": "off",
179
+ "computed-property-spacing": "off",
180
+ "lines-between-class-members": "off",
181
+ "@typescript-eslint/comma-spacing": "off",
182
+ "@typescript-eslint/object-curly-spacing": "off",
183
+ "@typescript-eslint/type-annotation-spacing": "off",
184
+ "@typescript-eslint/lines-around-comment": "off",
185
+ "@stylistic/key-spacing": ["error", { afterColon: !0, beforeColon: !1 }],
186
+ "@stylistic/comma-spacing": ["error", { after: !0, before: !1 }],
187
+ "@stylistic/arrow-spacing": ["error", { before: !0, after: !0 }],
188
+ "@stylistic/type-generic-spacing": "error",
189
+ "@stylistic/type-named-tuple-spacing": "error",
190
+ "@stylistic/block-spacing": ["error", "always"],
191
+ "@stylistic/no-multi-spaces": "error",
192
+ "@stylistic/keyword-spacing": ["error", { before: !0, after: !0 }],
193
+ "@stylistic/space-before-blocks": ["error", "always"],
194
+ "@stylistic/object-curly-spacing": ["error", "always"],
195
+ "@stylistic/array-bracket-spacing": ["error", "never"],
196
+ "@stylistic/array-bracket-newline": ["error", "consistent"],
197
+ "@stylistic/function-call-spacing": ["error", "never"],
198
+ "@stylistic/template-curly-spacing": ["error", "never"],
199
+ "@stylistic/object-property-newline": ["error", { allowAllPropertiesOnSameLine: !0 }],
200
+ "@stylistic/generator-star-spacing": ["error", { before: !0, after: !0 }],
201
+ "@stylistic/computed-property-spacing": ["error", "never"],
202
+ "@stylistic/multiline-ternary": ["error", "always-multiline"],
203
+ "@stylistic/lines-around-comment": ["error", {
204
+ beforeBlockComment: !0,
205
+ beforeLineComment: !0,
206
+ ignorePattern: "^(?! ?---|\\*)",
207
+ applyDefaultIgnorePatterns: !0,
208
+ afterHashbangComment: !0
209
+ }],
210
+ "@stylistic/spaced-comment": ["error", "always", {
211
+ block: { markers: ["!"], exceptions: ["*"], balanced: !0 },
212
+ line: { markers: ["/"], exceptions: ["/", "#"] }
213
+ }],
214
+ "@stylistic/lines-between-class-members": ["error", {
215
+ enforce: [{ blankLine: "always", prev: "method", next: "*" }]
216
+ }, {
217
+ exceptAfterSingleLine: !0
218
+ }],
219
+ "@stylistic/type-annotation-spacing": ["error", {
220
+ before: !1,
221
+ after: !0,
222
+ overrides: {
223
+ arrow: { before: !0, after: !0 },
224
+ colon: { before: !1, after: !0 },
225
+ variable: { before: !1, after: !0 },
226
+ property: { before: !1, after: !0 },
227
+ parameter: { before: !1, after: !0 },
228
+ returnType: { before: !1, after: !0 }
229
+ }
230
+ }],
231
+ /**
232
+ * Enforce the use of `@ts-expect-error` over `@ts-ignore` to silence TypeScript
233
+ * errors. This rule aims to ensure that TypeScript errors are never silenced
234
+ * without explanation or justification. When an error is fixed, the
235
+ * `@ts-expect-error` forces the developer to remove the comment.
236
+ *
237
+ * @see https://typescript-eslint.io/rules/prefer-ts-expect-error
238
+ * @see https://typescript-eslint.io/rules/ban-ts-comment
239
+ */
240
+ "@typescript-eslint/prefer-ts-expect-error": "error",
241
+ "@typescript-eslint/ban-ts-comment": ["error", {
242
+ "ts-check": !1,
243
+ "ts-expect-error": "allow-with-description",
244
+ "ts-ignore": !1,
245
+ "ts-nocheck": !1
246
+ }],
247
+ /**
248
+ * Disallow dangling expressions and promises. This rule aims to prevent
249
+ * dangling promises and expressions that are not assigned to a variable.
250
+ * This can lead to bugs and unexpected behavior in the codebase.
251
+ *
252
+ * @see https://eslint.org/docs/rules/no-void
253
+ * @see https://typescript-eslint.io/rules/no-floating-promises
254
+ */
255
+ "no-void": "off",
256
+ "no-unused-expressions": "off",
257
+ "@typescript-eslint/no-unused-expressions": "error",
258
+ "@typescript-eslint/no-floating-promises": ["error", {
259
+ ignoreVoid: !0,
260
+ ignoreIIFE: !0
261
+ }],
262
+ /**
263
+ * Sort imports alphabetically and group them without newlines. This rule
264
+ * aims to maintain consistency around the order of imports in JavaScript
265
+ * files. Helps reduce the visual noise in the codebase.
266
+ *
267
+ * @see https://eslint-plugin-perfectionist.azat.io/rules/sort-imports
268
+ */
269
+ "sort-imports": "off",
270
+ "@typescript-eslint/sort-type-constituents": "off",
271
+ "@typescript-eslint/consistent-type-imports": ["error", {
272
+ disallowTypeAnnotations: !1,
273
+ prefer: "no-type-imports"
274
+ }],
275
+ "perfectionist/sort-named-imports": ["error", { type: "natural" }],
276
+ "perfectionist/sort-imports": ["error", {
277
+ "newlines-between": "never",
278
+ order: "desc"
279
+ }],
280
+ /**
281
+ * Enforce no unused variables. Helps keep the codebase clean and reduces
282
+ * the chance of bugs from side-effects.
283
+ *
284
+ * @see https://typescript-eslint.io/rules/@typescript-eslint/no-unused-vars
285
+ */
286
+ "no-redeclare": "off",
287
+ "no-unused-vars": "off",
288
+ "@typescript-eslint/no-redeclare": "error",
289
+ "@typescript-eslint/no-unused-vars": ["error", { argsIgnorePattern: "^_" }],
290
+ //////////////////////////////////////////////////////////////////////////////////////////
291
+ "perfectionist/sort-intersection-types": ["error", { type: "natural" }],
292
+ "perfectionist/sort-union-types": ["error", {
293
+ type: "natural",
294
+ "nullable-last": !0
295
+ }],
296
+ "no-useless-constructor": "off",
297
+ "@typescript-eslint/ban-types": "off",
298
+ "@typescript-eslint/camelcase": "off",
299
+ "@typescript-eslint/explicit-function-return-type": "off",
300
+ "@typescript-eslint/explicit-member-accessibility": "off",
301
+ "@typescript-eslint/explicit-module-boundary-types": "off",
302
+ "@typescript-eslint/no-empty-function": "off",
303
+ "@typescript-eslint/no-empty-interface": "off",
304
+ "@typescript-eslint/no-explicit-any": "off",
305
+ "@typescript-eslint/no-namespace": "off",
306
+ "@typescript-eslint/no-non-null-assertion": "off",
307
+ "@typescript-eslint/no-parameter-properties": "off",
308
+ "array-callback-return": "error",
309
+ "arrow-body-style": ["error", "as-needed"],
310
+ "arrow-parens": ["error", "as-needed", { requireForBlockBody: !0 }],
311
+ "block-scoped-var": "error",
312
+ camelcase: "off",
313
+ "comma-style": ["error", "last"],
314
+ complexity: ["off", 11],
315
+ "consistent-return": "off",
316
+ curly: ["error", "multi-or-nest", "consistent"],
317
+ eqeqeq: ["error", "smart"],
318
+ "no-alert": "error",
319
+ "no-case-declarations": "error",
320
+ "no-cond-assign": ["error", "always"],
321
+ "no-confusing-arrow": "error",
322
+ "no-console": ["warn", { allow: ["warn", "error"] }],
323
+ "no-constant-condition": "error",
324
+ "no-debugger": "error",
325
+ "no-eval": "error",
326
+ "no-implied-eval": "error",
327
+ "no-multi-str": "error",
328
+ "no-param-reassign": "off",
329
+ "no-restricted-syntax": ["error", "DebuggerStatement", "LabeledStatement", "WithStatement"],
330
+ "no-return-assign": "off",
331
+ "no-return-await": "off",
332
+ "no-trailing-spaces": "error",
333
+ "no-useless-escape": "off",
334
+ "no-var": "error",
335
+ "no-with": "error",
336
+ "object-shorthand": ["error", "always", { avoidQuotes: !0, ignoreConstructors: !1 }],
337
+ "one-var-declaration-per-line": "error",
338
+ "operator-linebreak": ["error", "before"],
339
+ "prefer-arrow-callback": ["error", { allowNamedFunctions: !1, allowUnboundThis: !0 }],
340
+ "prefer-const": ["error", { destructuring: "any", ignoreReadBeforeAssign: !0 }],
341
+ "prefer-rest-params": "error",
342
+ "prefer-spread": "error",
343
+ "prefer-template": "error",
344
+ "quote-props": ["error", "consistent-as-needed"],
345
+ quotes: ["error", "single"],
346
+ "require-await": "off",
347
+ "space-before-function-paren": ["error", "never"],
348
+ "vars-on-top": "error"
349
+ }
350
+ },
351
+ /**
352
+ * Ignore duplicate imports in declaration files as they are often used to re-export
353
+ * types from other packages into multiple namespaces. This is a common pattern
354
+ * in TypeScript declaration files.
355
+ */
356
+ {
357
+ files: ["*.d.ts"],
358
+ rules: {
359
+ "@typescript-eslint/no-use-before-define": "off",
360
+ "import/no-duplicates": "off"
361
+ }
362
+ },
363
+ /**
364
+ * Allow console statements in scripts and CLI files since they are not part of the
365
+ * library / production code and are useful for debugging, logging, and testing.
366
+ */
367
+ {
368
+ files: ["**/scripts/**/*", "cli.*"],
369
+ rules: {
370
+ "no-console": "off"
371
+ }
372
+ }
373
+ ];
374
+ }
375
+ function vue(options) {
376
+ const TYPESCRIPT_CONFIG = typescript(options).at(1);
377
+ return [
378
+ ...vuePlugin.configs?.["flat/base"],
379
+ {
380
+ plugins: {
381
+ vue: vuePlugin,
382
+ ...TYPESCRIPT_CONFIG.plugins
383
+ },
384
+ languageOptions: {
385
+ globals: {
386
+ computed: "readonly",
387
+ defineEmits: "readonly",
388
+ defineExpose: "readonly",
389
+ defineProps: "readonly",
390
+ onMounted: "readonly",
391
+ onUnmounted: "readonly",
392
+ reactive: "readonly",
393
+ ref: "readonly",
394
+ shallowReactive: "readonly",
395
+ shallowRef: "readonly",
396
+ toRef: "readonly",
397
+ toRefs: "readonly",
398
+ watch: "readonly",
399
+ watchEffect: "readonly"
400
+ },
401
+ parser: vueParser,
402
+ parserOptions: {
403
+ parser: tslint.parser,
404
+ extraFileExtensions: [".vue"],
405
+ ...TYPESCRIPT_CONFIG.languageOptions.parserOptions
406
+ }
407
+ },
408
+ processor: mergeProcessors([
409
+ // @ts-expect-error: ignore
410
+ vuePlugin.processors[".vue"],
411
+ vueProcessorBlocks()
412
+ ]),
413
+ files: [
414
+ "**/*.vue"
415
+ ],
416
+ rules: {
417
+ ...TYPESCRIPT_CONFIG.rules,
418
+ // @ts-expect-error: ignore
419
+ ...vuePlugin.configs["flat/recommended"].rules,
420
+ // @ts-expect-error: ignore
421
+ ...vuePlugin.configs["flat/strongly-recommended"].rules,
422
+ // @ts-expect-error: ignore
423
+ ...vuePlugin.configs["flat/essential"].rules,
424
+ /**
425
+ * Disable some TypeScript rules that may conflict with the Vue SFC parser.
426
+ */
427
+ "@typescript-eslint/no-unsafe-call": "off",
428
+ "@typescript-eslint/no-unsafe-return": "off",
429
+ "@typescript-eslint/no-misused-promises": "off",
430
+ "@typescript-eslint/no-unsafe-assignment": "off",
431
+ "@typescript-eslint/no-unsafe-member-access": "off",
432
+ /**
433
+ * Enforces consistent usage of type imports. This rule will enforce the use
434
+ * of `type` imports to make it easier for the Vue SFC compiler to analyze
435
+ * the code and infer the dependency graph correctly.
436
+ *
437
+ * @see https://typescript-eslint.io/rules/consistent-type-imports
438
+ * @see https://vuejs.github.io/vetur/guide/FAQ.html#why-does-vetur-show-cannot-find-module-xxx
439
+ */
440
+ // '@typescript-eslint/consistent-type-imports': ['error', {
441
+ // disallowTypeAnnotations: false,
442
+ // fixStyle: 'inline-type-imports',
443
+ // prefer: 'type-imports',
444
+ // }],
445
+ /**
446
+ * Enforce the order of the top-level properties in the component. This rule
447
+ * helps to maintain consistency and readability by enforcing a predictable
448
+ * order of the top-level properties in the component.
449
+ *
450
+ * @see https://eslint.vuejs.org/rules/ordered-component-elements.html
451
+ */
452
+ "vue/block-order": ["error", {
453
+ order: [
454
+ "docs",
455
+ "script",
456
+ "template",
457
+ "style"
458
+ ]
459
+ }],
460
+ /**
461
+ * Enforce use of the Composition API and TypeScript. This rule forbids the
462
+ * use of the Options API and JavaScript in Vue components for better
463
+ * consistency and maintainability.
464
+ *
465
+ * @see https://eslint.vuejs.org/rules/vue/prefer-define-options.html
466
+ * @see https://eslint.vuejs.org/rules/vue/component-api-style.html
467
+ */
468
+ "vue/prefer-define-options": "error",
469
+ "vue/component-api-style": ["error", ["script-setup"]],
470
+ /**
471
+ * Enforce the component name casing to be PascalCase. This rules helps identify
472
+ * and distinguish between components and HTML elements. It also helps to avoid
473
+ * conflicts with existing and future HTML elements.
474
+ *
475
+ * @see https://eslint.vuejs.org/rules/component-name-in-template-casing.html
476
+ */
477
+ "vue/component-name-in-template-casing": ["error", "PascalCase", {
478
+ ignores: ["/\\./"],
479
+ registeredComponentsOnly: !1
480
+ }],
481
+ /**
482
+ * Enforce consistent spacing between HTML comments and their content.
483
+ *
484
+ * @see https://eslint.vuejs.org/rules/html-comment-content-spacing.html
485
+ * @see https://eslint.vuejs.org/rules/html-comment-content-newline.html
486
+ */
487
+ "vue/html-comment-content-spacing": ["error", "always"],
488
+ "vue/html-comment-content-newline": ["error", {
489
+ multiline: "always",
490
+ singleline: "never"
491
+ }],
492
+ /**
493
+ * Enforce consistent spacing between HTML / Component tags. This makes it
494
+ * easier to read and understand the structure of the component.
495
+ *
496
+ * @see https://eslint.vuejs.org/rules/padding-line-between-blocks.html
497
+ * @see https://eslint.vuejs.org/rules/padding-line-between-tags.html
498
+ */
499
+ "vue/padding-line-between-blocks": ["error", "always"],
500
+ "vue/padding-line-between-tags": ["error", [
501
+ { blankLine: "consistent", next: "*", prev: "*" },
502
+ { blankLine: "always", next: "*", prev: "comment" }
503
+ ]],
504
+ "vue/html-comment-indent": ["error", 2],
505
+ "vue/multiline-html-element-content-newline": ["error", {
506
+ allowEmptyLines: !0,
507
+ ignores: [],
508
+ ignoreWhenEmpty: !0
509
+ }],
510
+ /**
511
+ * Enforce consistent spacing and newlines in the template. This rule helps
512
+ * to maintain consistency and readability by enforcing a predictable
513
+ *
514
+ * @see https://eslint.vuejs.org/rules/html-indent.html
515
+ * @see https://eslint.vuejs.org/rules/max-attributes-per-line.html
516
+ * @see https://eslint.vuejs.org/rules/html-closing-bracket-newline.html
517
+ */
518
+ "vue/html-indent": ["error", 2, {
519
+ alignAttributesVertically: !0,
520
+ attribute: 1,
521
+ baseIndent: 1,
522
+ closeBracket: 0,
523
+ ignores: []
524
+ }],
525
+ // 'vue/func-call-spacing': ['off', 'never'],
526
+ "vue/key-spacing": ["error", { afterColon: !0, beforeColon: !1 }],
527
+ "vue/keyword-spacing": ["error", { after: !0, before: !0 }],
528
+ "vue/max-attributes-per-line": ["error", {
529
+ multiline: { max: 1 },
530
+ singleline: { max: 5 }
531
+ }],
532
+ /**
533
+ * Allow single-word component names. This rule is disabled because we use
534
+ * pascal-casing to distinguish between components and HTML elements.
535
+ *
536
+ * @see https://eslint.vuejs.org/rules/multi-word-component-names.html
537
+ */
538
+ "vue/multi-word-component-names": "off",
539
+ "vue/no-reserved-component-names": "off",
540
+ /**
541
+ * Reports the destructuring or member expression of props passed to setup
542
+ * causing the value to lose reactivity. This rule helps to avoid common
543
+ * pitfalls when using the Composition API.
544
+ *
545
+ * @see https://eslint.vuejs.org/rules/no-setup-props-reactivity-loss.html
546
+ */
547
+ "vue/no-setup-props-reactivity-loss": "error",
548
+ /**
549
+ * Disallow v-if in v-for. This rule helps to avoid common pitfalls when
550
+ * using v-if and v-for together in the same element.
551
+ *
552
+ * @see https://eslint.vuejs.org/rules/no-use-v-if-with-v-for.html
553
+ */
554
+ "vue/no-use-v-if-with-v-for": "error",
555
+ /**
556
+ * Enforce the declaration of emits in the setup function and warn on unused
557
+ * emits declarations. This rule helps reduce the risk stale code.
558
+ *
559
+ * @see https://eslint.vuejs.org/rules/require-explicit-emits.html
560
+ * @see https://eslint.vuejs.org/rules/no-unused-emit-declarations.html
561
+ */
562
+ "vue/require-explicit-emits": "error",
563
+ /**
564
+ * Enforce the `@` shorthand over `v-on:` and only allow inline callbacks.
565
+ * This rule helps to maintain consistency and readability by enforcing a
566
+ * predictable order of the event handlers in the component.
567
+ *
568
+ * @see https://eslint.vuejs.org/rules/v-on-style.html
569
+ * @see https://eslint.vuejs.org/rules/v-on-handler-style.html
570
+ */
571
+ "vue/v-on-style": ["error", "shorthand"],
572
+ "vue/return-in-computed-property": "off",
573
+ "vue/no-sparse-arrays": "error",
574
+ "vue/no-unused-emit-declarations": "error",
575
+ "vue/no-use-v-else-with-v-for": "error",
576
+ "vue/no-useless-v-bind": "error",
577
+ "vue/no-v-html": "off",
578
+ "vue/no-v-text-v-html-on-component": "error",
579
+ "vue/object-curly-newline": ["error", { consistent: !0, multiline: !0 }],
580
+ "vue/object-curly-spacing": ["error", "always"],
581
+ "vue/object-shorthand": [
582
+ "error",
583
+ "always",
584
+ {
585
+ avoidQuotes: !0,
586
+ ignoreConstructors: !1
587
+ }
588
+ ],
589
+ "vue/operator-linebreak": ["error", "before"],
590
+ "vue/prefer-import-from-vue": "off",
591
+ "vue/prefer-separate-static-class": "error",
592
+ "vue/prefer-template": "error",
593
+ "vue/quote-props": ["error", "consistent-as-needed"],
594
+ "vue/require-default-prop": "off",
595
+ // reactivity transform
596
+ "vue/block-tag-newline": ["error", {
597
+ multiline: "always",
598
+ singleline: "always"
599
+ }],
600
+ // extensions
601
+ "vue/array-bracket-spacing": ["error", "never"],
602
+ "vue/arrow-spacing": ["error", { after: !0, before: !0 }],
603
+ "vue/block-lang": ["error", { script: { lang: "ts" } }],
604
+ "vue/block-spacing": ["error", "always"],
605
+ "vue/brace-style": ["error", "stroustrup", { allowSingleLine: !0 }],
606
+ "vue/comma-dangle": ["error", "always-multiline"],
607
+ "vue/comma-spacing": ["error", { after: !0, before: !1 }],
608
+ "vue/comma-style": ["error", "last"],
609
+ "vue/component-options-name-casing": ["error", "PascalCase"],
610
+ "vue/custom-event-name-casing": ["error", "camelCase"],
611
+ "vue/define-macros-order": ["error", {
612
+ order: ["defineProps", "defineEmits"]
613
+ }],
614
+ "vue/dot-location": ["error", "property"],
615
+ "vue/dot-notation": ["error", { allowKeywords: !0 }],
616
+ "vue/eqeqeq": ["error", "smart"],
617
+ "vue/first-attribute-linebreak": ["error", {
618
+ multiline: "below",
619
+ singleline: "beside"
620
+ }],
621
+ "vue/html-closing-bracket-newline": ["error", {
622
+ multiline: "never",
623
+ selfClosingTag: {
624
+ multiline: "always",
625
+ singleline: "never"
626
+ },
627
+ singleline: "never"
628
+ }],
629
+ "vue/no-constant-condition": "warn",
630
+ "vue/no-empty-pattern": "error",
631
+ "vue/no-extra-parens": ["error", "functions"],
632
+ "vue/no-irregular-whitespace": "error",
633
+ "vue/no-loss-of-precision": "error",
634
+ "vue/no-restricted-syntax": [
635
+ "error",
636
+ "DebuggerStatement",
637
+ "LabeledStatement",
638
+ "WithStatement"
639
+ ],
640
+ "vue/no-restricted-v-bind": ["error", "/^v-/"],
641
+ "vue/require-prop-types": "off",
642
+ "vue/space-in-parens": ["error", "never"],
643
+ "vue/space-infix-ops": "error",
644
+ "vue/space-unary-ops": ["error", { nonwords: !1, words: !0 }],
645
+ "vue/template-curly-spacing": "error",
646
+ "vue/v-on-handler-style": ["error", "inline"],
647
+ /** User-defined rules */
648
+ ...options.rules
649
+ }
650
+ }
651
+ ];
652
+ }
653
+ function vitest(options) {
654
+ return [
655
+ {
656
+ plugins: {
657
+ vitest: vitestPlugin
658
+ },
659
+ files: [
660
+ "**/*.{ts,mts,cts,tsx,d.ts}",
661
+ "**/*.{js,mjs,cjs,jsx}"
662
+ ],
663
+ settings: {
664
+ vitest: {
665
+ typecheck: !0
666
+ }
667
+ },
668
+ languageOptions: {
669
+ globals: {
670
+ ...vitestPlugin.environments.env.globals,
671
+ expectTypeOf: !0
672
+ }
673
+ },
674
+ rules: {
675
+ /**
676
+ * Inject all configuration from eslint-plugin-vitest.
677
+ *
678
+ * @see https://github.com/veritem/eslint-plugin-vitest/tree/main?tab=readme-ov-file#rules
679
+ */
680
+ ...vitestPlugin.configs.all.rules,
681
+ /**
682
+ * This rule aims to enforce having at least one expectation
683
+ * in test body to ensure that the test is actually testing something.
684
+ *
685
+ * @see https://github.com/veritem/eslint-plugin-vitest/blob/main/docs/rules/expect-expect.md
686
+ */
687
+ "vitest/expect-expect": ["error", {
688
+ assertFunctionNames: [
689
+ "expect",
690
+ "expectTypeOf"
691
+ ]
692
+ }],
693
+ /**
694
+ * Disable the conditional test rule as it is prevent's us to use in-source
695
+ * testing when using the `if (import.meta.vitest)` condition. Also disable
696
+ * the rule that prevents the use of if-else statements in tests as we want
697
+ * to use it to test type predicates.
698
+ *
699
+ * @see https://github.com/veritem/eslint-plugin-vitest/blob/main/docs/rules/no-conditional-in-test.md
700
+ */
701
+ "vitest/no-conditional-in-test": "off",
702
+ "vitest/no-conditional-tests": "off",
703
+ /**
704
+ * Since we use in-source testing, we need to disable the rule as it may prevent
705
+ * us from using top level evaluation that are not part of the test suite.
706
+ *
707
+ * @see https://github.com/veritem/eslint-plugin-vitest/blob/main/docs/rules/no-hooks.md
708
+ */
709
+ "vitest/require-hook": "off",
710
+ "vitest/no-hooks": "off",
711
+ /**
712
+ * Disable the rule that enforces the use of `expect.assertions` in tests.
713
+ * As much as this rule enforces a best-practice, it is not always necessary.
714
+ *
715
+ * @see https://github.com/veritem/eslint-plugin-vitest/blob/main/docs/rules/prefer-expect-assertions.md
716
+ */
717
+ "vitest/prefer-expect-assertions": "off",
718
+ /**
719
+ * Some functions may have a single test case, and it is not necessary
720
+ * to wrap them in a describe block.
721
+ *
722
+ * @see https://github.com/veritem/eslint-plugin-vitest/blob/main/docs/rules/require-top-level-describe.md
723
+ */
724
+ "vitest/require-top-level-describe": "off",
725
+ /**
726
+ * Enforce rule titles starts with 'should'. This is a convention
727
+ * to force the developer to write the test in a way that it reads
728
+ * like a sentence.
729
+ *
730
+ * @see https://github.com/veritem/eslint-plugin-vitest/blob/main/docs/rules/valid-title.md
731
+ */
732
+ "vitest/valid-title": ["error", {
733
+ ignoreTypeOfDescribeName: !0,
734
+ mustMatch: {
735
+ test: ["^should"]
736
+ }
737
+ }],
738
+ /** User-defined rules */
739
+ ...options.rules
740
+ }
741
+ }
742
+ ];
743
+ }
744
+ const UNICORN_RECOMMENDED_RULES = unicornPlugin.configs.recommended.rules;
745
+ function unicorn(options) {
746
+ return [
747
+ {
748
+ plugins: {
749
+ unicorn: unicornPlugin
750
+ },
751
+ rules: {
752
+ ...UNICORN_RECOMMENDED_RULES,
753
+ /**
754
+ * Improve regexes by making them shorter, consistent, and safer. This rule
755
+ * aims to improve readability and consistency of regexes while also
756
+ * mitigating regex denial of service attacks by disallowing potentially
757
+ * catastrophic backtracking.
758
+ *
759
+ * @see https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/better-regex.md
760
+ */
761
+ "unicorn/better-regex": "error",
762
+ /**
763
+ * Enforce the catch clause parameter name to be named `error`. This rule
764
+ * aims to enforce a consistent parameter name in catch clauses. The name
765
+ * `error` is the most commonly used name for the parameter that is passed
766
+ * to the catch clause.
767
+ *
768
+ * @see https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/catch-error-name.md
769
+ */
770
+ "unicorn/catch-error-name": ["error", {
771
+ name: "error"
772
+ }],
773
+ /**
774
+ * Enforce the use of camelCase or PascalCase when naming folders, files and
775
+ * variables. This rule aims to enforce a consistent naming convention for
776
+ * filenames, directory names, and variable names.
777
+ *
778
+ * @see https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/filename-case.md
779
+ */
780
+ "unicorn/filename-case": ["error", {
781
+ cases: {
782
+ camelCase: !0,
783
+ pascalCase: !0
784
+ },
785
+ ignore: [
786
+ "^[A-Z]+(.md)?$"
787
+ ]
788
+ }],
789
+ /**
790
+ * Disable the recommended import style rules. We want to be able to use both
791
+ * named and default imports in our codebase.
792
+ *
793
+ * @see https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/import-style.md
794
+ */
795
+ "unicorn/import-style": "off",
796
+ /**
797
+ * Disallow unsafe regular expressions. Regular expressions can be unsafe
798
+ * when they are too complex and can cause catastrophic backtracking. This
799
+ * rule disallows regular expressions that can lead to catastrophic
800
+ *
801
+ * @see https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/no-unsafe-regex.md
802
+ */
803
+ "unicorn/no-unsafe-regex": "error",
804
+ /**
805
+ * Enforces a convention of grouping digits using numeric separators.
806
+ * Long numbers can become really hard to read, so cutting it into groups
807
+ * of digits, separated with a _, is important to keep your code clear.
808
+ *
809
+ * @see https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/numeric-separators-style.md
810
+ */
811
+ "unicorn/numeric-separators-style": ["error", {
812
+ onlyIfContainsSeparator: !0
813
+ }],
814
+ "unicorn/number-literal-case": "error",
815
+ "unicorn/consistent-function-scoping": "off",
816
+ "unicorn/error-message": "error",
817
+ "unicorn/escape-case": "error",
818
+ "unicorn/no-array-callback-reference": "off",
819
+ "unicorn/no-array-for-each": "off",
820
+ "unicorn/no-array-instanceof": "error",
821
+ "unicorn/no-new-buffer": "error",
822
+ "unicorn/no-static-only-class": "off",
823
+ "unicorn/prefer-code-point": "off",
824
+ "unicorn/prefer-exponentiation-operator": "error",
825
+ "unicorn/prefer-includes": "error",
826
+ "unicorn/prefer-module": "off",
827
+ "unicorn/prefer-starts-ends-with": "error",
828
+ "unicorn/prefer-switch": "off",
829
+ "unicorn/prefer-text-content": "error",
830
+ "unicorn/prefer-type-error": "error",
831
+ "unicorn/prevent-abbreviations": ["error", {
832
+ allowList: {
833
+ args: !0,
834
+ dir: !0,
835
+ fn: !0,
836
+ i: !0,
837
+ j: !0,
838
+ k: !0,
839
+ props: !0,
840
+ Props: !0,
841
+ ref: !0,
842
+ v: !0,
843
+ x: !0,
844
+ y: !0,
845
+ z: !0
846
+ }
847
+ }],
848
+ "unicorn/throw-new-error": "error"
849
+ },
850
+ /** User-defined rules */
851
+ ...options.rules
852
+ }
853
+ ];
854
+ }
855
+ function sonarjs(options) {
856
+ return new FlatCompat().config({
857
+ extends: [
858
+ "plugin:sonarjs/recommended"
859
+ ],
860
+ plugins: [
861
+ "sonarjs"
862
+ ],
863
+ rules: {
864
+ /**
865
+ * Cognitive Complexity is a measure of how hard the control flow of a function
866
+ * is to understand. Functions with high Cognitive Complexity will be difficult
867
+ * to maintain.
868
+ *
869
+ * @see https://github.com/SonarSource/eslint-plugin-sonarjs/blob/master/docs/rules/cognitive-complexity.md
870
+ */
871
+ "sonarjs/cognitive-complexity": ["error", 30],
872
+ /**
873
+ * Duplicated string literals make the process of refactoring error-prone,
874
+ * since you must be sure to update all occurrences. On the other hand,
875
+ * constants can be referenced from many places, but only need to be
876
+ * updated in a single place.
877
+ *
878
+ * @see https://github.com/SonarSource/eslint-plugin-sonarjs/blob/master/docs/rules/no-duplicate-string.md
879
+ */
880
+ "sonarjs/no-duplicate-string": ["error", {
881
+ threshold: 10
882
+ }],
883
+ /**
884
+ * Those rules are crashing ESLint at startup, so they are disabled for now.
885
+ */
886
+ "sonarjs/no-empty-collection": "off",
887
+ "sonarjs/no-extra-arguments": "off",
888
+ "sonarjs/no-gratuitous-expressions": "off",
889
+ "sonarjs/no-one-iteration-loop": "off",
890
+ "sonarjs/no-redundant-jump": "off",
891
+ "sonarjs/no-unused-collection": "off",
892
+ "sonarjs/no-use-of-empty-return-value": "off",
893
+ /** User-defined rules */
894
+ ...options.rules
895
+ }
896
+ });
897
+ }
898
+ function node(options) {
899
+ return [
900
+ {
901
+ plugins: {
902
+ n: nodePlugin
903
+ },
904
+ rules: {
905
+ ...nodePlugin.configs.recommended.rules,
906
+ /**
907
+ * Disallow the use of extraneous imports. This rule helps prevent the
908
+ * use of third-party modules that are not listed in the project's
909
+ * dependencies.
910
+ *
911
+ * @see https://github.com/eslint-community/eslint-plugin-n/blob/HEAD/docs/rules/no-extraneous-import.md
912
+ */
913
+ "n/no-extraneous-import": "error",
914
+ /**
915
+ * Disable the no-missing-import as module resolution is already checked
916
+ * by other tools and IDEs extensively. This rule is redundant.
917
+ *
918
+ * @see https://github.com/eslint-community/eslint-plugin-n/blob/HEAD/docs/rules/no-missing-import.md
919
+ */
920
+ "n/no-missing-import": "off",
921
+ "n/no-missing-require": "off",
922
+ /**
923
+ * Enfore the use of the asyncrounous version of the `fs` and `dns` APIs.
924
+ *
925
+ * @see https://github.com/eslint-community/eslint-plugin-n/blob/HEAD/docs/rules/no-sync.md
926
+ * @see https://github.com/eslint-community/eslint-plugin-n/blob/HEAD/docs/rules/prefer-promises/fs.md
927
+ * @see https://github.com/eslint-community/eslint-plugin-n/blob/HEAD/docs/rules/prefer-promises/dns.md
928
+ */
929
+ "n/no-sync": "off",
930
+ "n/prefer-promises/fs": "error",
931
+ "n/prefer-promises/dns": "error",
932
+ /**
933
+ * Allow the use of features up to Node.js version 20. This will allow
934
+ * the use of newer ECMAScript features and Node.js APIs.
935
+ *
936
+ * @see https://github.com/eslint-community/eslint-plugin-n/tree/master/docs/rules
937
+ */
938
+ "n/no-unsupported-features/es-syntax": "error",
939
+ "n/no-unsupported-features/es-builtins": "error",
940
+ "n/no-unsupported-features/node-builtins": "error",
941
+ /**
942
+ * Prepend the `node:` prefix to all Node.js core modules. This helps
943
+ * identify the module as a Node.js core module and not a third-party
944
+ * module.
945
+ *
946
+ * @see https://github.com/eslint-community/eslint-plugin-n/blob/HEAD/docs/rules/prefer-node-protocol.md
947
+ */
948
+ "n/prefer-node-protocol": "error",
949
+ /** User-defined rules */
950
+ ...options.rules
951
+ },
952
+ settings: {
953
+ node: {
954
+ version: ">=20.0.0"
955
+ }
956
+ }
957
+ }
958
+ ];
959
+ }
960
+ function jsonTsconfig() {
961
+ return [
962
+ {
963
+ files: [
964
+ "**/tsconfig.json",
965
+ "**/tsconfig.*.json"
966
+ ],
967
+ rules: {
968
+ "jsonc/sort-array-values": [
969
+ "error",
970
+ {
971
+ order: { type: "asc" },
972
+ pathPattern: "^(includes|excludes)$"
973
+ }
974
+ ],
975
+ "jsonc/sort-keys": [
976
+ "error",
977
+ {
978
+ order: [
979
+ "extends",
980
+ "compilerOptions",
981
+ "references",
982
+ "files",
983
+ "include",
984
+ "exclude"
985
+ ],
986
+ pathPattern: "^$"
987
+ },
988
+ {
989
+ order: [
990
+ // --- Project Structure
991
+ "incremental",
992
+ "composite",
993
+ "tsBuildInfoFile",
994
+ "disableSourceOfProjectReferenceRedirect",
995
+ "disableSolutionSearching",
996
+ "disableReferencedProjectLoad",
997
+ // --- Language and Environment
998
+ "target",
999
+ "jsx",
1000
+ "jsxFactory",
1001
+ "jsxFragmentFactory",
1002
+ "jsxImportSource",
1003
+ "lib",
1004
+ "moduleDetection",
1005
+ "noLib",
1006
+ "reactNamespace",
1007
+ "useDefineForClassFields",
1008
+ "emitDecoratorMetadata",
1009
+ "experimentalDecorators",
1010
+ // --- Module Resolution
1011
+ "baseUrl",
1012
+ "rootDir",
1013
+ "rootDirs",
1014
+ "customConditions",
1015
+ "module",
1016
+ "moduleResolution",
1017
+ "moduleSuffixes",
1018
+ "noResolve",
1019
+ "paths",
1020
+ "resolveJsonModule",
1021
+ "resolvePackageJsonExports",
1022
+ "resolvePackageJsonImports",
1023
+ "typeRoots",
1024
+ "types",
1025
+ "allowArbitraryExtensions",
1026
+ "allowImportingTsExtensions",
1027
+ "allowUmdGlobalAccess",
1028
+ // --- JavaScript Support
1029
+ "allowJs",
1030
+ "checkJs",
1031
+ "maxNodeModuleJsDepth",
1032
+ // --- Type Checking
1033
+ "strict",
1034
+ "strictBindCallApply",
1035
+ "strictFunctionTypes",
1036
+ "strictNullChecks",
1037
+ "strictPropertyInitialization",
1038
+ "allowUnreachableCode",
1039
+ "allowUnusedLabels",
1040
+ "alwaysStrict",
1041
+ "exactOptionalPropertyTypes",
1042
+ "noFallthroughCasesInSwitch",
1043
+ "noImplicitAny",
1044
+ "noImplicitOverride",
1045
+ "noImplicitReturns",
1046
+ "noImplicitThis",
1047
+ "noPropertyAccessFromIndexSignature",
1048
+ "noUncheckedIndexedAccess",
1049
+ "noUnusedLocals",
1050
+ "noUnusedParameters",
1051
+ "useUnknownInCatchVariables",
1052
+ // --- Emitting
1053
+ "declaration",
1054
+ "declarationDir",
1055
+ "declarationMap",
1056
+ "downlevelIteration",
1057
+ "emitBOM",
1058
+ "emitDeclarationOnly",
1059
+ "importHelpers",
1060
+ "importsNotUsedAsValues",
1061
+ "inlineSourceMap",
1062
+ "inlineSources",
1063
+ "mapRoot",
1064
+ "newLine",
1065
+ "noEmit",
1066
+ "noEmitHelpers",
1067
+ "noEmitOnError",
1068
+ "outDir",
1069
+ "outFile",
1070
+ "preserveConstEnums",
1071
+ "preserveValueImports",
1072
+ "removeComments",
1073
+ "sourceMap",
1074
+ "sourceRoot",
1075
+ "stripInternal",
1076
+ // --- Interop Constraints
1077
+ "allowSyntheticDefaultImports",
1078
+ "esModuleInterop",
1079
+ "forceConsistentCasingInFileNames",
1080
+ "isolatedModules",
1081
+ "preserveSymlinks",
1082
+ "verbatimModuleSyntax",
1083
+ // --- Completeness
1084
+ "skipDefaultLibCheck",
1085
+ "skipLibCheck"
1086
+ ],
1087
+ pathPattern: "^compilerOptions$"
1088
+ },
1089
+ {
1090
+ order: { type: "asc" },
1091
+ pathPattern: "^compilerOptions\\.paths$"
1092
+ }
1093
+ ]
1094
+ }
1095
+ }
1096
+ ];
1097
+ }
1098
+ function jsonPackage() {
1099
+ return [
1100
+ {
1101
+ files: [
1102
+ "**/package.json"
1103
+ ],
1104
+ rules: {
1105
+ "jsonc/sort-keys": [
1106
+ "error",
1107
+ {
1108
+ order: [
1109
+ "name",
1110
+ "type",
1111
+ "version",
1112
+ "license",
1113
+ "private",
1114
+ "sideEffects",
1115
+ // --- Publishing
1116
+ "description",
1117
+ "author",
1118
+ "keywords",
1119
+ "bugs",
1120
+ "funding",
1121
+ "homepage",
1122
+ "repository",
1123
+ // --- Distribution
1124
+ "bin",
1125
+ "main",
1126
+ "module",
1127
+ "types",
1128
+ "typings",
1129
+ "browser",
1130
+ "exports",
1131
+ "files",
1132
+ // --- Package Manager
1133
+ "packageManager",
1134
+ "pnpm",
1135
+ // --- Scripts
1136
+ "scripts",
1137
+ // --- Dependencies
1138
+ "peerDependencies",
1139
+ "peerDependenciesMeta",
1140
+ "optionalDependencies",
1141
+ "dependencies",
1142
+ "devDependencies",
1143
+ "bundledDependencies",
1144
+ "bundleDependencies",
1145
+ // --- Config
1146
+ "tsup",
1147
+ "husky",
1148
+ "lint-staged",
1149
+ "eslintConfig"
1150
+ ],
1151
+ pathPattern: "^$"
1152
+ },
1153
+ {
1154
+ order: { type: "asc" },
1155
+ pathPattern: "^(?:dev|peer|optional|bundled)?[Dd]ependencies$"
1156
+ }
1157
+ ]
1158
+ }
1159
+ }
1160
+ ];
1161
+ }
1162
+ function configJson(options) {
1163
+ return [
1164
+ ...jsonc.configs["flat/recommended-with-json"],
1165
+ {
1166
+ files: [
1167
+ "**/*.json",
1168
+ "**/*.json5"
1169
+ ],
1170
+ rules: {
1171
+ /**
1172
+ * Automatically apply jsonc rules similar to your configured ESLint core rules to JSON.
1173
+ *
1174
+ * @see https://ota-meshi.github.io/eslint-plugin-jsonc/rules/auto.html
1175
+ */
1176
+ "jsonc/auto": "error",
1177
+ /** User-defined rules */
1178
+ ...options.rules
1179
+ }
1180
+ }
1181
+ ];
1182
+ }
1183
+ function jsdoc(options) {
1184
+ return [
1185
+ pluginJsdoc.configs["flat/recommended-typescript-flavor-error"],
1186
+ {
1187
+ files: [
1188
+ "**/*.{ts,mts,cts,tsx,d.ts}",
1189
+ "**/*.{js,mjs,cjs,jsx}",
1190
+ "**/*.vue"
1191
+ ],
1192
+ rules: {
1193
+ /**
1194
+ * Enforce a consistent padding of the block description.
1195
+ *
1196
+ * @see https://github.com/gajus/eslint-plugin-jsdoc/blob/HEAD/docs/rules/check-alignment.md#readme
1197
+ */
1198
+ "jsdoc/check-alignment": "error",
1199
+ /**
1200
+ * Normalize the indentation in the JSdoc comment to improve readability.
1201
+ *
1202
+ * @see https://github.com/gajus/eslint-plugin-jsdoc/blob/main/docs/rules/check-indentation.md#readme
1203
+ */
1204
+ "jsdoc/check-indentation": "error",
1205
+ /**
1206
+ * Enforce a strict set of tags for the JSDoc comment. This rule also includes
1207
+ * some custom tags that are used in our projects.
1208
+ *
1209
+ * @see https://github.com/gajus/eslint-plugin-jsdoc/blob/main/.README/rules/check-tag-names.md
1210
+ */
1211
+ "jsdoc/require-jsdoc": "off",
1212
+ "jsdoc/require-param-type": "off",
1213
+ "jsdoc/check-tag-names": ["error", {
1214
+ definedTags: [
1215
+ "category"
1216
+ ]
1217
+ }],
1218
+ /**
1219
+ * Checks for multi-line-style comments which fail to meet the criteria of a jsdoc block,
1220
+ * namely that it should begin with two and only two asterisks.
1221
+ *
1222
+ * @see https://github.com/gajus/eslint-plugin-jsdoc/blob/main/docs/rules/no-bad-blocks.md
1223
+ */
1224
+ "jsdoc/no-bad-blocks": "error",
1225
+ /**
1226
+ * It is common practice to prefix a hyphen to parameters in JSDoc. But this
1227
+ * is sometimes forgotten and has no real purpose. This rule aims to enforce
1228
+ * that no hyphen is used.
1229
+ *
1230
+ * @see https://github.com/gajus/eslint-plugin-jsdoc/blob/main/docs/rules/require-hyphen-before-param-description
1231
+ */
1232
+ "jsdoc/require-hyphen-before-param-description": ["error", "never"],
1233
+ /**
1234
+ * Since we are using TypeScript, we don't need to enforce types in JSDoc.
1235
+ *
1236
+ * @see https://github.com/gajus/eslint-plugin-jsdoc/blob/main/docs/rules/require-param-type.md
1237
+ */
1238
+ "jsdoc/require-returns-type": "off",
1239
+ /**
1240
+ * Enforce a new-line between the JSDoc summary and tags. Aims to improve
1241
+ * readability by separating the summary and tags.
1242
+ *
1243
+ * @see https://github.com/gajus/eslint-plugin-jsdoc/blob/main/docs/rules/tag-lines.md
1244
+ */
1245
+ "jsdoc/tag-lines": ["error", "any", { startLines: 1 }],
1246
+ /** User-defined rules */
1247
+ ...options.rules
1248
+ }
1249
+ }
1250
+ ];
1251
+ }
1252
+ function eslintComments(options) {
1253
+ return [
1254
+ {
1255
+ plugins: {
1256
+ "eslint-comments": eslintCommentsPlugin
1257
+ },
1258
+ rules: {
1259
+ /**
1260
+ * Allow multiple rules directive in a single comment. This
1261
+ * reduces the number of comments in the code.
1262
+ *
1263
+ * @see https://mysticatea.github.io/eslint-plugin-eslint-comments/rules/disable-enable-pair
1264
+ */
1265
+ "eslint-comments/disable-enable-pair": "off",
1266
+ /**
1267
+ * `eslint-enable` directive-comments can enable rules which are disabled by different
1268
+ * eslint-disable directive-comments. It can enable a rule unintentionally. This rule
1269
+ * will report such cases.
1270
+ *
1271
+ * @see https://mysticatea.github.io/eslint-plugin-eslint-comments/rules/no-aggregating-enable
1272
+ */
1273
+ "eslint-comments/no-aggregating-enable": "error",
1274
+ /**
1275
+ * Disallow duplicate eslint-disable comments. This rule will report when there are
1276
+ * multiple eslint-disable comments for the same rule, either in the same line or enabled
1277
+ * by different eslint-disable comments.
1278
+ *
1279
+ * @see https://mysticatea.github.io/eslint-plugin-eslint-comments/rules/no-duplicate-disable
1280
+ */
1281
+ "eslint-comments/no-duplicate-disable": "error",
1282
+ /**
1283
+ * Disallow eslint-disable comments without rule names. This ensures that we cannot
1284
+ * disable all rules in a file using eslint-disable comment.
1285
+ *
1286
+ * @see https://mysticatea.github.io/eslint-plugin-eslint-comments/rules/no-unlimited-disable
1287
+ */
1288
+ "eslint-comments/no-unlimited-disable": "error",
1289
+ /**
1290
+ * Errors when an eslint-disable comment has no effect. This is useful
1291
+ * to prevent unnecessary comments in the code.
1292
+ *
1293
+ * @see https://mysticatea.github.io/eslint-plugin-eslint-comments/rules/no-unused-disable
1294
+ */
1295
+ "eslint-comments/no-unused-disable": "error",
1296
+ /** User-defined rules */
1297
+ ...options.rules
1298
+ }
1299
+ }
1300
+ ];
1301
+ }
1302
+ function antfu(options) {
1303
+ return [
1304
+ {
1305
+ plugins: {
1306
+ antfu: pluginAntfu
1307
+ },
1308
+ rules: {
1309
+ "antfu/consistent-list-newline": "error",
1310
+ /**
1311
+ * Auto-fix import duplication. The TypeScript compiler already detects and removes
1312
+ * duplicate imports, but this rule can be used to fix the issue automatically in the editor.
1313
+ *
1314
+ * @see https://github.com/antfu/eslint-plugin-antfu/blob/main/src/rules/import-dedupe.md
1315
+ */
1316
+ "antfu/import-dedupe": "error",
1317
+ /**
1318
+ * Enforce top-level function to be declared using function instead of arrow function. This
1319
+ * rule helps when you want to add additional overload signatures to a function without
1320
+ * having to transform the arrow function into a function declaration manually.
1321
+ *
1322
+ * On top of that, it mitigates the risk of accidentally using the `this` instance from
1323
+ * an outer scope.
1324
+ *
1325
+ * @see https://github.com/antfu/eslint-plugin-antfu/blob/main/src/rules/top-level-function.md
1326
+ */
1327
+ "antfu/top-level-function": "error",
1328
+ /**
1329
+ * Enforce consistent line breaks inside braces of object/array/named imports/exports and
1330
+ * function parameters. Reduces the cognitive load of reasoning about code style.
1331
+ *
1332
+ * @see https://github.com/antfu/eslint-plugin-antfu/blob/main/src/rules/consistent-list-newline.md
1333
+ */
1334
+ "object-curly-newline": "off",
1335
+ /** User-defined rules */
1336
+ ...options.rules
1337
+ }
1338
+ }
1339
+ ];
1340
+ }
1341
+ function all(options = {}) {
1342
+ return [
1343
+ ...antfu(options),
1344
+ ...eslintComments(options),
1345
+ ...jsdoc(options),
1346
+ ...configJson(options),
1347
+ ...jsonPackage(),
1348
+ ...jsonTsconfig(),
1349
+ ...node(options),
1350
+ ...sonarjs(options),
1351
+ ...typescript(options),
1352
+ ...unicorn(options),
1353
+ ...vitest(options),
1354
+ ...vue(options),
1355
+ {
1356
+ ignores: [
1357
+ "**/dist",
1358
+ "**/bin",
1359
+ "**/node_modules",
1360
+ "**/.nuxt",
1361
+ "**/output",
1362
+ "**/coverage",
1363
+ "**/public",
1364
+ "**/__wip__",
1365
+ "**/__snapshots__",
1366
+ "**/LICENSE*",
1367
+ "**/CHANGELOG*",
1368
+ "packages-lock.json",
1369
+ "pnpm-lock.yaml",
1370
+ "yarn.lock"
1371
+ ]
1372
+ }
1373
+ ];
1374
+ }
1375
+ export {
1376
+ all as default
1377
+ };
1378
+ //# sourceMappingURL=index.js.map