@coderwyd/eslint-config 1.1.0-beta.0 → 1.1.0-beta.1

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