@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/dist/index.js CHANGED
@@ -113,6 +113,7 @@ async function disables() {
113
113
  files: [`**/scripts/${GLOB_SRC}`],
114
114
  name: "eslint/disables/scripts",
115
115
  rules: {
116
+ "antfu/no-top-level-await": "off",
116
117
  "no-console": "off",
117
118
  "ts/explicit-function-return-type": "off"
118
119
  }
@@ -121,6 +122,7 @@ async function disables() {
121
122
  files: [`**/cli/${GLOB_SRC}`, `**/cli.${GLOB_SRC_EXT}`],
122
123
  name: "eslint/disables/cli",
123
124
  rules: {
125
+ "antfu/no-top-level-await": "off",
124
126
  "no-console": "off"
125
127
  }
126
128
  },
@@ -143,17 +145,19 @@ async function disables() {
143
145
  }
144
146
  },
145
147
  {
146
- files: ["**/*.{test,spec}.([tj])s?(x)"],
147
- name: "eslint/disables/test",
148
+ files: ["**/*.js", "**/*.cjs"],
149
+ name: "eslint/disables/cjs",
148
150
  rules: {
149
- "no-unused-expressions": "off"
151
+ "ts/no-require-imports": "off"
150
152
  }
151
153
  },
152
154
  {
153
- files: ["**/*.js", "**/*.cjs"],
154
- name: "eslint/disables/cjs",
155
+ files: [`**/*.config.${GLOB_SRC_EXT}`, `**/*.config.*.${GLOB_SRC_EXT}`],
156
+ name: "antfu/disables/config-files",
155
157
  rules: {
156
- "ts/no-require-imports": "off"
158
+ "antfu/no-top-level-await": "off",
159
+ "no-console": "off",
160
+ "ts/explicit-function-return-type": "off"
157
161
  }
158
162
  }
159
163
  ];
@@ -312,6 +316,16 @@ async function stylistic(options = {}) {
312
316
  }
313
317
 
314
318
  // src/configs/formatters.ts
319
+ function mergePrettierOptions(options, overrides = {}) {
320
+ return {
321
+ ...options,
322
+ ...overrides,
323
+ plugins: [
324
+ ...overrides.plugins || [],
325
+ ...options.plugins || []
326
+ ]
327
+ };
328
+ }
315
329
  async function formatters(options = {}, stylistic2 = {}) {
316
330
  const defaultIndent = 4;
317
331
  if (options === true) {
@@ -383,10 +397,10 @@ async function formatters(options = {}, stylistic2 = {}) {
383
397
  rules: {
384
398
  "format/prettier": [
385
399
  "error",
386
- {
400
+ mergePrettierOptions(prettierOptions, {
387
401
  ...prettierOptions,
388
402
  parser: "css"
389
- }
403
+ })
390
404
  ]
391
405
  }
392
406
  },
@@ -399,10 +413,10 @@ async function formatters(options = {}, stylistic2 = {}) {
399
413
  rules: {
400
414
  "format/prettier": [
401
415
  "error",
402
- {
416
+ mergePrettierOptions(prettierOptions, {
403
417
  ...prettierOptions,
404
418
  parser: "scss"
405
- }
419
+ })
406
420
  ]
407
421
  }
408
422
  },
@@ -415,10 +429,10 @@ async function formatters(options = {}, stylistic2 = {}) {
415
429
  rules: {
416
430
  "format/prettier": [
417
431
  "error",
418
- {
432
+ mergePrettierOptions(prettierOptions, {
419
433
  ...prettierOptions,
420
434
  parser: "less"
421
- }
435
+ })
422
436
  ]
423
437
  }
424
438
  }
@@ -434,10 +448,30 @@ async function formatters(options = {}, stylistic2 = {}) {
434
448
  rules: {
435
449
  "format/prettier": [
436
450
  "error",
437
- {
451
+ mergePrettierOptions(prettierOptions, {
438
452
  ...prettierOptions,
439
453
  parser: "html"
440
- }
454
+ })
455
+ ]
456
+ }
457
+ });
458
+ }
459
+ if (options.xml) {
460
+ configs2.push({
461
+ files: [GLOB_XML],
462
+ languageOptions: {
463
+ parser: parserPlain
464
+ },
465
+ name: "eslint/formatter/xml",
466
+ rules: {
467
+ "format/prettier": [
468
+ "error",
469
+ mergePrettierOptions({ ...prettierXmlOptions, ...prettierOptions }, {
470
+ parser: "xml",
471
+ plugins: [
472
+ "@prettier/plugin-xml"
473
+ ]
474
+ })
441
475
  ]
442
476
  }
443
477
  });
@@ -452,14 +486,12 @@ async function formatters(options = {}, stylistic2 = {}) {
452
486
  rules: {
453
487
  "format/prettier": [
454
488
  "error",
455
- {
456
- ...prettierXmlOptions,
457
- ...prettierOptions,
489
+ mergePrettierOptions({ ...prettierXmlOptions, ...prettierOptions }, {
458
490
  parser: "xml",
459
491
  plugins: [
460
492
  "@prettier/plugin-xml"
461
493
  ]
462
- }
494
+ })
463
495
  ]
464
496
  }
465
497
  });
