@vinicunca/eslint-config 2.0.0-beta.2 → 2.0.0-beta.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.cjs ADDED
@@ -0,0 +1,1754 @@
1
+ "use strict";
2
+ var __create = Object.create;
3
+ var __defProp = Object.defineProperty;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __getProtoOf = Object.getPrototypeOf;
7
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
8
+ var __export = (target, all) => {
9
+ for (var name in all)
10
+ __defProp(target, name, { get: all[name], enumerable: true });
11
+ };
12
+ var __copyProps = (to, from, except, desc) => {
13
+ if (from && typeof from === "object" || typeof from === "function") {
14
+ for (let key of __getOwnPropNames(from))
15
+ if (!__hasOwnProp.call(to, key) && key !== except)
16
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
17
+ }
18
+ return to;
19
+ };
20
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
+ // If the importer is in node compatibility mode or this is not an ESM
22
+ // file that has been converted to a CommonJS file using a Babel-
23
+ // compatible transform (i.e. "__esModule" has not been set), then set
24
+ // "default" to the CommonJS "module.exports" for node compatibility.
25
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
26
+ mod
27
+ ));
28
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
+
30
+ // src/index.ts
31
+ var src_exports = {};
32
+ __export(src_exports, {
33
+ GLOB_EXCLUDE: () => GLOB_EXCLUDE,
34
+ GLOB_JS: () => GLOB_JS,
35
+ GLOB_JSON: () => GLOB_JSON,
36
+ GLOB_JSON5: () => GLOB_JSON5,
37
+ GLOB_JSONC: () => GLOB_JSONC,
38
+ GLOB_JSX: () => GLOB_JSX,
39
+ GLOB_MARKDOWN: () => GLOB_MARKDOWN,
40
+ GLOB_MARKDOWN_CODE: () => GLOB_MARKDOWN_CODE,
41
+ GLOB_SRC: () => GLOB_SRC,
42
+ GLOB_SRC_EXT: () => GLOB_SRC_EXT,
43
+ GLOB_TESTS: () => GLOB_TESTS,
44
+ GLOB_TS: () => GLOB_TS,
45
+ GLOB_TSX: () => GLOB_TSX,
46
+ GLOB_VUE: () => GLOB_VUE,
47
+ GLOB_YAML: () => GLOB_YAML,
48
+ combineConfigs: () => combineConfigs,
49
+ comments: () => comments,
50
+ default: () => src_default,
51
+ ignores: () => ignores,
52
+ imports: () => imports,
53
+ javascript: () => javascript,
54
+ jsdoc: () => jsdoc,
55
+ jsonc: () => jsonc,
56
+ markdown: () => markdown,
57
+ node: () => node,
58
+ parserJsonc: () => import_jsonc_eslint_parser.default,
59
+ parserTs: () => parserTs,
60
+ parserVue: () => import_vue_eslint_parser.default,
61
+ parserYaml: () => import_yaml_eslint_parser.default,
62
+ pluginComments: () => import_eslint_plugin_eslint_comments.default,
63
+ pluginImport: () => pluginImport,
64
+ pluginJsdoc: () => import_eslint_plugin_jsdoc.default,
65
+ pluginJsonc: () => pluginJsonc,
66
+ pluginMarkdown: () => import_eslint_plugin_markdown.default,
67
+ pluginNoOnlyTests: () => import_eslint_plugin_no_only_tests.default,
68
+ pluginNode: () => import_eslint_plugin_n.default,
69
+ pluginReact: () => import_eslint_plugin_react.default,
70
+ pluginReactHooks: () => import_eslint_plugin_react_hooks.default,
71
+ pluginStylistic: () => import_eslint_plugin.default,
72
+ pluginTs: () => import_eslint_plugin2.default,
73
+ pluginUnicorn: () => import_eslint_plugin_unicorn.default,
74
+ pluginUnusedImports: () => import_eslint_plugin_unused_imports.default,
75
+ pluginVinicunca: () => import_eslint_plugin_vinicunca.default,
76
+ pluginVitest: () => import_eslint_plugin_vitest.default,
77
+ pluginVue: () => import_eslint_plugin_vue.default,
78
+ pluginYaml: () => pluginYaml,
79
+ react: () => react,
80
+ renameRules: () => renameRules,
81
+ sortPackageJson: () => sortPackageJson,
82
+ sortTsconfig: () => sortTsconfig,
83
+ stylistic: () => stylistic,
84
+ test: () => test,
85
+ typescript: () => typescript,
86
+ unicorn: () => unicorn,
87
+ vinicuncaESLint: () => vinicuncaESLint,
88
+ vue: () => vue,
89
+ yaml: () => yaml
90
+ });
91
+ module.exports = __toCommonJS(src_exports);
92
+
93
+ // src/base.ts
94
+ var import_node_process2 = __toESM(require("process"), 1);
95
+ var import_local_pkg = require("local-pkg");
96
+
97
+ // ../node_modules/.pnpm/@vinicunca+perkakas@0.0.4/node_modules/@vinicunca/perkakas/dist/es/function/purry.js
98
+ function purry(fn, args, lazy) {
99
+ const diff = fn.length - args.length;
100
+ const arrayArgs = Array.from(args);
101
+ if (diff === 0) {
102
+ return fn(...arrayArgs);
103
+ }
104
+ if (diff === 1) {
105
+ const ret = (data) => fn(data, ...arrayArgs);
106
+ if (lazy || fn.lazy) {
107
+ ret.lazy = lazy || fn.lazy;
108
+ ret.lazyArgs = args;
109
+ }
110
+ return ret;
111
+ }
112
+ throw new Error("Wrong number of arguments");
113
+ }
114
+
115
+ // ../node_modules/.pnpm/@vinicunca+perkakas@0.0.4/node_modules/@vinicunca/perkakas/dist/es/guard/is-boolean.js
116
+ function isBoolean(data) {
117
+ return typeof data === "boolean";
118
+ }
119
+
120
+ // ../node_modules/.pnpm/@vinicunca+perkakas@0.0.4/node_modules/@vinicunca/perkakas/dist/es/utils/reduce-lazy.js
121
+ function _reduceLazy(array, lazy, indexed) {
122
+ const newArray = [];
123
+ for (let index = 0; index < array.length; index++) {
124
+ const item = array[index];
125
+ const result = indexed ? lazy(item, index, array) : lazy(item);
126
+ if (result.hasMany === true) {
127
+ newArray.push(...result.next);
128
+ } else if (result.hasNext) {
129
+ newArray.push(result.next);
130
+ }
131
+ }
132
+ return newArray;
133
+ }
134
+
135
+ // ../node_modules/.pnpm/@vinicunca+perkakas@0.0.4/node_modules/@vinicunca/perkakas/dist/es/array/uniq.js
136
+ function uniq() {
137
+ return purry(_uniq, arguments, uniq.lazy);
138
+ }
139
+ function _uniq(array) {
140
+ return _reduceLazy(array, uniq.lazy());
141
+ }
142
+ (function(uniq2) {
143
+ function lazy() {
144
+ const set = /* @__PURE__ */ new Set();
145
+ return (value) => {
146
+ if (set.has(value)) {
147
+ return {
148
+ done: false,
149
+ hasNext: false
150
+ };
151
+ }
152
+ set.add(value);
153
+ return {
154
+ done: false,
155
+ hasNext: true,
156
+ next: value
157
+ };
158
+ };
159
+ }
160
+ uniq2.lazy = lazy;
161
+ })(uniq || (uniq = {}));
162
+
163
+ // src/configs/ignores.ts
164
+ var import_node_fs = __toESM(require("fs"), 1);
165
+ var import_parse_gitignore = __toESM(require("parse-gitignore"), 1);
166
+
167
+ // src/globs.ts
168
+ var GLOB_JS = "**/*.?([cm])js";
169
+ var GLOB_JSX = "**/*.?([cm])jsx";
170
+ var GLOB_TS = "**/*.?([cm])ts";
171
+ var GLOB_TSX = "**/*.?([cm])tsx";
172
+ var GLOB_EXCLUDE = [
173
+ "**/node_modules",
174
+ "**/dist",
175
+ "**/package-lock.json",
176
+ "**/yarn.lock",
177
+ "**/pnpm-lock.yaml",
178
+ "**/output",
179
+ "**/coverage",
180
+ "**/temp",
181
+ "**/.vitepress/cache",
182
+ "**/.nuxt",
183
+ "**/.vercel",
184
+ "**/.changeset",
185
+ "**/.idea",
186
+ "**/.cache",
187
+ "**/.output",
188
+ "**/.vite-inspect",
189
+ "**/CHANGELOG*.md",
190
+ "**/*.min.*",
191
+ "**/LICENSE*",
192
+ "**/__snapshots__",
193
+ "**/auto-import?(s).d.ts",
194
+ "**/components.d.ts"
195
+ ];
196
+ var GLOB_SRC = "**/*.?([cm])[jt]s?(x)";
197
+ var GLOB_SRC_EXT = "?([cm])[jt]s?(x)";
198
+ var GLOB_TESTS = [
199
+ `**/__tests__/**/*.${GLOB_SRC_EXT}`,
200
+ `**/*.spec.${GLOB_SRC_EXT}`,
201
+ `**/*.test.${GLOB_SRC_EXT}`,
202
+ `**/*.bench.${GLOB_SRC_EXT}`,
203
+ `**/*.benchmark.${GLOB_SRC_EXT}`
204
+ ];
205
+ var GLOB_VUE = "**/*.vue";
206
+ var GLOB_JSON = "**/*.json";
207
+ var GLOB_JSON5 = "**/*.json5";
208
+ var GLOB_JSONC = "**/*.jsonc";
209
+ var GLOB_YAML = "**/*.y?(a)ml";
210
+ var GLOB_MARKDOWN = "**/*.md";
211
+ var GLOB_MARKDOWN_CODE = `${GLOB_MARKDOWN}/${GLOB_SRC}`;
212
+
213
+ // src/configs/ignores.ts
214
+ function ignores({
215
+ enableGitignore = true,
216
+ items = [],
217
+ replace = false
218
+ } = {}) {
219
+ const ignoreList = [];
220
+ if (enableGitignore) {
221
+ if (import_node_fs.default.existsSync(".gitignore")) {
222
+ const gitignoreContent = import_node_fs.default.readFileSync(".gitignore", "utf8");
223
+ const parsed = (0, import_parse_gitignore.default)(gitignoreContent);
224
+ const globs = parsed.globs();
225
+ for (const glob of globs) {
226
+ if (glob.type === "ignore") {
227
+ ignoreList.push(...glob.patterns);
228
+ } else if (glob.type === "unignore") {
229
+ ignoreList.push(...glob.patterns.map((pattern) => `!${pattern}`));
230
+ }
231
+ ;
232
+ }
233
+ }
234
+ }
235
+ if (replace) {
236
+ ignoreList.push(...items);
237
+ } else {
238
+ ignoreList.push(...GLOB_EXCLUDE, ...items);
239
+ }
240
+ return [
241
+ {
242
+ name: "vinicunca:ignores",
243
+ ignores: uniq(ignoreList)
244
+ }
245
+ ];
246
+ }
247
+
248
+ // src/utils.ts
249
+ function combineConfigs(...configs) {
250
+ return configs.flatMap((config) => Array.isArray(config) ? config : [config]);
251
+ }
252
+ function renameRules(rules, from, to) {
253
+ return Object.fromEntries(
254
+ Object.entries(rules).map(([key, value]) => {
255
+ if (key.startsWith(from)) {
256
+ return [to + key.slice(from.length), value];
257
+ }
258
+ ;
259
+ return [key, value];
260
+ })
261
+ );
262
+ }
263
+
264
+ // src/flags.ts
265
+ var ERROR = "error";
266
+ var OFF = "off";
267
+ var WARN = "warn";
268
+ var CONSISTENT = "consistent";
269
+ var NEVER = "never";
270
+ var ALWAYS = "always";
271
+
272
+ // src/plugins.ts
273
+ var import_eslint_plugin = __toESM(require("@stylistic/eslint-plugin"), 1);
274
+ var import_eslint_plugin_vinicunca = __toESM(require("@vinicunca/eslint-plugin-vinicunca"), 1);
275
+ var import_eslint_plugin2 = __toESM(require("@typescript-eslint/eslint-plugin"), 1);
276
+ var parserTs = __toESM(require("@typescript-eslint/parser"), 1);
277
+ var import_eslint_plugin_eslint_comments = __toESM(require("eslint-plugin-eslint-comments"), 1);
278
+ var pluginImport = __toESM(require("eslint-plugin-i"), 1);
279
+ var import_eslint_plugin_jsdoc = __toESM(require("eslint-plugin-jsdoc"), 1);
280
+ var pluginJsonc = __toESM(require("eslint-plugin-jsonc"), 1);
281
+ var import_eslint_plugin_markdown = __toESM(require("eslint-plugin-markdown"), 1);
282
+ var import_eslint_plugin_n = __toESM(require("eslint-plugin-n"), 1);
283
+ var import_eslint_plugin_no_only_tests = __toESM(require("eslint-plugin-no-only-tests"), 1);
284
+ var import_eslint_plugin_unicorn = __toESM(require("eslint-plugin-unicorn"), 1);
285
+ var import_eslint_plugin_unused_imports = __toESM(require("eslint-plugin-unused-imports"), 1);
286
+ var import_eslint_plugin_react = __toESM(require("eslint-plugin-react"), 1);
287
+ var import_eslint_plugin_react_hooks = __toESM(require("eslint-plugin-react-hooks"), 1);
288
+ var import_eslint_plugin_vue = __toESM(require("eslint-plugin-vue"), 1);
289
+ var pluginYaml = __toESM(require("eslint-plugin-yml"), 1);
290
+ var import_eslint_plugin_vitest = __toESM(require("eslint-plugin-vitest"), 1);
291
+ var import_jsonc_eslint_parser = __toESM(require("jsonc-eslint-parser"), 1);
292
+ var import_vue_eslint_parser = __toESM(require("vue-eslint-parser"), 1);
293
+ var import_yaml_eslint_parser = __toESM(require("yaml-eslint-parser"), 1);
294
+
295
+ // src/configs/comments.ts
296
+ function comments() {
297
+ return [
298
+ {
299
+ name: "vinicunca:eslint-comments",
300
+ plugins: {
301
+ "eslint-comments": import_eslint_plugin_eslint_comments.default
302
+ },
303
+ rules: {
304
+ "eslint-comments/no-aggregating-enable": ERROR,
305
+ "eslint-comments/no-duplicate-disable": ERROR,
306
+ "eslint-comments/no-unlimited-disable": ERROR,
307
+ "eslint-comments/no-unused-enable": ERROR
308
+ }
309
+ }
310
+ ];
311
+ }
312
+
313
+ // src/configs/imports.ts
314
+ function imports() {
315
+ return [
316
+ {
317
+ name: "vinicunca:imports",
318
+ plugins: {
319
+ import: pluginImport,
320
+ vinicunca: import_eslint_plugin_vinicunca.default
321
+ },
322
+ rules: {
323
+ "import/export": ERROR,
324
+ "import/first": ERROR,
325
+ "import/newline-after-import": [ERROR, {
326
+ considerComments: true,
327
+ count: 1
328
+ }],
329
+ "import/no-duplicates": ERROR,
330
+ "import/no-mutable-exports": ERROR,
331
+ "import/no-named-default": ERROR,
332
+ "import/no-self-import": ERROR,
333
+ "import/no-webpack-loader-syntax": ERROR,
334
+ "import/order": ERROR,
335
+ "vinicunca/import-dedupe": ERROR,
336
+ "vinicunca/no-import-node-modules-by-path": ERROR
337
+ }
338
+ }
339
+ ];
340
+ }
341
+
342
+ // src/configs/javascript.ts
343
+ var import_globals = __toESM(require("globals"), 1);
344
+ function javascript(options = {}) {
345
+ const {
346
+ isInEditor = false,
347
+ overrides = {}
348
+ } = options;
349
+ return [
350
+ {
351
+ name: "vinicunca:javascript",
352
+ languageOptions: {
353
+ ecmaVersion: 2022,
354
+ globals: {
355
+ ...import_globals.default.es2021,
356
+ ...import_globals.default.node,
357
+ document: "readonly",
358
+ navigator: "readonly",
359
+ window: "readonly"
360
+ },
361
+ parserOptions: {
362
+ ecmaFeatures: { jsx: true },
363
+ ecmaVersion: 2022,
364
+ sourceType: "module"
365
+ },
366
+ sourceType: "module"
367
+ },
368
+ plugins: {
369
+ "vinicunca": import_eslint_plugin_vinicunca.default,
370
+ "unused-imports": import_eslint_plugin_unused_imports.default
371
+ },
372
+ rules: {
373
+ "accessor-pairs": [ERROR, {
374
+ setWithoutGet: true,
375
+ enforceForClassMembers: true
376
+ }],
377
+ "array-callback-return": [ERROR, { checkForEach: true }],
378
+ "arrow-parens": [ERROR, ALWAYS],
379
+ "block-scoped-var": ERROR,
380
+ "camelcase": [ERROR, {
381
+ allow: ["^UNSAFE_"],
382
+ properties: NEVER,
383
+ ignoreGlobals: true
384
+ }],
385
+ "constructor-super": ERROR,
386
+ "default-case-last": ERROR,
387
+ "dot-notation": [ERROR, { allowKeywords: true }],
388
+ "eqeqeq": [ERROR, "smart"],
389
+ "for-direction": ERROR,
390
+ "new-cap": [ERROR, {
391
+ capIsNew: false,
392
+ properties: true
393
+ }],
394
+ "no-alert": WARN,
395
+ "no-array-constructor": ERROR,
396
+ "no-async-promise-executor": ERROR,
397
+ "no-await-in-loop": ERROR,
398
+ "no-caller": ERROR,
399
+ "no-case-declarations": ERROR,
400
+ "no-class-assign": ERROR,
401
+ "no-compare-neg-zero": ERROR,
402
+ "no-console": [ERROR, {
403
+ allow: [WARN, ERROR]
404
+ }],
405
+ "no-cond-assign": [ERROR, ALWAYS],
406
+ "no-const-assign": ERROR,
407
+ "no-constant-binary-expression": ERROR,
408
+ "no-constant-condition": [ERROR, {
409
+ checkLoops: false
410
+ }],
411
+ "no-constructor-return": ERROR,
412
+ "no-control-regex": ERROR,
413
+ "no-debugger": ERROR,
414
+ "no-delete-var": ERROR,
415
+ "no-dupe-args": ERROR,
416
+ "no-dupe-class-members": ERROR,
417
+ "no-dupe-else-if": ERROR,
418
+ "no-dupe-keys": ERROR,
419
+ "no-duplicate-case": ERROR,
420
+ "no-empty": [ERROR, {
421
+ allowEmptyCatch: true
422
+ }],
423
+ "no-empty-character-class": ERROR,
424
+ "no-empty-pattern": ERROR,
425
+ "no-eval": ERROR,
426
+ "no-ex-assign": ERROR,
427
+ "no-extend-native": ERROR,
428
+ "no-extra-bind": ERROR,
429
+ "no-extra-boolean-cast": ERROR,
430
+ "no-fallthrough": ERROR,
431
+ "no-func-assign": ERROR,
432
+ "no-global-assign": ERROR,
433
+ "no-implied-eval": ERROR,
434
+ "no-import-assign": ERROR,
435
+ "no-invalid-this": ERROR,
436
+ "no-invalid-regexp": ERROR,
437
+ "no-irregular-whitespace": ERROR,
438
+ "no-iterator": ERROR,
439
+ "no-labels": ERROR,
440
+ "no-lone-blocks": ERROR,
441
+ "no-loss-of-precision": ERROR,
442
+ "no-misleading-character-class": ERROR,
443
+ "no-multi-str": ERROR,
444
+ "no-nested-ternary": ERROR,
445
+ "no-new": ERROR,
446
+ "no-new-func": ERROR,
447
+ "no-new-symbol": ERROR,
448
+ "no-new-wrappers": ERROR,
449
+ "no-obj-calls": ERROR,
450
+ "no-object-constructor": ERROR,
451
+ "no-octal": ERROR,
452
+ "no-octal-escape": ERROR,
453
+ "no-promise-executor-return": ERROR,
454
+ "no-proto": ERROR,
455
+ "no-prototype-builtins": ERROR,
456
+ "no-redeclare": [ERROR, {
457
+ builtinGlobals: false
458
+ }],
459
+ "no-regex-spaces": ERROR,
460
+ "no-restricted-globals": [
461
+ ERROR,
462
+ {
463
+ name: "global",
464
+ message: "Use `globalThis` instead."
465
+ },
466
+ {
467
+ name: "self",
468
+ message: "Use `globalThis` instead."
469
+ }
470
+ ],
471
+ "no-restricted-properties": [
472
+ ERROR,
473
+ {
474
+ property: "__proto__",
475
+ message: "Use `Object.getPrototypeOf` or `Object.setPrototypeOf` instead."
476
+ },
477
+ {
478
+ property: "__defineGetter__",
479
+ message: "Use `Object.defineProperty` instead."
480
+ },
481
+ {
482
+ property: "__defineSetter__",
483
+ message: "Use `Object.defineProperty` instead."
484
+ },
485
+ {
486
+ property: "__lookupGetter__",
487
+ message: "Use `Object.getOwnPropertyDescriptor` instead."
488
+ },
489
+ {
490
+ property: "__lookupSetter__",
491
+ message: "Use `Object.getOwnPropertyDescriptor` instead."
492
+ }
493
+ ],
494
+ "no-restricted-syntax": [
495
+ ERROR,
496
+ "DebuggerStatement",
497
+ "ForInStatement",
498
+ "LabeledStatement",
499
+ "WithStatement"
500
+ ],
501
+ "no-return-assign": [ERROR, ALWAYS],
502
+ "no-self-assign": [ERROR, {
503
+ props: true
504
+ }],
505
+ "no-self-compare": ERROR,
506
+ "no-sequences": ERROR,
507
+ "no-shadow-restricted-names": ERROR,
508
+ "no-sparse-arrays": ERROR,
509
+ "no-template-curly-in-string": ERROR,
510
+ "no-this-before-super": ERROR,
511
+ "no-throw-literal": ERROR,
512
+ "no-undef": ERROR,
513
+ "no-undef-init": ERROR,
514
+ "no-unexpected-multiline": ERROR,
515
+ "no-unmodified-loop-condition": ERROR,
516
+ "no-unneeded-ternary": [ERROR, {
517
+ defaultAssignment: false
518
+ }],
519
+ "no-unreachable": ERROR,
520
+ "no-unreachable-loop": ERROR,
521
+ "no-unsafe-finally": ERROR,
522
+ "no-unsafe-negation": ERROR,
523
+ "no-unused-expressions": [ERROR, {
524
+ allowShortCircuit: true,
525
+ allowTernary: true,
526
+ allowTaggedTemplates: true
527
+ }],
528
+ "no-unused-vars": [ERROR, {
529
+ args: "none",
530
+ caughtErrors: "none",
531
+ ignoreRestSiblings: true,
532
+ vars: "all"
533
+ }],
534
+ "no-use-before-define": [ERROR, {
535
+ functions: false,
536
+ classes: false,
537
+ variables: true
538
+ }],
539
+ "no-useless-backreference": ERROR,
540
+ "no-useless-call": ERROR,
541
+ "no-useless-catch": ERROR,
542
+ "no-useless-computed-key": ERROR,
543
+ "no-useless-constructor": ERROR,
544
+ "no-useless-rename": ERROR,
545
+ "no-useless-return": ERROR,
546
+ "no-var": ERROR,
547
+ "no-void": ERROR,
548
+ "no-with": ERROR,
549
+ "object-shorthand": [ERROR, ALWAYS, {
550
+ ignoreConstructors: false,
551
+ avoidQuotes: true
552
+ }],
553
+ "one-var": [ERROR, {
554
+ initialized: NEVER
555
+ }],
556
+ "prefer-arrow-callback": [ERROR],
557
+ "prefer-const": [ERROR, {
558
+ destructuring: "all",
559
+ ignoreReadBeforeAssign: true
560
+ }],
561
+ "prefer-exponentiation-operator": ERROR,
562
+ "prefer-promise-reject-errors": ERROR,
563
+ "prefer-regex-literals": [ERROR, {
564
+ disallowRedundantWrapping: true
565
+ }],
566
+ "prefer-rest-params": ERROR,
567
+ "prefer-spread": ERROR,
568
+ "prefer-template": ERROR,
569
+ "sort-imports": [ERROR, {
570
+ ignoreCase: false,
571
+ ignoreDeclarationSort: true,
572
+ ignoreMemberSort: false,
573
+ memberSyntaxSortOrder: [
574
+ "none",
575
+ "all",
576
+ "multiple",
577
+ "single"
578
+ ],
579
+ allowSeparatedGroups: false
580
+ }],
581
+ "symbol-description": ERROR,
582
+ "unicode-bom": [ERROR, NEVER],
583
+ "use-isnan": [ERROR, {
584
+ enforceForSwitchCase: true,
585
+ enforceForIndexOf: true
586
+ }],
587
+ "valid-typeof": [ERROR, {
588
+ requireStringLiterals: true
589
+ }],
590
+ "vars-on-top": ERROR,
591
+ "yoda": [ERROR, NEVER],
592
+ "unused-imports/no-unused-imports": isInEditor ? OFF : ERROR,
593
+ "unused-imports/no-unused-vars": [WARN, {
594
+ vars: "all",
595
+ varsIgnorePattern: "^_",
596
+ args: "after-used",
597
+ argsIgnorePattern: "^_",
598
+ ignoreRestSiblings: true
599
+ }],
600
+ ...overrides
601
+ }
602
+ },
603
+ {
604
+ name: "vinicunca:javascript:overrides",
605
+ files: [`scripts/${GLOB_SRC}`, `cli.${GLOB_SRC_EXT}`],
606
+ rules: {
607
+ "no-console": OFF
608
+ }
609
+ }
610
+ ];
611
+ }
612
+
613
+ // src/configs/jsdoc.ts
614
+ function jsdoc() {
615
+ return [
616
+ {
617
+ name: "vinicunca:jsdoc",
618
+ plugins: {
619
+ jsdoc: import_eslint_plugin_jsdoc.default
620
+ },
621
+ rules: {
622
+ "jsdoc/check-access": WARN,
623
+ "jsdoc/check-alignment": WARN,
624
+ "jsdoc/check-param-names": WARN,
625
+ "jsdoc/check-property-names": WARN,
626
+ "jsdoc/check-types": WARN,
627
+ "jsdoc/empty-tags": WARN,
628
+ "jsdoc/implements-on-classes": WARN,
629
+ "jsdoc/multiline-blocks": WARN,
630
+ "jsdoc/no-defaults": WARN,
631
+ "jsdoc/no-multi-asterisks": WARN,
632
+ "jsdoc/no-types": WARN,
633
+ "jsdoc/require-param-name": WARN,
634
+ "jsdoc/require-property": WARN,
635
+ "jsdoc/require-property-description": WARN,
636
+ "jsdoc/require-property-name": WARN,
637
+ "jsdoc/require-returns-check": WARN,
638
+ "jsdoc/require-returns-description": WARN,
639
+ "jsdoc/require-yields-check": WARN,
640
+ "jsdoc/valid-types": WARN
641
+ }
642
+ }
643
+ ];
644
+ }
645
+
646
+ // src/configs/jsonc.ts
647
+ function jsonc(options = {}) {
648
+ const {
649
+ overrides = {}
650
+ } = options;
651
+ return [
652
+ {
653
+ name: "vinicunca:jsonc:setup",
654
+ plugins: {
655
+ jsonc: pluginJsonc
656
+ }
657
+ },
658
+ {
659
+ name: "vinicunca:jsonc:rules",
660
+ files: [GLOB_JSON, GLOB_JSON5, GLOB_JSONC],
661
+ languageOptions: {
662
+ parser: import_jsonc_eslint_parser.default
663
+ },
664
+ rules: {
665
+ "jsonc/array-bracket-spacing": [ERROR, NEVER],
666
+ "jsonc/comma-dangle": [ERROR, NEVER],
667
+ "jsonc/comma-style": [ERROR, "last"],
668
+ "jsonc/indent": [ERROR, 2],
669
+ "jsonc/key-spacing": [ERROR, { afterColon: true, beforeColon: false }],
670
+ "jsonc/no-bigint-literals": ERROR,
671
+ "jsonc/no-binary-expression": ERROR,
672
+ "jsonc/no-binary-numeric-literals": ERROR,
673
+ "jsonc/no-dupe-keys": ERROR,
674
+ "jsonc/no-escape-sequence-in-identifier": ERROR,
675
+ "jsonc/no-floating-decimal": ERROR,
676
+ "jsonc/no-hexadecimal-numeric-literals": ERROR,
677
+ "jsonc/no-infinity": ERROR,
678
+ "jsonc/no-multi-str": ERROR,
679
+ "jsonc/no-nan": ERROR,
680
+ "jsonc/no-number-props": ERROR,
681
+ "jsonc/no-numeric-separators": ERROR,
682
+ "jsonc/no-octal": ERROR,
683
+ "jsonc/no-octal-escape": ERROR,
684
+ "jsonc/no-octal-numeric-literals": ERROR,
685
+ "jsonc/no-parenthesized": ERROR,
686
+ "jsonc/no-plus-sign": ERROR,
687
+ "jsonc/no-regexp-literals": ERROR,
688
+ "jsonc/no-sparse-arrays": ERROR,
689
+ "jsonc/no-template-literals": ERROR,
690
+ "jsonc/no-undefined-value": ERROR,
691
+ "jsonc/no-unicode-codepoint-escapes": ERROR,
692
+ "jsonc/no-useless-escape": ERROR,
693
+ "jsonc/object-curly-newline": [ERROR, { consistent: true, multiline: true }],
694
+ "jsonc/object-curly-spacing": [ERROR, "always"],
695
+ "jsonc/object-property-newline": [ERROR, { allowMultiplePropertiesPerLine: true }],
696
+ "jsonc/quote-props": ERROR,
697
+ "jsonc/quotes": ERROR,
698
+ "jsonc/space-unary-ops": ERROR,
699
+ "jsonc/valid-json-number": ERROR,
700
+ "jsonc/vue-custom-block/no-parsing-error": ERROR,
701
+ ...overrides
702
+ }
703
+ }
704
+ ];
705
+ }
706
+
707
+ // src/configs/markdown.ts
708
+ function markdown(options = {}) {
709
+ const {
710
+ componentExts = [],
711
+ overrides = {}
712
+ } = options;
713
+ return [
714
+ {
715
+ name: "vinicunca:markdown:setup",
716
+ plugins: {
717
+ markdown: import_eslint_plugin_markdown.default
718
+ }
719
+ },
720
+ {
721
+ name: "vinicunca:markdown:processor",
722
+ files: [GLOB_MARKDOWN],
723
+ processor: "markdown/markdown"
724
+ },
725
+ {
726
+ name: "vinicunca:markdown:rules",
727
+ files: [
728
+ GLOB_MARKDOWN_CODE,
729
+ ...componentExts.map((ext) => `${GLOB_MARKDOWN}/**/*.${ext}`)
730
+ ],
731
+ languageOptions: {
732
+ parserOptions: {
733
+ ecmaFeatures: {
734
+ impliedStrict: true
735
+ }
736
+ }
737
+ },
738
+ rules: {
739
+ "no-alert": OFF,
740
+ "no-console": OFF,
741
+ "no-undef": OFF,
742
+ "no-unused-expressions": OFF,
743
+ "no-unused-vars": OFF,
744
+ "node/prefer-global/process": OFF,
745
+ "style/comma-dangle": OFF,
746
+ "style/eol-last": OFF,
747
+ "ts/consistent-type-imports": OFF,
748
+ "ts/no-namespace": OFF,
749
+ "ts/no-redeclare": OFF,
750
+ "ts/no-require-imports": OFF,
751
+ "ts/no-unused-vars": OFF,
752
+ "ts/no-use-before-define": OFF,
753
+ "ts/no-var-requires": OFF,
754
+ "unicode-bom": OFF,
755
+ "unused-imports/no-unused-imports": OFF,
756
+ "unused-imports/no-unused-vars": OFF,
757
+ // Type aware rules
758
+ ...{
759
+ "ts/await-thenable": OFF,
760
+ "ts/dot-notation": OFF,
761
+ "ts/no-floating-promises": OFF,
762
+ "ts/no-for-in-array": OFF,
763
+ "ts/no-implied-eval": OFF,
764
+ "ts/no-misused-promises": OFF,
765
+ "ts/no-throw-literal": OFF,
766
+ "ts/no-unnecessary-type-assertion": OFF,
767
+ "ts/no-unsafe-argument": OFF,
768
+ "ts/no-unsafe-assignment": OFF,
769
+ "ts/no-unsafe-call": OFF,
770
+ "ts/no-unsafe-member-access": OFF,
771
+ "ts/no-unsafe-return": OFF,
772
+ "ts/restrict-plus-operands": OFF,
773
+ "ts/restrict-template-expressions": OFF,
774
+ "ts/unbound-method": OFF
775
+ },
776
+ "vinicunca/no-cjs-exports": OFF,
777
+ "vinicunca/no-ts-export-equal": OFF,
778
+ ...overrides
779
+ }
780
+ }
781
+ ];
782
+ }
783
+
784
+ // src/configs/node.ts
785
+ function node() {
786
+ return [
787
+ {
788
+ name: "vinicunca:node",
789
+ plugins: {
790
+ node: import_eslint_plugin_n.default
791
+ },
792
+ rules: {
793
+ "node/handle-callback-err": [ERROR, "^(err|error)$"],
794
+ "node/no-callback-literal": OFF,
795
+ "node/no-deprecated-api": ERROR,
796
+ "node/no-exports-assign": ERROR,
797
+ "node/no-new-require": ERROR,
798
+ "node/no-path-concat": ERROR,
799
+ "node/prefer-global/buffer": [ERROR, NEVER],
800
+ "node/prefer-global/process": [ERROR, NEVER],
801
+ "node/process-exit-as-throw": ERROR
802
+ }
803
+ }
804
+ ];
805
+ }
806
+
807
+ // src/configs/react.ts
808
+ function react(options = {}) {
809
+ const {
810
+ overrides = {}
811
+ } = options;
812
+ return [
813
+ {
814
+ name: "vinicunca:react:setup",
815
+ plugins: {
816
+ "react": import_eslint_plugin_react.default,
817
+ "react-hooks": import_eslint_plugin_react_hooks.default
818
+ }
819
+ },
820
+ {
821
+ name: "vinicunca:react:rules",
822
+ settings: {
823
+ react: {
824
+ version: "detect"
825
+ }
826
+ },
827
+ rules: {
828
+ ...import_eslint_plugin_react.default.configs.recommended.rules,
829
+ ...import_eslint_plugin_react_hooks.default.configs.recommended.rules,
830
+ "style/jsx-quotes": [ERROR, "prefer-double"],
831
+ "react/jsx-boolean-value": [ERROR, NEVER, { always: [] }],
832
+ "react/jsx-closing-bracket-location": [ERROR, "line-aligned"],
833
+ "react/jsx-closing-tag-location": ERROR,
834
+ "react/jsx-curly-spacing": [ERROR, {
835
+ when: "always",
836
+ spacing: {
837
+ objectLiterals: NEVER
838
+ },
839
+ children: true
840
+ }],
841
+ "react/jsx-indent-props": [ERROR, 2],
842
+ "react/jsx-key": OFF,
843
+ "react/jsx-max-props-per-line": [ERROR, { maximum: 1, when: "multiline" }],
844
+ "react/jsx-no-duplicate-props": [ERROR, { ignoreCase: true }],
845
+ "react/jsx-no-literals": [OFF, { noStrings: true }],
846
+ "react/jsx-pascal-case": [ERROR, {
847
+ allowAllCaps: true,
848
+ ignore: []
849
+ }],
850
+ "react/jsx-sort-props": [OFF, {
851
+ ignoreCase: true,
852
+ callbacksLast: false,
853
+ shorthandFirst: false,
854
+ shorthandLast: false,
855
+ noSortAlphabetically: false,
856
+ reservedFirst: true
857
+ }],
858
+ "react/jsx-sort-default-props": [OFF, {
859
+ ignoreCase: true
860
+ }],
861
+ "react/no-danger": WARN,
862
+ "react/self-closing-comp": ERROR,
863
+ "react/jsx-wrap-multilines": [ERROR, {
864
+ declaration: "parens-new-line",
865
+ assignment: "parens-new-line",
866
+ return: "parens-new-line",
867
+ arrow: "parens-new-line",
868
+ condition: "parens-new-line",
869
+ logical: "parens-new-line",
870
+ prop: "parens-new-line"
871
+ }],
872
+ "react/jsx-first-prop-new-line": [ERROR, "multiline-multiprop"],
873
+ "react/jsx-equals-spacing": [ERROR, NEVER],
874
+ "react/jsx-indent": [ERROR, 2],
875
+ "react/style-prop-object": ERROR,
876
+ "react/jsx-tag-spacing": [ERROR, {
877
+ closingSlash: NEVER,
878
+ beforeSelfClosing: "always",
879
+ afterOpening: NEVER,
880
+ beforeClosing: NEVER
881
+ }],
882
+ "react/boolean-prop-naming": [OFF, {
883
+ propTypeNames: ["bool", "mutuallyExclusiveTrueProps"],
884
+ rule: "^(is|has)[A-Z]([A-Za-z0-9]?)+",
885
+ message: ""
886
+ }],
887
+ "react/jsx-curly-brace-presence": [ERROR, { props: NEVER, children: NEVER }],
888
+ "react/jsx-one-expression-per-line": [ERROR, { allow: "single-child" }],
889
+ "react/destructuring-assignment": [ERROR, "always"],
890
+ "react/jsx-child-element-spacing": OFF,
891
+ "react/jsx-max-depth": OFF,
892
+ "react/jsx-props-no-multi-spaces": ERROR,
893
+ "react/jsx-curly-newline": [ERROR, {
894
+ multiline: "consistent",
895
+ singleline: "consistent"
896
+ }],
897
+ "react/jsx-newline": ERROR,
898
+ ...overrides
899
+ }
900
+ }
901
+ ];
902
+ }
903
+
904
+ // src/configs/sort-package-json.ts
905
+ function sortPackageJson() {
906
+ return [
907
+ {
908
+ name: "vinicunca:sort-package-json",
909
+ files: ["**/package.json"],
910
+ rules: {
911
+ "jsonc/sort-array-values": [
912
+ ERROR,
913
+ {
914
+ order: { type: "asc" },
915
+ pathPattern: "^files$"
916
+ }
917
+ ],
918
+ "jsonc/sort-keys": [
919
+ ERROR,
920
+ {
921
+ order: [
922
+ "publisher",
923
+ "name",
924
+ "displayName",
925
+ "type",
926
+ "version",
927
+ "private",
928
+ "packageManager",
929
+ "description",
930
+ "author",
931
+ "license",
932
+ "funding",
933
+ "homepage",
934
+ "repository",
935
+ "bugs",
936
+ "keywords",
937
+ "categories",
938
+ "sideEffects",
939
+ "exports",
940
+ "main",
941
+ "module",
942
+ "unpkg",
943
+ "jsdelivr",
944
+ "types",
945
+ "typesVersions",
946
+ "bin",
947
+ "icon",
948
+ "files",
949
+ "engines",
950
+ "activationEvents",
951
+ "contributes",
952
+ "scripts",
953
+ "peerDependencies",
954
+ "peerDependenciesMeta",
955
+ "dependencies",
956
+ "optionalDependencies",
957
+ "devDependencies",
958
+ "pnpm",
959
+ "overrides",
960
+ "resolutions",
961
+ "husky",
962
+ "simple-git-hooks",
963
+ "lint-staged",
964
+ "eslintConfig"
965
+ ],
966
+ pathPattern: "^$"
967
+ },
968
+ {
969
+ order: { type: "asc" },
970
+ pathPattern: "^(?:dev|peer|optional|bundled)?[Dd]ependencies$"
971
+ },
972
+ {
973
+ order: { type: "asc" },
974
+ pathPattern: "^resolutions$"
975
+ },
976
+ {
977
+ order: { type: "asc" },
978
+ pathPattern: "^pnpm.overrides$"
979
+ },
980
+ {
981
+ order: [
982
+ "types",
983
+ "import",
984
+ "require",
985
+ "default"
986
+ ],
987
+ pathPattern: "^exports.*$"
988
+ }
989
+ ]
990
+ }
991
+ }
992
+ ];
993
+ }
994
+ function sortTsconfig() {
995
+ return [
996
+ {
997
+ name: "vinicunca:sort-tsconfig",
998
+ files: ["**/tsconfig.json", "**/tsconfig.*.json"],
999
+ rules: {
1000
+ "jsonc/sort-keys": [
1001
+ ERROR,
1002
+ {
1003
+ order: [
1004
+ "extends",
1005
+ "compilerOptions",
1006
+ "references",
1007
+ "files",
1008
+ "include",
1009
+ "exclude"
1010
+ ],
1011
+ pathPattern: "^$"
1012
+ },
1013
+ {
1014
+ order: [
1015
+ /* Projects */
1016
+ "incremental",
1017
+ "composite",
1018
+ "tsBuildInfoFile",
1019
+ "disableSourceOfProjectReferenceRedirect",
1020
+ "disableSolutionSearching",
1021
+ "disableReferencedProjectLoad",
1022
+ /* Language and Environment */
1023
+ "target",
1024
+ "jsx",
1025
+ "jsxFactory",
1026
+ "jsxFragmentFactory",
1027
+ "jsxImportSource",
1028
+ "lib",
1029
+ "moduleDetection",
1030
+ "noLib",
1031
+ "reactNamespace",
1032
+ "useDefineForClassFields",
1033
+ "emitDecoratorMetadata",
1034
+ "experimentalDecorators",
1035
+ /* Modules */
1036
+ "baseUrl",
1037
+ "rootDir",
1038
+ "rootDirs",
1039
+ "customConditions",
1040
+ "module",
1041
+ "moduleResolution",
1042
+ "moduleSuffixes",
1043
+ "noResolve",
1044
+ "paths",
1045
+ "resolveJsonModule",
1046
+ "resolvePackageJsonExports",
1047
+ "resolvePackageJsonImports",
1048
+ "typeRoots",
1049
+ "types",
1050
+ "allowArbitraryExtensions",
1051
+ "allowImportingTsExtensions",
1052
+ "allowUmdGlobalAccess",
1053
+ /* JavaScript Support */
1054
+ "allowJs",
1055
+ "checkJs",
1056
+ "maxNodeModuleJsDepth",
1057
+ /* Type Checking */
1058
+ "strict",
1059
+ "strictBindCallApply",
1060
+ "strictFunctionTypes",
1061
+ "strictNullChecks",
1062
+ "strictPropertyInitialization",
1063
+ "allowUnreachableCode",
1064
+ "allowUnusedLabels",
1065
+ "alwaysStrict",
1066
+ "exactOptionalPropertyTypes",
1067
+ "noFallthroughCasesInSwitch",
1068
+ "noImplicitAny",
1069
+ "noImplicitOverride",
1070
+ "noImplicitReturns",
1071
+ "noImplicitThis",
1072
+ "noPropertyAccessFromIndexSignature",
1073
+ "noUncheckedIndexedAccess",
1074
+ "noUnusedLocals",
1075
+ "noUnusedParameters",
1076
+ "useUnknownInCatchVariables",
1077
+ /* Emit */
1078
+ "declaration",
1079
+ "declarationDir",
1080
+ "declarationMap",
1081
+ "downlevelIteration",
1082
+ "emitBOM",
1083
+ "emitDeclarationOnly",
1084
+ "importHelpers",
1085
+ "importsNotUsedAsValues",
1086
+ "inlineSourceMap",
1087
+ "inlineSources",
1088
+ "mapRoot",
1089
+ "newLine",
1090
+ "noEmit",
1091
+ "noEmitHelpers",
1092
+ "noEmitOnError",
1093
+ "outDir",
1094
+ "outFile",
1095
+ "preserveConstEnums",
1096
+ "preserveValueImports",
1097
+ "removeComments",
1098
+ "sourceMap",
1099
+ "sourceRoot",
1100
+ "stripInternal",
1101
+ /* Interop Constraints */
1102
+ "allowSyntheticDefaultImports",
1103
+ "esModuleInterop",
1104
+ "forceConsistentCasingInFileNames",
1105
+ "isolatedModules",
1106
+ "preserveSymlinks",
1107
+ "verbatimModuleSyntax",
1108
+ /* Completeness */
1109
+ "skipDefaultLibCheck",
1110
+ "skipLibCheck"
1111
+ ],
1112
+ pathPattern: "^compilerOptions$"
1113
+ }
1114
+ ]
1115
+ }
1116
+ }
1117
+ ];
1118
+ }
1119
+
1120
+ // src/configs/stylistic.ts
1121
+ function stylistic() {
1122
+ return [
1123
+ {
1124
+ name: "vinicunca:stylistic",
1125
+ plugins: {
1126
+ vinicunca: import_eslint_plugin_vinicunca.default,
1127
+ style: import_eslint_plugin.default
1128
+ },
1129
+ rules: {
1130
+ "curly": [ERROR, "all"],
1131
+ "style/array-bracket-newline": [ERROR, CONSISTENT],
1132
+ "style/array-bracket-spacing": [ERROR, NEVER],
1133
+ "style/array-element-newline": [ERROR, CONSISTENT],
1134
+ "style/arrow-spacing": [ERROR, { before: true, after: true }],
1135
+ "style/block-spacing": [ERROR, ALWAYS],
1136
+ "style/brace-style": [ERROR],
1137
+ "style/comma-spacing": [ERROR, { before: false, after: true }],
1138
+ "style/comma-style": [ERROR, "last"],
1139
+ "style/computed-property-spacing": [ERROR, NEVER, { enforceForClassMembers: true }],
1140
+ "style/dot-location": [ERROR, "property"],
1141
+ "style/eol-last": ERROR,
1142
+ "style/func-call-spacing": [ERROR, NEVER],
1143
+ "style/indent": [ERROR, 2, {
1144
+ SwitchCase: 1,
1145
+ VariableDeclarator: 1,
1146
+ outerIIFEBody: 1,
1147
+ MemberExpression: 1,
1148
+ FunctionDeclaration: { parameters: 1, body: 1 },
1149
+ FunctionExpression: { parameters: 1, body: 1 },
1150
+ CallExpression: { arguments: 1 },
1151
+ ArrayExpression: 1,
1152
+ ObjectExpression: 1,
1153
+ ImportDeclaration: 1,
1154
+ flatTernaryExpressions: false,
1155
+ ignoreComments: false,
1156
+ ignoredNodes: ["TemplateLiteral *", "JSXElement", "JSXElement > *", "JSXAttribute", "JSXIdentifier", "JSXNamespacedName", "JSXMemberExpression", "JSXSpreadAttribute", "JSXExpressionContainer", "JSXOpeningElement", "JSXClosingElement", "JSXFragment", "JSXOpeningFragment", "JSXClosingFragment", "JSXText", "JSXEmptyExpression", "JSXSpreadChild"],
1157
+ offsetTernaryExpressions: true
1158
+ }],
1159
+ "style/key-spacing": [ERROR, { beforeColon: false, afterColon: true }],
1160
+ "style/keyword-spacing": [ERROR, { before: true, after: true }],
1161
+ "style/lines-between-class-members": [ERROR, ALWAYS, { exceptAfterSingleLine: true }],
1162
+ "style/max-statements-per-line": [ERROR, { max: 1 }],
1163
+ "style/member-delimiter-style": [ERROR],
1164
+ "style/multiline-ternary": [ERROR, "always-multiline"],
1165
+ "style/new-parens": ERROR,
1166
+ "style/no-extra-parens": [ERROR, "functions"],
1167
+ "style/no-floating-decimal": ERROR,
1168
+ "style/no-mixed-operators": [ERROR, {
1169
+ groups: [
1170
+ ["==", "!=", "===", "!==", ">", ">=", "<", "<="],
1171
+ ["&&", "||"],
1172
+ ["in", "instanceof"]
1173
+ ],
1174
+ allowSamePrecedence: true
1175
+ }],
1176
+ "style/no-mixed-spaces-and-tabs": ERROR,
1177
+ "style/no-multi-spaces": ERROR,
1178
+ "style/no-multiple-empty-lines": [ERROR, { max: 1, maxBOF: 0, maxEOF: 1 }],
1179
+ "style/no-tabs": ERROR,
1180
+ "style/no-trailing-spaces": ERROR,
1181
+ "style/no-whitespace-before-property": ERROR,
1182
+ "style/object-curly-newline": [ERROR, { multiline: true, consistent: true }],
1183
+ "style/object-curly-spacing": [ERROR, ALWAYS],
1184
+ "style/object-property-newline": [ERROR, { allowMultiplePropertiesPerLine: true }],
1185
+ "style/operator-linebreak": [ERROR, "before"],
1186
+ "style/padded-blocks": [ERROR, { blocks: NEVER, switches: NEVER, classes: NEVER }],
1187
+ "style/quote-props": [ERROR, "consistent-as-needed"],
1188
+ "style/quotes": [ERROR, "single"],
1189
+ "style/rest-spread-spacing": [ERROR, NEVER],
1190
+ "style/semi": [ERROR, ALWAYS],
1191
+ "style/semi-spacing": [ERROR, { before: false, after: true }],
1192
+ "style/space-before-blocks": [ERROR, ALWAYS],
1193
+ "style/space-before-function-paren": [ERROR, {
1194
+ anonymous: NEVER,
1195
+ named: NEVER,
1196
+ asyncArrow: ALWAYS
1197
+ }],
1198
+ "style/space-in-parens": [ERROR, NEVER],
1199
+ "style/space-infix-ops": ERROR,
1200
+ "style/space-unary-ops": [ERROR, { words: true, nonwords: false }],
1201
+ "style/spaced-comment": [ERROR, "always", {
1202
+ line: {
1203
+ markers: ["/"],
1204
+ exceptions: ["/", "#"]
1205
+ },
1206
+ block: {
1207
+ markers: ["!"],
1208
+ exceptions: ["*"],
1209
+ balanced: true
1210
+ }
1211
+ }],
1212
+ "style/template-curly-spacing": ERROR,
1213
+ "style/template-tag-spacing": [ERROR, NEVER],
1214
+ "style/type-annotation-spacing": [ERROR, {}],
1215
+ "style/wrap-iife": [ERROR, "any", {
1216
+ functionPrototypeMethods: true
1217
+ }],
1218
+ "style/yield-star-spacing": [ERROR, "both"],
1219
+ "style/comma-dangle": [ERROR, "always-multiline"],
1220
+ "vinicunca/consistent-list-newline": ERROR,
1221
+ "vinicunca/if-newline": ERROR,
1222
+ "vinicunca/top-level-function": ERROR
1223
+ }
1224
+ }
1225
+ ];
1226
+ }
1227
+
1228
+ // src/configs/test.ts
1229
+ function test(options = {}) {
1230
+ const {
1231
+ isInEditor = false,
1232
+ overrides = {}
1233
+ } = options;
1234
+ return [
1235
+ {
1236
+ name: "vinicunca:test:setup",
1237
+ plugins: {
1238
+ test: {
1239
+ ...import_eslint_plugin_vitest.default,
1240
+ rules: {
1241
+ ...import_eslint_plugin_vitest.default.rules,
1242
+ // extend `test/no-only-tests` rule
1243
+ ...import_eslint_plugin_no_only_tests.default.rules
1244
+ }
1245
+ }
1246
+ }
1247
+ },
1248
+ {
1249
+ name: "vinicunca:test:rules",
1250
+ files: GLOB_TESTS,
1251
+ rules: {
1252
+ "test/consistent-test-it": [ERROR, { fn: "it", withinDescribe: "it" }],
1253
+ "test/no-identical-title": ERROR,
1254
+ "test/no-only-tests": isInEditor ? OFF : ERROR,
1255
+ "test/prefer-hooks-in-order": ERROR,
1256
+ "test/prefer-lowercase-title": ERROR,
1257
+ ...overrides
1258
+ }
1259
+ }
1260
+ ];
1261
+ }
1262
+
1263
+ // src/configs/typescript.ts
1264
+ var import_node_process = __toESM(require("process"), 1);
1265
+ function typescript(options) {
1266
+ const {
1267
+ componentExts = [],
1268
+ overrides = {},
1269
+ parserOptions = {},
1270
+ tsconfigPath
1271
+ } = options ?? {};
1272
+ const typeAwareRules = {
1273
+ "dot-notation": OFF,
1274
+ "no-implied-eval": OFF,
1275
+ "no-throw-literal": OFF,
1276
+ "ts/await-thenable": ERROR,
1277
+ "ts/dot-notation": [ERROR, { allowKeywords: true }],
1278
+ "ts/no-floating-promises": ERROR,
1279
+ "ts/no-for-in-array": ERROR,
1280
+ "ts/no-implied-eval": ERROR,
1281
+ "ts/no-misused-promises": ERROR,
1282
+ "ts/no-throw-literal": ERROR,
1283
+ "ts/no-unnecessary-type-assertion": ERROR,
1284
+ "ts/no-unsafe-argument": ERROR,
1285
+ "ts/no-unsafe-assignment": ERROR,
1286
+ "ts/no-unsafe-call": ERROR,
1287
+ "ts/no-unsafe-member-access": ERROR,
1288
+ "ts/no-unsafe-return": ERROR,
1289
+ "ts/restrict-plus-operands": ERROR,
1290
+ "ts/restrict-template-expressions": ERROR,
1291
+ "ts/unbound-method": ERROR
1292
+ };
1293
+ return [
1294
+ {
1295
+ // Install the plugins without globs, so they can be configured separately.
1296
+ name: "vinicunca:typescript:setup",
1297
+ plugins: {
1298
+ vinicunca: import_eslint_plugin_vinicunca.default,
1299
+ import: pluginImport,
1300
+ ts: import_eslint_plugin2.default
1301
+ }
1302
+ },
1303
+ {
1304
+ name: "vinicunca:typescript:rules",
1305
+ files: [
1306
+ GLOB_SRC,
1307
+ ...componentExts.map((ext) => `**/*.${ext}`)
1308
+ ],
1309
+ languageOptions: {
1310
+ parser: parserTs,
1311
+ parserOptions: {
1312
+ sourceType: "module",
1313
+ ...tsconfigPath ? {
1314
+ project: [tsconfigPath],
1315
+ tsconfigRootDir: import_node_process.default.cwd()
1316
+ } : {},
1317
+ ...parserOptions
1318
+ }
1319
+ },
1320
+ rules: {
1321
+ ...renameRules(
1322
+ import_eslint_plugin2.default.configs["eslint-recommended"].overrides[0].rules,
1323
+ "@typescript-eslint/",
1324
+ "ts/"
1325
+ ),
1326
+ ...renameRules(
1327
+ import_eslint_plugin2.default.configs.strict.rules,
1328
+ "@typescript-eslint/",
1329
+ "ts/"
1330
+ ),
1331
+ "no-dupe-class-members": OFF,
1332
+ "ts/no-dupe-class-members": ERROR,
1333
+ "no-invalid-this": OFF,
1334
+ "ts/no-invalid-this": ERROR,
1335
+ "no-loss-of-precision": OFF,
1336
+ "ts/no-loss-of-precision": ERROR,
1337
+ "no-redeclare": OFF,
1338
+ "ts/no-redeclare": ERROR,
1339
+ "no-use-before-define": OFF,
1340
+ "ts/no-use-before-define": [ERROR, { functions: false, classes: false, variables: true }],
1341
+ "no-useless-constructor": OFF,
1342
+ "ts/ban-ts-comment": [ERROR, { "ts-ignore": "allow-with-description" }],
1343
+ "ts/ban-types": [ERROR, { types: { Function: false } }],
1344
+ "ts/consistent-type-definitions": [ERROR, "interface"],
1345
+ "ts/consistent-type-imports": [ERROR, { prefer: "type-imports", disallowTypeAnnotations: false }],
1346
+ "ts/explicit-function-return-type": OFF,
1347
+ "ts/explicit-member-accessibility": OFF,
1348
+ "ts/explicit-module-boundary-types": OFF,
1349
+ "ts/naming-convention": OFF,
1350
+ "ts/no-empty-function": OFF,
1351
+ "ts/no-empty-interface": OFF,
1352
+ "ts/no-explicit-any": OFF,
1353
+ "ts/no-invalid-void-type": OFF,
1354
+ "ts/no-non-null-assertion": OFF,
1355
+ "ts/no-require-imports": ERROR,
1356
+ "no-unused-vars": OFF,
1357
+ "ts/no-unused-vars": [ERROR, {
1358
+ argsIgnorePattern: "^_",
1359
+ destructuredArrayIgnorePattern: "^_",
1360
+ ignoreRestSiblings: true
1361
+ }],
1362
+ "ts/parameter-properties": OFF,
1363
+ "ts/prefer-ts-expect-error": ERROR,
1364
+ "ts/triple-slash-reference": OFF,
1365
+ "vinicunca/generic-spacing": ERROR,
1366
+ "vinicunca/named-tuple-spacing": ERROR,
1367
+ "vinicunca/no-cjs-exports": ERROR,
1368
+ "vinicunca/no-const-enum": ERROR,
1369
+ "vinicunca/no-ts-export-equal": ERROR,
1370
+ "vinicunca/prefer-inline-type-import": ERROR,
1371
+ ...tsconfigPath ? typeAwareRules : {},
1372
+ ...overrides
1373
+ }
1374
+ },
1375
+ {
1376
+ name: "vinicunca:typescript:dts-overrides",
1377
+ files: ["**/*.d.ts"],
1378
+ rules: {
1379
+ "eslint-comments/no-unlimited-disable": OFF,
1380
+ "import/no-duplicates": OFF,
1381
+ "unused-imports/no-unused-vars": OFF
1382
+ }
1383
+ },
1384
+ {
1385
+ name: "vinicunca:typescript:tests-overrides",
1386
+ files: ["**/*.{test,spec}.ts?(x)"],
1387
+ rules: {
1388
+ "no-unused-expressions": OFF
1389
+ }
1390
+ },
1391
+ {
1392
+ name: "vinicunca:typescript:javascript-overrides",
1393
+ files: ["**/*.js", "**/*.cjs"],
1394
+ rules: {
1395
+ "ts/no-require-imports": OFF,
1396
+ "ts/no-var-requires": OFF
1397
+ }
1398
+ }
1399
+ ];
1400
+ }
1401
+
1402
+ // src/configs/unicorn.ts
1403
+ function unicorn(options = {}) {
1404
+ const {
1405
+ overrides = {}
1406
+ } = options;
1407
+ return [
1408
+ {
1409
+ name: "vinicunca:unicorn",
1410
+ plugins: {
1411
+ unicorn: import_eslint_plugin_unicorn.default
1412
+ },
1413
+ rules: {
1414
+ "unicorn/error-message": ERROR,
1415
+ "unicorn/escape-case": ERROR,
1416
+ "unicorn/no-instanceof-array": ERROR,
1417
+ "unicorn/no-new-array": ERROR,
1418
+ "unicorn/no-new-buffer": ERROR,
1419
+ "unicorn/number-literal-case": ERROR,
1420
+ "unicorn/prefer-includes": ERROR,
1421
+ "unicorn/prefer-node-protocol": ERROR,
1422
+ "unicorn/prefer-number-properties": ERROR,
1423
+ "unicorn/prefer-string-starts-ends-with": ERROR,
1424
+ "unicorn/prefer-dom-node-text-content": ERROR,
1425
+ "unicorn/prefer-type-error": ERROR,
1426
+ "unicorn/throw-new-error": ERROR,
1427
+ ...overrides
1428
+ }
1429
+ }
1430
+ ];
1431
+ }
1432
+
1433
+ // src/configs/vue.ts
1434
+ function vue(options = {}) {
1435
+ const {
1436
+ overrides = {}
1437
+ } = options;
1438
+ return [
1439
+ {
1440
+ name: "vinicunca:vue:setup",
1441
+ plugins: {
1442
+ vue: import_eslint_plugin_vue.default
1443
+ }
1444
+ },
1445
+ {
1446
+ name: "vinicunca:vue:rules",
1447
+ files: [GLOB_VUE],
1448
+ languageOptions: {
1449
+ parser: import_vue_eslint_parser.default,
1450
+ parserOptions: {
1451
+ ecmaFeatures: {
1452
+ jsx: true
1453
+ },
1454
+ extraFileExtensions: [".vue"],
1455
+ parser: options.typescript ? parserTs : null,
1456
+ sourceType: "module"
1457
+ }
1458
+ },
1459
+ processor: import_eslint_plugin_vue.default.processors[".vue"],
1460
+ rules: {
1461
+ ...import_eslint_plugin_vue.default.configs.base.rules,
1462
+ ...import_eslint_plugin_vue.default.configs["vue3-essential"].rules,
1463
+ ...import_eslint_plugin_vue.default.configs["vue3-strongly-recommended"].rules,
1464
+ ...import_eslint_plugin_vue.default.configs["vue3-recommended"].rules,
1465
+ "node/prefer-global/process": OFF,
1466
+ "vue/array-bracket-spacing": [ERROR, NEVER],
1467
+ "vue/arrow-spacing": [ERROR, {
1468
+ after: true,
1469
+ before: true
1470
+ }],
1471
+ "vue/block-order": [ERROR, {
1472
+ order: ["script", "template", "style"]
1473
+ }],
1474
+ "vue/block-spacing": [ERROR, ALWAYS],
1475
+ "vue/block-tag-newline": [ERROR, {
1476
+ multiline: ALWAYS,
1477
+ singleline: ALWAYS
1478
+ }],
1479
+ "vue/brace-style": [ERROR, "stroustrup", { allowSingleLine: true }],
1480
+ "vue/comma-dangle": [ERROR, "always-multiline"],
1481
+ "vue/comma-spacing": [ERROR, {
1482
+ after: true,
1483
+ before: false
1484
+ }],
1485
+ "vue/comma-style": [ERROR, "last"],
1486
+ "vue/component-name-in-template-casing": [ERROR, "PascalCase"],
1487
+ "vue/component-options-name-casing": [ERROR, "PascalCase"],
1488
+ "vue/custom-event-name-casing": [ERROR, "camelCase"],
1489
+ "vue/define-macros-order": [ERROR, {
1490
+ order: ["defineOptions", "defineProps", "defineEmits", "defineSlots"]
1491
+ }],
1492
+ "vue/dot-location": [ERROR, "property"],
1493
+ "vue/dot-notation": [ERROR, { allowKeywords: true }],
1494
+ "vue/eqeqeq": [ERROR, "smart"],
1495
+ "vue/html-comment-content-spacing": [ERROR, ALWAYS, {
1496
+ exceptions: ["-"]
1497
+ }],
1498
+ "vue/key-spacing": [ERROR, {
1499
+ afterColon: true,
1500
+ beforeColon: false
1501
+ }],
1502
+ "vue/keyword-spacing": [ERROR, {
1503
+ after: true,
1504
+ before: true
1505
+ }],
1506
+ "vue/max-attributes-per-line": [ERROR],
1507
+ "vue/multi-word-component-names": OFF,
1508
+ "vue/no-constant-condition": WARN,
1509
+ "vue/no-dupe-keys": OFF,
1510
+ "vue/no-empty-pattern": ERROR,
1511
+ "vue/no-extra-parens": [ERROR, "functions"],
1512
+ "vue/no-irregular-whitespace": ERROR,
1513
+ "vue/no-loss-of-precision": ERROR,
1514
+ "vue/no-restricted-syntax": [
1515
+ ERROR,
1516
+ "DebuggerStatement",
1517
+ "LabeledStatement",
1518
+ "WithStatement"
1519
+ ],
1520
+ "vue/no-restricted-v-bind": [ERROR, "/^v-/"],
1521
+ // reactivity transform
1522
+ "vue/no-setup-props-reactivity-loss": OFF,
1523
+ "vue/no-sparse-arrays": ERROR,
1524
+ "vue/no-unused-refs": ERROR,
1525
+ "vue/no-useless-v-bind": ERROR,
1526
+ "vue/no-v-html": OFF,
1527
+ "vue/no-v-text-v-html-on-component": OFF,
1528
+ "vue/object-curly-newline": [ERROR, { multiline: true, consistent: true }],
1529
+ "vue/object-curly-spacing": [ERROR, ALWAYS],
1530
+ "vue/object-property-newline": [ERROR, { allowMultiplePropertiesPerLine: true }],
1531
+ "vue/object-shorthand": [ERROR, ALWAYS, {
1532
+ avoidQuotes: true,
1533
+ ignoreConstructors: false
1534
+ }],
1535
+ "vue/operator-linebreak": [ERROR, "before"],
1536
+ "vue/padding-line-between-blocks": [ERROR, ALWAYS],
1537
+ "vue/prefer-import-from-vue": OFF,
1538
+ "vue/prefer-separate-static-class": ERROR,
1539
+ "vue/prefer-template": ERROR,
1540
+ "vue/quote-props": [ERROR, "consistent-as-needed"],
1541
+ "vue/require-default-prop": OFF,
1542
+ "vue/require-prop-types": OFF,
1543
+ "vue/space-in-parens": [ERROR, NEVER],
1544
+ "vue/space-infix-ops": ERROR,
1545
+ "vue/space-unary-ops": [ERROR, {
1546
+ nonwords: false,
1547
+ words: true
1548
+ }],
1549
+ "vue/template-curly-spacing": ERROR,
1550
+ ...overrides
1551
+ }
1552
+ }
1553
+ ];
1554
+ }
1555
+
1556
+ // src/configs/yaml.ts
1557
+ function yaml(options = {}) {
1558
+ const {
1559
+ overrides = {}
1560
+ } = options;
1561
+ return [
1562
+ {
1563
+ name: "vinicunca:yaml:setup",
1564
+ plugins: {
1565
+ yaml: pluginYaml
1566
+ }
1567
+ },
1568
+ {
1569
+ name: "vinicunca:yaml:rules",
1570
+ files: [GLOB_YAML],
1571
+ languageOptions: {
1572
+ parser: import_yaml_eslint_parser.default
1573
+ },
1574
+ rules: {
1575
+ "style/spaced-comment": OFF,
1576
+ "yaml/block-mapping": ERROR,
1577
+ "yaml/block-mapping-question-indicator-newline": ERROR,
1578
+ "yaml/block-sequence": ERROR,
1579
+ "yaml/block-sequence-hyphen-indicator-newline": ERROR,
1580
+ "yaml/flow-mapping-curly-newline": ERROR,
1581
+ "yaml/flow-mapping-curly-spacing": ERROR,
1582
+ "yaml/flow-sequence-bracket-newline": ERROR,
1583
+ "yaml/flow-sequence-bracket-spacing": ERROR,
1584
+ "yaml/indent": [ERROR, 2],
1585
+ "yaml/key-spacing": ERROR,
1586
+ "yaml/no-empty-key": ERROR,
1587
+ "yaml/no-empty-sequence-entry": ERROR,
1588
+ "yaml/no-irregular-whitespace": ERROR,
1589
+ "yaml/no-tab-indent": ERROR,
1590
+ "yaml/plain-scalar": ERROR,
1591
+ "yaml/quotes": [ERROR, { avoidEscape: false, prefer: "single" }],
1592
+ "yaml/spaced-comment": ERROR,
1593
+ "yaml/vue-custom-block/no-parsing-error": ERROR,
1594
+ ...overrides
1595
+ }
1596
+ }
1597
+ ];
1598
+ }
1599
+
1600
+ // src/base.ts
1601
+ var VuePackages = [
1602
+ "vue",
1603
+ "nuxt",
1604
+ "vitepress",
1605
+ "@slidev/cli"
1606
+ ];
1607
+ function vinicuncaESLint({ options = {}, userConfigs = [] }) {
1608
+ const {
1609
+ isInEditor = !!((import_node_process2.default.env.VSCODE_PID || import_node_process2.default.env.JETBRAINS_IDE) && !import_node_process2.default.env.CI),
1610
+ vue: enableVue = VuePackages.some((i) => (0, import_local_pkg.isPackageExists)(i)),
1611
+ typescript: enableTypeScript = (0, import_local_pkg.isPackageExists)("typescript"),
1612
+ stylistic: enableStylistic = true,
1613
+ test: enableTest = true,
1614
+ jsonc: enableJsonc = true,
1615
+ yaml: enableYaml = true,
1616
+ markdown: enableMarkdown = true,
1617
+ react: enableReact = false,
1618
+ overrides = {},
1619
+ componentExts = []
1620
+ } = options;
1621
+ const configs = [];
1622
+ configs.push(
1623
+ ignores(options.ignores),
1624
+ javascript({
1625
+ isInEditor,
1626
+ overrides: overrides.javascript
1627
+ }),
1628
+ comments(),
1629
+ node(),
1630
+ jsdoc(),
1631
+ imports(),
1632
+ unicorn()
1633
+ );
1634
+ if (enableVue) {
1635
+ componentExts.push("vue");
1636
+ }
1637
+ if (enableTypeScript) {
1638
+ configs.push(typescript({
1639
+ ...!isBoolean(enableTypeScript) ? enableTypeScript : {},
1640
+ componentExts,
1641
+ overrides: overrides.typescript
1642
+ }));
1643
+ }
1644
+ if (enableStylistic) {
1645
+ configs.push(stylistic());
1646
+ }
1647
+ if (enableTest) {
1648
+ configs.push(test({
1649
+ isInEditor,
1650
+ overrides: overrides.test
1651
+ }));
1652
+ }
1653
+ ;
1654
+ if (enableVue) {
1655
+ configs.push(vue({
1656
+ typescript: !!enableTypeScript,
1657
+ overrides: overrides.vue
1658
+ }));
1659
+ }
1660
+ ;
1661
+ if (enableJsonc) {
1662
+ configs.push(
1663
+ jsonc({
1664
+ overrides: overrides.jsonc
1665
+ }),
1666
+ sortPackageJson(),
1667
+ sortTsconfig()
1668
+ );
1669
+ }
1670
+ if (enableYaml) {
1671
+ configs.push(yaml({
1672
+ overrides: overrides.yaml
1673
+ }));
1674
+ }
1675
+ ;
1676
+ if (enableMarkdown) {
1677
+ configs.push(markdown({
1678
+ componentExts,
1679
+ overrides: overrides.markdown
1680
+ }));
1681
+ }
1682
+ ;
1683
+ if (enableReact) {
1684
+ configs.push(react({
1685
+ overrides: overrides.react
1686
+ }));
1687
+ }
1688
+ return combineConfigs(
1689
+ ...configs,
1690
+ ...userConfigs
1691
+ );
1692
+ }
1693
+
1694
+ // src/index.ts
1695
+ var src_default = vinicuncaESLint;
1696
+ // Annotate the CommonJS export names for ESM import in node:
1697
+ 0 && (module.exports = {
1698
+ GLOB_EXCLUDE,
1699
+ GLOB_JS,
1700
+ GLOB_JSON,
1701
+ GLOB_JSON5,
1702
+ GLOB_JSONC,
1703
+ GLOB_JSX,
1704
+ GLOB_MARKDOWN,
1705
+ GLOB_MARKDOWN_CODE,
1706
+ GLOB_SRC,
1707
+ GLOB_SRC_EXT,
1708
+ GLOB_TESTS,
1709
+ GLOB_TS,
1710
+ GLOB_TSX,
1711
+ GLOB_VUE,
1712
+ GLOB_YAML,
1713
+ combineConfigs,
1714
+ comments,
1715
+ ignores,
1716
+ imports,
1717
+ javascript,
1718
+ jsdoc,
1719
+ jsonc,
1720
+ markdown,
1721
+ node,
1722
+ parserJsonc,
1723
+ parserTs,
1724
+ parserVue,
1725
+ parserYaml,
1726
+ pluginComments,
1727
+ pluginImport,
1728
+ pluginJsdoc,
1729
+ pluginJsonc,
1730
+ pluginMarkdown,
1731
+ pluginNoOnlyTests,
1732
+ pluginNode,
1733
+ pluginReact,
1734
+ pluginReactHooks,
1735
+ pluginStylistic,
1736
+ pluginTs,
1737
+ pluginUnicorn,
1738
+ pluginUnusedImports,
1739
+ pluginVinicunca,
1740
+ pluginVitest,
1741
+ pluginVue,
1742
+ pluginYaml,
1743
+ react,
1744
+ renameRules,
1745
+ sortPackageJson,
1746
+ sortTsconfig,
1747
+ stylistic,
1748
+ test,
1749
+ typescript,
1750
+ unicorn,
1751
+ vinicuncaESLint,
1752
+ vue,
1753
+ yaml
1754
+ });