@ivanmaxlogiudice/eslint-config 3.0.0-beta.1 → 3.0.0-beta.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 CHANGED
@@ -1,45 +1,1388 @@
1
- // src/index.ts
2
- import antfu from "@antfu/eslint-config";
3
- import { defu } from "defu";
4
- var config = (options, ...userConfigs) => {
5
- const pipe = antfu(
6
- defu(options?.stylistic === false ? {} : { stylistic: { indent: 4 } }, options),
7
- ...userConfigs
8
- );
9
- if (options?.stylistic !== false) {
10
- pipe.override("antfu/stylistic/rules", {
1
+ // src/configs/comments.ts
2
+ import plugin from "@eslint-community/eslint-plugin-eslint-comments";
3
+ var comments = [
4
+ {
5
+ name: "ivanmaxlogiudice/comments/rules",
6
+ plugins: {
7
+ "eslint-comments": plugin
8
+ },
9
+ rules: {
10
+ "eslint-comments/disable-enable-pair": ["error", { allowWholeFile: true }],
11
+ "eslint-comments/no-aggregating-enable": "error",
12
+ "eslint-comments/no-duplicate-disable": "error",
13
+ "eslint-comments/no-unlimited-disable": "error",
14
+ "eslint-comments/no-unused-enable": "error"
15
+ }
16
+ }
17
+ ];
18
+
19
+ // src/configs/ignores.ts
20
+ import { dedupe, parsePath, toFlatConfig } from "@ivanmaxlogiudice/gitignore";
21
+
22
+ // src/globs.ts
23
+ var GLOB_SRC_EXT = "?([cm])[jt]s?(x)";
24
+ var GLOB_SRC = "**/*.?([cm])[jt]s?(x)";
25
+ var GLOB_JS = "**/*.?([cm])js";
26
+ var GLOB_TS = "**/*.?([cm])ts";
27
+ var GLOB_JSON = "**/*.json";
28
+ var GLOB_JSON5 = "**/*.json5";
29
+ var GLOB_JSONC = "**/*.jsonc";
30
+ var GLOB_MARKDOWN = "**/*.md";
31
+ var GLOB_VUE = "**/*.vue";
32
+ var GLOB_YAML = "**/*.y?(a)ml";
33
+ var GLOB_MARKDOWN_CODE = `${GLOB_MARKDOWN}/${GLOB_SRC}`;
34
+ var GLOB_TESTS = [
35
+ `**/__tests__/**/*.${GLOB_SRC_EXT}`,
36
+ `**/*.spec.${GLOB_SRC_EXT}`,
37
+ `**/*.test.${GLOB_SRC_EXT}`,
38
+ `**/*.bench.${GLOB_SRC_EXT}`,
39
+ `**/*.benchmark.${GLOB_SRC_EXT}`
40
+ ];
41
+ var GLOB_ALL_SRC = [
42
+ GLOB_SRC,
43
+ GLOB_JSON,
44
+ GLOB_JSON5,
45
+ GLOB_MARKDOWN,
46
+ GLOB_VUE
47
+ ];
48
+ var GLOB_EXCLUDE = [
49
+ "**/node_modules",
50
+ "**/dist",
51
+ "**/package-lock.json",
52
+ "**/yarn.lock",
53
+ "**/pnpm-lock.yaml",
54
+ "**/bun.lockb",
55
+ "**/output",
56
+ "**/coverage",
57
+ "**/temp",
58
+ "**/.temp",
59
+ "**/tmp",
60
+ "**/.tmp",
61
+ "**/.history",
62
+ "**/.vitepress/cache",
63
+ "**/.nuxt",
64
+ "**/.vercel",
65
+ "**/.changeset",
66
+ "**/.idea",
67
+ "**/.cache",
68
+ "**/.output",
69
+ "**/.vite-inspect",
70
+ "**/.yarn",
71
+ "**/vite.config.*.timestamp-*",
72
+ "**/CHANGELOG*.md",
73
+ "**/*.min.*",
74
+ "**/LICENSE*",
75
+ "**/__snapshots__",
76
+ "**/auto-import?(s).d.ts",
77
+ "**/components.d.ts"
78
+ ];
79
+
80
+ // src/utils.ts
81
+ import { Buffer } from "node:buffer";
82
+ import { spawn } from "node:child_process";
83
+ import fs from "node:fs";
84
+ import path from "node:path";
85
+ import process from "node:process";
86
+ var cachePkg;
87
+ async function combine(...configs) {
88
+ const resolved = await Promise.all(configs);
89
+ return resolved.flat();
90
+ }
91
+ function renameRules(rules, from, to) {
92
+ const renamed = {};
93
+ for (const rule in rules) {
94
+ if (rule.startsWith(from)) {
95
+ renamed[`${to}${rule.slice(from.length)}`] = rules[rule];
96
+ continue;
97
+ }
98
+ renamed[rule] = rules[rule];
99
+ }
100
+ return renamed;
101
+ }
102
+ function clearPackageCache() {
103
+ cachePkg = void 0;
104
+ }
105
+ function hasSomePackage(names) {
106
+ return names.some((name) => packageExists(name));
107
+ }
108
+ function findUp(file, cwd = process.cwd(), depth = 3) {
109
+ let currentPath = cwd;
110
+ for (let i = 0; i <= depth; i++) {
111
+ const pkgPath = path.join(currentPath, file);
112
+ if (fs.existsSync(pkgPath)) {
113
+ return pkgPath;
114
+ }
115
+ currentPath = path.resolve(currentPath, "..");
116
+ }
117
+ return null;
118
+ }
119
+ function packageExists(name) {
120
+ if (!cachePkg) {
121
+ const pkgPath = findUp("package.json");
122
+ if (!pkgPath) {
123
+ throw new Error('Can not found "package.json".');
124
+ }
125
+ const pkgContent = fs.readFileSync(pkgPath, "utf-8");
126
+ cachePkg = JSON.parse(pkgContent);
127
+ }
128
+ return cachePkg?.dependencies?.[name] !== void 0 || cachePkg?.devDependencies?.[name] !== void 0;
129
+ }
130
+ async function ensurePackages(packages) {
131
+ if (process.env.CI || process.stdout.isTTY === false)
132
+ return;
133
+ const missingPackages = packages.filter((i) => i && !packageExists(i));
134
+ if (missingPackages.length === 0)
135
+ return;
136
+ console.log(`
137
+ \u26A0\uFE0F Installing the required ${missingPackages.length === 1 ? "package" : "packages"} for this config: ${missingPackages.join(", ")}.`);
138
+ await spawnAsync("bun", ["add", "-D", ...missingPackages], {
139
+ stdio: "pipe"
140
+ });
141
+ console.log(`\u2705 ${missingPackages.length === 1 ? "Package" : "Packages"} installed successfully.
142
+ `);
143
+ }
144
+ async function interopDefault(m) {
145
+ const resolved = await m;
146
+ return resolved.default || resolved;
147
+ }
148
+ function isInEditorEnv() {
149
+ return !!((process.env.VSCODE_PID || process.env.VSCODE_CWD || process.env.JETBRAINS_IDE || process.env.VIM || process.env.NVIM) && !process.env.CI);
150
+ }
151
+ async function spawnAsync(command, args, options) {
152
+ return new Promise((resolve, reject) => {
153
+ const proc = spawn(command, args, {
154
+ ...options,
155
+ shell: process.platform === "win32",
156
+ stdio: "pipe"
157
+ });
158
+ const stderr = [];
159
+ const stdout = [];
160
+ proc.stderr.on("data", (chunk) => stderr.push(chunk));
161
+ proc.stdout.on("data", (chunk) => stdout.push(chunk));
162
+ proc.on("error", () => reject(new Error(`${command} exited with code -1: ${stderr}`)));
163
+ proc.on("close", (code) => code ? reject(new Error(`${command} exited with code ${code}: ${stderr}`)) : resolve({
164
+ stderr: Buffer.concat(stderr).toString(),
165
+ stdout: Buffer.concat(stdout).toString()
166
+ }));
167
+ });
168
+ }
169
+
170
+ // src/configs/ignores.ts
171
+ function ignores() {
172
+ const path2 = findUp(".gitignore");
173
+ const patterns = path2 ? parsePath(path2) : [];
174
+ return [
175
+ toFlatConfig(
176
+ dedupe([...GLOB_EXCLUDE, ...patterns]),
177
+ {
178
+ name: "ivanmaxlogiudice/ignores"
179
+ }
180
+ )
181
+ ];
182
+ }
183
+
184
+ // src/configs/imports.ts
185
+ import plugin2 from "eslint-plugin-import-x";
186
+ var imports = [
187
+ {
188
+ name: "ivanmaxlogiudice/imports/rules",
189
+ plugins: {
190
+ import: plugin2
191
+ },
192
+ rules: {
193
+ "antfu/import-dedupe": "error",
194
+ "antfu/no-import-dist": "error",
195
+ "antfu/no-import-node-modules-by-path": "error",
196
+ "import/first": "error",
197
+ "import/no-duplicates": "error",
198
+ "import/no-mutable-exports": "error",
199
+ "import/no-named-default": "error",
200
+ "import/no-self-import": "error",
201
+ "import/no-webpack-loader-syntax": "error",
202
+ // Stylistic
203
+ "import/newline-after-import": ["error", { count: 1 }]
204
+ }
205
+ },
206
+ {
207
+ name: "ivanmaxlogiudice/imports/disables/bin",
208
+ files: ["**/bin/**/*", `**/bin.${GLOB_SRC_EXT}`],
209
+ rules: {
210
+ "antfu/no-import-dist": "off",
211
+ "antfu/no-import-node-modules-by-path": "off"
212
+ }
213
+ }
214
+ ];
215
+
216
+ // src/configs/javascript.ts
217
+ import pluginAntfu from "eslint-plugin-antfu";
218
+ import pluginUnused from "eslint-plugin-unused-imports";
219
+ import globals from "globals";
220
+ var restrictedSyntaxJs = [
221
+ "ForInStatement",
222
+ "LabeledStatement",
223
+ "WithStatement"
224
+ ];
225
+ var javascript = [
226
+ {
227
+ name: "ivanmaxlogiudice/javascript/setup",
228
+ languageOptions: {
229
+ ecmaVersion: 2022,
230
+ globals: {
231
+ ...globals.browser,
232
+ ...globals.es2021,
233
+ ...globals.node,
234
+ document: "readonly",
235
+ navigator: "readonly",
236
+ window: "readonly"
237
+ },
238
+ parserOptions: {
239
+ ecmaFeatures: {
240
+ jsx: true
241
+ },
242
+ ecmaVersion: 2022,
243
+ sourceType: "module"
244
+ },
245
+ sourceType: "module"
246
+ },
247
+ linterOptions: {
248
+ reportUnusedDisableDirectives: true
249
+ }
250
+ },
251
+ {
252
+ name: "ivanmaxlogiudice/javascript/rules",
253
+ plugins: {
254
+ "antfu": pluginAntfu,
255
+ "unused-imports": pluginUnused
256
+ },
257
+ rules: {
258
+ "accessor-pairs": ["error", { enforceForClassMembers: true, setWithoutGet: true }],
259
+ "array-callback-return": "error",
260
+ "block-scoped-var": "error",
261
+ "constructor-super": "error",
262
+ "default-case-last": "error",
263
+ "dot-notation": ["error", { allowKeywords: true }],
264
+ "eqeqeq": ["error", "smart"],
265
+ "new-cap": ["error", { capIsNew: false, newIsCap: true, properties: true }],
266
+ "no-alert": "error",
267
+ "no-array-constructor": "error",
268
+ "no-async-promise-executor": "error",
269
+ "no-caller": "error",
270
+ "no-case-declarations": "error",
271
+ "no-class-assign": "error",
272
+ "no-compare-neg-zero": "error",
273
+ "no-cond-assign": ["error", "always"],
274
+ "no-console": ["error", { allow: ["warn", "error"] }],
275
+ "no-const-assign": "error",
276
+ "no-control-regex": "error",
277
+ "no-debugger": "error",
278
+ "no-delete-var": "error",
279
+ "no-dupe-args": "error",
280
+ "no-dupe-class-members": "error",
281
+ "no-dupe-keys": "error",
282
+ "no-duplicate-case": "error",
283
+ "no-empty": ["error", { allowEmptyCatch: true }],
284
+ "no-empty-character-class": "error",
285
+ "no-empty-pattern": "error",
286
+ "no-eval": "error",
287
+ "no-ex-assign": "error",
288
+ "no-extend-native": "error",
289
+ "no-extra-bind": "error",
290
+ "no-extra-boolean-cast": "error",
291
+ "no-fallthrough": "error",
292
+ "no-func-assign": "error",
293
+ "no-global-assign": "error",
294
+ "no-implied-eval": "error",
295
+ "no-import-assign": "error",
296
+ "no-invalid-regexp": "error",
297
+ "no-irregular-whitespace": "error",
298
+ "no-iterator": "error",
299
+ "no-labels": ["error", { allowLoop: false, allowSwitch: false }],
300
+ "no-lone-blocks": "error",
301
+ "no-loss-of-precision": "error",
302
+ "no-misleading-character-class": "error",
303
+ "no-multi-str": "error",
304
+ "no-new": "error",
305
+ "no-new-func": "error",
306
+ "no-new-native-nonconstructor": "error",
307
+ "no-new-wrappers": "error",
308
+ "no-obj-calls": "error",
309
+ "no-octal": "error",
310
+ "no-octal-escape": "error",
311
+ "no-proto": "error",
312
+ "no-prototype-builtins": "error",
313
+ "no-redeclare": ["error", { builtinGlobals: false }],
314
+ "no-regex-spaces": "error",
315
+ "no-restricted-globals": [
316
+ "error",
317
+ { name: "global", message: "Use `globalThis` instead." },
318
+ { name: "self", message: "Use `globalThis` instead." }
319
+ ],
320
+ "no-restricted-properties": [
321
+ "error",
322
+ { message: "Use `Object.getPrototypeOf` or `Object.setPrototypeOf` instead.", property: "__proto__" },
323
+ { message: "Use `Object.defineProperty` instead.", property: "__defineGetter__" },
324
+ { message: "Use `Object.defineProperty` instead.", property: "__defineSetter__" },
325
+ { message: "Use `Object.getOwnPropertyDescriptor` instead.", property: "__lookupGetter__" },
326
+ { message: "Use `Object.getOwnPropertyDescriptor` instead.", property: "__lookupSetter__" }
327
+ ],
328
+ "no-restricted-syntax": [
329
+ "error",
330
+ "DebuggerStatement",
331
+ "LabeledStatement",
332
+ "WithStatement",
333
+ "TSEnumDeclaration[const=true]",
334
+ "TSExportAssignment"
335
+ ],
336
+ "no-self-assign": ["error", { props: true }],
337
+ "no-self-compare": "error",
338
+ "no-sequences": "error",
339
+ "no-shadow-restricted-names": "error",
340
+ "no-sparse-arrays": "error",
341
+ "no-template-curly-in-string": "error",
342
+ "no-this-before-super": "error",
343
+ "no-throw-literal": "error",
344
+ "no-undef": "error",
345
+ "no-undef-init": "error",
346
+ "no-unexpected-multiline": "error",
347
+ "no-unmodified-loop-condition": "error",
348
+ "no-unneeded-ternary": ["error", { defaultAssignment: false }],
349
+ "no-unreachable": "error",
350
+ "no-unreachable-loop": "error",
351
+ "no-unsafe-finally": "error",
352
+ "no-unsafe-negation": "error",
353
+ "no-unused-expressions": ["error", {
354
+ allowShortCircuit: true,
355
+ allowTaggedTemplates: true,
356
+ allowTernary: true
357
+ }],
358
+ "no-unused-vars": ["error", {
359
+ args: "none",
360
+ caughtErrors: "none",
361
+ ignoreRestSiblings: true,
362
+ vars: "all"
363
+ }],
364
+ "no-use-before-define": ["error", { classes: false, functions: false, variables: true }],
365
+ "no-useless-backreference": "error",
366
+ "no-useless-call": "error",
367
+ "no-useless-catch": "error",
368
+ "no-useless-computed-key": "error",
369
+ "no-useless-constructor": "error",
370
+ "no-useless-rename": "error",
371
+ "no-useless-return": "error",
372
+ "no-var": "error",
373
+ "no-with": "error",
374
+ "object-shorthand": [
375
+ "error",
376
+ "always",
377
+ {
378
+ avoidQuotes: true,
379
+ ignoreConstructors: false
380
+ }
381
+ ],
382
+ "one-var": ["error", { initialized: "never" }],
383
+ "prefer-arrow-callback": [
384
+ "error",
385
+ {
386
+ allowNamedFunctions: false,
387
+ allowUnboundThis: true
388
+ }
389
+ ],
390
+ "prefer-const": [
391
+ "error",
392
+ {
393
+ destructuring: "all",
394
+ ignoreReadBeforeAssign: true
395
+ }
396
+ ],
397
+ "prefer-exponentiation-operator": "error",
398
+ "prefer-promise-reject-errors": "error",
399
+ "prefer-regex-literals": ["error", { disallowRedundantWrapping: true }],
400
+ "prefer-rest-params": "error",
401
+ "prefer-spread": "error",
402
+ "prefer-template": "error",
403
+ "symbol-description": "error",
404
+ "unicode-bom": ["error", "never"],
405
+ "unused-imports/no-unused-imports": isInEditorEnv() ? "off" : "error",
406
+ "unused-imports/no-unused-vars": [
407
+ "error",
408
+ {
409
+ args: "after-used",
410
+ argsIgnorePattern: "^_",
411
+ ignoreRestSiblings: true,
412
+ vars: "all",
413
+ varsIgnorePattern: "^_"
414
+ }
415
+ ],
416
+ "use-isnan": ["error", { enforceForIndexOf: true, enforceForSwitchCase: true }],
417
+ "valid-typeof": ["error", { requireStringLiterals: true }],
418
+ "vars-on-top": "error",
419
+ "yoda": ["error", "never"]
420
+ }
421
+ },
422
+ {
423
+ name: "ivanmaxlogiudice/javascript/disables/cli",
424
+ files: [`scripts/${GLOB_SRC}`, `**/cli/${GLOB_SRC}`],
425
+ rules: {
426
+ "no-console": "off"
427
+ }
428
+ }
429
+ ];
430
+
431
+ // src/configs/jsdoc.ts
432
+ import plugin3 from "eslint-plugin-jsdoc";
433
+ var jsdoc = [
434
+ {
435
+ name: "ivanmaxlogiudice/jsdoc/rules",
436
+ plugins: {
437
+ jsdoc: plugin3
438
+ },
439
+ rules: {
440
+ "jsdoc/check-access": "warn",
441
+ "jsdoc/check-param-names": "warn",
442
+ "jsdoc/check-property-names": "warn",
443
+ "jsdoc/check-types": "warn",
444
+ "jsdoc/empty-tags": "warn",
445
+ "jsdoc/implements-on-classes": "warn",
446
+ "jsdoc/no-defaults": "warn",
447
+ "jsdoc/no-multi-asterisks": "warn",
448
+ "jsdoc/require-param-name": "warn",
449
+ "jsdoc/require-property": "warn",
450
+ "jsdoc/require-property-description": "warn",
451
+ "jsdoc/require-property-name": "warn",
452
+ "jsdoc/require-returns-check": "warn",
453
+ "jsdoc/require-returns-description": "warn",
454
+ "jsdoc/require-yields-check": "warn",
455
+ // Stylistic
456
+ "jsdoc/check-alignment": "warn",
457
+ "jsdoc/multiline-blocks": "warn"
458
+ }
459
+ }
460
+ ];
461
+
462
+ // src/configs/jsonc.ts
463
+ import plugin4 from "eslint-plugin-jsonc";
464
+ import parser from "jsonc-eslint-parser";
465
+ var jsonc = [
466
+ {
467
+ name: "ivanmaxlogiudice/jsonc/setup",
468
+ plugins: {
469
+ jsonc: plugin4
470
+ }
471
+ },
472
+ {
473
+ name: "ivanmaxlogiudice/jsonc/rules",
474
+ files: [GLOB_JSON, GLOB_JSON5, GLOB_JSONC],
475
+ languageOptions: {
476
+ parser
477
+ },
478
+ rules: {
479
+ "jsonc/no-bigint-literals": "error",
480
+ "jsonc/no-binary-expression": "error",
481
+ "jsonc/no-binary-numeric-literals": "error",
482
+ "jsonc/no-dupe-keys": "error",
483
+ "jsonc/no-escape-sequence-in-identifier": "error",
484
+ "jsonc/no-floating-decimal": "error",
485
+ "jsonc/no-hexadecimal-numeric-literals": "error",
486
+ "jsonc/no-infinity": "error",
487
+ "jsonc/no-multi-str": "error",
488
+ "jsonc/no-nan": "error",
489
+ "jsonc/no-number-props": "error",
490
+ "jsonc/no-numeric-separators": "error",
491
+ "jsonc/no-octal": "error",
492
+ "jsonc/no-octal-escape": "error",
493
+ "jsonc/no-octal-numeric-literals": "error",
494
+ "jsonc/no-parenthesized": "error",
495
+ "jsonc/no-plus-sign": "error",
496
+ "jsonc/no-regexp-literals": "error",
497
+ "jsonc/no-sparse-arrays": "error",
498
+ "jsonc/no-template-literals": "error",
499
+ "jsonc/no-undefined-value": "error",
500
+ "jsonc/no-unicode-codepoint-escapes": "error",
501
+ "jsonc/no-useless-escape": "error",
502
+ "jsonc/space-unary-ops": "error",
503
+ "jsonc/valid-json-number": "error",
504
+ "jsonc/vue-custom-block/no-parsing-error": "error",
505
+ // Stylistic
506
+ "jsonc/array-bracket-spacing": ["error", "never"],
507
+ "jsonc/comma-dangle": ["error", "never"],
508
+ "jsonc/comma-style": ["error", "last"],
509
+ "jsonc/indent": ["error", 4],
510
+ "jsonc/key-spacing": ["error", { afterColon: true, beforeColon: false }],
511
+ "jsonc/object-curly-newline": ["error", { consistent: true, multiline: true }],
512
+ "jsonc/object-curly-spacing": ["error", "always"],
513
+ "jsonc/object-property-newline": ["error", { allowMultiplePropertiesPerLine: true }],
514
+ "jsonc/quote-props": "error",
515
+ "jsonc/quotes": "error"
516
+ }
517
+ }
518
+ ];
519
+
520
+ // src/configs/markdown.ts
521
+ async function markdown(options = {}) {
522
+ const {
523
+ componentExts = []
524
+ } = options;
525
+ await ensurePackages(["eslint-plugin-markdown"]);
526
+ const plugin10 = await interopDefault(import("eslint-plugin-markdown"));
527
+ return [
528
+ {
529
+ name: "ivanmaxlogiudice/markdown/setup",
530
+ plugins: {
531
+ markdown: plugin10
532
+ }
533
+ },
534
+ {
535
+ name: "ivanmaxlogiudice/markdown/processor",
536
+ files: [GLOB_MARKDOWN],
537
+ processor: "markdown/markdown"
538
+ },
539
+ {
540
+ name: "ivanmaxlogiudice/markdown/disables",
541
+ files: [
542
+ GLOB_MARKDOWN_CODE,
543
+ ...componentExts.map((ext) => `${GLOB_MARKDOWN}/**/*.${ext}`)
544
+ ],
545
+ languageOptions: {
546
+ parserOptions: {
547
+ ecmaFeatures: {
548
+ impliedStrict: true
549
+ }
550
+ }
551
+ },
11
552
  rules: {
12
- "style/function-call-spacing": ["error", "never"]
553
+ "import/newline-after-import": "off",
554
+ "no-alert": "off",
555
+ "no-console": "off",
556
+ "no-labels": "off",
557
+ "no-lone-blocks": "off",
558
+ "no-restricted-syntax": "off",
559
+ "no-undef": "off",
560
+ "no-unused-expressions": "off",
561
+ "no-unused-labels": "off",
562
+ "no-unused-vars": "off",
563
+ "node/prefer-global/process": "off",
564
+ "style/comma-dangle": "off",
565
+ "style/eol-last": "off",
566
+ "ts/consistent-type-imports": "off",
567
+ "ts/no-namespace": "off",
568
+ "ts/no-redeclare": "off",
569
+ "ts/no-require-imports": "off",
570
+ "ts/no-unused-expressions": "off",
571
+ "ts/no-unused-vars": "off",
572
+ "ts/no-use-before-define": "off",
573
+ "unicode-bom": "off",
574
+ "unused-imports/no-unused-imports": "off",
575
+ "unused-imports/no-unused-vars": "off"
13
576
  }
14
- });
577
+ }
578
+ ];
579
+ }
580
+
581
+ // src/configs/node.ts
582
+ import plugin5 from "eslint-plugin-n";
583
+ var node = [
584
+ {
585
+ name: "ivanmaxlogiudice/node/rules",
586
+ plugins: {
587
+ node: plugin5
588
+ },
589
+ rules: {
590
+ "node/handle-callback-err": ["error", "^(err|error)$"],
591
+ "node/no-deprecated-api": "error",
592
+ "node/no-exports-assign": "error",
593
+ "node/no-new-require": "error",
594
+ "node/no-path-concat": "error",
595
+ "node/no-unsupported-features/es-builtins": "error",
596
+ "node/prefer-global/buffer": ["error", "never"],
597
+ "node/prefer-global/process": ["error", "never"],
598
+ "node/process-exit-as-throw": "error"
599
+ }
600
+ }
601
+ ];
602
+
603
+ // src/configs/perfectionist.ts
604
+ import plugin6 from "eslint-plugin-perfectionist";
605
+ var perfectionist = [
606
+ {
607
+ name: "ivanmaxlogiudice/perfectionist/rules",
608
+ plugins: {
609
+ perfectionist: plugin6
610
+ },
611
+ rules: {
612
+ "perfectionist/sort-imports": ["warn", {
613
+ groups: [
614
+ "builtin",
615
+ "external",
616
+ "internal",
617
+ "internal-type",
618
+ "parent",
619
+ "parent-type",
620
+ "sibling",
621
+ "sibling-type",
622
+ "index",
623
+ "index-type",
624
+ "object",
625
+ "type",
626
+ "side-effect",
627
+ "side-effect-style"
628
+ ],
629
+ internalPattern: ["@/**"],
630
+ newlinesBetween: "ignore"
631
+ }],
632
+ "perfectionist/sort-named-exports": ["warn", { groupKind: "values-first" }],
633
+ "perfectionist/sort-named-imports": ["warn", { groupKind: "values-first" }]
634
+ }
15
635
  }
16
- if (options?.vue) {
17
- pipe.override("antfu/vue/rules", {
636
+ ];
637
+
638
+ // src/configs/regexp.ts
639
+ async function regexp() {
640
+ await ensurePackages(["eslint-plugin-regexp"]);
641
+ const plugin10 = await interopDefault(import("eslint-plugin-regexp"));
642
+ return [
643
+ {
644
+ name: "ivanmaxlogiudice/regexp/rules",
645
+ plugins: {
646
+ regexp: plugin10
647
+ },
648
+ rules: {
649
+ ...plugin10.configs["flat/recommended"].rules
650
+ }
651
+ }
652
+ ];
653
+ }
654
+
655
+ // src/configs/sort.ts
656
+ var sortPackageJson = [
657
+ {
658
+ name: "ivanmaxlogiudice/sort/packageJson",
659
+ files: ["**/package.json"],
660
+ rules: {
661
+ "jsonc/sort-array-values": [
662
+ "error",
663
+ {
664
+ order: { type: "asc" },
665
+ pathPattern: "^files$"
666
+ }
667
+ ],
668
+ "jsonc/sort-keys": [
669
+ "error",
670
+ {
671
+ order: [
672
+ "name",
673
+ "version",
674
+ "private",
675
+ "packageManager",
676
+ "description",
677
+ "type",
678
+ "keywords",
679
+ "license",
680
+ "homepage",
681
+ "bugs",
682
+ "repository",
683
+ "author",
684
+ "contributors",
685
+ "funding",
686
+ "files",
687
+ "main",
688
+ "module",
689
+ "types",
690
+ "exports",
691
+ "typesVersions",
692
+ "sideEffects",
693
+ "unpkg",
694
+ "jsdelivr",
695
+ "browser",
696
+ "bin",
697
+ "man",
698
+ "directories",
699
+ "publishConfig",
700
+ "scripts",
701
+ "peerDependencies",
702
+ "peerDependenciesMeta",
703
+ "optionalDependencies",
704
+ "dependencies",
705
+ "devDependencies",
706
+ "engines",
707
+ "config",
708
+ "overrides",
709
+ "pnpm",
710
+ "husky",
711
+ "lint-staged",
712
+ "eslintConfig",
713
+ "prettier"
714
+ ],
715
+ pathPattern: "^$"
716
+ },
717
+ {
718
+ order: { type: "asc" },
719
+ pathPattern: "^(?:dev|peer|optional|bundled)?[Dd]ependencies(Meta)?$"
720
+ },
721
+ {
722
+ order: ["types", "require", "import", "default"],
723
+ pathPattern: "^exports.*$"
724
+ },
725
+ {
726
+ order: { type: "asc" },
727
+ pathPattern: "^(?:resolutions|overrides|pnpm.overrides)$"
728
+ }
729
+ ]
730
+ }
731
+ }
732
+ ];
733
+ var sortTsconfig = [
734
+ {
735
+ name: "ivanmaxlogiudice/sort/tsconfig",
736
+ files: ["**/tsconfig.json", "**/tsconfig.*.json"],
737
+ rules: {
738
+ "jsonc/sort-keys": [
739
+ "error",
740
+ {
741
+ order: [
742
+ "extends",
743
+ "compilerOptions",
744
+ "references",
745
+ "files",
746
+ "include",
747
+ "exclude"
748
+ ],
749
+ pathPattern: "^$"
750
+ },
751
+ {
752
+ order: [
753
+ /* Projects */
754
+ "incremental",
755
+ "composite",
756
+ "tsBuildInfoFile",
757
+ "disableSourceOfProjectReferenceRedirect",
758
+ "disableSolutionSearching",
759
+ "disableReferencedProjectLoad",
760
+ /* Language and Environment */
761
+ "target",
762
+ "jsx",
763
+ "jsxFactory",
764
+ "jsxFragmentFactory",
765
+ "jsxImportSource",
766
+ "lib",
767
+ "moduleDetection",
768
+ "noLib",
769
+ "reactNamespace",
770
+ "useDefineForClassFields",
771
+ "emitDecoratorMetadata",
772
+ "experimentalDecorators",
773
+ /* Modules */
774
+ "baseUrl",
775
+ "rootDir",
776
+ "rootDirs",
777
+ "customConditions",
778
+ "module",
779
+ "moduleResolution",
780
+ "moduleSuffixes",
781
+ "noResolve",
782
+ "paths",
783
+ "resolveJsonModule",
784
+ "resolvePackageJsonExports",
785
+ "resolvePackageJsonImports",
786
+ "typeRoots",
787
+ "types",
788
+ "allowArbitraryExtensions",
789
+ "allowImportingTsExtensions",
790
+ "allowUmdGlobalAccess",
791
+ /* JavaScript Support */
792
+ "allowJs",
793
+ "checkJs",
794
+ "maxNodeModuleJsDepth",
795
+ /* Type Checking */
796
+ "strict",
797
+ "strictBindCallApply",
798
+ "strictFunctionTypes",
799
+ "strictNullChecks",
800
+ "strictPropertyInitialization",
801
+ "allowUnreachableCode",
802
+ "allowUnusedLabels",
803
+ "alwaysStrict",
804
+ "exactOptionalPropertyTypes",
805
+ "noFallthroughCasesInSwitch",
806
+ "noImplicitAny",
807
+ "noImplicitOverride",
808
+ "noImplicitReturns",
809
+ "noImplicitThis",
810
+ "noPropertyAccessFromIndexSignature",
811
+ "noUncheckedIndexedAccess",
812
+ "noUnusedLocals",
813
+ "noUnusedParameters",
814
+ "useUnknownInCatchVariables",
815
+ /* Emit */
816
+ "declaration",
817
+ "declarationDir",
818
+ "declarationMap",
819
+ "downlevelIteration",
820
+ "emitBOM",
821
+ "emitDeclarationOnly",
822
+ "importHelpers",
823
+ "importsNotUsedAsValues",
824
+ "inlineSourceMap",
825
+ "inlineSources",
826
+ "isolatedDeclarations",
827
+ "mapRoot",
828
+ "newLine",
829
+ "noEmit",
830
+ "noEmitHelpers",
831
+ "noEmitOnError",
832
+ "outDir",
833
+ "outFile",
834
+ "preserveConstEnums",
835
+ "preserveValueImports",
836
+ "removeComments",
837
+ "sourceMap",
838
+ "sourceRoot",
839
+ "stripInternal",
840
+ /* Interop Constraints */
841
+ "allowSyntheticDefaultImports",
842
+ "esModuleInterop",
843
+ "forceConsistentCasingInFileNames",
844
+ "isolatedModules",
845
+ "preserveSymlinks",
846
+ "verbatimModuleSyntax",
847
+ /* Completeness */
848
+ "skipDefaultLibCheck",
849
+ "skipLibCheck"
850
+ ],
851
+ pathPattern: "^compilerOptions$"
852
+ }
853
+ ]
854
+ }
855
+ }
856
+ ];
857
+
858
+ // src/configs/stylistic.ts
859
+ import plugin7 from "@stylistic/eslint-plugin";
860
+ var config = plugin7.configs.customize({
861
+ flat: true,
862
+ indent: 4,
863
+ jsx: false,
864
+ pluginName: "style",
865
+ quotes: "single",
866
+ semi: false
867
+ });
868
+ config.rules["style/indent"][2].offsetTernaryExpressions = false;
869
+ var stylistic = [
870
+ {
871
+ name: "ivanmaxlogiudice/stylistic/rules",
872
+ plugins: {
873
+ style: plugin7
874
+ },
875
+ rules: {
876
+ ...config.rules,
877
+ "antfu/consistent-list-newline": "error",
878
+ "antfu/curly": "error",
879
+ "antfu/if-newline": "error",
880
+ "antfu/top-level-function": "error",
881
+ "style/function-call-spacing": ["error", "never"]
882
+ }
883
+ }
884
+ ];
885
+
886
+ // src/configs/test.ts
887
+ var _pluginTest;
888
+ async function test() {
889
+ const [pluginVitest, pluginNoOnlyTests] = await Promise.all([
890
+ interopDefault(import("@vitest/eslint-plugin")),
891
+ // @ts-expect-error missing types
892
+ interopDefault(import("eslint-plugin-no-only-tests"))
893
+ ]);
894
+ _pluginTest = _pluginTest || {
895
+ ...pluginVitest,
896
+ rules: {
897
+ ...pluginVitest.rules,
898
+ // extend `test/no-only-tests` rule
899
+ ...pluginNoOnlyTests.rules
900
+ }
901
+ };
902
+ return [
903
+ {
904
+ name: "ivanmaxlogiudice/test/setup",
905
+ plugins: {
906
+ test: _pluginTest
907
+ }
908
+ },
909
+ {
910
+ name: "ivanmaxlogiudice/test/rules",
911
+ files: GLOB_TESTS,
18
912
  rules: {
913
+ "node/prefer-global/process": "off",
914
+ "test/consistent-test-it": ["error", { fn: "it", withinDescribe: "it" }],
915
+ "test/no-identical-title": "error",
916
+ "test/no-import-node-test": "error",
917
+ "test/no-only-tests": isInEditorEnv() ? "off" : "error",
918
+ "test/prefer-hooks-in-order": "error",
919
+ "test/prefer-lowercase-title": "error",
920
+ "ts/explicit-function-return-type": "off"
921
+ }
922
+ }
923
+ ];
924
+ }
925
+
926
+ // src/configs/typescript.ts
927
+ import plugin8 from "@typescript-eslint/eslint-plugin";
928
+ import parser2 from "@typescript-eslint/parser";
929
+ function typescript(options = {}) {
930
+ const {
931
+ componentExts = [],
932
+ type = "app"
933
+ } = options;
934
+ const files = [GLOB_TS, ...componentExts.map((ext) => `**/*.${ext}`)];
935
+ return [
936
+ {
937
+ name: "ivanmaxlogiudice/typescript/setup",
938
+ plugins: {
939
+ ts: plugin8
940
+ }
941
+ },
942
+ {
943
+ name: "ivanmaxlogiudice/typescript/parser",
944
+ files,
945
+ languageOptions: {
946
+ parser: parser2,
947
+ parserOptions: {
948
+ extraFileExtensions: componentExts.map((ext) => `.${ext}`),
949
+ sourceType: "module"
950
+ }
951
+ }
952
+ },
953
+ {
954
+ name: "ivanmaxlogiudice/typescript/rules",
955
+ files,
956
+ rules: {
957
+ // Disable eslint rules which are already handled by TypeScript.
958
+ ...renameRules(plugin8.configs["eslint-recommended"].overrides[0].rules, "@typescript-eslint", "ts"),
959
+ ...renameRules(plugin8.configs.strict.rules, "@typescript-eslint", "ts"),
960
+ "no-dupe-class-members": "off",
961
+ "no-redeclare": "off",
962
+ "no-use-before-define": "off",
963
+ "no-useless-constructor": "off",
964
+ "ts/ban-ts-comment": ["error", { "ts-expect-error": "allow-with-description" }],
965
+ "ts/consistent-type-definitions": ["error", "interface"],
966
+ "ts/consistent-type-imports": ["error", {
967
+ disallowTypeAnnotations: false,
968
+ prefer: "type-imports"
969
+ }],
970
+ "ts/method-signature-style": ["error", "property"],
971
+ // https://www.totaltypescript.com/method-shorthand-syntax-considered-harmful
972
+ "ts/no-dupe-class-members": "error",
973
+ "ts/no-dynamic-delete": "off",
974
+ "ts/no-empty-object-type": ["error", { allowInterfaces: "always" }],
975
+ "ts/no-explicit-any": "off",
976
+ "ts/no-extraneous-class": "off",
977
+ "ts/no-import-type-side-effects": "error",
978
+ "ts/no-invalid-void-type": "off",
979
+ "ts/no-non-null-assertion": "off",
980
+ "ts/no-redeclare": "error",
981
+ "ts/no-require-imports": "error",
982
+ "ts/no-unused-vars": "off",
983
+ "ts/no-use-before-define": ["error", { classes: false, functions: false, variables: true }],
984
+ "ts/no-useless-constructor": "off",
985
+ "ts/no-wrapper-object-types": "error",
986
+ "ts/triple-slash-reference": "off",
987
+ "ts/unified-signatures": "off",
988
+ ...type === "lib" ? {
989
+ "ts/explicit-function-return-type": ["error", {
990
+ allowExpressions: true,
991
+ allowHigherOrderFunctions: true,
992
+ allowIIFEs: true
993
+ }]
994
+ } : {}
995
+ }
996
+ },
997
+ {
998
+ name: "ivanmaxlogiudice/typescript/disables/dts",
999
+ files: ["**/*.d.?([cm])ts"],
1000
+ rules: {
1001
+ "eslint-comments/no-unlimited-disable": "off",
1002
+ "import/no-duplicates": "off",
1003
+ "no-restricted-syntax": "off",
1004
+ "unused-imports/no-unused-vars": "off"
1005
+ }
1006
+ },
1007
+ {
1008
+ name: "ivanmaxlogiudice/typescript/disables/test",
1009
+ files: ["**/*.{test,spec}.ts?(x)"],
1010
+ rules: {
1011
+ "no-unused-expressions": "off"
1012
+ }
1013
+ },
1014
+ {
1015
+ name: "ivanmaxlogiudice/typescript/disables/cjs",
1016
+ files: ["**/*.js", "**/*.cjs"],
1017
+ rules: {
1018
+ "ts/no-require-imports": "off"
1019
+ }
1020
+ }
1021
+ ];
1022
+ }
1023
+
1024
+ // src/configs/unicorn.ts
1025
+ import plugin9 from "eslint-plugin-unicorn";
1026
+ var unicorn = [
1027
+ {
1028
+ name: "ivanmaxlogiudice/unicorn/rules",
1029
+ plugins: {
1030
+ unicorn: plugin9
1031
+ },
1032
+ rules: {
1033
+ // Pass error message when throwing errors
1034
+ "unicorn/error-message": "error",
1035
+ // Uppercase regex escapes
1036
+ "unicorn/escape-case": "error",
1037
+ // Array.isArray instead of instanceof
1038
+ "unicorn/no-instanceof-array": "error",
1039
+ // Ban `new Array` as `Array` constructor's params are ambiguous
1040
+ "unicorn/no-new-array": "error",
1041
+ // Prevent deprecated `new Buffer()`
1042
+ "unicorn/no-new-buffer": "error",
1043
+ // Lowercase number formatting for octal, hex, binary (0x1'error' instead of 0X1'error')
1044
+ "unicorn/number-literal-case": "error",
1045
+ // textContent instead of innerText
1046
+ "unicorn/prefer-dom-node-text-content": "error",
1047
+ // includes over indexOf when checking for existence
1048
+ "unicorn/prefer-includes": "error",
1049
+ // Prefer using the node: protocol
1050
+ "unicorn/prefer-node-protocol": "error",
1051
+ // Prefer using number properties like `Number.isNaN` rather than `isNaN`
1052
+ "unicorn/prefer-number-properties": "error",
1053
+ // String methods startsWith/endsWith instead of more complicated stuff
1054
+ "unicorn/prefer-string-starts-ends-with": "error",
1055
+ // Enforce throwing type error when throwing error while checking typeof
1056
+ "unicorn/prefer-type-error": "error",
1057
+ // Use new when throwing error
1058
+ "unicorn/throw-new-error": "error"
1059
+ }
1060
+ }
1061
+ ];
1062
+
1063
+ // src/configs/unocss.ts
1064
+ async function unocss(options = {}) {
1065
+ const {
1066
+ attributify = true,
1067
+ strict = false
1068
+ } = options;
1069
+ await ensurePackages(["@unocss/eslint-plugin"]);
1070
+ const [plugin10] = await Promise.all([
1071
+ interopDefault(import("@unocss/eslint-plugin"))
1072
+ ]);
1073
+ return [
1074
+ {
1075
+ name: "ivanmaxlogiudice/unocss/rules",
1076
+ plugins: {
1077
+ unocss: plugin10
1078
+ },
1079
+ rules: {
1080
+ "unocss/order": "warn",
1081
+ ...attributify ? { "unocss/order-attributify": "warn" } : {},
1082
+ ...strict ? { "unocss/blocklist": "error" } : {}
1083
+ }
1084
+ }
1085
+ ];
1086
+ }
1087
+
1088
+ // src/configs/vue.ts
1089
+ async function vue(options = {}) {
1090
+ await ensurePackages(["eslint-plugin-vue", "vue-eslint-parser"]);
1091
+ const [plugin10, parser3] = await Promise.all([
1092
+ // @ts-expect-error missing types
1093
+ interopDefault(import("eslint-plugin-vue")),
1094
+ interopDefault(import("vue-eslint-parser"))
1095
+ ]);
1096
+ return [
1097
+ {
1098
+ name: "ivanmaxlogiudice/vue/setup",
1099
+ plugins: {
1100
+ vue: plugin10
1101
+ },
1102
+ // This allows Vue plugin to work with auto imports
1103
+ // https://github.com/vuejs/eslint-plugin-vue/pull/2422
1104
+ languageOptions: {
1105
+ globals: {
1106
+ computed: "readonly",
1107
+ defineEmits: "readonly",
1108
+ defineExpose: "readonly",
1109
+ defineProps: "readonly",
1110
+ onMounted: "readonly",
1111
+ onUnmounted: "readonly",
1112
+ reactive: "readonly",
1113
+ ref: "readonly",
1114
+ shallowReactive: "readonly",
1115
+ shallowRef: "readonly",
1116
+ toRef: "readonly",
1117
+ toRefs: "readonly",
1118
+ watch: "readonly",
1119
+ watchEffect: "readonly"
1120
+ }
1121
+ }
1122
+ },
1123
+ {
1124
+ name: "ivanmaxlogiudice/vue/rules",
1125
+ files: [GLOB_VUE],
1126
+ languageOptions: {
1127
+ parser: parser3,
1128
+ parserOptions: {
1129
+ ecmaFeatures: {
1130
+ jsx: true
1131
+ },
1132
+ extraFileExtensions: [".vue"],
1133
+ parser: options.typescript ? await interopDefault(import("@typescript-eslint/parser")) : null,
1134
+ sourceType: "module"
1135
+ }
1136
+ },
1137
+ processor: plugin10.processors[".vue"],
1138
+ rules: {
1139
+ ...plugin10.configs.base.rules,
1140
+ ...plugin10.configs["vue3-essential"].rules,
1141
+ ...plugin10.configs["vue3-strongly-recommended"].rules,
1142
+ ...plugin10.configs["vue3-recommended"].rules,
1143
+ "node/prefer-global/process": "off",
19
1144
  "vue/block-order": ["error", {
20
1145
  order: ["template", "script", "style"]
21
1146
  }],
22
- "vue/html-indent": ["error", 4]
1147
+ "vue/component-name-in-template-casing": ["error", "PascalCase"],
1148
+ "vue/component-options-name-casing": ["error", "PascalCase"],
1149
+ // this is deprecated
1150
+ "vue/component-tags-order": "off",
1151
+ "vue/custom-event-name-casing": ["error", "camelCase"],
1152
+ "vue/define-macros-order": ["error", {
1153
+ order: ["defineOptions", "defineProps", "defineEmits", "defineSlots"]
1154
+ }],
1155
+ "vue/dot-location": ["error", "property"],
1156
+ "vue/dot-notation": ["error", { allowKeywords: true }],
1157
+ "vue/eqeqeq": ["error", "smart"],
1158
+ "vue/html-indent": ["error", 4],
1159
+ "vue/html-quotes": ["error", "double"],
1160
+ "vue/max-attributes-per-line": "off",
1161
+ "vue/multi-word-component-names": "off",
1162
+ "vue/no-dupe-keys": "off",
1163
+ "vue/no-empty-pattern": "error",
1164
+ "vue/no-irregular-whitespace": "error",
1165
+ "vue/no-loss-of-precision": "error",
1166
+ "vue/no-restricted-syntax": [
1167
+ "error",
1168
+ "DebuggerStatement",
1169
+ "LabeledStatement",
1170
+ "WithStatement"
1171
+ ],
1172
+ "vue/no-restricted-v-bind": ["error", "/^v-/"],
1173
+ "vue/no-setup-props-reactivity-loss": "off",
1174
+ "vue/no-sparse-arrays": "error",
1175
+ "vue/no-unused-refs": "error",
1176
+ "vue/no-useless-v-bind": "error",
1177
+ "vue/no-v-html": "off",
1178
+ "vue/object-shorthand": [
1179
+ "error",
1180
+ "always",
1181
+ {
1182
+ avoidQuotes: true,
1183
+ ignoreConstructors: false
1184
+ }
1185
+ ],
1186
+ "vue/prefer-separate-static-class": "error",
1187
+ "vue/prefer-template": "error",
1188
+ "vue/prop-name-casing": ["error", "camelCase"],
1189
+ "vue/require-default-prop": "off",
1190
+ "vue/require-prop-types": "off",
1191
+ "vue/space-infix-ops": "error",
1192
+ "vue/space-unary-ops": ["error", { nonwords: false, words: true }],
1193
+ // Stylistic
1194
+ "vue/array-bracket-spacing": ["error", "never"],
1195
+ "vue/arrow-spacing": ["error", { after: true, before: true }],
1196
+ "vue/block-spacing": ["error", "always"],
1197
+ "vue/block-tag-newline": ["error", {
1198
+ multiline: "always",
1199
+ singleline: "always"
1200
+ }],
1201
+ "vue/brace-style": ["error", "stroustrup", { allowSingleLine: true }],
1202
+ "vue/comma-dangle": ["error", "always-multiline"],
1203
+ "vue/comma-spacing": ["error", { after: true, before: false }],
1204
+ "vue/comma-style": ["error", "last"],
1205
+ "vue/html-comment-content-spacing": ["error", "always", {
1206
+ exceptions: ["-"]
1207
+ }],
1208
+ "vue/key-spacing": ["error", { afterColon: true, beforeColon: false }],
1209
+ "vue/keyword-spacing": ["error", { after: true, before: true }],
1210
+ "vue/object-curly-newline": "off",
1211
+ "vue/object-curly-spacing": ["error", "always"],
1212
+ "vue/object-property-newline": ["error", { allowMultiplePropertiesPerLine: true }],
1213
+ "vue/operator-linebreak": ["error", "before"],
1214
+ "vue/padding-line-between-blocks": ["error", "always"],
1215
+ "vue/quote-props": ["error", "consistent-as-needed"],
1216
+ "vue/space-in-parens": ["error", "never"],
1217
+ "vue/template-curly-spacing": "error"
23
1218
  }
24
- });
25
- }
26
- if (options?.yaml ?? true) {
27
- pipe.override("antfu/yaml/rules", {
1219
+ }
1220
+ ];
1221
+ }
1222
+
1223
+ // src/configs/yaml.ts
1224
+ async function yaml() {
1225
+ await ensurePackages(["eslint-plugin-yml", "yaml-eslint-parser"]);
1226
+ const [plugin10, parser3] = await Promise.all([
1227
+ interopDefault(import("eslint-plugin-yml")),
1228
+ interopDefault(import("yaml-eslint-parser"))
1229
+ ]);
1230
+ return [
1231
+ {
1232
+ name: "ivanmaxlogiudice/yaml/setup",
1233
+ plugins: {
1234
+ yaml: plugin10
1235
+ }
1236
+ },
1237
+ {
1238
+ name: "ivanmaxlogiudice/yaml/rules",
1239
+ files: [GLOB_YAML],
1240
+ languageOptions: {
1241
+ parser: parser3
1242
+ },
28
1243
  rules: {
29
- "yaml/indent": ["error", 2]
1244
+ // TODO: Check rules (https://github.com/ota-meshi/eslint-plugin-yml)
1245
+ "style/spaced-comment": "off",
1246
+ "yaml/block-mapping": "error",
1247
+ "yaml/block-sequence": "error",
1248
+ "yaml/no-empty-key": "error",
1249
+ "yaml/no-empty-sequence-entry": "error",
1250
+ "yaml/no-irregular-whitespace": "error",
1251
+ "yaml/plain-scalar": "error",
1252
+ "yaml/vue-custom-block/no-parsing-error": "error",
1253
+ // Stylistic
1254
+ "yaml/block-mapping-question-indicator-newline": "error",
1255
+ "yaml/block-sequence-hyphen-indicator-newline": "error",
1256
+ "yaml/flow-mapping-curly-newline": "error",
1257
+ "yaml/flow-mapping-curly-spacing": "error",
1258
+ "yaml/flow-sequence-bracket-newline": "error",
1259
+ "yaml/flow-sequence-bracket-spacing": "error",
1260
+ "yaml/indent": ["error", 2],
1261
+ "yaml/key-spacing": "error",
1262
+ "yaml/no-tab-indent": "error",
1263
+ "yaml/quotes": ["error", { avoidEscape: false, prefer: "single" }],
1264
+ "yaml/spaced-comment": "error"
30
1265
  }
31
- });
32
- }
33
- pipe.onResolved((config2) => {
34
- const stylistic = config2.find((item) => item.name === "antfu/stylistic/rules");
35
- if (stylistic && stylistic.rules && Array.isArray(stylistic.rules["style/indent"]) && stylistic.rules["style/indent"][2]) {
36
- stylistic.rules["style/indent"][2].offsetTernaryExpressions = false;
37
1266
  }
38
- });
39
- return pipe;
40
- };
41
- var src_default = config;
1267
+ ];
1268
+ }
1269
+
1270
+ // src/factory.ts
1271
+ async function config2(options = {}, ...userConfigs) {
1272
+ clearPackageCache();
1273
+ const {
1274
+ componentExts = [],
1275
+ regexp: enableRegexp = false,
1276
+ typescript: enableTypeScript = packageExists("typescript"),
1277
+ unocss: enableUnoCSS = hasSomePackage(["unocss", "@unocss/nuxt"]),
1278
+ vue: enableVue = hasSomePackage(["vue", "nuxt", "vitepress", "@slidev/cli"])
1279
+ } = options;
1280
+ const configs = [
1281
+ comments,
1282
+ ignores(),
1283
+ imports,
1284
+ javascript,
1285
+ jsdoc,
1286
+ node,
1287
+ perfectionist,
1288
+ stylistic,
1289
+ unicorn,
1290
+ // Basic json(c) file support and sorting json keys
1291
+ jsonc,
1292
+ sortPackageJson,
1293
+ sortTsconfig
1294
+ ];
1295
+ if (enableVue) {
1296
+ componentExts.push("vue");
1297
+ }
1298
+ if (enableTypeScript) {
1299
+ configs.push(typescript({
1300
+ componentExts,
1301
+ type: options.type
1302
+ }));
1303
+ }
1304
+ if (enableRegexp) {
1305
+ configs.push(regexp());
1306
+ }
1307
+ if (options.test ?? true) {
1308
+ configs.push(test());
1309
+ }
1310
+ if (enableVue) {
1311
+ configs.push(vue({
1312
+ typescript: enableTypeScript
1313
+ }));
1314
+ }
1315
+ if (enableUnoCSS) {
1316
+ configs.push(unocss({
1317
+ ...resolveSubOptions(options, "unocss")
1318
+ }));
1319
+ }
1320
+ if (options.yaml) {
1321
+ configs.push(yaml());
1322
+ }
1323
+ if (options.markdown) {
1324
+ configs.push(markdown({
1325
+ componentExts
1326
+ }));
1327
+ }
1328
+ const merged = await combine(
1329
+ ...configs,
1330
+ ...userConfigs
1331
+ );
1332
+ return merged;
1333
+ }
1334
+ function resolveSubOptions(options, key) {
1335
+ return typeof options[key] === "boolean" ? {} : options[key] || {};
1336
+ }
1337
+
1338
+ // src/index.ts
1339
+ var src_default = config2;
42
1340
  export {
43
- config,
44
- src_default as default
1341
+ GLOB_ALL_SRC,
1342
+ GLOB_EXCLUDE,
1343
+ GLOB_JS,
1344
+ GLOB_JSON,
1345
+ GLOB_JSON5,
1346
+ GLOB_JSONC,
1347
+ GLOB_MARKDOWN,
1348
+ GLOB_MARKDOWN_CODE,
1349
+ GLOB_SRC,
1350
+ GLOB_SRC_EXT,
1351
+ GLOB_TESTS,
1352
+ GLOB_TS,
1353
+ GLOB_VUE,
1354
+ GLOB_YAML,
1355
+ clearPackageCache,
1356
+ combine,
1357
+ comments,
1358
+ config2 as config,
1359
+ src_default as default,
1360
+ ensurePackages,
1361
+ findUp,
1362
+ hasSomePackage,
1363
+ ignores,
1364
+ imports,
1365
+ interopDefault,
1366
+ isInEditorEnv,
1367
+ javascript,
1368
+ jsdoc,
1369
+ jsonc,
1370
+ markdown,
1371
+ node,
1372
+ packageExists,
1373
+ perfectionist,
1374
+ regexp,
1375
+ renameRules,
1376
+ resolveSubOptions,
1377
+ restrictedSyntaxJs,
1378
+ sortPackageJson,
1379
+ sortTsconfig,
1380
+ spawnAsync,
1381
+ stylistic,
1382
+ test,
1383
+ typescript,
1384
+ unicorn,
1385
+ unocss,
1386
+ vue,
1387
+ yaml
45
1388
  };