@lincy/eslint-config 5.2.5 → 5.2.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -144,13 +144,6 @@ async function disables() {
144
144
  "unused-imports/no-unused-vars": "off"
145
145
  }
146
146
  },
147
- {
148
- files: ["**/*.{test,spec}.([tj])s?(x)"],
149
- name: "eslint/disables/test",
150
- rules: {
151
- "no-unused-expressions": "off"
152
- }
153
- },
154
147
  {
155
148
  files: ["**/*.js", "**/*.cjs"],
156
149
  name: "eslint/disables/cjs",
@@ -323,10 +316,20 @@ async function stylistic(options = {}) {
323
316
  }
324
317
 
325
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
+ }
326
329
  async function formatters(options = {}, stylistic2 = {}) {
327
330
  const defaultIndent = 4;
331
+ const isPrettierPluginXmlInScope = isPackageInScope("@prettier/plugin-xml");
328
332
  if (options === true) {
329
- const isPrettierPluginXmlInScope = isPackageInScope("@prettier/plugin-xml");
330
333
  options = {
331
334
  css: false,
332
335
  graphql: true,
@@ -335,6 +338,15 @@ async function formatters(options = {}, stylistic2 = {}) {
335
338
  svg: isPrettierPluginXmlInScope,
336
339
  xml: isPrettierPluginXmlInScope
337
340
  };
341
+ } else {
342
+ options = {
343
+ css: options.css ?? false,
344
+ graphql: options.graphql ?? true,
345
+ html: options.html ?? true,
346
+ markdown: options.markdown ?? true,
347
+ svg: isPrettierPluginXmlInScope,
348
+ xml: isPrettierPluginXmlInScope
349
+ };
338
350
  }
339
351
  await ensurePackages([
340
352
  "eslint-plugin-format",
@@ -394,10 +406,10 @@ async function formatters(options = {}, stylistic2 = {}) {
394
406
  rules: {
395
407
  "format/prettier": [
396
408
  "error",
397
- {
409
+ mergePrettierOptions(prettierOptions, {
398
410
  ...prettierOptions,
399
411
  parser: "css"
400
- }
412
+ })
401
413
  ]
402
414
  }
403
415
  },
@@ -410,10 +422,10 @@ async function formatters(options = {}, stylistic2 = {}) {
410
422
  rules: {
411
423
  "format/prettier": [
412
424
  "error",
413
- {
425
+ mergePrettierOptions(prettierOptions, {
414
426
  ...prettierOptions,
415
427
  parser: "scss"
416
- }
428
+ })
417
429
  ]
418
430
  }
419
431
  },
@@ -426,10 +438,10 @@ async function formatters(options = {}, stylistic2 = {}) {
426
438
  rules: {
427
439
  "format/prettier": [
428
440
  "error",
429
- {
441
+ mergePrettierOptions(prettierOptions, {
430
442
  ...prettierOptions,
431
443
  parser: "less"
432
- }
444
+ })
433
445
  ]
434
446
  }
435
447
  }
@@ -445,10 +457,30 @@ async function formatters(options = {}, stylistic2 = {}) {
445
457
  rules: {
446
458
  "format/prettier": [
447
459
  "error",
448
- {
460
+ mergePrettierOptions(prettierOptions, {
449
461
  ...prettierOptions,
450
462
  parser: "html"
451
- }
463
+ })
464
+ ]
465
+ }
466
+ });
467
+ }
468
+ if (options.xml) {
469
+ configs2.push({
470
+ files: [GLOB_XML],
471
+ languageOptions: {
472
+ parser: parserPlain
473
+ },
474
+ name: "eslint/formatter/xml",
475
+ rules: {
476
+ "format/prettier": [
477
+ "error",
478
+ mergePrettierOptions({ ...prettierXmlOptions, ...prettierOptions }, {
479
+ parser: "xml",
480
+ plugins: [
481
+ "@prettier/plugin-xml"
482
+ ]
483
+ })
452
484
  ]
453
485
  }
454
486
  });
@@ -463,14 +495,12 @@ async function formatters(options = {}, stylistic2 = {}) {
463
495
  rules: {
464
496
  "format/prettier": [
465
497
  "error",
466
- {
467
- ...prettierXmlOptions,
468
- ...prettierOptions,
498
+ mergePrettierOptions({ ...prettierXmlOptions, ...prettierOptions }, {
469
499
  parser: "xml",
470
500
  plugins: [
471
501
  "@prettier/plugin-xml"
472
502
  ]
473
- }
503
+ })
474
504
  ]
475
505
  }
476
506
  });
@@ -486,11 +516,10 @@ async function formatters(options = {}, stylistic2 = {}) {
486
516
  rules: {
487
517
  [`format/${formater}`]: [
488
518
  "error",
489
- formater === "prettier" ? {
490
- ...prettierOptions,
519
+ formater === "prettier" ? mergePrettierOptions(prettierOptions, {
491
520
  embeddedLanguageFormatting: "off",
492
521
  parser: "markdown"
493
- } : {
522
+ }) : {
494
523
  ...dprintOptions,
495
524
  language: "markdown"
496
525
  }
@@ -508,10 +537,9 @@ async function formatters(options = {}, stylistic2 = {}) {
508
537
  rules: {
509
538
  "format/prettier": [
510
539
  "error",
511
- {
512
- ...prettierOptions,
540
+ mergePrettierOptions(prettierOptions, {
513
541
  parser: "graphql"
514
- }
542
+ })
515
543
  ]
516
544
  }
517
545
  });
@@ -948,6 +976,7 @@ async function markdown(options = {}) {
948
976
  },
949
977
  name: "eslint/markdown/disables",
950
978
  rules: {
979
+ "antfu/no-top-level-await": "off",
951
980
  "import/newline-after-import": "off",
952
981
  "no-alert": "off",
953
982
  "no-console": "off",
@@ -1481,14 +1510,19 @@ async function test(options = {}) {
1481
1510
  files,
1482
1511
  name: "eslint/test/rules",
1483
1512
  rules: {
1484
- "node/prefer-global/process": "off",
1485
1513
  "test/consistent-test-it": ["error", { fn: "it", withinDescribe: "it" }],
1486
1514
  "test/no-identical-title": "error",
1487
1515
  "test/no-import-node-test": "error",
1488
1516
  "test/no-only-tests": isInEditor ? "off" : "error",
1489
1517
  "test/prefer-hooks-in-order": "error",
1490
1518
  "test/prefer-lowercase-title": "error",
1491
- "ts/explicit-function-return-type": "off",
1519
+ // Disables
1520
+ ...{
1521
+ "antfu/no-top-level-await": "off",
1522
+ "no-unused-expressions": "off",
1523
+ "node/prefer-global/process": "off",
1524
+ "ts/explicit-function-return-type": "off"
1525
+ },
1492
1526
  ...overrides
1493
1527
  }
1494
1528
  }
@@ -1812,7 +1846,6 @@ async function vue(options = {}) {
1812
1846
  parserVue,
1813
1847
  processorVueBlocks
1814
1848
  ] = await Promise.all([
1815
- // @ts-expect-error missing types
1816
1849
  interopDefault(import("eslint-plugin-vue")),
1817
1850
  interopDefault(import("vue-eslint-parser")),
1818
1851
  interopDefault(import("eslint-processor-vue-blocks"))
@@ -1889,6 +1922,7 @@ async function vue(options = {}) {
1889
1922
  ...vueVersion === "2" ? {
1890
1923
  "vue/require-explicit-emits": "off"
1891
1924
  } : null,
1925
+ "no-irregular-whitespace": "off",
1892
1926
  "vue/define-macros-order": ["error", {
1893
1927
  order: ["defineOptions", "defineProps", "defineEmits", "defineSlots"]
1894
1928
  }],
@@ -1917,7 +1951,14 @@ async function vue(options = {}) {
1917
1951
  "vue/no-dupe-keys": "off",
1918
1952
  "vue/no-empty-pattern": "error",
1919
1953
  "vue/no-extra-parens": ["error", "functions"],
1920
- "vue/no-irregular-whitespace": "error",
1954
+ "vue/no-irregular-whitespace": ["error", {
1955
+ skipComments: false,
1956
+ skipHTMLAttributeValues: false,
1957
+ skipHTMLTextContents: true,
1958
+ skipRegExps: false,
1959
+ skipStrings: true,
1960
+ skipTemplates: false
1961
+ }],
1921
1962
  "vue/no-loss-of-precision": "error",
1922
1963
  "vue/no-restricted-syntax": [
1923
1964
  "error",
package/package.json CHANGED
@@ -1,8 +1,8 @@
1
1
  {
2
2
  "name": "@lincy/eslint-config",
3
3
  "type": "module",
4
- "version": "5.2.5",
5
- "packageManager": "pnpm@9.1.0",
4
+ "version": "5.2.7",
5
+ "packageManager": "pnpm@9.12.3",
6
6
  "description": "LinCenYing's ESLint config",
7
7
  "author": "LinCenYing <lincenying@gmail.com> (https://github.com/lincenying/)",
8
8
  "license": "MIT",
@@ -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": {
@@ -69,31 +69,31 @@
69
69
  "@antfu/eslint-define-config": "1.23.0-2",
70
70
  "@antfu/install-pkg": "^0.4.1",
71
71
  "@clack/prompts": "^0.7.0",
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.7.0",
76
- "@typescript-eslint/parser": "8.7.0",
77
- "@vitest/eslint-plugin": "^1.1.4",
72
+ "@eslint-community/eslint-plugin-eslint-comments": "^4.4.1",
73
+ "@eslint/markdown": "^6.2.1",
74
+ "@stylistic/eslint-plugin": "2.10.1",
75
+ "@typescript-eslint/eslint-plugin": "8.13.0",
76
+ "@typescript-eslint/parser": "8.13.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
82
  "eslint-plugin-antfu": "^2.7.0",
83
- "eslint-plugin-import-x": "^4.3.0",
84
- "eslint-plugin-jsdoc": "^50.2.4",
83
+ "eslint-plugin-import-x": "^4.4.0",
84
+ "eslint-plugin-jsdoc": "^50.4.3",
85
85
  "eslint-plugin-jsonc": "^2.16.0",
86
- "eslint-plugin-n": "^17.10.3",
86
+ "eslint-plugin-n": "^17.13.0",
87
87
  "eslint-plugin-no-only-tests": "^3.3.0",
88
- "eslint-plugin-perfectionist": "^3.7.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",
94
- "eslint-plugin-yml": "^1.14.0",
93
+ "eslint-plugin-vue": "^9.30.0",
94
+ "eslint-plugin-yml": "^1.15.0",
95
95
  "eslint-processor-vue-blocks": "^0.1.2",
96
- "globals": "^15.9.0",
96
+ "globals": "^15.12.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.2",
106
+ "@eslint-react/eslint-plugin": "^1.15.2",
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.6",
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.7.0",
113
+ "@stylistic/eslint-plugin-migrate": "^2.10.1",
114
+ "@types/node": "^22.9.0",
115
115
  "@types/prompts": "^2.4.9",
116
- "@unocss/eslint-plugin": "^0.62.4",
117
- "bumpp": "^9.5.2",
118
- "eslint": "^9.11.1",
116
+ "@unocss/eslint-plugin": "^0.64.0",
117
+ "bumpp": "^9.8.1",
118
+ "eslint": "^9.14.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.14",
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.3.0",
133
- "typescript": "^5.6.2",
132
+ "tsup": "^8.3.5",
133
+ "typescript": "^5.6.3",
134
134
  "unbuild": "^2.0.0",
135
- "vitest": "^2.1.1",
136
- "vue": "^3.5.8"
135
+ "vitest": "^2.1.4",
136
+ "vue": "^3.5.12"
137
137
  },
138
138
  "pnpm": {
139
139
  "peerDependencyRules": {
@@ -143,10 +143,10 @@
143
143
  }
144
144
  },
145
145
  "resolutions": {
146
- "@eslint-community/eslint-utils": "^4.4.0",
147
- "@typescript-eslint/utils": "^8.3.0",
148
- "eslint": "^9.9.1",
149
- "tsx": "^4.18.0"
146
+ "@eslint-community/eslint-utils": "^4.4.1",
147
+ "@typescript-eslint/utils": "^8.13.0",
148
+ "eslint": "^9.14.0",
149
+ "tsx": "^4.19.2"
150
150
  },
151
151
  "simple-git-hooks": {
152
152
  "pre-commit": "npx lint-staged"