@lincy/eslint-config 5.2.4 → 5.2.6

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/README.md CHANGED
@@ -302,14 +302,12 @@ export default lincy({
302
302
 
303
303
  ```js
304
304
  // eslint.config.js
305
- import { readFile } from 'node:fs/promises'
305
+ import { readFileSync } from 'node:fs'
306
306
 
307
307
  import lincy from '@lincy/eslint-config'
308
308
  import plugin from '@unocss/eslint-plugin'
309
309
 
310
- const autoImport = JSON.parse(
311
- await readFile(new URL('./.eslintrc-auto-import.json', import.meta.url)),
312
- )
310
+ const autoImport = JSON.parse(readFileSync(new URL('./.eslintrc-auto-import.json', import.meta.url)))
313
311
 
314
312
  export default lincy(
315
313
  {
package/dist/index.cjs CHANGED
@@ -99,7 +99,7 @@ __export(src_exports, {
99
99
  });
100
100
  module.exports = __toCommonJS(src_exports);
101
101
 
102
- // node_modules/.pnpm/tsup@8.2.4_jiti@1.21.6_postcss@8.4.47_tsx@4.19.1_typescript@5.6.2_yaml@2.5.1/node_modules/tsup/assets/cjs_shims.js
102
+ // node_modules/.pnpm/tsup@8.3.0_jiti@2.3.3_postcss@8.4.47_tsx@4.19.1_typescript@5.6.3_yaml@2.6.0/node_modules/tsup/assets/cjs_shims.js
103
103
  var getImportMetaUrl = () => typeof document === "undefined" ? new URL(`file:${__filename}`).href : document.currentScript && document.currentScript.src || new URL("main.js", document.baseURI).href;
104
104
  var importMetaUrl = /* @__PURE__ */ getImportMetaUrl();
105
105
 
@@ -218,6 +218,7 @@ async function disables() {
218
218
  files: [`**/scripts/${GLOB_SRC}`],
219
219
  name: "eslint/disables/scripts",
220
220
  rules: {
221
+ "antfu/no-top-level-await": "off",
221
222
  "no-console": "off",
222
223
  "ts/explicit-function-return-type": "off"
223
224
  }
@@ -226,6 +227,7 @@ async function disables() {
226
227
  files: [`**/cli/${GLOB_SRC}`, `**/cli.${GLOB_SRC_EXT}`],
227
228
  name: "eslint/disables/cli",
228
229
  rules: {
230
+ "antfu/no-top-level-await": "off",
229
231
  "no-console": "off"
230
232
  }
231
233
  },
@@ -248,17 +250,19 @@ async function disables() {
248
250
  }
249
251
  },
250
252
  {
251
- files: ["**/*.{test,spec}.([tj])s?(x)"],
252
- name: "eslint/disables/test",
253
+ files: ["**/*.js", "**/*.cjs"],
254
+ name: "eslint/disables/cjs",
253
255
  rules: {
254
- "no-unused-expressions": "off"
256
+ "ts/no-require-imports": "off"
255
257
  }
256
258
  },
257
259
  {
258
- files: ["**/*.js", "**/*.cjs"],
259
- name: "eslint/disables/cjs",
260
+ files: [`**/*.config.${GLOB_SRC_EXT}`, `**/*.config.*.${GLOB_SRC_EXT}`],
261
+ name: "antfu/disables/config-files",
260
262
  rules: {
261
- "ts/no-require-imports": "off"
263
+ "antfu/no-top-level-await": "off",
264
+ "no-console": "off",
265
+ "ts/explicit-function-return-type": "off"
262
266
  }
263
267
  }
264
268
  ];
@@ -417,6 +421,16 @@ async function stylistic(options = {}) {
417
421
  }
418
422
 
419
423
  // src/configs/formatters.ts
424
+ function mergePrettierOptions(options, overrides = {}) {
425
+ return {
426
+ ...options,
427
+ ...overrides,
428
+ plugins: [
429
+ ...overrides.plugins || [],
430
+ ...options.plugins || []
431
+ ]
432
+ };
433
+ }
420
434
  async function formatters(options = {}, stylistic2 = {}) {
421
435
  const defaultIndent = 4;
422
436
  if (options === true) {
@@ -488,10 +502,10 @@ async function formatters(options = {}, stylistic2 = {}) {
488
502
  rules: {
489
503
  "format/prettier": [
490
504
  "error",
491
- {
505
+ mergePrettierOptions(prettierOptions, {
492
506
  ...prettierOptions,
493
507
  parser: "css"
494
- }
508
+ })
495
509
  ]
496
510
  }
497
511
  },
@@ -504,10 +518,10 @@ async function formatters(options = {}, stylistic2 = {}) {
504
518
  rules: {
505
519
  "format/prettier": [
506
520
  "error",
507
- {
521
+ mergePrettierOptions(prettierOptions, {
508
522
  ...prettierOptions,
509
523
  parser: "scss"
510
- }
524
+ })
511
525
  ]
512
526
  }
513
527
  },
@@ -520,10 +534,10 @@ async function formatters(options = {}, stylistic2 = {}) {
520
534
  rules: {
521
535
  "format/prettier": [
522
536
  "error",
523
- {
537
+ mergePrettierOptions(prettierOptions, {
524
538
  ...prettierOptions,
525
539
  parser: "less"
526
- }
540
+ })
527
541
  ]
528
542
  }
529
543
  }
@@ -539,10 +553,30 @@ async function formatters(options = {}, stylistic2 = {}) {
539
553
  rules: {
540
554
  "format/prettier": [
541
555
  "error",
542
- {
556
+ mergePrettierOptions(prettierOptions, {
543
557
  ...prettierOptions,
544
558
  parser: "html"
545
- }
559
+ })
560
+ ]
561
+ }
562
+ });
563
+ }
564
+ if (options.xml) {
565
+ configs2.push({
566
+ files: [GLOB_XML],
567
+ languageOptions: {
568
+ parser: parserPlain
569
+ },
570
+ name: "eslint/formatter/xml",
571
+ rules: {
572
+ "format/prettier": [
573
+ "error",
574
+ mergePrettierOptions({ ...prettierXmlOptions, ...prettierOptions }, {
575
+ parser: "xml",
576
+ plugins: [
577
+ "@prettier/plugin-xml"
578
+ ]
579
+ })
546
580
  ]
547
581
  }
548
582
  });
@@ -557,14 +591,12 @@ async function formatters(options = {}, stylistic2 = {}) {
557
591
  rules: {
558
592
  "format/prettier": [
559
593
  "error",
560
- {
561
- ...prettierXmlOptions,
562
- ...prettierOptions,
594
+ mergePrettierOptions({ ...prettierXmlOptions, ...prettierOptions }, {
563
595
  parser: "xml",
564
596
  plugins: [
565
597
  "@prettier/plugin-xml"
566
598
  ]
567
- }
599
+ })
568
600
  ]
569
601
  }
570
602
  });
@@ -580,11 +612,10 @@ async function formatters(options = {}, stylistic2 = {}) {
580
612
  rules: {
581
613
  [`format/${formater}`]: [
582
614
  "error",
583
- formater === "prettier" ? {
584
- ...prettierOptions,
615
+ formater === "prettier" ? mergePrettierOptions(prettierOptions, {
585
616
  embeddedLanguageFormatting: "off",
586
617
  parser: "markdown"
587
- } : {
618
+ }) : {
588
619
  ...dprintOptions,
589
620
  language: "markdown"
590
621
  }
@@ -602,10 +633,9 @@ async function formatters(options = {}, stylistic2 = {}) {
602
633
  rules: {
603
634
  "format/prettier": [
604
635
  "error",
605
- {
606
- ...prettierOptions,
636
+ mergePrettierOptions(prettierOptions, {
607
637
  parser: "graphql"
608
- }
638
+ })
609
639
  ]
610
640
  }
611
641
  });
@@ -702,6 +732,7 @@ async function javascript(options = {}) {
702
732
  },
703
733
  rules: {
704
734
  "accessor-pairs": ["error", { enforceForClassMembers: true, setWithoutGet: true }],
735
+ "antfu/no-top-level-await": "error",
705
736
  "array-callback-return": "error",
706
737
  "block-scoped-var": "error",
707
738
  "constructor-super": "error",
@@ -1041,6 +1072,7 @@ async function markdown(options = {}) {
1041
1072
  },
1042
1073
  name: "eslint/markdown/disables",
1043
1074
  rules: {
1075
+ "antfu/no-top-level-await": "off",
1044
1076
  "import/newline-after-import": "off",
1045
1077
  "no-alert": "off",
1046
1078
  "no-console": "off",
@@ -1574,14 +1606,19 @@ async function test(options = {}) {
1574
1606
  files,
1575
1607
  name: "eslint/test/rules",
1576
1608
  rules: {
1577
- "node/prefer-global/process": "off",
1578
1609
  "test/consistent-test-it": ["error", { fn: "it", withinDescribe: "it" }],
1579
1610
  "test/no-identical-title": "error",
1580
1611
  "test/no-import-node-test": "error",
1581
1612
  "test/no-only-tests": isInEditor ? "off" : "error",
1582
1613
  "test/prefer-hooks-in-order": "error",
1583
1614
  "test/prefer-lowercase-title": "error",
1584
- "ts/explicit-function-return-type": "off",
1615
+ // Disables
1616
+ ...{
1617
+ "antfu/no-top-level-await": "off",
1618
+ "no-unused-expressions": "off",
1619
+ "node/prefer-global/process": "off",
1620
+ "ts/explicit-function-return-type": "off"
1621
+ },
1585
1622
  ...overrides
1586
1623
  }
1587
1624
  }
@@ -1905,7 +1942,6 @@ async function vue(options = {}) {
1905
1942
  parserVue,
1906
1943
  processorVueBlocks
1907
1944
  ] = await Promise.all([
1908
- // @ts-expect-error missing types
1909
1945
  interopDefault(import("eslint-plugin-vue")),
1910
1946
  interopDefault(import("vue-eslint-parser")),
1911
1947
  interopDefault(import("eslint-processor-vue-blocks"))
@@ -1970,6 +2006,7 @@ async function vue(options = {}) {
1970
2006
  ...pluginVue.configs["strongly-recommended"].rules,
1971
2007
  ...pluginVue.configs.recommended.rules
1972
2008
  },
2009
+ "antfu/no-top-level-await": "off",
1973
2010
  "node/prefer-global/process": "off",
1974
2011
  "ts/explicit-function-return-type": "off",
1975
2012
  "vue/block-order": ["error", {
@@ -1981,6 +2018,7 @@ async function vue(options = {}) {
1981
2018
  ...vueVersion === "2" ? {
1982
2019
  "vue/require-explicit-emits": "off"
1983
2020
  } : null,
2021
+ "no-irregular-whitespace": "off",
1984
2022
  "vue/define-macros-order": ["error", {
1985
2023
  order: ["defineOptions", "defineProps", "defineEmits", "defineSlots"]
1986
2024
  }],
@@ -2009,7 +2047,14 @@ async function vue(options = {}) {
2009
2047
  "vue/no-dupe-keys": "off",
2010
2048
  "vue/no-empty-pattern": "error",
2011
2049
  "vue/no-extra-parens": ["error", "functions"],
2012
- "vue/no-irregular-whitespace": "error",
2050
+ "vue/no-irregular-whitespace": ["error", {
2051
+ skipComments: false,
2052
+ skipHTMLAttributeValues: false,
2053
+ skipHTMLTextContents: true,
2054
+ skipRegExps: false,
2055
+ skipStrings: true,
2056
+ skipTemplates: false
2057
+ }],
2013
2058
  "vue/no-loss-of-precision": "error",
2014
2059
  "vue/no-restricted-syntax": [
2015
2060
  "error",