@2030/eslint-config 2.0.2 → 3.0.0

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 DELETED
@@ -1,2754 +0,0 @@
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_ASTRO_TS: () => GLOB_ASTRO_TS,
36
- GLOB_CSS: () => GLOB_CSS,
37
- GLOB_EXCLUDE: () => GLOB_EXCLUDE,
38
- GLOB_GRAPHQL: () => GLOB_GRAPHQL,
39
- GLOB_HTML: () => GLOB_HTML,
40
- GLOB_JS: () => GLOB_JS,
41
- GLOB_JSON: () => GLOB_JSON,
42
- GLOB_JSON5: () => GLOB_JSON5,
43
- GLOB_JSONC: () => GLOB_JSONC,
44
- GLOB_JSX: () => GLOB_JSX,
45
- GLOB_LESS: () => GLOB_LESS,
46
- GLOB_MARKDOWN: () => GLOB_MARKDOWN,
47
- GLOB_MARKDOWN_CODE: () => GLOB_MARKDOWN_CODE,
48
- GLOB_MARKDOWN_IN_MARKDOWN: () => GLOB_MARKDOWN_IN_MARKDOWN,
49
- GLOB_POSTCSS: () => GLOB_POSTCSS,
50
- GLOB_SCSS: () => GLOB_SCSS,
51
- GLOB_SRC: () => GLOB_SRC,
52
- GLOB_SRC_EXT: () => GLOB_SRC_EXT,
53
- GLOB_STYLE: () => GLOB_STYLE,
54
- GLOB_SVELTE: () => GLOB_SVELTE,
55
- GLOB_SVG: () => GLOB_SVG,
56
- GLOB_TESTS: () => GLOB_TESTS,
57
- GLOB_TOML: () => GLOB_TOML,
58
- GLOB_TS: () => GLOB_TS,
59
- GLOB_TSX: () => GLOB_TSX,
60
- GLOB_VUE: () => GLOB_VUE,
61
- GLOB_XML: () => GLOB_XML,
62
- GLOB_YAML: () => GLOB_YAML,
63
- StylisticConfigDefaults: () => StylisticConfigDefaults,
64
- astro: () => astro,
65
- combine: () => combine,
66
- command: () => command,
67
- comments: () => comments,
68
- default: () => src_default,
69
- defaultPluginRenaming: () => defaultPluginRenaming,
70
- disables: () => disables,
71
- ensurePackages: () => ensurePackages,
72
- formatters: () => formatters,
73
- getOverrides: () => getOverrides,
74
- ignores: () => ignores,
75
- imports: () => imports,
76
- interopDefault: () => interopDefault,
77
- isInEditorEnv: () => isInEditorEnv,
78
- isInGitHooksOrLintStaged: () => isInGitHooksOrLintStaged,
79
- isPackageInScope: () => isPackageInScope,
80
- javascript: () => javascript,
81
- jsdoc: () => jsdoc,
82
- jsonc: () => jsonc,
83
- jsx: () => jsx,
84
- jun: () => jun,
85
- markdown: () => markdown,
86
- node: () => node,
87
- parserPlain: () => parserPlain,
88
- perfectionist: () => perfectionist,
89
- react: () => react,
90
- regexp: () => regexp,
91
- renamePluginInConfigs: () => renamePluginInConfigs,
92
- renameRules: () => renameRules,
93
- resolveSubOptions: () => resolveSubOptions,
94
- solid: () => solid,
95
- sortPackageJson: () => sortPackageJson,
96
- sortTsconfig: () => sortTsconfig,
97
- stylistic: () => stylistic,
98
- svelte: () => svelte,
99
- test: () => test,
100
- toArray: () => toArray,
101
- toml: () => toml,
102
- typescript: () => typescript,
103
- unicorn: () => unicorn,
104
- unocss: () => unocss,
105
- vue: () => vue,
106
- yaml: () => yaml
107
- });
108
- module.exports = __toCommonJS(src_exports);
109
-
110
- // node_modules/.pnpm/tsup@8.3.0_xbsphhdvxjfgldfrf2ivwsgage/node_modules/tsup/assets/cjs_shims.js
111
- var getImportMetaUrl = () => typeof document === "undefined" ? new URL(`file:${__filename}`).href : document.currentScript && document.currentScript.src || new URL("main.js", document.baseURI).href;
112
- var importMetaUrl = /* @__PURE__ */ getImportMetaUrl();
113
-
114
- // src/factory.ts
115
- var import_eslint_flat_config_utils = require("eslint-flat-config-utils");
116
- var import_local_pkg4 = require("local-pkg");
117
-
118
- // src/globs.ts
119
- var GLOB_SRC_EXT = "?([cm])[jt]s?(x)";
120
- var GLOB_SRC = "**/*.?([cm])[jt]s?(x)";
121
- var GLOB_JS = "**/*.?([cm])js";
122
- var GLOB_JSX = "**/*.?([cm])jsx";
123
- var GLOB_TS = "**/*.?([cm])ts";
124
- var GLOB_TSX = "**/*.?([cm])tsx";
125
- var GLOB_STYLE = "**/*.{c,le,sc}ss";
126
- var GLOB_CSS = "**/*.css";
127
- var GLOB_POSTCSS = "**/*.{p,post}css";
128
- var GLOB_LESS = "**/*.less";
129
- var GLOB_SCSS = "**/*.scss";
130
- var GLOB_JSON = "**/*.json";
131
- var GLOB_JSON5 = "**/*.json5";
132
- var GLOB_JSONC = "**/*.jsonc";
133
- var GLOB_MARKDOWN = "**/*.md";
134
- var GLOB_MARKDOWN_IN_MARKDOWN = "**/*.md/*.md";
135
- var GLOB_SVELTE = "**/*.svelte";
136
- var GLOB_VUE = "**/*.vue";
137
- var GLOB_YAML = "**/*.y?(a)ml";
138
- var GLOB_TOML = "**/*.toml";
139
- var GLOB_XML = "**/*.xml";
140
- var GLOB_SVG = "**/*.svg";
141
- var GLOB_HTML = "**/*.htm?(l)";
142
- var GLOB_ASTRO = "**/*.astro";
143
- var GLOB_ASTRO_TS = "**/*.astro/*.ts";
144
- var GLOB_GRAPHQL = "**/*.{g,graph}ql";
145
- var GLOB_MARKDOWN_CODE = `${GLOB_MARKDOWN}/${GLOB_SRC}`;
146
- var GLOB_TESTS = [
147
- `**/__tests__/**/*.${GLOB_SRC_EXT}`,
148
- `**/*.spec.${GLOB_SRC_EXT}`,
149
- `**/*.test.${GLOB_SRC_EXT}`,
150
- `**/*.bench.${GLOB_SRC_EXT}`,
151
- `**/*.benchmark.${GLOB_SRC_EXT}`
152
- ];
153
- var GLOB_ALL_SRC = [
154
- GLOB_SRC,
155
- GLOB_STYLE,
156
- GLOB_JSON,
157
- GLOB_JSON5,
158
- GLOB_MARKDOWN,
159
- GLOB_SVELTE,
160
- GLOB_VUE,
161
- GLOB_YAML,
162
- GLOB_XML,
163
- GLOB_HTML
164
- ];
165
- var GLOB_EXCLUDE = [
166
- "**/node_modules",
167
- "**/dist",
168
- "**/package-lock.json",
169
- "**/yarn.lock",
170
- "**/pnpm-lock.yaml",
171
- "**/bun.lockb",
172
- "**/output",
173
- "**/coverage",
174
- "**/temp",
175
- "**/.temp",
176
- "**/tmp",
177
- "**/.tmp",
178
- "**/.history",
179
- "**/.vitepress/cache",
180
- "**/.nuxt",
181
- "**/.next",
182
- "**/.svelte-kit",
183
- "**/.vercel",
184
- "**/.changeset",
185
- "**/.idea",
186
- "**/.cache",
187
- "**/.output",
188
- "**/.vite-inspect",
189
- "**/.yarn",
190
- "**/vite.config.*.timestamp-*",
191
- "**/CHANGELOG*.md",
192
- "**/*.min.*",
193
- "**/LICENSE*",
194
- "**/__snapshots__",
195
- "**/auto-import?(s).d.ts",
196
- "**/components.d.ts"
197
- ];
198
-
199
- // src/utils.ts
200
- var import_node_process = __toESM(require("process"), 1);
201
- var import_node_url = require("url");
202
- var import_local_pkg = require("local-pkg");
203
- var scopeUrl = (0, import_node_url.fileURLToPath)(new URL(".", importMetaUrl));
204
- var isCwdInScope = (0, import_local_pkg.isPackageExists)("@jun2030/eslint-config");
205
- var parserPlain = {
206
- meta: {
207
- name: "parser-plain"
208
- },
209
- parseForESLint: (code) => ({
210
- ast: {
211
- body: [],
212
- comments: [],
213
- loc: { end: code.length, start: 0 },
214
- range: [0, code.length],
215
- tokens: [],
216
- type: "Program"
217
- },
218
- scopeManager: null,
219
- services: { isPlain: true },
220
- visitorKeys: {
221
- Program: []
222
- }
223
- })
224
- };
225
- async function combine(...configs2) {
226
- const resolved = await Promise.all(configs2);
227
- return resolved.flat();
228
- }
229
- function renameRules(rules, map) {
230
- return Object.fromEntries(
231
- Object.entries(rules).map(([key, value]) => {
232
- for (const [from, to] of Object.entries(map)) {
233
- if (key.startsWith(`${from}/`))
234
- return [to + key.slice(from.length), value];
235
- }
236
- return [key, value];
237
- })
238
- );
239
- }
240
- function renamePluginInConfigs(configs2, map) {
241
- return configs2.map((i) => {
242
- const clone = { ...i };
243
- if (clone.rules)
244
- clone.rules = renameRules(clone.rules, map);
245
- if (clone.plugins) {
246
- clone.plugins = Object.fromEntries(
247
- Object.entries(clone.plugins).map(([key, value]) => {
248
- if (key in map)
249
- return [map[key], value];
250
- return [key, value];
251
- })
252
- );
253
- }
254
- return clone;
255
- });
256
- }
257
- function toArray(value) {
258
- return Array.isArray(value) ? value : [value];
259
- }
260
- async function interopDefault(m) {
261
- const resolved = await m;
262
- return resolved.default || resolved;
263
- }
264
- function isPackageInScope(name) {
265
- return (0, import_local_pkg.isPackageExists)(name, { paths: [scopeUrl] });
266
- }
267
- async function ensurePackages(packages) {
268
- if (import_node_process.default.env.CI || import_node_process.default.stdout.isTTY === false || isCwdInScope === false)
269
- return;
270
- const nonExistingPackages = packages.filter((i) => i && !isPackageInScope(i));
271
- if (nonExistingPackages.length === 0)
272
- return;
273
- const p = await import("@clack/prompts");
274
- const result = await p.confirm({
275
- message: `${nonExistingPackages.length === 1 ? "Package is" : "Packages are"} required for this config: ${nonExistingPackages.join(", ")}. Do you want to install them?`
276
- });
277
- if (result)
278
- await import("@antfu/install-pkg").then((i) => i.installPackage(nonExistingPackages, { dev: true }));
279
- }
280
- function isInEditorEnv() {
281
- if (import_node_process.default.env.CI)
282
- return false;
283
- if (isInGitHooksOrLintStaged())
284
- return false;
285
- return !!(import_node_process.default.env.VSCODE_PID || import_node_process.default.env.VSCODE_CWD || import_node_process.default.env.JETBRAINS_IDE || import_node_process.default.env.VIM || import_node_process.default.env.NVIM);
286
- }
287
- function isInGitHooksOrLintStaged() {
288
- return !!(import_node_process.default.env.GIT_PARAMS || import_node_process.default.env.VSCODE_GIT_COMMAND || import_node_process.default.env.npm_lifecycle_script?.startsWith("lint-staged"));
289
- }
290
-
291
- // src/configs/astro.ts
292
- async function astro(options = {}) {
293
- const {
294
- files = [GLOB_ASTRO],
295
- overrides = {},
296
- stylistic: stylistic2 = true
297
- } = options;
298
- const [
299
- pluginAstro,
300
- parserAstro,
301
- parserTs
302
- ] = await Promise.all([
303
- interopDefault(import("eslint-plugin-astro")),
304
- interopDefault(import("astro-eslint-parser")),
305
- interopDefault(import("@typescript-eslint/parser"))
306
- ]);
307
- return [
308
- {
309
- name: "jun/astro/setup",
310
- plugins: {
311
- astro: pluginAstro
312
- }
313
- },
314
- {
315
- files,
316
- languageOptions: {
317
- globals: pluginAstro.environments.astro.globals,
318
- parser: parserAstro,
319
- parserOptions: {
320
- extraFileExtensions: [".astro"],
321
- parser: parserTs
322
- },
323
- sourceType: "module"
324
- },
325
- name: "jun/astro/rules",
326
- processor: "astro/client-side-ts",
327
- rules: {
328
- // use recommended rules
329
- "astro/missing-client-only-directive-value": "error",
330
- "astro/no-conflict-set-directives": "error",
331
- "astro/no-deprecated-astro-canonicalurl": "error",
332
- "astro/no-deprecated-astro-fetchcontent": "error",
333
- "astro/no-deprecated-astro-resolve": "error",
334
- "astro/no-deprecated-getentrybyslug": "error",
335
- "astro/no-set-html-directive": "off",
336
- "astro/no-unused-define-vars-in-style": "error",
337
- "astro/semi": "off",
338
- "astro/valid-compile": "error",
339
- ...stylistic2 ? {
340
- "style/indent": "off",
341
- "style/jsx-closing-tag-location": "off",
342
- "style/jsx-one-expression-per-line": "off",
343
- "style/no-multiple-empty-lines": "off"
344
- } : {},
345
- ...overrides
346
- }
347
- }
348
- ];
349
- }
350
-
351
- // src/configs/command.ts
352
- var import_config = __toESM(require("eslint-plugin-command/config"), 1);
353
- async function command() {
354
- return [
355
- {
356
- ...(0, import_config.default)(),
357
- name: "jun/command/rules"
358
- }
359
- ];
360
- }
361
-
362
- // src/plugins.ts
363
- var import_eslint_plugin_eslint_comments = __toESM(require("@eslint-community/eslint-plugin-eslint-comments"), 1);
364
- var import_eslint_plugin_antfu = __toESM(require("eslint-plugin-antfu"), 1);
365
- var pluginImport = __toESM(require("eslint-plugin-import-x"), 1);
366
- var import_eslint_plugin_n = __toESM(require("eslint-plugin-n"), 1);
367
- var import_eslint_plugin_perfectionist = __toESM(require("eslint-plugin-perfectionist"), 1);
368
- var import_eslint_plugin_unicorn = __toESM(require("eslint-plugin-unicorn"), 1);
369
- var import_eslint_plugin_unused_imports = __toESM(require("eslint-plugin-unused-imports"), 1);
370
-
371
- // src/configs/comments.ts
372
- async function comments() {
373
- return [
374
- {
375
- name: "jun/eslint-comments/rules",
376
- plugins: {
377
- "eslint-comments": import_eslint_plugin_eslint_comments.default
378
- },
379
- rules: {
380
- "eslint-comments/no-aggregating-enable": "error",
381
- "eslint-comments/no-duplicate-disable": "error",
382
- "eslint-comments/no-unlimited-disable": "error",
383
- "eslint-comments/no-unused-enable": "error"
384
- }
385
- }
386
- ];
387
- }
388
-
389
- // src/configs/disables.ts
390
- async function disables() {
391
- return [
392
- {
393
- files: [`**/scripts/${GLOB_SRC}`],
394
- name: "jun/disables/scripts",
395
- rules: {
396
- "jun/no-top-level-await": "off",
397
- "no-console": "off",
398
- "ts/explicit-function-return-type": "off"
399
- }
400
- },
401
- {
402
- files: [`**/cli/${GLOB_SRC}`, `**/cli.${GLOB_SRC_EXT}`],
403
- name: "jun/disables/cli",
404
- rules: {
405
- "jun/no-top-level-await": "off",
406
- "no-console": "off"
407
- }
408
- },
409
- {
410
- files: ["**/bin/**/*", `**/bin.${GLOB_SRC_EXT}`],
411
- name: "jun/disables/bin",
412
- rules: {
413
- "jun/no-import-dist": "off",
414
- "jun/no-import-node-modules-by-path": "off"
415
- }
416
- },
417
- {
418
- files: ["**/*.d.?([cm])ts"],
419
- name: "jun/disables/dts",
420
- rules: {
421
- "eslint-comments/no-unlimited-disable": "off",
422
- "import/no-duplicates": "off",
423
- "no-restricted-syntax": "off",
424
- "unused-imports/no-unused-vars": "off"
425
- }
426
- },
427
- {
428
- files: ["**/*.js", "**/*.cjs"],
429
- name: "jun/disables/cjs",
430
- rules: {
431
- "ts/no-require-imports": "off"
432
- }
433
- },
434
- {
435
- files: [`**/*.config.${GLOB_SRC_EXT}`, `**/*.config.*.${GLOB_SRC_EXT}`],
436
- name: "jun/disables/config-files",
437
- rules: {
438
- "jun/no-top-level-await": "off",
439
- "no-console": "off",
440
- "ts/explicit-function-return-type": "off"
441
- }
442
- }
443
- ];
444
- }
445
-
446
- // src/configs/formatters.ts
447
- var import_local_pkg2 = require("local-pkg");
448
-
449
- // src/configs/stylistic.ts
450
- var StylisticConfigDefaults = {
451
- indent: 2,
452
- jsx: true,
453
- quotes: "single",
454
- semi: false
455
- };
456
- async function stylistic(options = {}) {
457
- const {
458
- indent,
459
- jsx: jsx2,
460
- lessOpinionated = false,
461
- overrides = {},
462
- quotes,
463
- semi
464
- } = {
465
- ...StylisticConfigDefaults,
466
- ...options
467
- };
468
- const pluginStylistic = await interopDefault(import("@stylistic/eslint-plugin"));
469
- const config = pluginStylistic.configs.customize({
470
- flat: true,
471
- indent,
472
- jsx: jsx2,
473
- pluginName: "style",
474
- quotes,
475
- semi
476
- });
477
- return [
478
- {
479
- name: "jun/stylistic/rules",
480
- plugins: {
481
- jun: import_eslint_plugin_antfu.default,
482
- style: pluginStylistic
483
- },
484
- rules: {
485
- ...config.rules,
486
- "jun/consistent-chaining": "error",
487
- "jun/consistent-list-newline": "error",
488
- ...lessOpinionated ? {
489
- curly: ["error", "all"]
490
- } : {
491
- "jun/curly": "error",
492
- "jun/if-newline": "error",
493
- "jun/top-level-function": "error"
494
- },
495
- ...overrides
496
- }
497
- }
498
- ];
499
- }
500
-
501
- // src/configs/formatters.ts
502
- function mergePrettierOptions(options, overrides = {}) {
503
- return {
504
- ...options,
505
- ...overrides,
506
- plugins: [
507
- ...overrides.plugins || [],
508
- ...options.plugins || []
509
- ]
510
- };
511
- }
512
- async function formatters(options = {}, stylistic2 = {}) {
513
- if (options === true) {
514
- const isPrettierPluginXmlInScope = isPackageInScope("@prettier/plugin-xml");
515
- options = {
516
- astro: isPackageInScope("prettier-plugin-astro"),
517
- css: true,
518
- graphql: true,
519
- html: true,
520
- markdown: true,
521
- slidev: (0, import_local_pkg2.isPackageExists)("@slidev/cli"),
522
- svg: isPrettierPluginXmlInScope,
523
- xml: isPrettierPluginXmlInScope
524
- };
525
- }
526
- await ensurePackages([
527
- "eslint-plugin-format",
528
- options.markdown && options.slidev ? "prettier-plugin-slidev" : void 0,
529
- options.astro ? "prettier-plugin-astro" : void 0,
530
- options.xml || options.svg ? "@prettier/plugin-xml" : void 0
531
- ]);
532
- if (options.slidev && options.markdown !== true && options.markdown !== "prettier")
533
- throw new Error("`slidev` option only works when `markdown` is enabled with `prettier`");
534
- const {
535
- indent,
536
- quotes,
537
- semi
538
- } = {
539
- ...StylisticConfigDefaults,
540
- ...stylistic2
541
- };
542
- const prettierOptions = Object.assign(
543
- {
544
- endOfLine: "auto",
545
- printWidth: 120,
546
- semi,
547
- singleQuote: quotes === "single",
548
- tabWidth: typeof indent === "number" ? indent : 2,
549
- trailingComma: "all",
550
- useTabs: indent === "tab"
551
- },
552
- options.prettierOptions || {}
553
- );
554
- const prettierXmlOptions = {
555
- xmlQuoteAttributes: "double",
556
- xmlSelfClosingSpace: true,
557
- xmlSortAttributesByKey: false,
558
- xmlWhitespaceSensitivity: "ignore"
559
- };
560
- const dprintOptions = Object.assign(
561
- {
562
- indentWidth: typeof indent === "number" ? indent : 2,
563
- quoteStyle: quotes === "single" ? "preferSingle" : "preferDouble",
564
- useTabs: indent === "tab"
565
- },
566
- options.dprintOptions || {}
567
- );
568
- const pluginFormat = await interopDefault(import("eslint-plugin-format"));
569
- const configs2 = [
570
- {
571
- name: "jun/formatter/setup",
572
- plugins: {
573
- format: pluginFormat
574
- }
575
- }
576
- ];
577
- if (options.css) {
578
- configs2.push(
579
- {
580
- files: [GLOB_CSS, GLOB_POSTCSS],
581
- languageOptions: {
582
- parser: parserPlain
583
- },
584
- name: "jun/formatter/css",
585
- rules: {
586
- "format/prettier": [
587
- "error",
588
- mergePrettierOptions(prettierOptions, {
589
- parser: "css"
590
- })
591
- ]
592
- }
593
- },
594
- {
595
- files: [GLOB_SCSS],
596
- languageOptions: {
597
- parser: parserPlain
598
- },
599
- name: "jun/formatter/scss",
600
- rules: {
601
- "format/prettier": [
602
- "error",
603
- mergePrettierOptions(prettierOptions, {
604
- parser: "scss"
605
- })
606
- ]
607
- }
608
- },
609
- {
610
- files: [GLOB_LESS],
611
- languageOptions: {
612
- parser: parserPlain
613
- },
614
- name: "jun/formatter/less",
615
- rules: {
616
- "format/prettier": [
617
- "error",
618
- mergePrettierOptions(prettierOptions, {
619
- parser: "less"
620
- })
621
- ]
622
- }
623
- }
624
- );
625
- }
626
- if (options.html) {
627
- configs2.push({
628
- files: [GLOB_HTML],
629
- languageOptions: {
630
- parser: parserPlain
631
- },
632
- name: "jun/formatter/html",
633
- rules: {
634
- "format/prettier": [
635
- "error",
636
- mergePrettierOptions(prettierOptions, {
637
- parser: "html"
638
- })
639
- ]
640
- }
641
- });
642
- }
643
- if (options.xml) {
644
- configs2.push({
645
- files: [GLOB_XML],
646
- languageOptions: {
647
- parser: parserPlain
648
- },
649
- name: "jun/formatter/xml",
650
- rules: {
651
- "format/prettier": [
652
- "error",
653
- mergePrettierOptions({ ...prettierXmlOptions, ...prettierOptions }, {
654
- parser: "xml",
655
- plugins: [
656
- "@prettier/plugin-xml"
657
- ]
658
- })
659
- ]
660
- }
661
- });
662
- }
663
- if (options.svg) {
664
- configs2.push({
665
- files: [GLOB_SVG],
666
- languageOptions: {
667
- parser: parserPlain
668
- },
669
- name: "jun/formatter/svg",
670
- rules: {
671
- "format/prettier": [
672
- "error",
673
- mergePrettierOptions({ ...prettierXmlOptions, ...prettierOptions }, {
674
- parser: "xml",
675
- plugins: [
676
- "@prettier/plugin-xml"
677
- ]
678
- })
679
- ]
680
- }
681
- });
682
- }
683
- if (options.markdown) {
684
- const formater = options.markdown === true ? "prettier" : options.markdown;
685
- const GLOB_SLIDEV = !options.slidev ? [] : options.slidev === true ? ["**/slides.md"] : options.slidev.files;
686
- configs2.push({
687
- files: [GLOB_MARKDOWN],
688
- ignores: GLOB_SLIDEV,
689
- languageOptions: {
690
- parser: parserPlain
691
- },
692
- name: "jun/formatter/markdown",
693
- rules: {
694
- [`format/${formater}`]: [
695
- "error",
696
- formater === "prettier" ? mergePrettierOptions(prettierOptions, {
697
- embeddedLanguageFormatting: "off",
698
- parser: "markdown"
699
- }) : {
700
- ...dprintOptions,
701
- language: "markdown"
702
- }
703
- ]
704
- }
705
- });
706
- if (options.slidev) {
707
- configs2.push({
708
- files: GLOB_SLIDEV,
709
- languageOptions: {
710
- parser: parserPlain
711
- },
712
- name: "jun/formatter/slidev",
713
- rules: {
714
- "format/prettier": [
715
- "error",
716
- mergePrettierOptions(prettierOptions, {
717
- embeddedLanguageFormatting: "off",
718
- parser: "slidev",
719
- plugins: [
720
- "prettier-plugin-slidev"
721
- ]
722
- })
723
- ]
724
- }
725
- });
726
- }
727
- }
728
- if (options.astro) {
729
- configs2.push({
730
- files: [GLOB_ASTRO],
731
- languageOptions: {
732
- parser: parserPlain
733
- },
734
- name: "jun/formatter/astro",
735
- rules: {
736
- "format/prettier": [
737
- "error",
738
- mergePrettierOptions(prettierOptions, {
739
- parser: "astro",
740
- plugins: [
741
- "prettier-plugin-astro"
742
- ]
743
- })
744
- ]
745
- }
746
- });
747
- configs2.push({
748
- files: [GLOB_ASTRO, GLOB_ASTRO_TS],
749
- name: "jun/formatter/astro/disables",
750
- rules: {
751
- "style/arrow-parens": "off",
752
- "style/block-spacing": "off",
753
- "style/comma-dangle": "off",
754
- "style/indent": "off",
755
- "style/no-multi-spaces": "off",
756
- "style/quotes": "off",
757
- "style/semi": "off"
758
- }
759
- });
760
- }
761
- if (options.graphql) {
762
- configs2.push({
763
- files: [GLOB_GRAPHQL],
764
- languageOptions: {
765
- parser: parserPlain
766
- },
767
- name: "jun/formatter/graphql",
768
- rules: {
769
- "format/prettier": [
770
- "error",
771
- mergePrettierOptions(prettierOptions, {
772
- parser: "graphql"
773
- })
774
- ]
775
- }
776
- });
777
- }
778
- return configs2;
779
- }
780
-
781
- // src/configs/ignores.ts
782
- async function ignores(userIgnores = []) {
783
- return [
784
- {
785
- ignores: [
786
- ...GLOB_EXCLUDE,
787
- ...userIgnores
788
- ],
789
- name: "jun/ignores"
790
- }
791
- ];
792
- }
793
-
794
- // src/configs/imports.ts
795
- async function imports(options = {}) {
796
- const {
797
- stylistic: stylistic2 = true
798
- } = options;
799
- return [
800
- {
801
- name: "jun/imports/rules",
802
- plugins: {
803
- import: pluginImport,
804
- jun: import_eslint_plugin_antfu.default
805
- },
806
- rules: {
807
- "import/first": "error",
808
- "import/no-duplicates": "error",
809
- "import/no-mutable-exports": "error",
810
- "import/no-named-default": "error",
811
- "import/no-self-import": "error",
812
- "import/no-webpack-loader-syntax": "error",
813
- "jun/import-dedupe": "error",
814
- "jun/no-import-dist": "error",
815
- "jun/no-import-node-modules-by-path": "error",
816
- ...stylistic2 ? {
817
- "import/newline-after-import": ["error", { count: 1 }]
818
- } : {}
819
- }
820
- }
821
- ];
822
- }
823
-
824
- // src/configs/javascript.ts
825
- var import_globals = __toESM(require("globals"), 1);
826
- async function javascript(options = {}) {
827
- const {
828
- isInEditor = false,
829
- overrides = {}
830
- } = options;
831
- return [
832
- {
833
- languageOptions: {
834
- ecmaVersion: 2022,
835
- globals: {
836
- ...import_globals.default.browser,
837
- ...import_globals.default.es2021,
838
- ...import_globals.default.node,
839
- document: "readonly",
840
- navigator: "readonly",
841
- window: "readonly"
842
- },
843
- parserOptions: {
844
- ecmaFeatures: {
845
- jsx: true
846
- },
847
- ecmaVersion: 2022,
848
- sourceType: "module"
849
- },
850
- sourceType: "module"
851
- },
852
- linterOptions: {
853
- reportUnusedDisableDirectives: true
854
- },
855
- name: "jun/javascript/setup"
856
- },
857
- {
858
- name: "jun/javascript/rules",
859
- plugins: {
860
- "jun": import_eslint_plugin_antfu.default,
861
- "unused-imports": import_eslint_plugin_unused_imports.default
862
- },
863
- rules: {
864
- "accessor-pairs": ["error", { enforceForClassMembers: true, setWithoutGet: true }],
865
- "array-callback-return": "error",
866
- "block-scoped-var": "error",
867
- "constructor-super": "error",
868
- "default-case-last": "error",
869
- "dot-notation": ["error", { allowKeywords: true }],
870
- "eqeqeq": ["error", "smart"],
871
- "jun/no-top-level-await": "error",
872
- "new-cap": ["error", { capIsNew: false, newIsCap: true, properties: true }],
873
- "no-alert": "error",
874
- "no-array-constructor": "error",
875
- "no-async-promise-executor": "error",
876
- "no-caller": "error",
877
- "no-case-declarations": "error",
878
- "no-class-assign": "error",
879
- "no-compare-neg-zero": "error",
880
- "no-cond-assign": ["error", "always"],
881
- "no-console": ["error", { allow: ["warn", "error"] }],
882
- "no-const-assign": "error",
883
- "no-control-regex": "error",
884
- "no-debugger": "error",
885
- "no-delete-var": "error",
886
- "no-dupe-args": "error",
887
- "no-dupe-class-members": "error",
888
- "no-dupe-keys": "error",
889
- "no-duplicate-case": "error",
890
- "no-empty": ["error", { allowEmptyCatch: true }],
891
- "no-empty-character-class": "error",
892
- "no-empty-pattern": "error",
893
- "no-eval": "error",
894
- "no-ex-assign": "error",
895
- "no-extend-native": "error",
896
- "no-extra-bind": "error",
897
- "no-extra-boolean-cast": "error",
898
- "no-fallthrough": "error",
899
- "no-func-assign": "error",
900
- "no-global-assign": "error",
901
- "no-implied-eval": "error",
902
- "no-import-assign": "error",
903
- "no-invalid-regexp": "error",
904
- "no-irregular-whitespace": "error",
905
- "no-iterator": "error",
906
- "no-labels": ["error", { allowLoop: false, allowSwitch: false }],
907
- "no-lone-blocks": "error",
908
- "no-loss-of-precision": "error",
909
- "no-misleading-character-class": "error",
910
- "no-multi-str": "error",
911
- "no-new": "error",
912
- "no-new-func": "error",
913
- "no-new-native-nonconstructor": "error",
914
- "no-new-wrappers": "error",
915
- "no-obj-calls": "error",
916
- "no-octal": "error",
917
- "no-octal-escape": "error",
918
- "no-proto": "error",
919
- "no-prototype-builtins": "error",
920
- "no-redeclare": ["error", { builtinGlobals: false }],
921
- "no-regex-spaces": "error",
922
- "no-restricted-globals": [
923
- "error",
924
- { message: "Use `globalThis` instead.", name: "global" },
925
- { message: "Use `globalThis` instead.", name: "self" }
926
- ],
927
- "no-restricted-properties": [
928
- "error",
929
- { message: "Use `Object.getPrototypeOf` or `Object.setPrototypeOf` instead.", property: "__proto__" },
930
- { message: "Use `Object.defineProperty` instead.", property: "__defineGetter__" },
931
- { message: "Use `Object.defineProperty` instead.", property: "__defineSetter__" },
932
- { message: "Use `Object.getOwnPropertyDescriptor` instead.", property: "__lookupGetter__" },
933
- { message: "Use `Object.getOwnPropertyDescriptor` instead.", property: "__lookupSetter__" }
934
- ],
935
- "no-restricted-syntax": [
936
- "error",
937
- "TSEnumDeclaration[const=true]",
938
- "TSExportAssignment"
939
- ],
940
- "no-self-assign": ["error", { props: true }],
941
- "no-self-compare": "error",
942
- "no-sequences": "error",
943
- "no-shadow-restricted-names": "error",
944
- "no-sparse-arrays": "error",
945
- "no-template-curly-in-string": "error",
946
- "no-this-before-super": "error",
947
- "no-throw-literal": "error",
948
- "no-undef": "error",
949
- "no-undef-init": "error",
950
- "no-unexpected-multiline": "error",
951
- "no-unmodified-loop-condition": "error",
952
- "no-unneeded-ternary": ["error", { defaultAssignment: false }],
953
- "no-unreachable": "error",
954
- "no-unreachable-loop": "error",
955
- "no-unsafe-finally": "error",
956
- "no-unsafe-negation": "error",
957
- "no-unused-expressions": ["error", {
958
- allowShortCircuit: true,
959
- allowTaggedTemplates: true,
960
- allowTernary: true
961
- }],
962
- "no-unused-vars": ["error", {
963
- args: "none",
964
- caughtErrors: "none",
965
- ignoreRestSiblings: true,
966
- vars: "all"
967
- }],
968
- "no-use-before-define": ["error", { classes: false, functions: false, variables: true }],
969
- "no-useless-backreference": "error",
970
- "no-useless-call": "error",
971
- "no-useless-catch": "error",
972
- "no-useless-computed-key": "error",
973
- "no-useless-constructor": "error",
974
- "no-useless-rename": "error",
975
- "no-useless-return": "error",
976
- "no-var": "error",
977
- "no-with": "error",
978
- "object-shorthand": [
979
- "error",
980
- "always",
981
- {
982
- avoidQuotes: true,
983
- ignoreConstructors: false
984
- }
985
- ],
986
- "one-var": ["error", { initialized: "never" }],
987
- "prefer-arrow-callback": [
988
- "error",
989
- {
990
- allowNamedFunctions: false,
991
- allowUnboundThis: true
992
- }
993
- ],
994
- "prefer-const": [
995
- "error",
996
- {
997
- destructuring: "all",
998
- ignoreReadBeforeAssign: true
999
- }
1000
- ],
1001
- "prefer-exponentiation-operator": "error",
1002
- "prefer-promise-reject-errors": "error",
1003
- "prefer-regex-literals": ["error", { disallowRedundantWrapping: true }],
1004
- "prefer-rest-params": "error",
1005
- "prefer-spread": "error",
1006
- "prefer-template": "error",
1007
- "symbol-description": "error",
1008
- "unicode-bom": ["error", "never"],
1009
- "unused-imports/no-unused-imports": isInEditor ? "off" : "error",
1010
- "unused-imports/no-unused-vars": [
1011
- "error",
1012
- {
1013
- args: "after-used",
1014
- argsIgnorePattern: "^_",
1015
- ignoreRestSiblings: true,
1016
- vars: "all",
1017
- varsIgnorePattern: "^_"
1018
- }
1019
- ],
1020
- "use-isnan": ["error", { enforceForIndexOf: true, enforceForSwitchCase: true }],
1021
- "valid-typeof": ["error", { requireStringLiterals: true }],
1022
- "vars-on-top": "error",
1023
- "yoda": ["error", "never"],
1024
- ...overrides
1025
- }
1026
- }
1027
- ];
1028
- }
1029
-
1030
- // src/configs/jsdoc.ts
1031
- async function jsdoc(options = {}) {
1032
- const {
1033
- stylistic: stylistic2 = true
1034
- } = options;
1035
- return [
1036
- {
1037
- name: "jun/jsdoc/rules",
1038
- plugins: {
1039
- jsdoc: await interopDefault(import("eslint-plugin-jsdoc"))
1040
- },
1041
- rules: {
1042
- "jsdoc/check-access": "warn",
1043
- "jsdoc/check-param-names": "warn",
1044
- "jsdoc/check-property-names": "warn",
1045
- "jsdoc/check-types": "warn",
1046
- "jsdoc/empty-tags": "warn",
1047
- "jsdoc/implements-on-classes": "warn",
1048
- "jsdoc/no-defaults": "warn",
1049
- "jsdoc/no-multi-asterisks": "warn",
1050
- "jsdoc/require-param-name": "warn",
1051
- "jsdoc/require-property": "warn",
1052
- "jsdoc/require-property-description": "warn",
1053
- "jsdoc/require-property-name": "warn",
1054
- "jsdoc/require-returns-check": "warn",
1055
- "jsdoc/require-returns-description": "warn",
1056
- "jsdoc/require-yields-check": "warn",
1057
- ...stylistic2 ? {
1058
- "jsdoc/check-alignment": "warn",
1059
- "jsdoc/multiline-blocks": "warn"
1060
- } : {}
1061
- }
1062
- }
1063
- ];
1064
- }
1065
-
1066
- // src/configs/jsonc.ts
1067
- async function jsonc(options = {}) {
1068
- const {
1069
- files = [GLOB_JSON, GLOB_JSON5, GLOB_JSONC],
1070
- overrides = {},
1071
- stylistic: stylistic2 = true
1072
- } = options;
1073
- const {
1074
- indent = 2
1075
- } = typeof stylistic2 === "boolean" ? {} : stylistic2;
1076
- const [
1077
- pluginJsonc,
1078
- parserJsonc
1079
- ] = await Promise.all([
1080
- interopDefault(import("eslint-plugin-jsonc")),
1081
- interopDefault(import("jsonc-eslint-parser"))
1082
- ]);
1083
- return [
1084
- {
1085
- name: "jun/jsonc/setup",
1086
- plugins: {
1087
- jsonc: pluginJsonc
1088
- }
1089
- },
1090
- {
1091
- files,
1092
- languageOptions: {
1093
- parser: parserJsonc
1094
- },
1095
- name: "jun/jsonc/rules",
1096
- rules: {
1097
- "jsonc/no-bigint-literals": "error",
1098
- "jsonc/no-binary-expression": "error",
1099
- "jsonc/no-binary-numeric-literals": "error",
1100
- "jsonc/no-dupe-keys": "error",
1101
- "jsonc/no-escape-sequence-in-identifier": "error",
1102
- "jsonc/no-floating-decimal": "error",
1103
- "jsonc/no-hexadecimal-numeric-literals": "error",
1104
- "jsonc/no-infinity": "error",
1105
- "jsonc/no-multi-str": "error",
1106
- "jsonc/no-nan": "error",
1107
- "jsonc/no-number-props": "error",
1108
- "jsonc/no-numeric-separators": "error",
1109
- "jsonc/no-octal": "error",
1110
- "jsonc/no-octal-escape": "error",
1111
- "jsonc/no-octal-numeric-literals": "error",
1112
- "jsonc/no-parenthesized": "error",
1113
- "jsonc/no-plus-sign": "error",
1114
- "jsonc/no-regexp-literals": "error",
1115
- "jsonc/no-sparse-arrays": "error",
1116
- "jsonc/no-template-literals": "error",
1117
- "jsonc/no-undefined-value": "error",
1118
- "jsonc/no-unicode-codepoint-escapes": "error",
1119
- "jsonc/no-useless-escape": "error",
1120
- "jsonc/space-unary-ops": "error",
1121
- "jsonc/valid-json-number": "error",
1122
- "jsonc/vue-custom-block/no-parsing-error": "error",
1123
- ...stylistic2 ? {
1124
- "jsonc/array-bracket-spacing": ["error", "never"],
1125
- "jsonc/comma-dangle": ["error", "never"],
1126
- "jsonc/comma-style": ["error", "last"],
1127
- "jsonc/indent": ["error", indent],
1128
- "jsonc/key-spacing": ["error", { afterColon: true, beforeColon: false }],
1129
- "jsonc/object-curly-newline": ["error", { consistent: true, multiline: true }],
1130
- "jsonc/object-curly-spacing": ["error", "always"],
1131
- "jsonc/object-property-newline": ["error", { allowMultiplePropertiesPerLine: true }],
1132
- "jsonc/quote-props": "error",
1133
- "jsonc/quotes": "error"
1134
- } : {},
1135
- ...overrides
1136
- }
1137
- }
1138
- ];
1139
- }
1140
-
1141
- // src/configs/jsx.ts
1142
- async function jsx() {
1143
- return [
1144
- {
1145
- files: [GLOB_JSX, GLOB_TSX],
1146
- languageOptions: {
1147
- parserOptions: {
1148
- ecmaFeatures: {
1149
- jsx: true
1150
- }
1151
- }
1152
- },
1153
- name: "jun/jsx/setup"
1154
- }
1155
- ];
1156
- }
1157
-
1158
- // src/configs/markdown.ts
1159
- var import_eslint_merge_processors = require("eslint-merge-processors");
1160
- async function markdown(options = {}) {
1161
- const {
1162
- componentExts = [],
1163
- files = [GLOB_MARKDOWN],
1164
- overrides = {}
1165
- } = options;
1166
- const markdown2 = await interopDefault(import("@eslint/markdown"));
1167
- return [
1168
- {
1169
- name: "jun/markdown/setup",
1170
- plugins: {
1171
- markdown: markdown2
1172
- }
1173
- },
1174
- {
1175
- files,
1176
- ignores: [GLOB_MARKDOWN_IN_MARKDOWN],
1177
- name: "jun/markdown/processor",
1178
- // `eslint-plugin-markdown` only creates virtual files for code blocks,
1179
- // but not the markdown file itself. We use `eslint-merge-processors` to
1180
- // add a pass-through processor for the markdown file itself.
1181
- processor: (0, import_eslint_merge_processors.mergeProcessors)([
1182
- markdown2.processors.markdown,
1183
- import_eslint_merge_processors.processorPassThrough
1184
- ])
1185
- },
1186
- {
1187
- files,
1188
- languageOptions: {
1189
- parser: parserPlain
1190
- },
1191
- name: "jun/markdown/parser"
1192
- },
1193
- {
1194
- files: [
1195
- GLOB_MARKDOWN_CODE,
1196
- ...componentExts.map((ext) => `${GLOB_MARKDOWN}/**/*.${ext}`)
1197
- ],
1198
- languageOptions: {
1199
- parserOptions: {
1200
- ecmaFeatures: {
1201
- impliedStrict: true
1202
- }
1203
- }
1204
- },
1205
- name: "jun/markdown/disables",
1206
- rules: {
1207
- "import/newline-after-import": "off",
1208
- "jun/no-top-level-await": "off",
1209
- "no-alert": "off",
1210
- "no-console": "off",
1211
- "no-labels": "off",
1212
- "no-lone-blocks": "off",
1213
- "no-restricted-syntax": "off",
1214
- "no-undef": "off",
1215
- "no-unused-expressions": "off",
1216
- "no-unused-labels": "off",
1217
- "no-unused-vars": "off",
1218
- "node/prefer-global/process": "off",
1219
- "style/comma-dangle": "off",
1220
- "style/eol-last": "off",
1221
- "ts/consistent-type-imports": "off",
1222
- "ts/explicit-function-return-type": "off",
1223
- "ts/no-namespace": "off",
1224
- "ts/no-redeclare": "off",
1225
- "ts/no-require-imports": "off",
1226
- "ts/no-unused-expressions": "off",
1227
- "ts/no-unused-vars": "off",
1228
- "ts/no-use-before-define": "off",
1229
- "unicode-bom": "off",
1230
- "unused-imports/no-unused-imports": "off",
1231
- "unused-imports/no-unused-vars": "off",
1232
- ...overrides
1233
- }
1234
- }
1235
- ];
1236
- }
1237
-
1238
- // src/configs/node.ts
1239
- async function node() {
1240
- return [
1241
- {
1242
- name: "jun/node/rules",
1243
- plugins: {
1244
- node: import_eslint_plugin_n.default
1245
- },
1246
- rules: {
1247
- "node/handle-callback-err": ["error", "^(err|error)$"],
1248
- "node/no-deprecated-api": "error",
1249
- "node/no-exports-assign": "error",
1250
- "node/no-new-require": "error",
1251
- "node/no-path-concat": "error",
1252
- "node/prefer-global/buffer": ["error", "never"],
1253
- "node/prefer-global/process": ["error", "never"],
1254
- "node/process-exit-as-throw": "error"
1255
- }
1256
- }
1257
- ];
1258
- }
1259
-
1260
- // src/configs/perfectionist.ts
1261
- async function perfectionist() {
1262
- return [
1263
- {
1264
- name: "jun/perfectionist/setup",
1265
- plugins: {
1266
- perfectionist: import_eslint_plugin_perfectionist.default
1267
- },
1268
- rules: {
1269
- "perfectionist/sort-exports": ["error", { order: "asc", type: "natural" }],
1270
- "perfectionist/sort-imports": ["error", {
1271
- groups: [
1272
- "type",
1273
- ["parent-type", "sibling-type", "index-type"],
1274
- "builtin",
1275
- "external",
1276
- ["internal", "internal-type"],
1277
- ["parent", "sibling", "index"],
1278
- "side-effect",
1279
- "object",
1280
- "unknown"
1281
- ],
1282
- newlinesBetween: "ignore",
1283
- order: "asc",
1284
- type: "natural"
1285
- }],
1286
- "perfectionist/sort-named-exports": ["error", { order: "asc", type: "natural" }],
1287
- "perfectionist/sort-named-imports": ["error", { order: "asc", type: "natural" }]
1288
- }
1289
- }
1290
- ];
1291
- }
1292
-
1293
- // src/configs/react.ts
1294
- var import_local_pkg3 = require("local-pkg");
1295
- var ReactRefreshAllowConstantExportPackages = [
1296
- "vite"
1297
- ];
1298
- var RemixPackages = [
1299
- "@remix-run/node",
1300
- "@remix-run/react",
1301
- "@remix-run/serve",
1302
- "@remix-run/dev"
1303
- ];
1304
- var NextJsPackages = [
1305
- "next"
1306
- ];
1307
- async function react(options = {}) {
1308
- const {
1309
- files = [GLOB_SRC],
1310
- overrides = {}
1311
- } = options;
1312
- await ensurePackages([
1313
- "@eslint-react/eslint-plugin",
1314
- "eslint-plugin-react-hooks",
1315
- "eslint-plugin-react-refresh"
1316
- ]);
1317
- const tsconfigPath = options?.tsconfigPath ? toArray(options.tsconfigPath) : void 0;
1318
- const isTypeAware = !!tsconfigPath;
1319
- const [
1320
- pluginReact,
1321
- pluginReactHooks,
1322
- pluginReactRefresh,
1323
- parserTs
1324
- ] = await Promise.all([
1325
- interopDefault(import("@eslint-react/eslint-plugin")),
1326
- interopDefault(import("eslint-plugin-react-hooks")),
1327
- interopDefault(import("eslint-plugin-react-refresh")),
1328
- interopDefault(import("@typescript-eslint/parser"))
1329
- ]);
1330
- const isAllowConstantExport = ReactRefreshAllowConstantExportPackages.some((i) => (0, import_local_pkg3.isPackageExists)(i));
1331
- const isUsingRemix = RemixPackages.some((i) => (0, import_local_pkg3.isPackageExists)(i));
1332
- const isUsingNext = NextJsPackages.some((i) => (0, import_local_pkg3.isPackageExists)(i));
1333
- const plugins = pluginReact.configs.all.plugins;
1334
- return [
1335
- {
1336
- name: "jun/react/setup",
1337
- plugins: {
1338
- "react": plugins["@eslint-react"],
1339
- "react-dom": plugins["@eslint-react/dom"],
1340
- "react-hooks": pluginReactHooks,
1341
- "react-hooks-extra": plugins["@eslint-react/hooks-extra"],
1342
- "react-naming-convention": plugins["@eslint-react/naming-convention"],
1343
- "react-refresh": pluginReactRefresh
1344
- }
1345
- },
1346
- {
1347
- files,
1348
- languageOptions: {
1349
- parser: parserTs,
1350
- parserOptions: {
1351
- ecmaFeatures: {
1352
- jsx: true
1353
- },
1354
- ...isTypeAware ? { project: tsconfigPath } : {}
1355
- },
1356
- sourceType: "module"
1357
- },
1358
- name: "jun/react/rules",
1359
- rules: {
1360
- // recommended rules from @eslint-react/dom
1361
- "react-dom/no-children-in-void-dom-elements": "warn",
1362
- "react-dom/no-dangerously-set-innerhtml": "warn",
1363
- "react-dom/no-dangerously-set-innerhtml-with-children": "error",
1364
- "react-dom/no-find-dom-node": "error",
1365
- "react-dom/no-missing-button-type": "warn",
1366
- "react-dom/no-missing-iframe-sandbox": "warn",
1367
- "react-dom/no-namespace": "error",
1368
- "react-dom/no-render-return-value": "error",
1369
- "react-dom/no-script-url": "warn",
1370
- "react-dom/no-unsafe-iframe-sandbox": "warn",
1371
- "react-dom/no-unsafe-target-blank": "warn",
1372
- // recommended rules react-hooks
1373
- "react-hooks/exhaustive-deps": "warn",
1374
- "react-hooks/rules-of-hooks": "error",
1375
- // react refresh
1376
- "react-refresh/only-export-components": [
1377
- "warn",
1378
- {
1379
- allowConstantExport: isAllowConstantExport,
1380
- allowExportNames: [
1381
- ...isUsingNext ? [
1382
- "dynamic",
1383
- "dynamicParams",
1384
- "revalidate",
1385
- "fetchCache",
1386
- "runtime",
1387
- "preferredRegion",
1388
- "maxDuration",
1389
- "config",
1390
- "generateStaticParams",
1391
- "metadata",
1392
- "generateMetadata",
1393
- "viewport",
1394
- "generateViewport"
1395
- ] : [],
1396
- ...isUsingRemix ? [
1397
- "meta",
1398
- "links",
1399
- "headers",
1400
- "loader",
1401
- "action"
1402
- ] : []
1403
- ]
1404
- }
1405
- ],
1406
- // recommended rules from @eslint-react
1407
- "react/ensure-forward-ref-using-ref": "warn",
1408
- "react/no-access-state-in-setstate": "error",
1409
- "react/no-array-index-key": "warn",
1410
- "react/no-children-count": "warn",
1411
- "react/no-children-for-each": "warn",
1412
- "react/no-children-map": "warn",
1413
- "react/no-children-only": "warn",
1414
- "react/no-children-prop": "warn",
1415
- "react/no-children-to-array": "warn",
1416
- "react/no-clone-element": "warn",
1417
- "react/no-comment-textnodes": "warn",
1418
- "react/no-component-will-mount": "error",
1419
- "react/no-component-will-receive-props": "error",
1420
- "react/no-component-will-update": "error",
1421
- "react/no-create-ref": "error",
1422
- "react/no-direct-mutation-state": "error",
1423
- "react/no-duplicate-key": "error",
1424
- "react/no-implicit-key": "error",
1425
- "react/no-missing-key": "error",
1426
- "react/no-nested-components": "warn",
1427
- "react/no-redundant-should-component-update": "error",
1428
- "react/no-set-state-in-component-did-mount": "warn",
1429
- "react/no-set-state-in-component-did-update": "warn",
1430
- "react/no-set-state-in-component-will-update": "warn",
1431
- "react/no-string-refs": "error",
1432
- "react/no-unsafe-component-will-mount": "warn",
1433
- "react/no-unsafe-component-will-receive-props": "warn",
1434
- "react/no-unsafe-component-will-update": "warn",
1435
- "react/no-unstable-context-value": "error",
1436
- "react/no-unstable-default-props": "error",
1437
- "react/no-unused-class-component-members": "warn",
1438
- "react/no-unused-state": "warn",
1439
- "react/no-useless-fragment": "warn",
1440
- "react/prefer-destructuring-assignment": "warn",
1441
- "react/prefer-shorthand-boolean": "warn",
1442
- "react/prefer-shorthand-fragment": "warn",
1443
- ...isTypeAware ? {
1444
- "react/no-leaked-conditional-rendering": "warn"
1445
- } : {},
1446
- // overrides
1447
- ...overrides
1448
- }
1449
- }
1450
- ];
1451
- }
1452
-
1453
- // src/configs/regexp.ts
1454
- var import_eslint_plugin_regexp = require("eslint-plugin-regexp");
1455
- async function regexp(options = {}) {
1456
- const config = import_eslint_plugin_regexp.configs["flat/recommended"];
1457
- const rules = {
1458
- ...config.rules
1459
- };
1460
- if (options.level === "warn") {
1461
- for (const key in rules) {
1462
- if (rules[key] === "error")
1463
- rules[key] = "warn";
1464
- }
1465
- }
1466
- return [
1467
- {
1468
- ...config,
1469
- name: "jun/regexp/rules",
1470
- rules: {
1471
- ...rules,
1472
- ...options.overrides
1473
- }
1474
- }
1475
- ];
1476
- }
1477
-
1478
- // src/configs/solid.ts
1479
- async function solid(options = {}) {
1480
- const {
1481
- files = [GLOB_JSX, GLOB_TSX],
1482
- overrides = {},
1483
- typescript: typescript2 = true
1484
- } = options;
1485
- await ensurePackages([
1486
- "eslint-plugin-solid"
1487
- ]);
1488
- const tsconfigPath = options?.tsconfigPath ? toArray(options.tsconfigPath) : void 0;
1489
- const isTypeAware = !!tsconfigPath;
1490
- const [
1491
- pluginSolid,
1492
- parserTs
1493
- ] = await Promise.all([
1494
- interopDefault(import("eslint-plugin-solid")),
1495
- interopDefault(import("@typescript-eslint/parser"))
1496
- ]);
1497
- return [
1498
- {
1499
- name: "jun/solid/setup",
1500
- plugins: {
1501
- solid: pluginSolid
1502
- }
1503
- },
1504
- {
1505
- files,
1506
- languageOptions: {
1507
- parser: parserTs,
1508
- parserOptions: {
1509
- ecmaFeatures: {
1510
- jsx: true
1511
- },
1512
- ...isTypeAware ? { project: tsconfigPath } : {}
1513
- },
1514
- sourceType: "module"
1515
- },
1516
- name: "jun/solid/rules",
1517
- rules: {
1518
- // reactivity
1519
- "solid/components-return-once": "warn",
1520
- "solid/event-handlers": ["error", {
1521
- // if true, don't warn on ambiguously named event handlers like `onclick` or `onchange`
1522
- ignoreCase: false,
1523
- // if true, warn when spreading event handlers onto JSX. Enable for Solid < v1.6.
1524
- warnOnSpread: false
1525
- }],
1526
- // these rules are mostly style suggestions
1527
- "solid/imports": "error",
1528
- // identifier usage is important
1529
- "solid/jsx-no-duplicate-props": "error",
1530
- "solid/jsx-no-script-url": "error",
1531
- "solid/jsx-no-undef": "error",
1532
- "solid/jsx-uses-vars": "error",
1533
- "solid/no-destructure": "error",
1534
- // security problems
1535
- "solid/no-innerhtml": ["error", { allowStatic: true }],
1536
- "solid/no-react-deps": "error",
1537
- "solid/no-react-specific-props": "error",
1538
- "solid/no-unknown-namespaces": "error",
1539
- "solid/prefer-for": "error",
1540
- "solid/reactivity": "warn",
1541
- "solid/self-closing-comp": "error",
1542
- "solid/style-prop": ["error", { styleProps: ["style", "css"] }],
1543
- ...typescript2 ? {
1544
- "solid/jsx-no-undef": ["error", { typescriptEnabled: true }],
1545
- "solid/no-unknown-namespaces": "off"
1546
- } : {},
1547
- // overrides
1548
- ...overrides
1549
- }
1550
- }
1551
- ];
1552
- }
1553
-
1554
- // src/configs/sort.ts
1555
- async function sortPackageJson() {
1556
- return [
1557
- {
1558
- files: ["**/package.json"],
1559
- name: "jun/sort/package-json",
1560
- rules: {
1561
- "jsonc/sort-array-values": [
1562
- "error",
1563
- {
1564
- order: { type: "asc" },
1565
- pathPattern: "^files$"
1566
- }
1567
- ],
1568
- "jsonc/sort-keys": [
1569
- "error",
1570
- {
1571
- order: [
1572
- "publisher",
1573
- "name",
1574
- "displayName",
1575
- "type",
1576
- "version",
1577
- "private",
1578
- "packageManager",
1579
- "description",
1580
- "author",
1581
- "contributors",
1582
- "license",
1583
- "funding",
1584
- "homepage",
1585
- "repository",
1586
- "bugs",
1587
- "keywords",
1588
- "categories",
1589
- "sideEffects",
1590
- "exports",
1591
- "main",
1592
- "module",
1593
- "unpkg",
1594
- "jsdelivr",
1595
- "types",
1596
- "typesVersions",
1597
- "bin",
1598
- "icon",
1599
- "files",
1600
- "engines",
1601
- "activationEvents",
1602
- "contributes",
1603
- "scripts",
1604
- "peerDependencies",
1605
- "peerDependenciesMeta",
1606
- "dependencies",
1607
- "optionalDependencies",
1608
- "devDependencies",
1609
- "pnpm",
1610
- "overrides",
1611
- "resolutions",
1612
- "husky",
1613
- "simple-git-hooks",
1614
- "lint-staged",
1615
- "eslintConfig"
1616
- ],
1617
- pathPattern: "^$"
1618
- },
1619
- {
1620
- order: { type: "asc" },
1621
- pathPattern: "^(?:dev|peer|optional|bundled)?[Dd]ependencies(Meta)?$"
1622
- },
1623
- {
1624
- order: { type: "asc" },
1625
- pathPattern: "^(?:resolutions|overrides|pnpm.overrides)$"
1626
- },
1627
- {
1628
- order: [
1629
- "types",
1630
- "import",
1631
- "require",
1632
- "default"
1633
- ],
1634
- pathPattern: "^exports.*$"
1635
- },
1636
- {
1637
- order: [
1638
- // client hooks only
1639
- "pre-commit",
1640
- "prepare-commit-msg",
1641
- "commit-msg",
1642
- "post-commit",
1643
- "pre-rebase",
1644
- "post-rewrite",
1645
- "post-checkout",
1646
- "post-merge",
1647
- "pre-push",
1648
- "pre-auto-gc"
1649
- ],
1650
- pathPattern: "^(?:gitHooks|husky|simple-git-hooks)$"
1651
- }
1652
- ]
1653
- }
1654
- }
1655
- ];
1656
- }
1657
- function sortTsconfig() {
1658
- return [
1659
- {
1660
- files: ["**/tsconfig.json", "**/tsconfig.*.json"],
1661
- name: "jun/sort/tsconfig-json",
1662
- rules: {
1663
- "jsonc/sort-keys": [
1664
- "error",
1665
- {
1666
- order: [
1667
- "extends",
1668
- "compilerOptions",
1669
- "references",
1670
- "files",
1671
- "include",
1672
- "exclude"
1673
- ],
1674
- pathPattern: "^$"
1675
- },
1676
- {
1677
- order: [
1678
- /* Projects */
1679
- "incremental",
1680
- "composite",
1681
- "tsBuildInfoFile",
1682
- "disableSourceOfProjectReferenceRedirect",
1683
- "disableSolutionSearching",
1684
- "disableReferencedProjectLoad",
1685
- /* Language and Environment */
1686
- "target",
1687
- "jsx",
1688
- "jsxFactory",
1689
- "jsxFragmentFactory",
1690
- "jsxImportSource",
1691
- "lib",
1692
- "moduleDetection",
1693
- "noLib",
1694
- "reactNamespace",
1695
- "useDefineForClassFields",
1696
- "emitDecoratorMetadata",
1697
- "experimentalDecorators",
1698
- /* Modules */
1699
- "baseUrl",
1700
- "rootDir",
1701
- "rootDirs",
1702
- "customConditions",
1703
- "module",
1704
- "moduleResolution",
1705
- "moduleSuffixes",
1706
- "noResolve",
1707
- "paths",
1708
- "resolveJsonModule",
1709
- "resolvePackageJsonExports",
1710
- "resolvePackageJsonImports",
1711
- "typeRoots",
1712
- "types",
1713
- "allowArbitraryExtensions",
1714
- "allowImportingTsExtensions",
1715
- "allowUmdGlobalAccess",
1716
- /* JavaScript Support */
1717
- "allowJs",
1718
- "checkJs",
1719
- "maxNodeModuleJsDepth",
1720
- /* Type Checking */
1721
- "strict",
1722
- "strictBindCallApply",
1723
- "strictFunctionTypes",
1724
- "strictNullChecks",
1725
- "strictPropertyInitialization",
1726
- "allowUnreachableCode",
1727
- "allowUnusedLabels",
1728
- "alwaysStrict",
1729
- "exactOptionalPropertyTypes",
1730
- "noFallthroughCasesInSwitch",
1731
- "noImplicitAny",
1732
- "noImplicitOverride",
1733
- "noImplicitReturns",
1734
- "noImplicitThis",
1735
- "noPropertyAccessFromIndexSignature",
1736
- "noUncheckedIndexedAccess",
1737
- "noUnusedLocals",
1738
- "noUnusedParameters",
1739
- "useUnknownInCatchVariables",
1740
- /* Emit */
1741
- "declaration",
1742
- "declarationDir",
1743
- "declarationMap",
1744
- "downlevelIteration",
1745
- "emitBOM",
1746
- "emitDeclarationOnly",
1747
- "importHelpers",
1748
- "importsNotUsedAsValues",
1749
- "inlineSourceMap",
1750
- "inlineSources",
1751
- "mapRoot",
1752
- "newLine",
1753
- "noEmit",
1754
- "noEmitHelpers",
1755
- "noEmitOnError",
1756
- "outDir",
1757
- "outFile",
1758
- "preserveConstEnums",
1759
- "preserveValueImports",
1760
- "removeComments",
1761
- "sourceMap",
1762
- "sourceRoot",
1763
- "stripInternal",
1764
- /* Interop Constraints */
1765
- "allowSyntheticDefaultImports",
1766
- "esModuleInterop",
1767
- "forceConsistentCasingInFileNames",
1768
- "isolatedDeclarations",
1769
- "isolatedModules",
1770
- "preserveSymlinks",
1771
- "verbatimModuleSyntax",
1772
- /* Completeness */
1773
- "skipDefaultLibCheck",
1774
- "skipLibCheck"
1775
- ],
1776
- pathPattern: "^compilerOptions$"
1777
- }
1778
- ]
1779
- }
1780
- }
1781
- ];
1782
- }
1783
-
1784
- // src/configs/svelte.ts
1785
- async function svelte(options = {}) {
1786
- const {
1787
- files = [GLOB_SVELTE],
1788
- overrides = {},
1789
- stylistic: stylistic2 = true
1790
- } = options;
1791
- const {
1792
- indent = 2,
1793
- quotes = "single"
1794
- } = typeof stylistic2 === "boolean" ? {} : stylistic2;
1795
- await ensurePackages([
1796
- "eslint-plugin-svelte"
1797
- ]);
1798
- const [
1799
- pluginSvelte,
1800
- parserSvelte
1801
- ] = await Promise.all([
1802
- interopDefault(import("eslint-plugin-svelte")),
1803
- interopDefault(import("svelte-eslint-parser"))
1804
- ]);
1805
- return [
1806
- {
1807
- name: "jun/svelte/setup",
1808
- plugins: {
1809
- svelte: pluginSvelte
1810
- }
1811
- },
1812
- {
1813
- files,
1814
- languageOptions: {
1815
- parser: parserSvelte,
1816
- parserOptions: {
1817
- extraFileExtensions: [".svelte"],
1818
- parser: options.typescript ? await interopDefault(import("@typescript-eslint/parser")) : null
1819
- }
1820
- },
1821
- name: "jun/svelte/rules",
1822
- processor: pluginSvelte.processors[".svelte"],
1823
- rules: {
1824
- "import/no-mutable-exports": "off",
1825
- "no-undef": "off",
1826
- // incompatible with most recent (attribute-form) generic types RFC
1827
- "no-unused-vars": ["error", {
1828
- args: "none",
1829
- caughtErrors: "none",
1830
- ignoreRestSiblings: true,
1831
- vars: "all",
1832
- varsIgnorePattern: "^(\\$\\$Props$|\\$\\$Events$|\\$\\$Slots$)"
1833
- }],
1834
- "svelte/comment-directive": "error",
1835
- "svelte/no-at-debug-tags": "warn",
1836
- "svelte/no-at-html-tags": "error",
1837
- "svelte/no-dupe-else-if-blocks": "error",
1838
- "svelte/no-dupe-style-properties": "error",
1839
- "svelte/no-dupe-use-directives": "error",
1840
- "svelte/no-dynamic-slot-name": "error",
1841
- "svelte/no-export-load-in-svelte-module-in-kit-pages": "error",
1842
- "svelte/no-inner-declarations": "error",
1843
- "svelte/no-not-function-handler": "error",
1844
- "svelte/no-object-in-text-mustaches": "error",
1845
- "svelte/no-reactive-functions": "error",
1846
- "svelte/no-reactive-literals": "error",
1847
- "svelte/no-shorthand-style-property-overrides": "error",
1848
- "svelte/no-unknown-style-directive-property": "error",
1849
- "svelte/no-unused-svelte-ignore": "error",
1850
- "svelte/no-useless-mustaches": "error",
1851
- "svelte/require-store-callbacks-use-set-param": "error",
1852
- "svelte/system": "error",
1853
- "svelte/valid-each-key": "error",
1854
- "unused-imports/no-unused-vars": [
1855
- "error",
1856
- {
1857
- args: "after-used",
1858
- argsIgnorePattern: "^_",
1859
- vars: "all",
1860
- varsIgnorePattern: "^(_|\\$\\$Props$|\\$\\$Events$|\\$\\$Slots$)"
1861
- }
1862
- ],
1863
- ...stylistic2 ? {
1864
- "style/indent": "off",
1865
- // superseded by svelte/indent
1866
- "style/no-trailing-spaces": "off",
1867
- // superseded by svelte/no-trailing-spaces
1868
- "svelte/derived-has-same-inputs-outputs": "error",
1869
- "svelte/html-closing-bracket-spacing": "error",
1870
- "svelte/html-quotes": ["error", { prefer: quotes }],
1871
- "svelte/indent": ["error", { alignAttributesVertically: true, indent }],
1872
- "svelte/mustache-spacing": "error",
1873
- "svelte/no-spaces-around-equal-signs-in-attribute": "error",
1874
- "svelte/no-trailing-spaces": "error",
1875
- "svelte/spaced-html-comment": "error"
1876
- } : {},
1877
- ...overrides
1878
- }
1879
- }
1880
- ];
1881
- }
1882
-
1883
- // src/configs/test.ts
1884
- var _pluginTest;
1885
- async function test(options = {}) {
1886
- const {
1887
- files = GLOB_TESTS,
1888
- isInEditor = false,
1889
- overrides = {}
1890
- } = options;
1891
- const [
1892
- pluginVitest,
1893
- pluginNoOnlyTests
1894
- ] = await Promise.all([
1895
- interopDefault(import("@vitest/eslint-plugin")),
1896
- // @ts-expect-error missing types
1897
- interopDefault(import("eslint-plugin-no-only-tests"))
1898
- ]);
1899
- _pluginTest = _pluginTest || {
1900
- ...pluginVitest,
1901
- rules: {
1902
- ...pluginVitest.rules,
1903
- // extend `test/no-only-tests` rule
1904
- ...pluginNoOnlyTests.rules
1905
- }
1906
- };
1907
- return [
1908
- {
1909
- name: "jun/test/setup",
1910
- plugins: {
1911
- test: _pluginTest
1912
- }
1913
- },
1914
- {
1915
- files,
1916
- name: "jun/test/rules",
1917
- rules: {
1918
- "test/consistent-test-it": ["error", { fn: "it", withinDescribe: "it" }],
1919
- "test/no-identical-title": "error",
1920
- "test/no-import-node-test": "error",
1921
- "test/no-only-tests": isInEditor ? "off" : "error",
1922
- "test/prefer-hooks-in-order": "error",
1923
- "test/prefer-lowercase-title": "error",
1924
- // Disables
1925
- ...{
1926
- "jun/no-top-level-await": "off",
1927
- "no-unused-expressions": "off",
1928
- "node/prefer-global/process": "off",
1929
- "ts/explicit-function-return-type": "off"
1930
- },
1931
- ...overrides
1932
- }
1933
- }
1934
- ];
1935
- }
1936
-
1937
- // src/configs/toml.ts
1938
- async function toml(options = {}) {
1939
- const {
1940
- files = [GLOB_TOML],
1941
- overrides = {},
1942
- stylistic: stylistic2 = true
1943
- } = options;
1944
- const {
1945
- indent = 2
1946
- } = typeof stylistic2 === "boolean" ? {} : stylistic2;
1947
- const [
1948
- pluginToml,
1949
- parserToml
1950
- ] = await Promise.all([
1951
- interopDefault(import("eslint-plugin-toml")),
1952
- interopDefault(import("toml-eslint-parser"))
1953
- ]);
1954
- return [
1955
- {
1956
- name: "jun/toml/setup",
1957
- plugins: {
1958
- toml: pluginToml
1959
- }
1960
- },
1961
- {
1962
- files,
1963
- languageOptions: {
1964
- parser: parserToml
1965
- },
1966
- name: "jun/toml/rules",
1967
- rules: {
1968
- "style/spaced-comment": "off",
1969
- "toml/comma-style": "error",
1970
- "toml/keys-order": "error",
1971
- "toml/no-space-dots": "error",
1972
- "toml/no-unreadable-number-separator": "error",
1973
- "toml/precision-of-fractional-seconds": "error",
1974
- "toml/precision-of-integer": "error",
1975
- "toml/tables-order": "error",
1976
- "toml/vue-custom-block/no-parsing-error": "error",
1977
- ...stylistic2 ? {
1978
- "toml/array-bracket-newline": "error",
1979
- "toml/array-bracket-spacing": "error",
1980
- "toml/array-element-newline": "error",
1981
- "toml/indent": ["error", indent === "tab" ? 2 : indent],
1982
- "toml/inline-table-curly-spacing": "error",
1983
- "toml/key-spacing": "error",
1984
- "toml/padding-line-between-pairs": "error",
1985
- "toml/padding-line-between-tables": "error",
1986
- "toml/quoted-keys": "error",
1987
- "toml/spaced-comment": "error",
1988
- "toml/table-bracket-spacing": "error"
1989
- } : {},
1990
- ...overrides
1991
- }
1992
- }
1993
- ];
1994
- }
1995
-
1996
- // src/configs/typescript.ts
1997
- var import_node_process2 = __toESM(require("process"), 1);
1998
- async function typescript(options = {}) {
1999
- const {
2000
- componentExts = [],
2001
- overrides = {},
2002
- overridesTypeAware = {},
2003
- parserOptions = {},
2004
- type = "app"
2005
- } = options;
2006
- const files = options.files ?? [
2007
- GLOB_TS,
2008
- GLOB_TSX,
2009
- ...componentExts.map((ext) => `**/*.${ext}`)
2010
- ];
2011
- const filesTypeAware = options.filesTypeAware ?? [GLOB_TS, GLOB_TSX];
2012
- const ignoresTypeAware = options.ignoresTypeAware ?? [
2013
- `${GLOB_MARKDOWN}/**`,
2014
- GLOB_ASTRO_TS
2015
- ];
2016
- const tsconfigPath = options?.tsconfigPath ? options.tsconfigPath : void 0;
2017
- const isTypeAware = !!tsconfigPath;
2018
- const typeAwareRules = {
2019
- "dot-notation": "off",
2020
- "no-implied-eval": "off",
2021
- "ts/await-thenable": "error",
2022
- "ts/dot-notation": ["error", { allowKeywords: true }],
2023
- "ts/no-floating-promises": "error",
2024
- "ts/no-for-in-array": "error",
2025
- "ts/no-implied-eval": "error",
2026
- "ts/no-misused-promises": "error",
2027
- "ts/no-unnecessary-type-assertion": "error",
2028
- "ts/no-unsafe-argument": "error",
2029
- "ts/no-unsafe-assignment": "error",
2030
- "ts/no-unsafe-call": "error",
2031
- "ts/no-unsafe-member-access": "error",
2032
- "ts/no-unsafe-return": "error",
2033
- "ts/promise-function-async": "error",
2034
- "ts/restrict-plus-operands": "error",
2035
- "ts/restrict-template-expressions": "error",
2036
- "ts/return-await": ["error", "in-try-catch"],
2037
- "ts/strict-boolean-expressions": ["error", { allowNullableBoolean: true, allowNullableObject: true }],
2038
- "ts/switch-exhaustiveness-check": "error",
2039
- "ts/unbound-method": "error"
2040
- };
2041
- const [
2042
- pluginTs,
2043
- parserTs
2044
- ] = await Promise.all([
2045
- interopDefault(import("@typescript-eslint/eslint-plugin")),
2046
- interopDefault(import("@typescript-eslint/parser"))
2047
- ]);
2048
- function makeParser(typeAware, files2, ignores2) {
2049
- return {
2050
- files: files2,
2051
- ...ignores2 ? { ignores: ignores2 } : {},
2052
- languageOptions: {
2053
- parser: parserTs,
2054
- parserOptions: {
2055
- extraFileExtensions: componentExts.map((ext) => `.${ext}`),
2056
- sourceType: "module",
2057
- ...typeAware ? {
2058
- projectService: {
2059
- allowDefaultProject: ["./*.js"],
2060
- defaultProject: tsconfigPath
2061
- },
2062
- tsconfigRootDir: import_node_process2.default.cwd()
2063
- } : {},
2064
- ...parserOptions
2065
- }
2066
- },
2067
- name: `jun/typescript/${typeAware ? "type-aware-parser" : "parser"}`
2068
- };
2069
- }
2070
- return [
2071
- {
2072
- // Install the plugins without globs, so they can be configured separately.
2073
- name: "jun/typescript/setup",
2074
- plugins: {
2075
- jun: import_eslint_plugin_antfu.default,
2076
- ts: pluginTs
2077
- }
2078
- },
2079
- // assign type-aware parser for type-aware files and type-unaware parser for the rest
2080
- ...isTypeAware ? [
2081
- makeParser(false, files),
2082
- makeParser(true, filesTypeAware, ignoresTypeAware)
2083
- ] : [
2084
- makeParser(false, files)
2085
- ],
2086
- {
2087
- files,
2088
- name: "jun/typescript/rules",
2089
- rules: {
2090
- ...renameRules(
2091
- pluginTs.configs["eslint-recommended"].overrides[0].rules,
2092
- { "@typescript-eslint": "ts" }
2093
- ),
2094
- ...renameRules(
2095
- pluginTs.configs.strict.rules,
2096
- { "@typescript-eslint": "ts" }
2097
- ),
2098
- "no-dupe-class-members": "off",
2099
- "no-redeclare": "off",
2100
- "no-use-before-define": "off",
2101
- "no-useless-constructor": "off",
2102
- "ts/ban-ts-comment": ["error", { "ts-expect-error": "allow-with-description" }],
2103
- "ts/consistent-type-definitions": ["error", "interface"],
2104
- "ts/consistent-type-imports": ["error", {
2105
- disallowTypeAnnotations: false,
2106
- prefer: "type-imports"
2107
- }],
2108
- "ts/method-signature-style": ["error", "property"],
2109
- // https://www.totaltypescript.com/method-shorthand-syntax-considered-harmful
2110
- "ts/no-dupe-class-members": "error",
2111
- "ts/no-dynamic-delete": "off",
2112
- "ts/no-empty-object-type": ["error", { allowInterfaces: "always" }],
2113
- "ts/no-explicit-any": "off",
2114
- "ts/no-extraneous-class": "off",
2115
- "ts/no-import-type-side-effects": "error",
2116
- "ts/no-invalid-void-type": "off",
2117
- "ts/no-non-null-assertion": "off",
2118
- "ts/no-redeclare": ["error", { builtinGlobals: false }],
2119
- "ts/no-require-imports": "error",
2120
- "ts/no-unused-expressions": ["error", {
2121
- allowShortCircuit: true,
2122
- allowTaggedTemplates: true,
2123
- allowTernary: true
2124
- }],
2125
- "ts/no-unused-vars": "off",
2126
- "ts/no-use-before-define": ["error", { classes: false, functions: false, variables: true }],
2127
- "ts/no-useless-constructor": "off",
2128
- "ts/no-wrapper-object-types": "error",
2129
- "ts/triple-slash-reference": "off",
2130
- "ts/unified-signatures": "off",
2131
- ...type === "lib" ? {
2132
- "ts/explicit-function-return-type": ["error", {
2133
- allowExpressions: true,
2134
- allowHigherOrderFunctions: true,
2135
- allowIIFEs: true
2136
- }]
2137
- } : {},
2138
- ...overrides
2139
- }
2140
- },
2141
- ...isTypeAware ? [{
2142
- files: filesTypeAware,
2143
- ignores: ignoresTypeAware,
2144
- name: "jun/typescript/rules-type-aware",
2145
- rules: {
2146
- ...typeAwareRules,
2147
- ...overridesTypeAware
2148
- }
2149
- }] : []
2150
- ];
2151
- }
2152
-
2153
- // src/configs/unicorn.ts
2154
- async function unicorn(options = {}) {
2155
- return [
2156
- {
2157
- name: "jun/unicorn/rules",
2158
- plugins: {
2159
- unicorn: import_eslint_plugin_unicorn.default
2160
- },
2161
- rules: {
2162
- ...options.allRecommended ? import_eslint_plugin_unicorn.default.configs["flat/recommended"].rules : {
2163
- "unicorn/consistent-empty-array-spread": "error",
2164
- "unicorn/error-message": "error",
2165
- "unicorn/escape-case": "error",
2166
- "unicorn/new-for-builtins": "error",
2167
- "unicorn/no-instanceof-array": "error",
2168
- "unicorn/no-new-array": "error",
2169
- "unicorn/no-new-buffer": "error",
2170
- "unicorn/number-literal-case": "error",
2171
- "unicorn/prefer-dom-node-text-content": "error",
2172
- "unicorn/prefer-includes": "error",
2173
- "unicorn/prefer-node-protocol": "error",
2174
- "unicorn/prefer-number-properties": "error",
2175
- "unicorn/prefer-string-starts-ends-with": "error",
2176
- "unicorn/prefer-type-error": "error",
2177
- "unicorn/throw-new-error": "error"
2178
- }
2179
- }
2180
- }
2181
- ];
2182
- }
2183
-
2184
- // src/configs/unocss.ts
2185
- async function unocss(options = {}) {
2186
- const {
2187
- attributify = true,
2188
- strict = false
2189
- } = options;
2190
- await ensurePackages([
2191
- "@unocss/eslint-plugin"
2192
- ]);
2193
- const [
2194
- pluginUnoCSS
2195
- ] = await Promise.all([
2196
- interopDefault(import("@unocss/eslint-plugin"))
2197
- ]);
2198
- return [
2199
- {
2200
- name: "jun/unocss",
2201
- plugins: {
2202
- unocss: pluginUnoCSS
2203
- },
2204
- rules: {
2205
- "unocss/order": "warn",
2206
- ...attributify ? {
2207
- "unocss/order-attributify": "warn"
2208
- } : {},
2209
- ...strict ? {
2210
- "unocss/blocklist": "error"
2211
- } : {}
2212
- }
2213
- }
2214
- ];
2215
- }
2216
-
2217
- // src/configs/vue.ts
2218
- var import_eslint_merge_processors2 = require("eslint-merge-processors");
2219
- async function vue(options = {}) {
2220
- const {
2221
- files = [GLOB_VUE],
2222
- overrides = {},
2223
- stylistic: stylistic2 = true,
2224
- vueVersion = 3
2225
- } = options;
2226
- const sfcBlocks = options.sfcBlocks === true ? {} : options.sfcBlocks ?? {};
2227
- const {
2228
- indent = 2
2229
- } = typeof stylistic2 === "boolean" ? {} : stylistic2;
2230
- const [
2231
- pluginVue,
2232
- parserVue,
2233
- processorVueBlocks
2234
- ] = await Promise.all([
2235
- // @ts-expect-error missing types
2236
- interopDefault(import("eslint-plugin-vue")),
2237
- interopDefault(import("vue-eslint-parser")),
2238
- interopDefault(import("eslint-processor-vue-blocks"))
2239
- ]);
2240
- return [
2241
- {
2242
- // This allows Vue plugin to work with auto imports
2243
- // https://github.com/vuejs/eslint-plugin-vue/pull/2422
2244
- languageOptions: {
2245
- globals: {
2246
- computed: "readonly",
2247
- defineEmits: "readonly",
2248
- defineExpose: "readonly",
2249
- defineProps: "readonly",
2250
- onMounted: "readonly",
2251
- onUnmounted: "readonly",
2252
- reactive: "readonly",
2253
- ref: "readonly",
2254
- shallowReactive: "readonly",
2255
- shallowRef: "readonly",
2256
- toRef: "readonly",
2257
- toRefs: "readonly",
2258
- watch: "readonly",
2259
- watchEffect: "readonly"
2260
- }
2261
- },
2262
- name: "jun/vue/setup",
2263
- plugins: {
2264
- vue: pluginVue
2265
- }
2266
- },
2267
- {
2268
- files,
2269
- languageOptions: {
2270
- parser: parserVue,
2271
- parserOptions: {
2272
- ecmaFeatures: {
2273
- jsx: true
2274
- },
2275
- extraFileExtensions: [".vue"],
2276
- parser: options.typescript ? await interopDefault(import("@typescript-eslint/parser")) : null,
2277
- sourceType: "module"
2278
- }
2279
- },
2280
- name: "jun/vue/rules",
2281
- processor: sfcBlocks === false ? pluginVue.processors[".vue"] : (0, import_eslint_merge_processors2.mergeProcessors)([
2282
- pluginVue.processors[".vue"],
2283
- processorVueBlocks({
2284
- ...sfcBlocks,
2285
- blocks: {
2286
- styles: true,
2287
- ...sfcBlocks.blocks
2288
- }
2289
- })
2290
- ]),
2291
- rules: {
2292
- ...pluginVue.configs.base.rules,
2293
- ...vueVersion === 2 ? {
2294
- ...pluginVue.configs.essential.rules,
2295
- ...pluginVue.configs["strongly-recommended"].rules,
2296
- ...pluginVue.configs.recommended.rules
2297
- } : {
2298
- ...pluginVue.configs["vue3-essential"].rules,
2299
- ...pluginVue.configs["vue3-strongly-recommended"].rules,
2300
- ...pluginVue.configs["vue3-recommended"].rules
2301
- },
2302
- "jun/no-top-level-await": "off",
2303
- "node/prefer-global/process": "off",
2304
- "ts/explicit-function-return-type": "off",
2305
- "vue/block-order": ["error", {
2306
- order: ["script", "template", "style"]
2307
- }],
2308
- "vue/component-name-in-template-casing": ["error", "PascalCase"],
2309
- "vue/component-options-name-casing": ["error", "PascalCase"],
2310
- // this is deprecated
2311
- "vue/component-tags-order": "off",
2312
- "vue/custom-event-name-casing": ["error", "camelCase"],
2313
- "vue/define-macros-order": ["error", {
2314
- order: ["defineOptions", "defineProps", "defineEmits", "defineSlots"]
2315
- }],
2316
- "vue/dot-location": ["error", "property"],
2317
- "vue/dot-notation": ["error", { allowKeywords: true }],
2318
- "vue/eqeqeq": ["error", "smart"],
2319
- "vue/html-indent": ["error", indent],
2320
- "vue/html-quotes": ["error", "double"],
2321
- "vue/max-attributes-per-line": "off",
2322
- "vue/multi-word-component-names": "off",
2323
- "vue/no-dupe-keys": "off",
2324
- "vue/no-empty-pattern": "error",
2325
- "vue/no-irregular-whitespace": "error",
2326
- "vue/no-loss-of-precision": "error",
2327
- "vue/no-restricted-syntax": [
2328
- "error",
2329
- "DebuggerStatement",
2330
- "LabeledStatement",
2331
- "WithStatement"
2332
- ],
2333
- "vue/no-restricted-v-bind": ["error", "/^v-/"],
2334
- "vue/no-setup-props-reactivity-loss": "off",
2335
- "vue/no-sparse-arrays": "error",
2336
- "vue/no-unused-refs": "error",
2337
- "vue/no-useless-v-bind": "error",
2338
- "vue/no-v-html": "off",
2339
- "vue/object-shorthand": [
2340
- "error",
2341
- "always",
2342
- {
2343
- avoidQuotes: true,
2344
- ignoreConstructors: false
2345
- }
2346
- ],
2347
- "vue/prefer-separate-static-class": "error",
2348
- "vue/prefer-template": "error",
2349
- "vue/prop-name-casing": ["error", "camelCase"],
2350
- "vue/require-default-prop": "off",
2351
- "vue/require-prop-types": "off",
2352
- "vue/space-infix-ops": "error",
2353
- "vue/space-unary-ops": ["error", { nonwords: false, words: true }],
2354
- ...stylistic2 ? {
2355
- "vue/array-bracket-spacing": ["error", "never"],
2356
- "vue/arrow-spacing": ["error", { after: true, before: true }],
2357
- "vue/block-spacing": ["error", "always"],
2358
- "vue/block-tag-newline": ["error", {
2359
- multiline: "always",
2360
- singleline: "always"
2361
- }],
2362
- "vue/brace-style": ["error", "1tbs", { allowSingleLine: true }],
2363
- "vue/comma-dangle": ["error", "always-multiline"],
2364
- "vue/comma-spacing": ["error", { after: true, before: false }],
2365
- "vue/comma-style": ["error", "last"],
2366
- "vue/html-comment-content-spacing": ["error", "always", {
2367
- exceptions: ["-"]
2368
- }],
2369
- "vue/key-spacing": ["error", { afterColon: true, beforeColon: false }],
2370
- "vue/keyword-spacing": ["error", { after: true, before: true }],
2371
- "vue/object-curly-newline": "off",
2372
- "vue/object-curly-spacing": ["error", "always"],
2373
- "vue/object-property-newline": ["error", { allowMultiplePropertiesPerLine: true }],
2374
- "vue/operator-linebreak": ["error", "before"],
2375
- "vue/padding-line-between-blocks": ["error", "always"],
2376
- "vue/quote-props": ["error", "consistent-as-needed"],
2377
- "vue/space-in-parens": ["error", "never"],
2378
- "vue/template-curly-spacing": "error"
2379
- } : {},
2380
- ...overrides
2381
- }
2382
- }
2383
- ];
2384
- }
2385
-
2386
- // src/configs/yaml.ts
2387
- async function yaml(options = {}) {
2388
- const {
2389
- files = [GLOB_YAML],
2390
- overrides = {},
2391
- stylistic: stylistic2 = true
2392
- } = options;
2393
- const {
2394
- indent = 2,
2395
- quotes = "single"
2396
- } = typeof stylistic2 === "boolean" ? {} : stylistic2;
2397
- const [
2398
- pluginYaml,
2399
- parserYaml
2400
- ] = await Promise.all([
2401
- interopDefault(import("eslint-plugin-yml")),
2402
- interopDefault(import("yaml-eslint-parser"))
2403
- ]);
2404
- return [
2405
- {
2406
- name: "jun/yaml/setup",
2407
- plugins: {
2408
- yaml: pluginYaml
2409
- }
2410
- },
2411
- {
2412
- files,
2413
- languageOptions: {
2414
- parser: parserYaml
2415
- },
2416
- name: "jun/yaml/rules",
2417
- rules: {
2418
- "style/spaced-comment": "off",
2419
- "yaml/block-mapping": "error",
2420
- "yaml/block-sequence": "error",
2421
- "yaml/no-empty-key": "error",
2422
- "yaml/no-empty-sequence-entry": "error",
2423
- "yaml/no-irregular-whitespace": "error",
2424
- "yaml/plain-scalar": "error",
2425
- "yaml/vue-custom-block/no-parsing-error": "error",
2426
- ...stylistic2 ? {
2427
- "yaml/block-mapping-question-indicator-newline": "error",
2428
- "yaml/block-sequence-hyphen-indicator-newline": "error",
2429
- "yaml/flow-mapping-curly-newline": "error",
2430
- "yaml/flow-mapping-curly-spacing": "error",
2431
- "yaml/flow-sequence-bracket-newline": "error",
2432
- "yaml/flow-sequence-bracket-spacing": "error",
2433
- "yaml/indent": ["error", indent === "tab" ? 2 : indent],
2434
- "yaml/key-spacing": "error",
2435
- "yaml/no-tab-indent": "error",
2436
- "yaml/quotes": ["error", { avoidEscape: false, prefer: quotes }],
2437
- "yaml/spaced-comment": "error"
2438
- } : {},
2439
- ...overrides
2440
- }
2441
- }
2442
- ];
2443
- }
2444
-
2445
- // src/factory.ts
2446
- var flatConfigProps = [
2447
- "name",
2448
- "languageOptions",
2449
- "linterOptions",
2450
- "processor",
2451
- "plugins",
2452
- "rules",
2453
- "settings"
2454
- ];
2455
- var VuePackages = [
2456
- "vue",
2457
- "nuxt",
2458
- "vitepress",
2459
- "@slidev/cli"
2460
- ];
2461
- var defaultPluginRenaming = {
2462
- "@eslint-react": "react",
2463
- "@eslint-react/dom": "react-dom",
2464
- "@eslint-react/hooks-extra": "react-hooks-extra",
2465
- "@eslint-react/naming-convention": "react-naming-convention",
2466
- "@stylistic": "style",
2467
- "@typescript-eslint": "ts",
2468
- "import-x": "import",
2469
- "n": "node",
2470
- "vitest": "test",
2471
- "yml": "yaml"
2472
- };
2473
- function jun(options = {}, ...userConfigs) {
2474
- const {
2475
- astro: enableAstro = false,
2476
- autoRenamePlugins = true,
2477
- componentExts = [],
2478
- gitignore: enableGitignore = true,
2479
- jsx: enableJsx = true,
2480
- react: enableReact = false,
2481
- regexp: enableRegexp = true,
2482
- solid: enableSolid = false,
2483
- svelte: enableSvelte = false,
2484
- typescript: enableTypeScript = (0, import_local_pkg4.isPackageExists)("typescript"),
2485
- unicorn: enableUnicorn = true,
2486
- unocss: enableUnoCSS = false,
2487
- vue: enableVue = VuePackages.some((i) => (0, import_local_pkg4.isPackageExists)(i))
2488
- } = options;
2489
- let isInEditor = options.isInEditor;
2490
- if (isInEditor == null) {
2491
- isInEditor = isInEditorEnv();
2492
- if (isInEditor)
2493
- console.log("[@jun2030/eslint-config] Detected running in editor, some rules are disabled.");
2494
- }
2495
- const stylisticOptions = options.stylistic === false ? false : typeof options.stylistic === "object" ? options.stylistic : {};
2496
- if (stylisticOptions && !("jsx" in stylisticOptions))
2497
- stylisticOptions.jsx = enableJsx;
2498
- const configs2 = [];
2499
- if (enableGitignore) {
2500
- if (typeof enableGitignore !== "boolean") {
2501
- configs2.push(interopDefault(import("eslint-config-flat-gitignore")).then((r) => [r({
2502
- name: "jun/gitignore",
2503
- ...enableGitignore
2504
- })]));
2505
- } else {
2506
- configs2.push(interopDefault(import("eslint-config-flat-gitignore")).then((r) => [r({
2507
- name: "jun/gitignore",
2508
- strict: false
2509
- })]));
2510
- }
2511
- }
2512
- const typescriptOptions = resolveSubOptions(options, "typescript");
2513
- const tsconfigPath = "tsconfigPath" in typescriptOptions ? typescriptOptions.tsconfigPath : void 0;
2514
- configs2.push(
2515
- ignores(options.ignores),
2516
- javascript({
2517
- isInEditor,
2518
- overrides: getOverrides(options, "javascript")
2519
- }),
2520
- comments(),
2521
- node(),
2522
- jsdoc({
2523
- stylistic: stylisticOptions
2524
- }),
2525
- imports({
2526
- stylistic: stylisticOptions
2527
- }),
2528
- command(),
2529
- // Optional plugins (installed but not enabled by default)
2530
- perfectionist()
2531
- );
2532
- if (enableUnicorn) {
2533
- configs2.push(unicorn(enableUnicorn === true ? {} : enableUnicorn));
2534
- }
2535
- if (enableVue) {
2536
- componentExts.push("vue");
2537
- }
2538
- if (enableJsx) {
2539
- configs2.push(jsx());
2540
- }
2541
- if (enableTypeScript) {
2542
- configs2.push(typescript({
2543
- ...typescriptOptions,
2544
- componentExts,
2545
- overrides: getOverrides(options, "typescript"),
2546
- type: options.type
2547
- }));
2548
- }
2549
- if (stylisticOptions) {
2550
- configs2.push(stylistic({
2551
- ...stylisticOptions,
2552
- lessOpinionated: options.lessOpinionated,
2553
- overrides: getOverrides(options, "stylistic")
2554
- }));
2555
- }
2556
- if (enableRegexp) {
2557
- configs2.push(regexp(typeof enableRegexp === "boolean" ? {} : enableRegexp));
2558
- }
2559
- if (options.test ?? true) {
2560
- configs2.push(test({
2561
- isInEditor,
2562
- overrides: getOverrides(options, "test")
2563
- }));
2564
- }
2565
- if (enableVue) {
2566
- configs2.push(vue({
2567
- ...resolveSubOptions(options, "vue"),
2568
- overrides: getOverrides(options, "vue"),
2569
- stylistic: stylisticOptions,
2570
- typescript: !!enableTypeScript
2571
- }));
2572
- }
2573
- if (enableReact) {
2574
- configs2.push(react({
2575
- overrides: getOverrides(options, "react"),
2576
- tsconfigPath
2577
- }));
2578
- }
2579
- if (enableSolid) {
2580
- configs2.push(solid({
2581
- overrides: getOverrides(options, "solid"),
2582
- tsconfigPath,
2583
- typescript: !!enableTypeScript
2584
- }));
2585
- }
2586
- if (enableSvelte) {
2587
- configs2.push(svelte({
2588
- overrides: getOverrides(options, "svelte"),
2589
- stylistic: stylisticOptions,
2590
- typescript: !!enableTypeScript
2591
- }));
2592
- }
2593
- if (enableUnoCSS) {
2594
- configs2.push(unocss({
2595
- ...resolveSubOptions(options, "unocss"),
2596
- overrides: getOverrides(options, "unocss")
2597
- }));
2598
- }
2599
- if (enableAstro) {
2600
- configs2.push(astro({
2601
- overrides: getOverrides(options, "astro"),
2602
- stylistic: stylisticOptions
2603
- }));
2604
- }
2605
- if (options.jsonc ?? true) {
2606
- configs2.push(
2607
- jsonc({
2608
- overrides: getOverrides(options, "jsonc"),
2609
- stylistic: stylisticOptions
2610
- }),
2611
- sortPackageJson(),
2612
- sortTsconfig()
2613
- );
2614
- }
2615
- if (options.yaml ?? true) {
2616
- configs2.push(yaml({
2617
- overrides: getOverrides(options, "yaml"),
2618
- stylistic: stylisticOptions
2619
- }));
2620
- }
2621
- if (options.toml ?? true) {
2622
- configs2.push(toml({
2623
- overrides: getOverrides(options, "toml"),
2624
- stylistic: stylisticOptions
2625
- }));
2626
- }
2627
- if (options.markdown ?? true) {
2628
- configs2.push(
2629
- markdown(
2630
- {
2631
- componentExts,
2632
- overrides: getOverrides(options, "markdown")
2633
- }
2634
- )
2635
- );
2636
- }
2637
- if (options.formatters) {
2638
- configs2.push(formatters(
2639
- options.formatters,
2640
- typeof stylisticOptions === "boolean" ? {} : stylisticOptions
2641
- ));
2642
- }
2643
- configs2.push(
2644
- disables()
2645
- );
2646
- if ("files" in options) {
2647
- throw new Error('[@jun2030/eslint-config] The first argument should not contain the "files" property as the options are supposed to be global. Place it in the second or later config instead.');
2648
- }
2649
- const fusedConfig = flatConfigProps.reduce((acc, key) => {
2650
- if (key in options)
2651
- acc[key] = options[key];
2652
- return acc;
2653
- }, {});
2654
- if (Object.keys(fusedConfig).length)
2655
- configs2.push([fusedConfig]);
2656
- let composer = new import_eslint_flat_config_utils.FlatConfigComposer();
2657
- composer = composer.append(
2658
- ...configs2,
2659
- ...userConfigs
2660
- );
2661
- if (autoRenamePlugins) {
2662
- composer = composer.renamePlugins(defaultPluginRenaming);
2663
- }
2664
- return composer;
2665
- }
2666
- function resolveSubOptions(options, key) {
2667
- return typeof options[key] === "boolean" ? {} : options[key] || {};
2668
- }
2669
- function getOverrides(options, key) {
2670
- const sub = resolveSubOptions(options, key);
2671
- return {
2672
- ...options.overrides?.[key],
2673
- ..."overrides" in sub ? sub.overrides : {}
2674
- };
2675
- }
2676
-
2677
- // src/index.ts
2678
- var src_default = jun;
2679
- // Annotate the CommonJS export names for ESM import in node:
2680
- 0 && (module.exports = {
2681
- GLOB_ALL_SRC,
2682
- GLOB_ASTRO,
2683
- GLOB_ASTRO_TS,
2684
- GLOB_CSS,
2685
- GLOB_EXCLUDE,
2686
- GLOB_GRAPHQL,
2687
- GLOB_HTML,
2688
- GLOB_JS,
2689
- GLOB_JSON,
2690
- GLOB_JSON5,
2691
- GLOB_JSONC,
2692
- GLOB_JSX,
2693
- GLOB_LESS,
2694
- GLOB_MARKDOWN,
2695
- GLOB_MARKDOWN_CODE,
2696
- GLOB_MARKDOWN_IN_MARKDOWN,
2697
- GLOB_POSTCSS,
2698
- GLOB_SCSS,
2699
- GLOB_SRC,
2700
- GLOB_SRC_EXT,
2701
- GLOB_STYLE,
2702
- GLOB_SVELTE,
2703
- GLOB_SVG,
2704
- GLOB_TESTS,
2705
- GLOB_TOML,
2706
- GLOB_TS,
2707
- GLOB_TSX,
2708
- GLOB_VUE,
2709
- GLOB_XML,
2710
- GLOB_YAML,
2711
- StylisticConfigDefaults,
2712
- astro,
2713
- combine,
2714
- command,
2715
- comments,
2716
- defaultPluginRenaming,
2717
- disables,
2718
- ensurePackages,
2719
- formatters,
2720
- getOverrides,
2721
- ignores,
2722
- imports,
2723
- interopDefault,
2724
- isInEditorEnv,
2725
- isInGitHooksOrLintStaged,
2726
- isPackageInScope,
2727
- javascript,
2728
- jsdoc,
2729
- jsonc,
2730
- jsx,
2731
- jun,
2732
- markdown,
2733
- node,
2734
- parserPlain,
2735
- perfectionist,
2736
- react,
2737
- regexp,
2738
- renamePluginInConfigs,
2739
- renameRules,
2740
- resolveSubOptions,
2741
- solid,
2742
- sortPackageJson,
2743
- sortTsconfig,
2744
- stylistic,
2745
- svelte,
2746
- test,
2747
- toArray,
2748
- toml,
2749
- typescript,
2750
- unicorn,
2751
- unocss,
2752
- vue,
2753
- yaml
2754
- });