@@ -475,11 +507,10 @@ async function formatters(options = {}, stylistic2 = {}) {
475
507
  rules: {
476
508
  [`format/${formater}`]: [
477
509
  "error",
478
- formater === "prettier" ? {
479
- ...prettierOptions,
510
+ formater === "prettier" ? mergePrettierOptions(prettierOptions, {
480
511
  embeddedLanguageFormatting: "off",
481
512
  parser: "markdown"
482
- } : {
513
+ }) : {
483
514
  ...dprintOptions,
484
515
  language: "markdown"
485
516
  }
@@ -497,10 +528,9 @@ async function formatters(options = {}, stylistic2 = {}) {
497
528
  rules: {
498
529
  "format/prettier": [
499
530
  "error",
500
- {
501
- ...prettierOptions,
531
+ mergePrettierOptions(prettierOptions, {
502
532
  parser: "graphql"
503
- }
533
+ })
504
534
  ]
505
535
  }
506
536
  });
@@ -597,6 +627,7 @@ async function javascript(options = {}) {
597
627
  },
598
628
  rules: {
599
629
  "accessor-pairs": ["error", { enforceForClassMembers: true, setWithoutGet: true }],
630
+ "antfu/no-top-level-await": "error",
600
631
  "array-callback-return": "error",
601
632
  "block-scoped-var": "error",
602
633
  "constructor-super": "error",
@@ -936,6 +967,7 @@ async function markdown(options = {}) {
936
967
  },
937
968
  name: "eslint/markdown/disables",
938
969
  rules: {
970
+ "antfu/no-top-level-await": "off",
939
971
  "import/newline-after-import": "off",
940
972
  "no-alert": "off",
941
973
  "no-console": "off",
@@ -1469,14 +1501,19 @@ async function test(options = {}) {
1469
1501
  files,
1470
1502
  name: "eslint/test/rules",
1471
1503
  rules: {
1472
- "node/prefer-global/process": "off",
1473
1504
  "test/consistent-test-it": ["error", { fn: "it", withinDescribe: "it" }],
1474
1505
  "test/no-identical-title": "error",
1475
1506
  "test/no-import-node-test": "error",
1476
1507
  "test/no-only-tests": isInEditor ? "off" : "error",
1477
1508
  "test/prefer-hooks-in-order": "error",
1478
1509
  "test/prefer-lowercase-title": "error",
1479
- "ts/explicit-function-return-type": "off",
1510
+ // Disables
1511
+ ...{
1512
+ "antfu/no-top-level-await": "off",
1513
+ "no-unused-expressions": "off",
1514
+ "node/prefer-global/process": "off",
1515
+ "ts/explicit-function-return-type": "off"
1516
+ },
1480
1517
  ...overrides
1481
1518
  }
1482
1519
  }
@@ -1800,7 +1837,6 @@ async function vue(options = {}) {
1800
1837
  parserVue,
1801
1838
  processorVueBlocks
1802
1839
  ] = await Promise.all([
1803
- // @ts-expect-error missing types
1804
1840
  interopDefault(import("eslint-plugin-vue")),
1805
1841
  interopDefault(import("vue-eslint-parser")),
1806
1842
  interopDefault(import("eslint-processor-vue-blocks"))
@@ -1865,6 +1901,7 @@ async function vue(options = {}) {
1865
1901
  ...pluginVue.configs["strongly-recommended"].rules,
1866
1902
  ...pluginVue.configs.recommended.rules
1867
1903
  },
1904
+ "antfu/no-top-level-await": "off",
1868
1905
  "node/prefer-global/process": "off",
1869
1906
  "ts/explicit-function-return-type": "off",
1870
1907
  "vue/block-order": ["error", {
@@ -1876,6 +1913,7 @@ async function vue(options = {}) {
1876
1913
  ...vueVersion === "2" ? {
1877
1914
  "vue/require-explicit-emits": "off"
1878
1915
  } : null,
1916
+ "no-irregular-whitespace": "off",
1879
1917
  "vue/define-macros-order": ["error", {
1880
1918
  order: ["defineOptions", "defineProps", "defineEmits", "defineSlots"]
1881
1919
  }],
@@ -1904,7 +1942,14 @@ async function vue(options = {}) {
1904
1942
  "vue/no-dupe-keys": "off",
1905
1943
  "vue/no-empty-pattern": "error",
1906
1944
  "vue/no-extra-parens": ["error", "functions"],
1907
- "vue/no-irregular-whitespace": "error",
1945
+ "vue/no-irregular-whitespace": ["error", {
1946
+ skipComments: false,
1947
+ skipHTMLAttributeValues: false,
1948
+ skipHTMLTextContents: true,
1949
+ skipRegExps: false,
1950
+ skipStrings: true,
1951
+ skipTemplates: false
1952
+ }],
1908
1953
  "vue/no-loss-of-precision": "error",
1909
1954
  "vue/no-restricted-syntax": [
1910
1955
  "error",
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@lincy/eslint-config",
3
3
  "type": "module",
4
- "version": "5.2.4",
4
+ "version": "5.2.6",
5
5
  "packageManager": "pnpm@9.1.0",
6
6
  "description": "LinCenYing's ESLint config",
7
7
  "author": "LinCenYing <lincenying@gmail.com> (https://github.com/lincenying/)",
@@ -37,13 +37,13 @@
37
37
  "prepare": "npx simple-git-hooks"
38
38
  },
39
39
  "peerDependencies": {
40
- "@eslint-react/eslint-plugin": "^7.33.2",
40
+ "@eslint-react/eslint-plugin": "^1.15.0",
41
41
  "@prettier/plugin-xml": "^3.4.1",
42
42
  "@unocss/eslint-plugin": ">=0.50.0",
43
43
  "eslint": ">=9.5.0",
44
44
  "eslint-plugin-format": ">=0.1.0",
45
- "eslint-plugin-react-hooks": "^4.6.0",
46
- "eslint-plugin-react-refresh": "^0.4.4"
45
+ "eslint-plugin-react-hooks": "^5.0.0",
46
+ "eslint-plugin-react-refresh": "^0.4.13"
47
47
  },
48
48
  "peerDependenciesMeta": {
49
49
  "@eslint-react/eslint-plugin": {
@@ -70,30 +70,30 @@
70
70
  "@antfu/install-pkg": "^0.4.1",
71
71
  "@clack/prompts": "^0.7.0",
72
72
  "@eslint-community/eslint-plugin-eslint-comments": "^4.4.0",
73
- "@eslint/markdown": "^6.1.0",
74
- "@stylistic/eslint-plugin": "2.8.0",
75
- "@typescript-eslint/eslint-plugin": "8.6.0",
76
- "@typescript-eslint/parser": "8.6.0",
77
- "@vitest/eslint-plugin": "^1.1.4",
73
+ "@eslint/markdown": "^6.2.1",
74
+ "@stylistic/eslint-plugin": "2.9.0",
75
+ "@typescript-eslint/eslint-plugin": "8.10.0",
76
+ "@typescript-eslint/parser": "8.10.0",
77
+ "@vitest/eslint-plugin": "^1.1.7",
78
78
  "eslint-config-flat-gitignore": "^0.3.0",
79
79
  "eslint-flat-config-utils": "^0.4.0",
80
80
  "eslint-merge-processors": "^0.1.0",
81
81
  "eslint-parser-plain": "^0.1.0",
82
- "eslint-plugin-antfu": "^2.6.0",
83
- "eslint-plugin-import-x": "^4.2.1",
84
- "eslint-plugin-jsdoc": "^50.2.3",
82
+ "eslint-plugin-antfu": "^2.7.0",
83
+ "eslint-plugin-import-x": "^4.3.1",
84
+ "eslint-plugin-jsdoc": "^50.4.3",
85
85
  "eslint-plugin-jsonc": "^2.16.0",
86
- "eslint-plugin-n": "^17.10.2",
86
+ "eslint-plugin-n": "^17.11.1",
87
87
  "eslint-plugin-no-only-tests": "^3.3.0",
88
- "eslint-plugin-perfectionist": "^3.6.0",
88
+ "eslint-plugin-perfectionist": "^3.9.1",
89
89
  "eslint-plugin-regexp": "^2.6.0",
90
90
  "eslint-plugin-toml": "^0.11.1",
91
- "eslint-plugin-unicorn": "^55.0.0",
91
+ "eslint-plugin-unicorn": "^56.0.0",
92
92
  "eslint-plugin-unused-imports": "^4.1.4",
93
- "eslint-plugin-vue": "^9.28.0",
93
+ "eslint-plugin-vue": "^9.29.1",
94
94
  "eslint-plugin-yml": "^1.14.0",
95
95
  "eslint-processor-vue-blocks": "^0.1.2",
96
- "globals": "^15.9.0",
96
+ "globals": "^15.11.0",
97
97
  "jsonc-eslint-parser": "^2.4.0",
98
98
  "local-pkg": "^0.5.0",
99
99
  "prompts": "^2.4.2",
@@ -103,25 +103,25 @@
103
103
  },
104
104
  "devDependencies": {
105
105
  "@antfu/ni": "^0.23.0",
106
- "@eslint-react/eslint-plugin": "^1.14.1",
106
+ "@eslint-react/eslint-plugin": "^1.15.0",
107
107
  "@eslint-types/jsdoc": "48.2.2",
108
108
  "@eslint-types/typescript-eslint": "^7.5.0",
109
109
  "@eslint-types/unicorn": "^52.0.0",
110
- "@eslint/config-inspector": "^0.5.4",
110
+ "@eslint/config-inspector": "^0.5.5",
111
111
  "@lincy/eslint-config": "workspace:*",
112
112
  "@prettier/plugin-xml": "^3.4.1",
113
- "@stylistic/eslint-plugin-migrate": "^2.8.0",
114
- "@types/node": "^22.5.5",
113
+ "@stylistic/eslint-plugin-migrate": "^2.9.0",
114
+ "@types/node": "^22.7.7",
115
115
  "@types/prompts": "^2.4.9",
116
- "@unocss/eslint-plugin": "^0.62.4",
117
- "bumpp": "^9.5.2",
118
- "eslint": "^9.10.0",
116
+ "@unocss/eslint-plugin": "^0.63.4",
117
+ "bumpp": "^9.7.1",
118
+ "eslint": "^9.13.0",
119
119
  "eslint-plugin-format": "^0.1.2",
120
- "eslint-plugin-react-hooks": "^4.6.2",
121
- "eslint-plugin-react-refresh": "^0.4.12",
120
+ "eslint-plugin-react-hooks": "^5.0.0",
121
+ "eslint-plugin-react-refresh": "^0.4.13",
122
122
  "eslint-ts-patch": "9.8.0-1",
123
123
  "eslint-typegen": "^0.3.2",
124
- "esno": "^4.7.0",
124
+ "esno": "^4.8.0",
125
125
  "lint-staged": "^15.2.10",
126
126
  "prettier": "^3.3.3",
127
127
  "react": "^18.3.1",
@@ -129,11 +129,11 @@
129
129
  "simple-git-hooks": "^2.11.1",
130
130
  "simple-open-url": "^3.0.1",
131
131
  "sucrase": "^3.35.0",
132
- "tsup": "^8.2.4",
133
- "typescript": "^5.6.2",
132
+ "tsup": "^8.3.0",
133
+ "typescript": "^5.6.3",
134
134
  "unbuild": "^2.0.0",
135
- "vitest": "^2.1.1",
136
- "vue": "^3.5.6"
135
+ "vitest": "^2.1.3",
136
+ "vue": "^3.5.12"
137
137
  },
138
138
  "pnpm": {
139
139
  "peerDependencyRules": {