@lincy/eslint-config 5.0.0 → 5.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.cjs CHANGED
@@ -63,6 +63,7 @@ __export(src_exports, {
63
63
  comments: () => comments,
64
64
  default: () => src_default,
65
65
  defaultPluginRenaming: () => defaultPluginRenaming,
66
+ disables: () => disables,
66
67
  ensurePackages: () => ensurePackages,
67
68
  formatters: () => formatters,
68
69
  ignores: () => ignores,
@@ -78,6 +79,7 @@ __export(src_exports, {
78
79
  lincy: () => lincy,
79
80
  markdown: () => markdown,
80
81
  node: () => node,
82
+ parserPlain: () => parserPlain,
81
83
  perfectionist: () => perfectionist,
82
84
  react: () => react,
83
85
  regexp: () => regexp,
@@ -97,22 +99,22 @@ __export(src_exports, {
97
99
  });
98
100
  module.exports = __toCommonJS(src_exports);
99
101
 
100
- // node_modules/.pnpm/tsup@8.2.4_jiti@1.21.6_postcss@8.4.41_tsx@4.19.0_typescript@5.5.4_yaml@2.5.0/node_modules/tsup/assets/cjs_shims.js
102
+ // node_modules/.pnpm/tsup@8.2.4_jiti@1.21.6_postcss@8.4.45_tsx@4.19.1_typescript@5.6.2_yaml@2.5.1/node_modules/tsup/assets/cjs_shims.js
101
103
  var getImportMetaUrl = () => typeof document === "undefined" ? new URL(`file:${__filename}`).href : document.currentScript && document.currentScript.src || new URL("main.js", document.baseURI).href;
102
104
  var importMetaUrl = /* @__PURE__ */ getImportMetaUrl();
103
105
 
104
106
  // src/factory.ts
105
- var import_local_pkg4 = require("local-pkg");
106
107
  var import_eslint_flat_config_utils = require("eslint-flat-config-utils");
108
+ var import_local_pkg4 = require("local-pkg");
107
109
 
108
110
  // src/plugins.ts
109
- var import_eslint_plugin_antfu = __toESM(require("eslint-plugin-antfu"), 1);
110
111
  var import_eslint_plugin_eslint_comments = __toESM(require("@eslint-community/eslint-plugin-eslint-comments"), 1);
112
+ var import_eslint_plugin_antfu = __toESM(require("eslint-plugin-antfu"), 1);
111
113
  var pluginImport = __toESM(require("eslint-plugin-import-x"), 1);
112
114
  var import_eslint_plugin_n = __toESM(require("eslint-plugin-n"), 1);
115
+ var import_eslint_plugin_perfectionist = __toESM(require("eslint-plugin-perfectionist"), 1);
113
116
  var import_eslint_plugin_unicorn = __toESM(require("eslint-plugin-unicorn"), 1);
114
117
  var import_eslint_plugin_unused_imports = __toESM(require("eslint-plugin-unused-imports"), 1);
115
- var import_eslint_plugin_perfectionist = __toESM(require("eslint-plugin-perfectionist"), 1);
116
118
 
117
119
  // src/configs/comments.ts
118
120
  async function comments() {
@@ -205,149 +207,542 @@ var GLOB_EXCLUDE = [
205
207
  "**/components.d.ts"
206
208
  ];
207
209
 
208
- // src/configs/ignores.ts
209
- async function ignores(options = {}) {
210
- const {
211
- ignores: ignores2 = []
212
- } = options;
210
+ // src/configs/disables.ts
211
+ async function disables() {
213
212
  return [
214
213
  {
215
- ignores: [
216
- ...GLOB_EXCLUDE,
217
- ...ignores2
218
- ],
219
- name: "eslint/ignores"
220
- }
221
- ];
222
- }
223
-
224
- // src/configs/imports.ts
225
- async function imports(options = {}) {
226
- const {
227
- stylistic: stylistic2 = true
228
- } = options;
229
- return [
214
+ files: [`scripts/${GLOB_SRC}`],
215
+ name: "eslint/disables/scripts",
216
+ rules: {
217
+ "no-console": "off",
218
+ "ts/explicit-function-return-type": "off"
219
+ }
220
+ },
230
221
  {
231
- name: "eslint/imports/rules",
232
- plugins: {
233
- antfu: import_eslint_plugin_antfu.default,
234
- import: pluginImport
235
- },
222
+ files: [`cli/${GLOB_SRC}`, `cli.${GLOB_SRC_EXT}`],
223
+ name: "eslint/disables/cli",
236
224
  rules: {
237
- "antfu/import-dedupe": "error",
238
- "antfu/no-import-dist": "error",
239
- "antfu/no-import-node-modules-by-path": "error",
240
- "import/first": "error",
241
- "import/no-duplicates": "error",
242
- "import/no-mutable-exports": "error",
243
- "import/no-named-default": "error",
244
- "import/no-self-import": "error",
245
- "import/no-webpack-loader-syntax": "error",
246
- "import/order": "error",
247
- ...stylistic2 ? {
248
- "import/newline-after-import": ["error", { considerComments: true, count: 1 }]
249
- } : {}
225
+ "no-console": "off"
250
226
  }
251
227
  },
252
228
  {
253
229
  files: ["**/bin/**/*", `**/bin.${GLOB_SRC_EXT}`],
254
- name: "eslint/imports/disables/bin",
230
+ name: "eslint/disables/bin",
255
231
  rules: {
256
232
  "antfu/no-import-dist": "off",
257
233
  "antfu/no-import-node-modules-by-path": "off"
258
234
  }
235
+ },
236
+ {
237
+ files: ["**/*.d.?([cm])ts"],
238
+ name: "eslint/disables/dts",
239
+ rules: {
240
+ "eslint-comments/no-unlimited-disable": "off",
241
+ "import/no-duplicates": "off",
242
+ "no-restricted-syntax": "off",
243
+ "unused-imports/no-unused-vars": "off"
244
+ }
245
+ },
246
+ {
247
+ files: ["**/*.{test,spec}.([tj])s?(x)"],
248
+ name: "eslint/disables/test",
249
+ rules: {
250
+ "no-unused-expressions": "off"
251
+ }
252
+ },
253
+ {
254
+ files: ["**/*.js", "**/*.cjs"],
255
+ name: "eslint/disables/cjs",
256
+ rules: {
257
+ "ts/no-require-imports": "off"
258
+ }
259
259
  }
260
260
  ];
261
261
  }
262
262
 
263
- // src/configs/javascript.ts
264
- var import_globals = __toESM(require("globals"), 1);
265
- async function javascript(options = {}) {
263
+ // src/utils.ts
264
+ var import_node_process = __toESM(require("process"), 1);
265
+ var import_node_url = require("url");
266
+ var import_local_pkg = require("local-pkg");
267
+ var scopeUrl = (0, import_node_url.fileURLToPath)(new URL(".", importMetaUrl));
268
+ var isCwdInScope = (0, import_local_pkg.isPackageExists)("@antfu/eslint-config");
269
+ var parserPlain = {
270
+ meta: {
271
+ name: "parser-plain"
272
+ },
273
+ parseForESLint: (code) => ({
274
+ ast: {
275
+ body: [],
276
+ comments: [],
277
+ loc: { end: code.length, start: 0 },
278
+ range: [0, code.length],
279
+ tokens: [],
280
+ type: "Program"
281
+ },
282
+ scopeManager: null,
283
+ services: { isPlain: true },
284
+ visitorKeys: {
285
+ Program: []
286
+ }
287
+ })
288
+ };
289
+ async function combine(...configs2) {
290
+ const resolved = await Promise.all(configs2);
291
+ return resolved.flat();
292
+ }
293
+ function renameRules(rules, map) {
294
+ return Object.fromEntries(
295
+ Object.entries(rules).map(([key, value]) => {
296
+ for (const [from, to] of Object.entries(map)) {
297
+ if (key.startsWith(`${from}/`)) {
298
+ return [to + key.slice(from.length), value];
299
+ }
300
+ }
301
+ return [key, value];
302
+ })
303
+ );
304
+ }
305
+ function renamePluginInConfigs(configs2, map) {
306
+ return configs2.map((i) => {
307
+ const clone = { ...i };
308
+ if (clone.rules) {
309
+ clone.rules = renameRules(clone.rules, map);
310
+ }
311
+ if (clone.plugins) {
312
+ clone.plugins = Object.fromEntries(
313
+ Object.entries(clone.plugins).map(([key, value]) => {
314
+ if (key in map) {
315
+ return [map[key], value];
316
+ }
317
+ return [key, value];
318
+ })
319
+ );
320
+ }
321
+ return clone;
322
+ });
323
+ }
324
+ function toArray(value) {
325
+ return Array.isArray(value) ? value : [value];
326
+ }
327
+ async function interopDefault(m) {
328
+ const resolved = await m;
329
+ return resolved.default || resolved;
330
+ }
331
+ function isPackageInScope(name) {
332
+ return (0, import_local_pkg.isPackageExists)(name, { paths: [scopeUrl] });
333
+ }
334
+ async function ensurePackages(packages) {
335
+ if (import_node_process.default.env.CI || import_node_process.default.stdout.isTTY === false || isCwdInScope === false)
336
+ return;
337
+ const nonExistingPackages = packages.filter((i) => i && !isPackageInScope(i));
338
+ if (nonExistingPackages.length === 0)
339
+ return;
340
+ const p = await import("@clack/prompts");
341
+ const result = await p.confirm({
342
+ message: `${nonExistingPackages.length === 1 ? "Package is" : "Packages are"} required for this config: ${nonExistingPackages.join(", ")}. Do you want to install them?`
343
+ });
344
+ if (result)
345
+ await import("@antfu/install-pkg").then((i) => i.installPackage(nonExistingPackages, { dev: true }));
346
+ }
347
+ function isInEditorEnv() {
348
+ if (import_node_process.default.env.CI)
349
+ return false;
350
+ if (isInGitHooksOrLintStaged())
351
+ return false;
352
+ 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);
353
+ }
354
+ function isInGitHooksOrLintStaged() {
355
+ 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"));
356
+ }
357
+
358
+ // src/configs/stylistic.ts
359
+ var StylisticConfigDefaults = {
360
+ indent: 4,
361
+ jsx: true,
362
+ lessOpinionated: false,
363
+ quotes: "single",
364
+ semi: false
365
+ };
366
+ async function stylistic(options = {}) {
266
367
  const {
267
- isInEditor = false,
268
- overrides = {}
368
+ overrides = {},
369
+ stylistic: stylistic2 = StylisticConfigDefaults
269
370
  } = options;
371
+ const {
372
+ indent,
373
+ jsx: jsx2,
374
+ lessOpinionated,
375
+ quotes,
376
+ semi
377
+ } = typeof stylistic2 === "boolean" ? StylisticConfigDefaults : { ...StylisticConfigDefaults, ...stylistic2 };
378
+ const pluginStylistic = await interopDefault(import("@stylistic/eslint-plugin"));
379
+ const config = pluginStylistic.configs.customize({
380
+ flat: true,
381
+ indent,
382
+ jsx: jsx2,
383
+ pluginName: "style",
384
+ quotes,
385
+ semi
386
+ });
270
387
  return [
271
388
  {
272
- languageOptions: {
273
- ecmaVersion: 2022,
274
- globals: {
275
- ...import_globals.default.browser,
276
- ...import_globals.default.es2021,
277
- ...import_globals.default.node,
278
- document: "readonly",
279
- navigator: "readonly",
280
- window: "readonly"
281
- },
282
- parserOptions: {
283
- ecmaFeatures: {
284
- jsx: true
285
- },
286
- ecmaVersion: 2022,
287
- sourceType: "module"
288
- },
289
- sourceType: "module"
290
- },
291
- linterOptions: {
292
- reportUnusedDisableDirectives: true
293
- },
294
- name: "eslint/javascript/setup"
295
- },
296
- {
297
- name: "eslint/javascript/rules",
389
+ name: "eslint/stylistic/rules",
298
390
  plugins: {
299
- "antfu": import_eslint_plugin_antfu.default,
300
- "unused-imports": import_eslint_plugin_unused_imports.default
391
+ antfu: import_eslint_plugin_antfu.default,
392
+ style: pluginStylistic
301
393
  },
302
394
  rules: {
303
- "accessor-pairs": ["error", { enforceForClassMembers: true, setWithoutGet: true }],
304
- "array-callback-return": "error",
305
- "block-scoped-var": "error",
306
- "constructor-super": "error",
307
- "default-case-last": "error",
308
- "dot-notation": ["error", { allowKeywords: true }],
309
- "eqeqeq": ["error", "smart"],
310
- "new-cap": ["error", { capIsNew: false, newIsCap: true, properties: true }],
311
- "no-alert": "error",
312
- "no-array-constructor": "error",
313
- "no-async-promise-executor": "error",
314
- "no-caller": "error",
315
- "no-case-declarations": "error",
316
- "no-class-assign": "error",
317
- "no-compare-neg-zero": "error",
318
- "no-cond-assign": ["error", "always"],
319
- // 'no-console': ['error', { allow: ['warn', 'error'] }],
320
- "no-console": "off",
321
- "no-const-assign": "error",
322
- "no-control-regex": "error",
323
- "no-debugger": "error",
324
- "no-delete-var": "error",
325
- "no-dupe-args": "error",
326
- "no-dupe-class-members": "error",
327
- "no-dupe-keys": "error",
328
- "no-duplicate-case": "error",
329
- "no-empty": ["error", { allowEmptyCatch: true }],
330
- "no-empty-character-class": "error",
331
- "no-empty-pattern": "error",
332
- "no-eval": "error",
333
- "no-ex-assign": "error",
334
- "no-extend-native": "error",
335
- "no-extra-bind": "error",
336
- "no-extra-boolean-cast": "error",
337
- "no-fallthrough": "error",
338
- "no-func-assign": "error",
339
- "no-global-assign": "error",
340
- "no-implied-eval": "error",
341
- "no-import-assign": "error",
342
- "no-invalid-regexp": "error",
343
- "no-irregular-whitespace": "error",
344
- "no-iterator": "error",
345
- "no-labels": ["error", { allowLoop: false, allowSwitch: false }],
346
- "no-lone-blocks": "error",
347
- "no-loss-of-precision": "error",
348
- "no-misleading-character-class": "error",
349
- "no-multi-str": "error",
350
- "no-new": "error",
395
+ ...config.rules,
396
+ "antfu/consistent-chaining": "error",
397
+ "antfu/consistent-list-newline": "off",
398
+ ...lessOpinionated ? {
399
+ curly: ["error", "all"]
400
+ } : {
401
+ "antfu/curly": "error",
402
+ "antfu/if-newline": "error",
403
+ "antfu/top-level-function": "error"
404
+ },
405
+ // 覆盖`stylistic`默认规则
406
+ "style/brace-style": ["error", "stroustrup"],
407
+ "style/member-delimiter-style": ["error", { multiline: { delimiter: "none" } }],
408
+ "style/multiline-ternary": ["error", "never"],
409
+ ...overrides
410
+ }
411
+ }
412
+ ];
413
+ }
414
+
415
+ // src/configs/formatters.ts
416
+ async function formatters(options = {}, stylistic2 = {}) {
417
+ const defaultIndent = 4;
418
+ if (options === true) {
419
+ const isPrettierPluginXmlInScope = isPackageInScope("@prettier/plugin-xml");
420
+ options = {
421
+ css: false,
422
+ graphql: true,
423
+ html: true,
424
+ markdown: true,
425
+ svg: isPrettierPluginXmlInScope,
426
+ xml: isPrettierPluginXmlInScope
427
+ };
428
+ }
429
+ await ensurePackages([
430
+ "eslint-plugin-format",
431
+ options.xml || options.svg ? "@prettier/plugin-xml" : void 0
432
+ ]);
433
+ const {
434
+ indent,
435
+ quotes,
436
+ semi
437
+ } = {
438
+ ...StylisticConfigDefaults,
439
+ ...stylistic2
440
+ };
441
+ const prettierOptions = Object.assign(
442
+ {
443
+ endOfLine: "lf",
444
+ printWidth: 200,
445
+ semi,
446
+ singleQuote: quotes === "single",
447
+ tabWidth: typeof indent === "number" ? indent : defaultIndent,
448
+ trailingComma: "all",
449
+ useTabs: indent === "tab"
450
+ },
451
+ options.prettierOptions || {}
452
+ );
453
+ const prettierXmlOptions = {
454
+ xmlQuoteAttributes: "double",
455
+ xmlSelfClosingSpace: true,
456
+ xmlSortAttributesByKey: false,
457
+ xmlWhitespaceSensitivity: "ignore"
458
+ };
459
+ const dprintOptions = Object.assign(
460
+ {
461
+ indentWidth: typeof indent === "number" ? indent : defaultIndent,
462
+ quoteStyle: quotes === "single" ? "preferSingle" : "preferDouble",
463
+ useTabs: indent === "tab"
464
+ },
465
+ options.dprintOptions || {}
466
+ );
467
+ const pluginFormat = await interopDefault(import("eslint-plugin-format"));
468
+ const configs2 = [
469
+ {
470
+ name: "eslint/formatters/setup",
471
+ plugins: {
472
+ format: pluginFormat
473
+ }
474
+ }
475
+ ];
476
+ if (options.css) {
477
+ configs2.push(
478
+ {
479
+ files: [GLOB_CSS, GLOB_POSTCSS],
480
+ languageOptions: {
481
+ parser: parserPlain
482
+ },
483
+ name: "eslint/formatters/css",
484
+ rules: {
485
+ "format/prettier": [
486
+ "error",
487
+ {
488
+ ...prettierOptions,
489
+ parser: "css"
490
+ }
491
+ ]
492
+ }
493
+ },
494
+ {
495
+ files: [GLOB_SCSS],
496
+ languageOptions: {
497
+ parser: parserPlain
498
+ },
499
+ name: "eslint/formatters/scss",
500
+ rules: {
501
+ "format/prettier": [
502
+ "error",
503
+ {
504
+ ...prettierOptions,
505
+ parser: "scss"
506
+ }
507
+ ]
508
+ }
509
+ },
510
+ {
511
+ files: [GLOB_LESS],
512
+ languageOptions: {
513
+ parser: parserPlain
514
+ },
515
+ name: "eslint/formatters/less",
516
+ rules: {
517
+ "format/prettier": [
518
+ "error",
519
+ {
520
+ ...prettierOptions,
521
+ parser: "less"
522
+ }
523
+ ]
524
+ }
525
+ }
526
+ );
527
+ }
528
+ if (options.html) {
529
+ configs2.push({
530
+ files: [GLOB_HTML],
531
+ languageOptions: {
532
+ parser: parserPlain
533
+ },
534
+ name: "eslint/formatters/html",
535
+ rules: {
536
+ "format/prettier": [
537
+ "error",
538
+ {
539
+ ...prettierOptions,
540
+ parser: "html"
541
+ }
542
+ ]
543
+ }
544
+ });
545
+ }
546
+ if (options.svg) {
547
+ configs2.push({
548
+ files: [GLOB_SVG],
549
+ languageOptions: {
550
+ parser: parserPlain
551
+ },
552
+ name: "eslint/formatters/svg",
553
+ rules: {
554
+ "format/prettier": [
555
+ "error",
556
+ {
557
+ ...prettierXmlOptions,
558
+ ...prettierOptions,
559
+ parser: "xml",
560
+ plugins: [
561
+ "@prettier/plugin-xml"
562
+ ]
563
+ }
564
+ ]
565
+ }
566
+ });
567
+ }
568
+ if (options.markdown) {
569
+ const formater = options.markdown === true ? "prettier" : options.markdown;
570
+ configs2.push({
571
+ files: [GLOB_MARKDOWN],
572
+ languageOptions: {
573
+ parser: parserPlain
574
+ },
575
+ name: "eslint/formatters/markdown",
576
+ rules: {
577
+ [`format/${formater}`]: [
578
+ "error",
579
+ formater === "prettier" ? {
580
+ ...prettierOptions,
581
+ embeddedLanguageFormatting: "off",
582
+ parser: "markdown"
583
+ } : {
584
+ ...dprintOptions,
585
+ language: "markdown"
586
+ }
587
+ ]
588
+ }
589
+ });
590
+ }
591
+ if (options.graphql) {
592
+ configs2.push({
593
+ files: [GLOB_GRAPHQL],
594
+ languageOptions: {
595
+ parser: parserPlain
596
+ },
597
+ name: "eslint/formatters/graphql",
598
+ rules: {
599
+ "format/prettier": [
600
+ "error",
601
+ {
602
+ ...prettierOptions,
603
+ parser: "graphql"
604
+ }
605
+ ]
606
+ }
607
+ });
608
+ }
609
+ return configs2;
610
+ }
611
+
612
+ // src/configs/ignores.ts
613
+ async function ignores(options = {}) {
614
+ const {
615
+ ignores: ignores2 = []
616
+ } = options;
617
+ return [
618
+ {
619
+ ignores: [
620
+ ...GLOB_EXCLUDE,
621
+ ...ignores2
622
+ ],
623
+ name: "eslint/ignores"
624
+ }
625
+ ];
626
+ }
627
+
628
+ // src/configs/imports.ts
629
+ async function imports(options = {}) {
630
+ const {
631
+ stylistic: stylistic2 = true
632
+ } = options;
633
+ return [
634
+ {
635
+ name: "eslint/imports/rules",
636
+ plugins: {
637
+ antfu: import_eslint_plugin_antfu.default,
638
+ import: pluginImport
639
+ },
640
+ rules: {
641
+ "antfu/import-dedupe": "error",
642
+ "antfu/no-import-dist": "error",
643
+ "antfu/no-import-node-modules-by-path": "error",
644
+ "import/first": "error",
645
+ "import/no-duplicates": "error",
646
+ "import/no-mutable-exports": "error",
647
+ "import/no-named-default": "error",
648
+ "import/no-self-import": "error",
649
+ "import/no-webpack-loader-syntax": "error",
650
+ ...stylistic2 ? {
651
+ "import/newline-after-import": ["error", { considerComments: true, count: 1 }]
652
+ } : {}
653
+ }
654
+ }
655
+ ];
656
+ }
657
+
658
+ // src/configs/javascript.ts
659
+ var import_globals = __toESM(require("globals"), 1);
660
+ async function javascript(options = {}) {
661
+ const {
662
+ isInEditor = false,
663
+ overrides = {}
664
+ } = options;
665
+ return [
666
+ {
667
+ languageOptions: {
668
+ ecmaVersion: 2022,
669
+ globals: {
670
+ ...import_globals.default.browser,
671
+ ...import_globals.default.es2021,
672
+ ...import_globals.default.node,
673
+ document: "readonly",
674
+ navigator: "readonly",
675
+ window: "readonly"
676
+ },
677
+ parserOptions: {
678
+ ecmaFeatures: {
679
+ jsx: true
680
+ },
681
+ ecmaVersion: 2022,
682
+ sourceType: "module"
683
+ },
684
+ sourceType: "module"
685
+ },
686
+ linterOptions: {
687
+ reportUnusedDisableDirectives: true
688
+ },
689
+ name: "eslint/javascript/setup"
690
+ },
691
+ {
692
+ name: "eslint/javascript/rules",
693
+ plugins: {
694
+ "antfu": import_eslint_plugin_antfu.default,
695
+ "unused-imports": import_eslint_plugin_unused_imports.default
696
+ },
697
+ rules: {
698
+ "accessor-pairs": ["error", { enforceForClassMembers: true, setWithoutGet: true }],
699
+ "array-callback-return": "error",
700
+ "block-scoped-var": "error",
701
+ "constructor-super": "error",
702
+ "default-case-last": "error",
703
+ "dot-notation": ["error", { allowKeywords: true }],
704
+ "eqeqeq": ["error", "smart"],
705
+ "new-cap": ["error", { capIsNew: false, newIsCap: true, properties: true }],
706
+ "no-alert": "error",
707
+ "no-array-constructor": "error",
708
+ "no-async-promise-executor": "error",
709
+ "no-caller": "error",
710
+ "no-case-declarations": "error",
711
+ "no-class-assign": "error",
712
+ "no-compare-neg-zero": "error",
713
+ "no-cond-assign": ["error", "always"],
714
+ // 'no-console': ['error', { allow: ['warn', 'error'] }],
715
+ "no-console": "off",
716
+ "no-const-assign": "error",
717
+ "no-control-regex": "error",
718
+ "no-debugger": "error",
719
+ "no-delete-var": "error",
720
+ "no-dupe-args": "error",
721
+ "no-dupe-class-members": "error",
722
+ "no-dupe-keys": "error",
723
+ "no-duplicate-case": "error",
724
+ "no-empty": ["error", { allowEmptyCatch: true }],
725
+ "no-empty-character-class": "error",
726
+ "no-empty-pattern": "error",
727
+ "no-eval": "error",
728
+ "no-ex-assign": "error",
729
+ "no-extend-native": "error",
730
+ "no-extra-bind": "error",
731
+ "no-extra-boolean-cast": "error",
732
+ "no-fallthrough": "error",
733
+ "no-func-assign": "error",
734
+ "no-global-assign": "error",
735
+ "no-implied-eval": "error",
736
+ "no-import-assign": "error",
737
+ "no-invalid-regexp": "error",
738
+ "no-irregular-whitespace": "error",
739
+ "no-iterator": "error",
740
+ "no-labels": ["error", { allowLoop: false, allowSwitch: false }],
741
+ "no-lone-blocks": "error",
742
+ "no-loss-of-precision": "error",
743
+ "no-misleading-character-class": "error",
744
+ "no-multi-str": "error",
745
+ "no-new": "error",
351
746
  "no-new-func": "error",
352
747
  "no-new-native-nonconstructor": "error",
353
748
  "no-new-wrappers": "error",
@@ -443,16 +838,6 @@ async function javascript(options = {}) {
443
838
  "prefer-rest-params": "error",
444
839
  "prefer-spread": "error",
445
840
  "prefer-template": "error",
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
841
  "symbol-description": "error",
457
842
  "unicode-bom": ["error", "never"],
458
843
  "unused-imports/no-unused-imports": isInEditor ? "off" : "error",
@@ -472,92 +857,10 @@ async function javascript(options = {}) {
472
857
  "yoda": ["error", "never"],
473
858
  ...overrides
474
859
  }
475
- },
476
- {
477
- files: [`scripts/${GLOB_SRC}`, `cli.${GLOB_SRC_EXT}`],
478
- name: "eslint/scripts/disables",
479
- rules: {
480
- "no-console": "off"
481
- }
482
860
  }
483
861
  ];
484
862
  }
485
863
 
486
- // src/utils.ts
487
- var import_node_process = __toESM(require("process"), 1);
488
- var import_node_url = require("url");
489
- var import_local_pkg = require("local-pkg");
490
- var scopeUrl = (0, import_node_url.fileURLToPath)(new URL(".", importMetaUrl));
491
- var isCwdInScope = (0, import_local_pkg.isPackageExists)("@antfu/eslint-config");
492
- async function combine(...configs2) {
493
- const resolved = await Promise.all(configs2);
494
- return resolved.flat();
495
- }
496
- function renameRules(rules, map) {
497
- return Object.fromEntries(
498
- Object.entries(rules).map(([key, value]) => {
499
- for (const [from, to] of Object.entries(map)) {
500
- if (key.startsWith(`${from}/`)) {
501
- return [to + key.slice(from.length), value];
502
- }
503
- }
504
- return [key, value];
505
- })
506
- );
507
- }
508
- function renamePluginInConfigs(configs2, map) {
509
- return configs2.map((i) => {
510
- const clone = { ...i };
511
- if (clone.rules) {
512
- clone.rules = renameRules(clone.rules, map);
513
- }
514
- if (clone.plugins) {
515
- clone.plugins = Object.fromEntries(
516
- Object.entries(clone.plugins).map(([key, value]) => {
517
- if (key in map) {
518
- return [map[key], value];
519
- }
520
- return [key, value];
521
- })
522
- );
523
- }
524
- return clone;
525
- });
526
- }
527
- function toArray(value) {
528
- return Array.isArray(value) ? value : [value];
529
- }
530
- async function interopDefault(m) {
531
- const resolved = await m;
532
- return resolved.default || resolved;
533
- }
534
- function isPackageInScope(name) {
535
- return (0, import_local_pkg.isPackageExists)(name, { paths: [scopeUrl] });
536
- }
537
- async function ensurePackages(packages) {
538
- if (import_node_process.default.env.CI || import_node_process.default.stdout.isTTY === false || isCwdInScope === false)
539
- return;
540
- const nonExistingPackages = packages.filter((i) => i && !isPackageInScope(i));
541
- if (nonExistingPackages.length === 0)
542
- return;
543
- const p = await import("@clack/prompts");
544
- const result = await p.confirm({
545
- message: `${nonExistingPackages.length === 1 ? "Package is" : "Packages are"} required for this config: ${nonExistingPackages.join(", ")}. Do you want to install them?`
546
- });
547
- if (result)
548
- await import("@antfu/install-pkg").then((i) => i.installPackage(nonExistingPackages, { dev: true }));
549
- }
550
- function isInEditorEnv() {
551
- if (import_node_process.default.env.CI)
552
- return false;
553
- if (isInGitHooksOrLintStaged())
554
- return false;
555
- 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);
556
- }
557
- function isInGitHooksOrLintStaged() {
558
- 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"));
559
- }
560
-
561
864
  // src/configs/jsdoc.ts
562
865
  async function jsdoc(options = {}) {
563
866
  const {
@@ -636,414 +939,145 @@ async function jsonc(options = {}) {
636
939
  "jsonc/no-numeric-separators": "error",
637
940
  "jsonc/no-octal": "error",
638
941
  "jsonc/no-octal-escape": "error",
639
- "jsonc/no-octal-numeric-literals": "error",
640
- "jsonc/no-parenthesized": "error",
641
- "jsonc/no-plus-sign": "error",
642
- "jsonc/no-regexp-literals": "error",
643
- "jsonc/no-sparse-arrays": "error",
644
- "jsonc/no-template-literals": "error",
645
- "jsonc/no-undefined-value": "error",
646
- "jsonc/no-unicode-codepoint-escapes": "error",
647
- "jsonc/no-useless-escape": "error",
648
- "jsonc/space-unary-ops": "error",
649
- "jsonc/valid-json-number": "error",
650
- "jsonc/vue-custom-block/no-parsing-error": "error",
651
- ...stylistic2 ? {
652
- "jsonc/array-bracket-spacing": ["error", "never"],
653
- "jsonc/comma-dangle": ["error", "never"],
654
- "jsonc/comma-style": ["error", "last"],
655
- "jsonc/indent": ["error", 2],
656
- "jsonc/key-spacing": ["error", { afterColon: true, beforeColon: false }],
657
- "jsonc/object-curly-newline": ["error", { consistent: true, multiline: true }],
658
- "jsonc/object-curly-spacing": ["error", "always"],
659
- "jsonc/object-property-newline": ["error", { allowMultiplePropertiesPerLine: true }],
660
- "jsonc/quote-props": "error",
661
- "jsonc/quotes": "error"
662
- } : {},
663
- ...overrides
664
- }
665
- }
666
- ];
667
- }
668
-
669
- // src/configs/jsx.ts
670
- async function jsx() {
671
- return [
672
- {
673
- files: [GLOB_JSX, GLOB_TSX],
674
- languageOptions: {
675
- parserOptions: {
676
- ecmaFeatures: {
677
- jsx: true
678
- }
679
- }
680
- },
681
- name: "eslint/jsx/setup"
682
- }
683
- ];
684
- }
685
-
686
- // src/configs/markdown.ts
687
- var parserPlain = __toESM(require("eslint-parser-plain"), 1);
688
- var import_eslint_merge_processors = require("eslint-merge-processors");
689
- async function markdown(options = {}) {
690
- const {
691
- componentExts = [],
692
- files = [GLOB_MARKDOWN],
693
- overrides = {}
694
- } = options;
695
- const markdown2 = await interopDefault(import("eslint-plugin-markdown"));
696
- return [
697
- {
698
- name: "eslint/markdown/setup",
699
- plugins: {
700
- markdown: markdown2
701
- }
702
- },
703
- {
704
- files,
705
- ignores: [GLOB_MARKDOWN_IN_MARKDOWN],
706
- name: "eslint/markdown/processor",
707
- processor: (0, import_eslint_merge_processors.mergeProcessors)([
708
- markdown2.processors.markdown,
709
- import_eslint_merge_processors.processorPassThrough
710
- ])
711
- },
712
- {
713
- files,
714
- languageOptions: {
715
- parser: parserPlain
716
- },
717
- name: "eslint/markdown/parser"
718
- },
719
- {
720
- files: [
721
- GLOB_MARKDOWN_CODE,
722
- ...componentExts.map((ext) => `${GLOB_MARKDOWN}/**/*.${ext}`)
723
- ],
724
- languageOptions: {
725
- parserOptions: {
726
- ecmaFeatures: {
727
- impliedStrict: true
728
- }
729
- }
730
- },
731
- name: "eslint/markdown/disables",
732
- rules: {
733
- "import/newline-after-import": "off",
734
- "no-alert": "off",
735
- "no-console": "off",
736
- "no-labels": "off",
737
- "no-lone-blocks": "off",
738
- "no-restricted-syntax": "off",
739
- "no-undef": "off",
740
- "no-unused-expressions": "off",
741
- "no-unused-labels": "off",
742
- "no-unused-vars": "off",
743
- "node/prefer-global/process": "off",
744
- "style/comma-dangle": "off",
745
- "style/eol-last": "off",
746
- "ts/consistent-type-imports": "off",
747
- "ts/no-namespace": "off",
748
- "ts/no-redeclare": "off",
749
- "ts/no-require-imports": "off",
750
- "ts/no-unused-expressions": "off",
751
- "ts/no-unused-vars": "off",
752
- "ts/no-use-before-define": "off",
753
- "ts/no-var-requires": "off",
754
- "unicode-bom": "off",
755
- "unused-imports/no-unused-imports": "off",
756
- "unused-imports/no-unused-vars": "off",
757
- // Type aware rules
758
- ...{
759
- "ts/await-thenable": "off",
760
- "ts/dot-notation": "off",
761
- "ts/no-floating-promises": "off",
762
- "ts/no-for-in-array": "off",
763
- "ts/no-implied-eval": "off",
764
- "ts/no-misused-promises": "off",
765
- "ts/no-unnecessary-type-assertion": "off",
766
- "ts/no-unsafe-argument": "off",
767
- "ts/no-unsafe-assignment": "off",
768
- "ts/no-unsafe-call": "off",
769
- "ts/no-unsafe-member-access": "off",
770
- "ts/no-unsafe-return": "off",
771
- "ts/restrict-plus-operands": "off",
772
- "ts/restrict-template-expressions": "off",
773
- "ts/unbound-method": "off"
774
- },
942
+ "jsonc/no-octal-numeric-literals": "error",
943
+ "jsonc/no-parenthesized": "error",
944
+ "jsonc/no-plus-sign": "error",
945
+ "jsonc/no-regexp-literals": "error",
946
+ "jsonc/no-sparse-arrays": "error",
947
+ "jsonc/no-template-literals": "error",
948
+ "jsonc/no-undefined-value": "error",
949
+ "jsonc/no-unicode-codepoint-escapes": "error",
950
+ "jsonc/no-useless-escape": "error",
951
+ "jsonc/space-unary-ops": "error",
952
+ "jsonc/valid-json-number": "error",
953
+ "jsonc/vue-custom-block/no-parsing-error": "error",
954
+ ...stylistic2 ? {
955
+ "jsonc/array-bracket-spacing": ["error", "never"],
956
+ "jsonc/comma-dangle": ["error", "never"],
957
+ "jsonc/comma-style": ["error", "last"],
958
+ "jsonc/indent": ["error", 2],
959
+ "jsonc/key-spacing": ["error", { afterColon: true, beforeColon: false }],
960
+ "jsonc/object-curly-newline": ["error", { consistent: true, multiline: true }],
961
+ "jsonc/object-curly-spacing": ["error", "always"],
962
+ "jsonc/object-property-newline": ["error", { allowMultiplePropertiesPerLine: true }],
963
+ "jsonc/quote-props": "error",
964
+ "jsonc/quotes": "error"
965
+ } : {},
775
966
  ...overrides
776
967
  }
777
968
  }
778
969
  ];
779
970
  }
780
971
 
781
- // src/configs/perfectionist.ts
782
- async function perfectionist() {
972
+ // src/configs/jsx.ts
973
+ async function jsx() {
783
974
  return [
784
975
  {
785
- name: "eslint/perfectionist/setup",
786
- plugins: {
787
- perfectionist: import_eslint_plugin_perfectionist.default
788
- }
976
+ files: [GLOB_JSX, GLOB_TSX],
977
+ languageOptions: {
978
+ parserOptions: {
979
+ ecmaFeatures: {
980
+ jsx: true
981
+ }
982
+ }
983
+ },
984
+ name: "eslint/jsx/setup"
789
985
  }
790
986
  ];
791
987
  }
792
988
 
793
- // src/configs/formatters.ts
989
+ // src/configs/markdown.ts
990
+ var import_eslint_merge_processors = require("eslint-merge-processors");
794
991
  var parserPlain2 = __toESM(require("eslint-parser-plain"), 1);
795
-
796
- // src/configs/stylistic.ts
797
- var StylisticConfigDefaults = {
798
- indent: 4,
799
- jsx: true,
800
- lessOpinionated: false,
801
- quotes: "single",
802
- semi: false
803
- };
804
- async function stylistic(options = {}) {
992
+ async function markdown(options = {}) {
805
993
  const {
806
- overrides = {},
807
- stylistic: stylistic2 = StylisticConfigDefaults
994
+ componentExts = [],
995
+ files = [GLOB_MARKDOWN],
996
+ overrides = {}
808
997
  } = options;
809
- const {
810
- indent,
811
- jsx: jsx2,
812
- lessOpinionated,
813
- quotes,
814
- semi
815
- } = typeof stylistic2 === "boolean" ? StylisticConfigDefaults : { ...StylisticConfigDefaults, ...stylistic2 };
816
- const pluginStylistic = await interopDefault(import("@stylistic/eslint-plugin"));
817
- const config = pluginStylistic.configs.customize({
818
- flat: true,
819
- indent,
820
- jsx: jsx2,
821
- pluginName: "style",
822
- quotes,
823
- semi
824
- });
998
+ const markdown2 = await interopDefault(import("@eslint/markdown"));
825
999
  return [
826
1000
  {
827
- name: "eslint/stylistic/rules",
828
- plugins: {
829
- antfu: import_eslint_plugin_antfu.default,
830
- style: pluginStylistic
831
- },
832
- rules: {
833
- ...config.rules,
834
- "antfu/consistent-list-newline": "off",
835
- ...lessOpinionated ? {
836
- curly: ["error", "all"]
837
- } : {
838
- "antfu/curly": "error",
839
- "antfu/if-newline": "error",
840
- "antfu/top-level-function": "error"
841
- },
842
- // 覆盖`stylistic`默认规则
843
- "style/brace-style": ["error", "stroustrup"],
844
- "style/member-delimiter-style": ["error", { multiline: { delimiter: "none" } }],
845
- "style/multiline-ternary": ["error", "never"],
846
- ...overrides
847
- }
848
- }
849
- ];
850
- }
851
-
852
- // src/configs/formatters.ts
853
- async function formatters(options = {}, stylistic2 = {}) {
854
- const defaultIndent = 4;
855
- if (options === true) {
856
- const isPrettierPluginXmlInScope = isPackageInScope("@prettier/plugin-xml");
857
- options = {
858
- css: false,
859
- graphql: true,
860
- html: true,
861
- markdown: true,
862
- svg: isPrettierPluginXmlInScope,
863
- xml: isPrettierPluginXmlInScope
864
- };
865
- }
866
- await ensurePackages([
867
- "eslint-plugin-format",
868
- options.xml || options.svg ? "@prettier/plugin-xml" : void 0
869
- ]);
870
- const {
871
- indent,
872
- quotes,
873
- semi
874
- } = {
875
- ...StylisticConfigDefaults,
876
- ...stylistic2
877
- };
878
- const prettierOptions = Object.assign(
879
- {
880
- endOfLine: "lf",
881
- printWidth: 200,
882
- semi,
883
- singleQuote: quotes === "single",
884
- tabWidth: typeof indent === "number" ? indent : defaultIndent,
885
- trailingComma: "all",
886
- useTabs: indent === "tab"
887
- },
888
- options.prettierOptions || {}
889
- );
890
- const prettierXmlOptions = {
891
- xmlQuoteAttributes: "double",
892
- xmlSelfClosingSpace: true,
893
- xmlSortAttributesByKey: false,
894
- xmlWhitespaceSensitivity: "ignore"
895
- };
896
- const dprintOptions = Object.assign(
897
- {
898
- indentWidth: typeof indent === "number" ? indent : defaultIndent,
899
- quoteStyle: quotes === "single" ? "preferSingle" : "preferDouble",
900
- useTabs: indent === "tab"
901
- },
902
- options.dprintOptions || {}
903
- );
904
- const pluginFormat = await interopDefault(import("eslint-plugin-format"));
905
- const configs2 = [
906
- {
907
- name: "eslint/formatters/setup",
1001
+ name: "eslint/markdown/setup",
908
1002
  plugins: {
909
- format: pluginFormat
910
- }
911
- }
912
- ];
913
- if (options.css) {
914
- configs2.push(
915
- {
916
- files: [GLOB_CSS, GLOB_POSTCSS],
917
- languageOptions: {
918
- parser: parserPlain2
919
- },
920
- name: "eslint/formatters/css",
921
- rules: {
922
- "format/prettier": [
923
- "error",
924
- {
925
- ...prettierOptions,
926
- parser: "css"
927
- }
928
- ]
929
- }
930
- },
931
- {
932
- files: [GLOB_SCSS],
933
- languageOptions: {
934
- parser: parserPlain2
935
- },
936
- name: "eslint/formatters/scss",
937
- rules: {
938
- "format/prettier": [
939
- "error",
940
- {
941
- ...prettierOptions,
942
- parser: "scss"
943
- }
944
- ]
945
- }
946
- },
947
- {
948
- files: [GLOB_LESS],
949
- languageOptions: {
950
- parser: parserPlain2
951
- },
952
- name: "eslint/formatters/less",
953
- rules: {
954
- "format/prettier": [
955
- "error",
956
- {
957
- ...prettierOptions,
958
- parser: "less"
959
- }
960
- ]
961
- }
962
- }
963
- );
964
- }
965
- if (options.html) {
966
- configs2.push({
967
- files: [GLOB_HTML],
968
- languageOptions: {
969
- parser: parserPlain2
970
- },
971
- name: "eslint/formatters/html",
972
- rules: {
973
- "format/prettier": [
974
- "error",
975
- {
976
- ...prettierOptions,
977
- parser: "html"
978
- }
979
- ]
980
- }
981
- });
982
- }
983
- if (options.svg) {
984
- configs2.push({
985
- files: [GLOB_SVG],
986
- languageOptions: {
987
- parser: parserPlain2
988
- },
989
- name: "eslint/formatters/svg",
990
- rules: {
991
- "format/prettier": [
992
- "error",
993
- {
994
- ...prettierXmlOptions,
995
- ...prettierOptions,
996
- parser: "xml",
997
- plugins: [
998
- "@prettier/plugin-xml"
999
- ]
1000
- }
1001
- ]
1002
- }
1003
- });
1004
- }
1005
- if (options.markdown) {
1006
- const formater = options.markdown === true ? "prettier" : options.markdown;
1007
- configs2.push({
1008
- files: [GLOB_MARKDOWN],
1003
+ markdown: markdown2
1004
+ }
1005
+ },
1006
+ {
1007
+ files,
1008
+ ignores: [GLOB_MARKDOWN_IN_MARKDOWN],
1009
+ name: "eslint/markdown/processor",
1010
+ processor: (0, import_eslint_merge_processors.mergeProcessors)([
1011
+ markdown2.processors.markdown,
1012
+ import_eslint_merge_processors.processorPassThrough
1013
+ ])
1014
+ },
1015
+ {
1016
+ files,
1009
1017
  languageOptions: {
1010
1018
  parser: parserPlain2
1011
1019
  },
1012
- name: "eslint/formatters/markdown",
1013
- rules: {
1014
- [`format/${formater}`]: [
1015
- "error",
1016
- formater === "prettier" ? {
1017
- ...prettierOptions,
1018
- embeddedLanguageFormatting: "off",
1019
- parser: "markdown"
1020
- } : {
1021
- ...dprintOptions,
1022
- language: "markdown"
1023
- }
1024
- ]
1025
- }
1026
- });
1027
- }
1028
- if (options.graphql) {
1029
- configs2.push({
1030
- files: [GLOB_GRAPHQL],
1020
+ name: "eslint/markdown/parser"
1021
+ },
1022
+ {
1023
+ files: [
1024
+ GLOB_MARKDOWN_CODE,
1025
+ ...componentExts.map((ext) => `${GLOB_MARKDOWN}/**/*.${ext}`)
1026
+ ],
1031
1027
  languageOptions: {
1032
- parser: parserPlain2
1028
+ parserOptions: {
1029
+ ecmaFeatures: {
1030
+ impliedStrict: true
1031
+ }
1032
+ }
1033
1033
  },
1034
- name: "eslint/formatters/graphql",
1034
+ name: "eslint/markdown/disables",
1035
1035
  rules: {
1036
- "format/prettier": [
1037
- "error",
1038
- {
1039
- ...prettierOptions,
1040
- parser: "graphql"
1041
- }
1042
- ]
1036
+ "import/newline-after-import": "off",
1037
+ "no-alert": "off",
1038
+ "no-console": "off",
1039
+ "no-labels": "off",
1040
+ "no-lone-blocks": "off",
1041
+ "no-restricted-syntax": "off",
1042
+ "no-undef": "off",
1043
+ "no-unused-expressions": "off",
1044
+ "no-unused-labels": "off",
1045
+ "no-unused-vars": "off",
1046
+ "node/prefer-global/process": "off",
1047
+ "style/comma-dangle": "off",
1048
+ "style/eol-last": "off",
1049
+ "ts/consistent-type-imports": "off",
1050
+ "ts/no-namespace": "off",
1051
+ "ts/no-redeclare": "off",
1052
+ "ts/no-require-imports": "off",
1053
+ "ts/no-unused-expressions": "off",
1054
+ "ts/no-unused-vars": "off",
1055
+ "ts/no-use-before-define": "off",
1056
+ "unicode-bom": "off",
1057
+ "unused-imports/no-unused-imports": "off",
1058
+ "unused-imports/no-unused-vars": "off",
1059
+ // Type aware rules
1060
+ ...{
1061
+ "ts/await-thenable": "off",
1062
+ "ts/dot-notation": "off",
1063
+ "ts/no-floating-promises": "off",
1064
+ "ts/no-for-in-array": "off",
1065
+ "ts/no-implied-eval": "off",
1066
+ "ts/no-misused-promises": "off",
1067
+ "ts/no-unnecessary-type-assertion": "off",
1068
+ "ts/no-unsafe-argument": "off",
1069
+ "ts/no-unsafe-assignment": "off",
1070
+ "ts/no-unsafe-call": "off",
1071
+ "ts/no-unsafe-member-access": "off",
1072
+ "ts/no-unsafe-return": "off",
1073
+ "ts/restrict-plus-operands": "off",
1074
+ "ts/restrict-template-expressions": "off",
1075
+ "ts/unbound-method": "off"
1076
+ },
1077
+ ...overrides
1043
1078
  }
1044
- });
1045
- }
1046
- return configs2;
1079
+ }
1080
+ ];
1047
1081
  }
1048
1082
 
1049
1083
  // src/configs/node.ts
@@ -1068,6 +1102,39 @@ async function node() {
1068
1102
  ];
1069
1103
  }
1070
1104
 
1105
+ // src/configs/perfectionist.ts
1106
+ async function perfectionist() {
1107
+ return [
1108
+ {
1109
+ name: "eslint/perfectionist/setup",
1110
+ plugins: {
1111
+ perfectionist: import_eslint_plugin_perfectionist.default
1112
+ },
1113
+ rules: {
1114
+ "perfectionist/sort-exports": ["error", { order: "asc", type: "natural" }],
1115
+ "perfectionist/sort-imports": ["error", {
1116
+ groups: [
1117
+ "type",
1118
+ ["parent-type", "sibling-type", "index-type"],
1119
+ "builtin",
1120
+ "external",
1121
+ ["internal", "internal-type"],
1122
+ ["parent", "sibling", "index"],
1123
+ "side-effect",
1124
+ "object",
1125
+ "unknown"
1126
+ ],
1127
+ // newlinesBetween: 'ignore',
1128
+ order: "asc",
1129
+ type: "natural"
1130
+ }],
1131
+ "perfectionist/sort-named-exports": ["error", { order: "asc", type: "natural" }],
1132
+ "perfectionist/sort-named-imports": ["error", { order: "asc", type: "natural" }]
1133
+ }
1134
+ }
1135
+ ];
1136
+ }
1137
+
1071
1138
  // src/configs/react.ts
1072
1139
  var import_local_pkg2 = require("local-pkg");
1073
1140
  var ReactRefreshAllowConstantExportPackages = [
@@ -1502,6 +1569,65 @@ async function test(options = {}) {
1502
1569
  ];
1503
1570
  }
1504
1571
 
1572
+ // src/configs/toml.ts
1573
+ async function toml(options = {}) {
1574
+ const {
1575
+ files = [GLOB_TOML],
1576
+ overrides = {},
1577
+ stylistic: stylistic2 = true
1578
+ } = options;
1579
+ const {
1580
+ indent = 4
1581
+ } = typeof stylistic2 === "boolean" ? {} : stylistic2;
1582
+ const [
1583
+ pluginToml,
1584
+ parserToml
1585
+ ] = await Promise.all([
1586
+ interopDefault(import("eslint-plugin-toml")),
1587
+ interopDefault(import("toml-eslint-parser"))
1588
+ ]);
1589
+ return [
1590
+ {
1591
+ name: "eslint/toml/setup",
1592
+ plugins: {
1593
+ toml: pluginToml
1594
+ }
1595
+ },
1596
+ {
1597
+ files,
1598
+ languageOptions: {
1599
+ parser: parserToml
1600
+ },
1601
+ name: "eslint/toml/rules",
1602
+ rules: {
1603
+ "style/spaced-comment": "off",
1604
+ "toml/comma-style": "error",
1605
+ "toml/keys-order": "error",
1606
+ "toml/no-space-dots": "error",
1607
+ "toml/no-unreadable-number-separator": "error",
1608
+ "toml/precision-of-fractional-seconds": "error",
1609
+ "toml/precision-of-integer": "error",
1610
+ "toml/tables-order": "error",
1611
+ "toml/vue-custom-block/no-parsing-error": "error",
1612
+ ...stylistic2 ? {
1613
+ "toml/array-bracket-newline": "error",
1614
+ "toml/array-bracket-spacing": "error",
1615
+ "toml/array-element-newline": "error",
1616
+ "toml/indent": ["error", indent === "tab" ? 4 : indent],
1617
+ "toml/inline-table-curly-spacing": "error",
1618
+ "toml/key-spacing": "error",
1619
+ "toml/padding-line-between-pairs": "error",
1620
+ "toml/padding-line-between-tables": "error",
1621
+ "toml/quoted-keys": "error",
1622
+ "toml/spaced-comment": "error",
1623
+ "toml/table-bracket-spacing": "error"
1624
+ } : {},
1625
+ ...overrides
1626
+ }
1627
+ }
1628
+ ];
1629
+ }
1630
+
1505
1631
  // src/configs/typescript.ts
1506
1632
  var import_node_process2 = __toESM(require("process"), 1);
1507
1633
  async function typescript(options = {}) {
@@ -1602,7 +1728,6 @@ async function typescript(options = {}) {
1602
1728
  { "@typescript-eslint": "ts" }
1603
1729
  ),
1604
1730
  "no-dupe-class-members": "off",
1605
- "no-loss-of-precision": "off",
1606
1731
  "no-redeclare": "off",
1607
1732
  "no-use-before-define": "off",
1608
1733
  "no-useless-constructor": "off",
@@ -1620,7 +1745,6 @@ async function typescript(options = {}) {
1620
1745
  "ts/no-extraneous-class": "off",
1621
1746
  "ts/no-import-type-side-effects": "error",
1622
1747
  "ts/no-invalid-void-type": "off",
1623
- "ts/no-loss-of-precision": "error",
1624
1748
  "ts/no-non-null-assertion": "off",
1625
1749
  "ts/no-redeclare": "error",
1626
1750
  "ts/no-require-imports": "error",
@@ -1648,32 +1772,7 @@ async function typescript(options = {}) {
1648
1772
  ...typeAwareRules,
1649
1773
  ...overrides
1650
1774
  }
1651
- }] : [],
1652
- {
1653
- files: ["**/*.d.?([cm])ts"],
1654
- name: "eslint/typescript/disables/dts",
1655
- rules: {
1656
- "eslint-comments/no-unlimited-disable": "off",
1657
- "import/no-duplicates": "off",
1658
- "no-restricted-syntax": "off",
1659
- "unused-imports/no-unused-vars": "off"
1660
- }
1661
- },
1662
- {
1663
- files: ["**/*.{test,spec}.ts?(x)"],
1664
- name: "eslint/typescript/disables/test",
1665
- rules: {
1666
- "no-unused-expressions": "off"
1667
- }
1668
- },
1669
- {
1670
- files: ["**/*.js", "**/*.cjs"],
1671
- name: "eslint/typescript/disables/cjs",
1672
- rules: {
1673
- "ts/no-require-imports": "off",
1674
- "ts/no-var-requires": "off"
1675
- }
1676
- }
1775
+ }] : []
1677
1776
  ];
