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

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