@lincy/eslint-config 3.0.6 → 3.0.7

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