1678
1777
  }
1679
1778
 
@@ -1688,7 +1787,6 @@ async function unicorn(options = {}) {
1688
1787
  rules: {
1689
1788
  ...options.allRecommended ? import_eslint_plugin_unicorn.default.configs["flat/recommended"].rules : {
1690
1789
  "unicorn/consistent-empty-array-spread": "error",
1691
- "unicorn/consistent-function-scoping": "error",
1692
1790
  "unicorn/error-message": "error",
1693
1791
  "unicorn/escape-case": "error",
1694
1792
  "unicorn/new-for-builtins": "error",
@@ -1977,65 +2075,6 @@ async function yaml(options = {}) {
1977
2075
  ];
1978
2076
  }
1979
2077
 
1980
- // src/configs/toml.ts
1981
- async function toml(options = {}) {
1982
- const {
1983
- files = [GLOB_TOML],
1984
- overrides = {},
1985
- stylistic: stylistic2 = true
1986
- } = options;
1987
- const {
1988
- indent = 4
1989
- } = typeof stylistic2 === "boolean" ? {} : stylistic2;
1990
- const [
1991
- pluginToml,
1992
- parserToml
1993
- ] = await Promise.all([
1994
- interopDefault(import("eslint-plugin-toml")),
1995
- interopDefault(import("toml-eslint-parser"))
1996
- ]);
1997
- return [
1998
- {
1999
- name: "eslint/toml/setup",
2000
- plugins: {
2001
- toml: pluginToml
2002
- }
2003
- },
2004
- {
2005
- files,
2006
- languageOptions: {
2007
- parser: parserToml
2008
- },
2009
- name: "eslint/toml/rules",
2010
- rules: {
2011
- "style/spaced-comment": "off",
2012
- "toml/comma-style": "error",
2013
- "toml/keys-order": "error",
2014
- "toml/no-space-dots": "error",
2015
- "toml/no-unreadable-number-separator": "error",
2016
- "toml/precision-of-fractional-seconds": "error",
2017
- "toml/precision-of-integer": "error",
2018
- "toml/tables-order": "error",
2019
- "toml/vue-custom-block/no-parsing-error": "error",
2020
- ...stylistic2 ? {
2021
- "toml/array-bracket-newline": "error",
2022
- "toml/array-bracket-spacing": "error",
2023
- "toml/array-element-newline": "error",
2024
- "toml/indent": ["error", indent === "tab" ? 4 : indent],
2025
- "toml/inline-table-curly-spacing": "error",
2026
- "toml/key-spacing": "error",
2027
- "toml/padding-line-between-pairs": "error",
2028
- "toml/padding-line-between-tables": "error",
2029
- "toml/quoted-keys": "error",
2030
- "toml/spaced-comment": "error",
2031
- "toml/table-bracket-spacing": "error"
2032
- } : {},
2033
- ...overrides
2034
- }
2035
- }
2036
- ];
2037
- }
2038
-
2039
2078
  // src/factory.ts
2040
2079
  var flatConfigProps = [
2041
2080
  "name",
@@ -2223,6 +2262,9 @@ function lincy(options = {}, ...userConfigs) {
2223
2262
  typeof stylisticOptions === "boolean" ? {} : stylisticOptions
2224
2263
  ));
2225
2264
  }
2265
+ configs2.push(
2266
+ disables()
2267
+ );
2226
2268
  if ("files" in options) {
2227
2269
  throw new Error("[@lincy/eslint-config] \u7B2C\u4E00\u4E2A\u53C2\u6570\u4E0D\u5E94\u5305\u542B\u201Cfiles\u201D\u5C5E\u6027\uFF0C\u56E0\u4E3A\u9009\u9879\u5E94\u8BE5\u662F\u5168\u5C40\u7684\u3002\u8BF7\u5C06\u5176\u653E\u5728\u7B2C\u4E8C\u4E2A\u6216\u66F4\u540E\u9762\u7684\u914D\u7F6E\u4E2D\u3002");
2228
2270
  }
@@ -2282,6 +2324,7 @@ var src_default = lincy;
2282
2324
  combine,
2283
2325
  comments,
2284
2326
  defaultPluginRenaming,
2327
+ disables,
2285
2328
  ensurePackages,
2286
2329
  formatters,
2287
2330
  ignores,
@@ -2297,6 +2340,7 @@ var src_default = lincy;
2297
2340
  lincy,
2298
2341
  markdown,
2299
2342
  node,
2343
+ parserPlain,
2300
2344
  perfectionist,
2301
2345
  react,
2302
2346
  regexp,