@dhzh/eslint-config 1.7.2 → 1.9.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/README.md CHANGED
@@ -7,6 +7,7 @@ I use ESLint to format and lint my code:
7
7
  | | | |
8
8
  |---|---|---|
9
9
  | [react](./src/configs/react.ts) | [`ESLint React`](https://eslint-react.xyz/) [`eslint-plugin-react-hooks`](https://www.npmjs.com/package/eslint-plugin-react-hooks) [`eslint-plugin-react-refresh`](https://github.com/ArnaudBarre/eslint-plugin-react-refresh) [`eslint-plugin-react-compiler`](https://www.npmjs.com/package/eslint-plugin-react-compiler) [`eslint-plugin-react-google-translate`](https://www.npmjs.com/package/eslint-plugin-react-google-translate) |
10
+ | [vue](./src/configs/vue.ts) | [`eslint-plugin-vue`](https://eslint.vuejs.org/) [`vue-eslint-parser`](https://www.npmjs.com/package/vue-eslint-parser) [`eslint-processor-vue-blocks`](https://github.com/antfu/eslint-processor-vue-blocks) |
10
11
  | [stylistic](./src/configs/stylistic.ts) | [`ESLint Stylistic`](https://eslint.style/) [`eslint-plugin-antfu`](https://github.com/antfu/eslint-plugin-antfu) [`eslint-plugin-hyoban`](https://github.com/hyoban/eslint-plugin-hyoban) |
11
12
  | [typescript](./src/configs/typescript.ts) | [`typescript-eslint`](https://typescript-eslint.io/) |
12
13
  | [javascript](./src/configs/javascript.ts) | [`@eslint/js`](https://eslint.org/docs/latest/rules) |
@@ -28,12 +28,12 @@ var import_ansis5 = __toESM(require("ansis"), 1);
28
28
  var import_cac = require("cac");
29
29
 
30
30
  // package.json
31
- var version = "1.7.2";
31
+ var version = "1.9.0";
32
32
  var package_default = {
33
33
  name: "@dhzh/eslint-config",
34
34
  type: "module",
35
35
  version,
36
- packageManager: "pnpm@10.11.0",
36
+ packageManager: "pnpm@10.14.0",
37
37
  description: "Lyle's ESLint config",
38
38
  author: {
39
39
  name: "Lyle Zheng",
@@ -95,18 +95,19 @@ var package_default = {
95
95
  "@eslint-community/eslint-plugin-eslint-comments": "^4.5.0",
96
96
  "@eslint-react/eslint-plugin": "^1.48.5",
97
97
  "@eslint/js": "^9.25.1",
98
- "@stylistic/eslint-plugin": "^4.2.0",
99
- "@unocss/eslint-config": "66.1.2",
98
+ "@stylistic/eslint-plugin": "^5.2.3",
99
+ "@unocss/eslint-config": "66.4.2",
100
100
  ansis: "^4.0.0",
101
101
  cac: "^6.7.14",
102
+ "eslint-merge-processors": "^2.0.0",
102
103
  "eslint-plugin-antfu": "^3.1.1",
103
104
  "eslint-plugin-format": "^1.0.1",
104
105
  "eslint-plugin-hyoban": "^0.6.1",
105
106
  "eslint-plugin-import-x": "^4.11.0",
106
107
  "eslint-plugin-jsonc": "^2.20.0",
107
108
  "eslint-plugin-n": "^17.17.0",
108
- "eslint-plugin-package-json": "^0.31.0",
109
- "eslint-plugin-react-compiler": "19.1.0-rc.1",
109
+ "eslint-plugin-package-json": "^0.54.0",
110
+ "eslint-plugin-react-compiler": "19.1.0-rc.2",
110
111
  "eslint-plugin-react-google-translate": "^0.1.1",
111
112
  "eslint-plugin-react-hooks": "^5.2.0",
112
113
  "eslint-plugin-react-refresh": "^0.4.20",
@@ -114,27 +115,31 @@ var package_default = {
114
115
  "eslint-plugin-simple-import-sort": "^12.1.1",
115
116
  "eslint-plugin-tailwindcss": "npm:@hyoban/eslint-plugin-tailwindcss@4.0.0-alpha.12",
116
117
  "eslint-plugin-toml": "^0.12.0",
117
- "eslint-plugin-unicorn": "^59.0.1",
118
+ "eslint-plugin-unicorn": "^60.0.0",
118
119
  "eslint-plugin-unused-imports": "^4.1.4",
120
+ "eslint-plugin-vue": "^10.1.0",
119
121
  "eslint-plugin-yml": "^1.18.0",
122
+ "eslint-processor-vue-blocks": "^2.0.0",
120
123
  globals: "^16.0.0",
121
124
  "jsonc-eslint-parser": "^2.4.0",
122
125
  "local-pkg": "^1.1.1",
123
126
  "toml-eslint-parser": "^0.10.0",
124
127
  "typescript-eslint": "^8.31.0",
128
+ "vue-eslint-parser": "^10.1.3",
125
129
  "yaml-eslint-parser": "^1.3.0"
126
130
  },
127
131
  devDependencies: {
128
132
  "@eslint/config-inspector": "^1.0.2",
129
133
  "@prettier/plugin-xml": "^3.4.1",
130
134
  "@types/eslint-plugin-tailwindcss": "^3.17.0",
131
- "@types/node": "^22.15.2",
135
+ "@types/node": "^22.17.2",
132
136
  bumpp: "^10.1.0",
133
137
  "bundle-require": "^5.1.0",
134
138
  eslint: "^9.25.1",
135
139
  "eslint-typegen": "^2.1.0",
136
140
  "lint-staged": "^16.0.0",
137
141
  "simple-git-hooks": "^2.13.0",
142
+ tailwindcss: "^4.1.12",
138
143
  tsup: "^8.4.0",
139
144
  tsx: "^4.19.3",
140
145
  typescript: "^5.8.3"
@@ -208,7 +213,8 @@ var vscodeSettingsString = `
208
213
  "pcss",
209
214
  "postcss",
210
215
  "gql",
211
- "graphql"
216
+ "graphql",
217
+ "vue"
212
218
  ],
213
219
 
214
220
  // Enable eslint as the default formatter
@@ -262,6 +268,9 @@ var vscodeSettingsString = `
262
268
  },
263
269
  "[graphql]": {
264
270
  "editor.defaultFormatter": "dbaeumer.vscode-eslint"
271
+ },
272
+ "[vue]": {
273
+ "editor.defaultFormatter": "dbaeumer.vscode-eslint"
265
274
  }
266
275
  `;
267
276
  var eslintConfigContent = `import { defineConfig } from '@dhzh/eslint-config';
package/dist/cli/index.js CHANGED
@@ -4,12 +4,12 @@ import c4 from "ansis";
4
4
  import { cac } from "cac";
5
5
 
6
6
  // package.json
7
- var version = "1.7.2";
7
+ var version = "1.9.0";
8
8
  var package_default = {
9
9
  name: "@dhzh/eslint-config",
10
10
  type: "module",
11
11
  version,
12
- packageManager: "pnpm@10.11.0",
12
+ packageManager: "pnpm@10.14.0",
13
13
  description: "Lyle's ESLint config",
14
14
  author: {
15
15
  name: "Lyle Zheng",
@@ -71,18 +71,19 @@ var package_default = {
71
71
  "@eslint-community/eslint-plugin-eslint-comments": "^4.5.0",
72
72
  "@eslint-react/eslint-plugin": "^1.48.5",
73
73
  "@eslint/js": "^9.25.1",
74
- "@stylistic/eslint-plugin": "^4.2.0",
75
- "@unocss/eslint-config": "66.1.2",
74
+ "@stylistic/eslint-plugin": "^5.2.3",
75
+ "@unocss/eslint-config": "66.4.2",
76
76
  ansis: "^4.0.0",
77
77
  cac: "^6.7.14",
78
+ "eslint-merge-processors": "^2.0.0",
78
79
  "eslint-plugin-antfu": "^3.1.1",
79
80
  "eslint-plugin-format": "^1.0.1",
80
81
  "eslint-plugin-hyoban": "^0.6.1",
81
82
  "eslint-plugin-import-x": "^4.11.0",
82
83
  "eslint-plugin-jsonc": "^2.20.0",
83
84
  "eslint-plugin-n": "^17.17.0",
84
- "eslint-plugin-package-json": "^0.31.0",
85
- "eslint-plugin-react-compiler": "19.1.0-rc.1",
85
+ "eslint-plugin-package-json": "^0.54.0",
86
+ "eslint-plugin-react-compiler": "19.1.0-rc.2",
86
87
  "eslint-plugin-react-google-translate": "^0.1.1",
87
88
  "eslint-plugin-react-hooks": "^5.2.0",
88
89
  "eslint-plugin-react-refresh": "^0.4.20",
@@ -90,27 +91,31 @@ var package_default = {
90
91
  "eslint-plugin-simple-import-sort": "^12.1.1",
91
92
  "eslint-plugin-tailwindcss": "npm:@hyoban/eslint-plugin-tailwindcss@4.0.0-alpha.12",
92
93
  "eslint-plugin-toml": "^0.12.0",
93
- "eslint-plugin-unicorn": "^59.0.1",
94
+ "eslint-plugin-unicorn": "^60.0.0",
94
95
  "eslint-plugin-unused-imports": "^4.1.4",
96
+ "eslint-plugin-vue": "^10.1.0",
95
97
  "eslint-plugin-yml": "^1.18.0",
98
+ "eslint-processor-vue-blocks": "^2.0.0",
96
99
  globals: "^16.0.0",
97
100
  "jsonc-eslint-parser": "^2.4.0",
98
101
  "local-pkg": "^1.1.1",
99
102
  "toml-eslint-parser": "^0.10.0",
100
103
  "typescript-eslint": "^8.31.0",
104
+ "vue-eslint-parser": "^10.1.3",
101
105
  "yaml-eslint-parser": "^1.3.0"
102
106
  },
103
107
  devDependencies: {
104
108
  "@eslint/config-inspector": "^1.0.2",
105
109
  "@prettier/plugin-xml": "^3.4.1",
106
110
  "@types/eslint-plugin-tailwindcss": "^3.17.0",
107
- "@types/node": "^22.15.2",
111
+ "@types/node": "^22.17.2",
108
112
  bumpp: "^10.1.0",
109
113
  "bundle-require": "^5.1.0",
110
114
  eslint: "^9.25.1",
111
115
  "eslint-typegen": "^2.1.0",
112
116
  "lint-staged": "^16.0.0",
113
117
  "simple-git-hooks": "^2.13.0",
118
+ tailwindcss: "^4.1.12",
114
119
  tsup: "^8.4.0",
115
120
  tsx: "^4.19.3",
116
121
  typescript: "^5.8.3"
@@ -184,7 +189,8 @@ var vscodeSettingsString = `
184
189
  "pcss",
185
190
  "postcss",
186
191
  "gql",
187
- "graphql"
192
+ "graphql",
193
+ "vue"
188
194
  ],
189
195
 
190
196
  // Enable eslint as the default formatter
@@ -238,6 +244,9 @@ var vscodeSettingsString = `
238
244
  },
239
245
  "[graphql]": {
240
246
  "editor.defaultFormatter": "dbaeumer.vscode-eslint"
247
+ },
248
+ "[vue]": {
249
+ "editor.defaultFormatter": "dbaeumer.vscode-eslint"
241
250
  }
242
251
  `;
243
252
  var eslintConfigContent = `import { defineConfig } from '@dhzh/eslint-config';
package/dist/index.cjs CHANGED
@@ -58,6 +58,7 @@ var GLOB_SCSS = "**/*.scss";
58
58
  var GLOB_GRAPHQL = "**/*.{g,graph}ql";
59
59
  var GLOB_XML = "**/*.xml";
60
60
  var GLOB_SVG = "**/*.svg";
61
+ var GLOB_VUE = "**/*.vue";
61
62
  var GLOB_JSON_SRC = [
62
63
  GLOB_JSON,
63
64
  GLOB_JSON5,
@@ -266,6 +267,58 @@ function react(options = {}) {
266
267
  ];
267
268
  }
268
269
 
270
+ // src/configs/vue.ts
271
+ var import_js = __toESM(require("@eslint/js"), 1);
272
+ var import_typescript_eslint = __toESM(require("typescript-eslint"), 1);
273
+ var import_eslint_plugin_vue = __toESM(require("eslint-plugin-vue"), 1);
274
+ var import_globals = __toESM(require("globals"), 1);
275
+ var import_eslint_merge_processors = require("eslint-merge-processors");
276
+ var import_eslint_processor_vue_blocks = __toESM(require("eslint-processor-vue-blocks"), 1);
277
+ function vue(options = {}) {
278
+ const { overrides = {} } = options;
279
+ return import_typescript_eslint.default.config(
280
+ {
281
+ ...import_js.default.configs.recommended,
282
+ name: `${RULE_PREFIX}/vue/shared/javascript`,
283
+ files: [GLOB_VUE]
284
+ },
285
+ import_typescript_eslint.default.configs.recommended.map((item) => ({
286
+ ...item,
287
+ name: `${RULE_PREFIX}/vue/shared/typescript/${item.name?.replace("typescript-eslint/", "")}`,
288
+ files: [GLOB_VUE]
289
+ })),
290
+ import_eslint_plugin_vue.default.configs["flat/recommended"].map((item) => ({
291
+ ...item,
292
+ name: `${RULE_PREFIX}/vue/shared/${item.name?.replace("vue/", "")}`,
293
+ files: [GLOB_VUE]
294
+ })),
295
+ {
296
+ name: `${RULE_PREFIX}/vue/customize`,
297
+ files: [GLOB_VUE],
298
+ languageOptions: {
299
+ ecmaVersion: "latest",
300
+ sourceType: "module",
301
+ globals: import_globals.default.browser,
302
+ parserOptions: {
303
+ parser: import_typescript_eslint.default.parser
304
+ }
305
+ },
306
+ processor: (0, import_eslint_merge_processors.mergeProcessors)([
307
+ import_eslint_plugin_vue.default.processors[".vue"],
308
+ (0, import_eslint_processor_vue_blocks.default)({
309
+ blocks: {
310
+ styles: true,
311
+ customBlocks: true,
312
+ script: false,
313
+ template: false
314
+ }
315
+ })
316
+ ]),
317
+ rules: overrides
318
+ }
319
+ );
320
+ }
321
+
269
322
  // src/configs/stylistic.ts
270
323
  var import_eslint_plugin2 = __toESM(require("@stylistic/eslint-plugin"), 1);
271
324
  var import_eslint_plugin_antfu = __toESM(require("eslint-plugin-antfu"), 1);
@@ -315,11 +368,11 @@ function stylistic(options = {}) {
315
368
  braceStyle: "1tbs"
316
369
  }),
317
370
  name: `${RULE_PREFIX}/stylistic/shared`,
318
- files: [...GLOB_SRC, ...GLOB_JSON_SRC]
371
+ files: [...GLOB_SRC, ...GLOB_JSON_SRC, GLOB_VUE]
319
372
  },
320
373
  {
321
374
  name: `${RULE_PREFIX}/stylistic/customize`,
322
- files: [...GLOB_SRC, ...GLOB_JSON_SRC],
375
+ files: [...GLOB_SRC, ...GLOB_JSON_SRC, GLOB_VUE],
323
376
  plugins: {
324
377
  stylistic: import_eslint_plugin2.default,
325
378
  antfu: import_eslint_plugin_antfu.default,
@@ -407,7 +460,16 @@ function stylistic(options = {}) {
407
460
  "stylistic/object-property-newline": [
408
461
  "error",
409
462
  {
410
- allowMultiplePropertiesPerLine: true
463
+ allowAllPropertiesOnSameLine: true
464
+ }
465
+ ],
466
+ "stylistic/space-before-function-paren": [
467
+ "error",
468
+ {
469
+ named: "never",
470
+ anonymous: "always",
471
+ asyncArrow: "always",
472
+ catch: "always"
411
473
  }
412
474
  ],
413
475
  "stylistic/switch-colon-spacing": [
@@ -438,7 +500,7 @@ function stylistic(options = {}) {
438
500
  },
439
501
  {
440
502
  name: `${RULE_PREFIX}/stylistic/customize/jsx`,
441
- files: GLOB_JSX_SRC,
503
+ files: [...GLOB_JSX_SRC, GLOB_VUE],
442
504
  plugins: {
443
505
  stylistic: import_eslint_plugin2.default,
444
506
  hyoban: import_eslint_plugin_hyoban.default
@@ -522,15 +584,15 @@ function stylistic(options = {}) {
522
584
 
523
585
  // src/configs/typescript.ts
524
586
  var import_node_process = __toESM(require("process"), 1);
525
- var import_typescript_eslint = __toESM(require("typescript-eslint"), 1);
587
+ var import_typescript_eslint2 = __toESM(require("typescript-eslint"), 1);
526
588
  function typescript(options = {}) {
527
589
  const { overrides = {}, typeSafe = false } = options;
528
590
  return [
529
- ...import_typescript_eslint.default.config(
530
- import_typescript_eslint.default.configs.base,
531
- import_typescript_eslint.default.configs.recommendedTypeChecked,
532
- import_typescript_eslint.default.configs.strictTypeChecked,
533
- import_typescript_eslint.default.configs.stylisticTypeChecked
591
+ ...import_typescript_eslint2.default.config(
592
+ import_typescript_eslint2.default.configs.base,
593
+ import_typescript_eslint2.default.configs.recommendedTypeChecked,
594
+ import_typescript_eslint2.default.configs.strictTypeChecked,
595
+ import_typescript_eslint2.default.configs.stylisticTypeChecked
534
596
  ).map((item) => ({
535
597
  ...item,
536
598
  name: `${RULE_PREFIX}/typescript/shared/${item.name?.replace("typescript-eslint/", "")}`,
@@ -611,9 +673,9 @@ function typescript(options = {}) {
611
673
  }
612
674
 
613
675
  // src/configs/javascript.ts
614
- var import_js = __toESM(require("@eslint/js"), 1);
676
+ var import_js2 = __toESM(require("@eslint/js"), 1);
615
677
  var import_eslint_plugin_antfu2 = __toESM(require("eslint-plugin-antfu"), 1);
616
- var import_globals = __toESM(require("globals"), 1);
678
+ var import_globals2 = __toESM(require("globals"), 1);
617
679
  function javascript(options = {}) {
618
680
  const { overrides = {} } = options;
619
681
  return [
@@ -623,9 +685,9 @@ function javascript(options = {}) {
623
685
  languageOptions: {
624
686
  ecmaVersion: 2022,
625
687
  globals: {
626
- ...import_globals.default.browser,
627
- ...import_globals.default.es2021,
628
- ...import_globals.default.node,
688
+ ...import_globals2.default.browser,
689
+ ...import_globals2.default.es2021,
690
+ ...import_globals2.default.node,
629
691
  document: "readonly",
630
692
  navigator: "readonly",
631
693
  window: "readonly"
@@ -642,7 +704,7 @@ function javascript(options = {}) {
642
704
  linterOptions: {
643
705
  reportUnusedDisableDirectives: true
644
706
  },
645
- rules: import_js.default.configs.recommended.rules
707
+ rules: import_js2.default.configs.recommended.rules
646
708
  },
647
709
  {
648
710
  name: `${RULE_PREFIX}/javascript/customize`,
@@ -1434,9 +1496,10 @@ function format(options = {}) {
1434
1496
 
1435
1497
  // src/configs/tailwindcss.ts
1436
1498
  var import_eslint_plugin_tailwindcss = __toESM(require("eslint-plugin-tailwindcss"), 1);
1499
+ var import_local_pkg2 = require("local-pkg");
1437
1500
  function tailwindcss(options = {}) {
1438
1501
  const { overrides = {} } = options;
1439
- return [
1502
+ return (0, import_local_pkg2.isPackageExists)("tailwindcss") ? [
1440
1503
  ...import_eslint_plugin_tailwindcss.default.configs["flat/recommended"].map((item) => ({
1441
1504
  ...item,
1442
1505
  name: `${RULE_PREFIX}/tailwindcss/shared/${item.name?.replace("tailwindcss:", "")}`,
@@ -1450,15 +1513,15 @@ function tailwindcss(options = {}) {
1450
1513
  ...overrides
1451
1514
  }
1452
1515
  }
1453
- ];
1516
+ ] : [];
1454
1517
  }
1455
1518
 
1456
1519
  // src/configs/unocss.ts
1457
1520
  var import_flat = __toESM(require("@unocss/eslint-config/flat"), 1);
1458
- var import_local_pkg2 = require("local-pkg");
1521
+ var import_local_pkg3 = require("local-pkg");
1459
1522
  function unocss(options = {}) {
1460
1523
  const { overrides = {} } = options;
1461
- const isUnocssEnabled = (0, import_local_pkg2.isPackageExists)("unocss");
1524
+ const isUnocssEnabled = (0, import_local_pkg3.isPackageExists)("unocss");
1462
1525
  if (!isUnocssEnabled) {
1463
1526
  return [];
1464
1527
  }
@@ -1639,7 +1702,6 @@ function eslintComments(options = {}) {
1639
1702
  const { overrides = {} } = options;
1640
1703
  return [
1641
1704
  {
1642
- // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
1643
1705
  ...import_configs.default.recommended,
1644
1706
  name: `${RULE_PREFIX}/eslint-comments/shared`
1645
1707
  },
@@ -1728,6 +1790,7 @@ function defineConfig(options = {}) {
1728
1790
  const { configs: configs2 = {}, ignorePatterns = [] } = options;
1729
1791
  return [
1730
1792
  ...react(configs2.react),
1793
+ ...vue(configs2.vue),
1731
1794
  ...stylistic(configs2.stylistic),
1732
1795
  ...typescript(configs2.typescript),
1733
1796
  ...javascript(configs2.javascript),
package/dist/index.d.cts CHANGED
@@ -129,6 +129,8 @@ interface IReactConfigsOptions {
129
129
  googleTranslate?: Record<string, Linter.RuleEntry>;
130
130
  };
131
131
  }
132
+ interface IVueConfigsOptions extends IConfigsOptions {
133
+ }
132
134
  interface IStylisticConfigsOptions extends IConfigsOptions {
133
135
  }
134
136
  interface ITypescriptConfigsOptions extends IConfigsOptions {
@@ -188,6 +190,7 @@ interface IDisablesConfigsOptions {
188
190
  interface Options {
189
191
  configs?: {
190
192
  react?: IReactConfigsOptions;
193
+ vue?: IVueConfigsOptions;
191
194
  stylistic?: IStylisticConfigsOptions;
192
195
  typescript?: ITypescriptConfigsOptions;
193
196
  javascript?: IJavascriptConfigsOptions;
package/dist/index.d.ts CHANGED
@@ -129,6 +129,8 @@ interface IReactConfigsOptions {
129
129
  googleTranslate?: Record<string, Linter.RuleEntry>;
130
130
  };
131
131
  }
132
+ interface IVueConfigsOptions extends IConfigsOptions {
133
+ }
132
134
  interface IStylisticConfigsOptions extends IConfigsOptions {
133
135
  }
134
136
  interface ITypescriptConfigsOptions extends IConfigsOptions {
@@ -188,6 +190,7 @@ interface IDisablesConfigsOptions {
188
190
  interface Options {
189
191
  configs?: {
190
192
  react?: IReactConfigsOptions;
193
+ vue?: IVueConfigsOptions;
191
194
  stylistic?: IStylisticConfigsOptions;
192
195
  typescript?: ITypescriptConfigsOptions;
193
196
  javascript?: IJavascriptConfigsOptions;
package/dist/index.js CHANGED
@@ -22,6 +22,7 @@ var GLOB_SCSS = "**/*.scss";
22
22
  var GLOB_GRAPHQL = "**/*.{g,graph}ql";
23
23
  var GLOB_XML = "**/*.xml";
24
24
  var GLOB_SVG = "**/*.svg";
25
+ var GLOB_VUE = "**/*.vue";
25
26
  var GLOB_JSON_SRC = [
26
27
  GLOB_JSON,
27
28
  GLOB_JSON5,
@@ -230,6 +231,58 @@ function react(options = {}) {
230
231
  ];
231
232
  }
232
233
 
234
+ // src/configs/vue.ts
235
+ import js from "@eslint/js";
236
+ import tseslint from "typescript-eslint";
237
+ import pluginVue from "eslint-plugin-vue";
238
+ import globals from "globals";
239
+ import { mergeProcessors } from "eslint-merge-processors";
240
+ import processorVueBlocks from "eslint-processor-vue-blocks";
241
+ function vue(options = {}) {
242
+ const { overrides = {} } = options;
243
+ return tseslint.config(
244
+ {
245
+ ...js.configs.recommended,
246
+ name: `${RULE_PREFIX}/vue/shared/javascript`,
247
+ files: [GLOB_VUE]
248
+ },
249
+ tseslint.configs.recommended.map((item) => ({
250
+ ...item,
251
+ name: `${RULE_PREFIX}/vue/shared/typescript/${item.name?.replace("typescript-eslint/", "")}`,
252
+ files: [GLOB_VUE]
253
+ })),
254
+ pluginVue.configs["flat/recommended"].map((item) => ({
255
+ ...item,
256
+ name: `${RULE_PREFIX}/vue/shared/${item.name?.replace("vue/", "")}`,
257
+ files: [GLOB_VUE]
258
+ })),
259
+ {
260
+ name: `${RULE_PREFIX}/vue/customize`,
261
+ files: [GLOB_VUE],
262
+ languageOptions: {
263
+ ecmaVersion: "latest",
264
+ sourceType: "module",
265
+ globals: globals.browser,
266
+ parserOptions: {
267
+ parser: tseslint.parser
268
+ }
269
+ },
270
+ processor: mergeProcessors([
271
+ pluginVue.processors[".vue"],
272
+ processorVueBlocks({
273
+ blocks: {
274
+ styles: true,
275
+ customBlocks: true,
276
+ script: false,
277
+ template: false
278
+ }
279
+ })
280
+ ]),
281
+ rules: overrides
282
+ }
283
+ );
284
+ }
285
+
233
286
  // src/configs/stylistic.ts
234
287
  import pluginStylistic from "@stylistic/eslint-plugin";
235
288
  import pluginAntfu from "eslint-plugin-antfu";
@@ -279,11 +332,11 @@ function stylistic(options = {}) {
279
332
  braceStyle: "1tbs"
280
333
  }),
281
334
  name: `${RULE_PREFIX}/stylistic/shared`,
282
- files: [...GLOB_SRC, ...GLOB_JSON_SRC]
335
+ files: [...GLOB_SRC, ...GLOB_JSON_SRC, GLOB_VUE]
283
336
  },
284
337
  {
285
338
  name: `${RULE_PREFIX}/stylistic/customize`,
286
- files: [...GLOB_SRC, ...GLOB_JSON_SRC],
339
+ files: [...GLOB_SRC, ...GLOB_JSON_SRC, GLOB_VUE],
287
340
  plugins: {
288
341
  stylistic: pluginStylistic,
289
342
  antfu: pluginAntfu,
@@ -371,7 +424,16 @@ function stylistic(options = {}) {
371
424
  "stylistic/object-property-newline": [
372
425
  "error",
373
426
  {
374
- allowMultiplePropertiesPerLine: true
427
+ allowAllPropertiesOnSameLine: true
428
+ }
429
+ ],
430
+ "stylistic/space-before-function-paren": [
431
+ "error",
432
+ {
433
+ named: "never",
434
+ anonymous: "always",
435
+ asyncArrow: "always",
436
+ catch: "always"
375
437
  }
376
438
  ],
377
439
  "stylistic/switch-colon-spacing": [
@@ -402,7 +464,7 @@ function stylistic(options = {}) {
402
464
  },
403
465
  {
404
466
  name: `${RULE_PREFIX}/stylistic/customize/jsx`,
405
- files: GLOB_JSX_SRC,
467
+ files: [...GLOB_JSX_SRC, GLOB_VUE],
406
468
  plugins: {
407
469
  stylistic: pluginStylistic,
408
470
  hyoban: pluginHyoban
@@ -486,15 +548,15 @@ function stylistic(options = {}) {
486
548
 
487
549
  // src/configs/typescript.ts
488
550
  import process from "node:process";
489
- import tseslint from "typescript-eslint";
551
+ import tseslint2 from "typescript-eslint";
490
552
  function typescript(options = {}) {
491
553
  const { overrides = {}, typeSafe = false } = options;
492
554
  return [
493
- ...tseslint.config(
494
- tseslint.configs.base,
495
- tseslint.configs.recommendedTypeChecked,
496
- tseslint.configs.strictTypeChecked,
497
- tseslint.configs.stylisticTypeChecked
555
+ ...tseslint2.config(
556
+ tseslint2.configs.base,
557
+ tseslint2.configs.recommendedTypeChecked,
558
+ tseslint2.configs.strictTypeChecked,
559
+ tseslint2.configs.stylisticTypeChecked
498
560
  ).map((item) => ({
499
561
  ...item,
500
562
  name: `${RULE_PREFIX}/typescript/shared/${item.name?.replace("typescript-eslint/", "")}`,
@@ -575,9 +637,9 @@ function typescript(options = {}) {
575
637
  }
576
638
 
577
639
  // src/configs/javascript.ts
578
- import js from "@eslint/js";
640
+ import js2 from "@eslint/js";
579
641
  import pluginAntfu2 from "eslint-plugin-antfu";
580
- import globals from "globals";
642
+ import globals2 from "globals";
581
643
  function javascript(options = {}) {
582
644
  const { overrides = {} } = options;
583
645
  return [
@@ -587,9 +649,9 @@ function javascript(options = {}) {
587
649
  languageOptions: {
588
650
  ecmaVersion: 2022,
589
651
  globals: {
590
- ...globals.browser,
591
- ...globals.es2021,
592
- ...globals.node,
652
+ ...globals2.browser,
653
+ ...globals2.es2021,
654
+ ...globals2.node,
593
655
  document: "readonly",
594
656
  navigator: "readonly",
595
657
  window: "readonly"
@@ -606,7 +668,7 @@ function javascript(options = {}) {
606
668
  linterOptions: {
607
669
  reportUnusedDisableDirectives: true
608
670
  },
609
- rules: js.configs.recommended.rules
671
+ rules: js2.configs.recommended.rules
610
672
  },
611
673
  {
612
674
  name: `${RULE_PREFIX}/javascript/customize`,
@@ -1398,9 +1460,10 @@ function format(options = {}) {
1398
1460
 
1399
1461
  // src/configs/tailwindcss.ts
1400
1462
  import pluginTailwindcss from "eslint-plugin-tailwindcss";
1463
+ import { isPackageExists as isPackageExists2 } from "local-pkg";
1401
1464
  function tailwindcss(options = {}) {
1402
1465
  const { overrides = {} } = options;
1403
- return [
1466
+ return isPackageExists2("tailwindcss") ? [
1404
1467
  ...pluginTailwindcss.configs["flat/recommended"].map((item) => ({
1405
1468
  ...item,
1406
1469
  name: `${RULE_PREFIX}/tailwindcss/shared/${item.name?.replace("tailwindcss:", "")}`,
@@ -1414,15 +1477,15 @@ function tailwindcss(options = {}) {
1414
1477
  ...overrides
1415
1478
  }
1416
1479
  }
1417
- ];
1480
+ ] : [];
1418
1481
  }
1419
1482
 
1420
1483
  // src/configs/unocss.ts
1421
1484
  import configUnocss from "@unocss/eslint-config/flat";
1422
- import { isPackageExists as isPackageExists2 } from "local-pkg";
1485
+ import { isPackageExists as isPackageExists3 } from "local-pkg";
1423
1486
  function unocss(options = {}) {
1424
1487
  const { overrides = {} } = options;
1425
- const isUnocssEnabled = isPackageExists2("unocss");
1488
+ const isUnocssEnabled = isPackageExists3("unocss");
1426
1489
  if (!isUnocssEnabled) {
1427
1490
  return [];
1428
1491
  }
@@ -1603,7 +1666,6 @@ function eslintComments(options = {}) {
1603
1666
  const { overrides = {} } = options;
1604
1667
  return [
1605
1668
  {
1606
- // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
1607
1669
  ...pluginEslintComments.recommended,
1608
1670
  name: `${RULE_PREFIX}/eslint-comments/shared`
1609
1671
  },
@@ -1692,6 +1754,7 @@ function defineConfig(options = {}) {
1692
1754
  const { configs: configs2 = {}, ignorePatterns = [] } = options;
1693
1755
  return [
1694
1756
  ...react(configs2.react),
1757
+ ...vue(configs2.vue),
1695
1758
  ...stylistic(configs2.stylistic),
1696
1759
  ...typescript(configs2.typescript),
1697
1760
  ...javascript(configs2.javascript),
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@dhzh/eslint-config",
3
3
  "type": "module",
4
- "version": "1.7.2",
4
+ "version": "1.9.0",
5
5
  "description": "Lyle's ESLint config",
6
6
  "author": {
7
7
  "name": "Lyle Zheng",
@@ -51,18 +51,19 @@
51
51
  "@eslint-community/eslint-plugin-eslint-comments": "^4.5.0",
52
52
  "@eslint-react/eslint-plugin": "^1.48.5",
53
53
  "@eslint/js": "^9.25.1",
54
- "@stylistic/eslint-plugin": "^4.2.0",
55
- "@unocss/eslint-config": "66.1.2",
54
+ "@stylistic/eslint-plugin": "^5.2.3",
55
+ "@unocss/eslint-config": "66.4.2",
56
56
  "ansis": "^4.0.0",
57
57
  "cac": "^6.7.14",
58
+ "eslint-merge-processors": "^2.0.0",
58
59
  "eslint-plugin-antfu": "^3.1.1",
59
60
  "eslint-plugin-format": "^1.0.1",
60
61
  "eslint-plugin-hyoban": "^0.6.1",
61
62
  "eslint-plugin-import-x": "^4.11.0",
62
63
  "eslint-plugin-jsonc": "^2.20.0",
63
64
  "eslint-plugin-n": "^17.17.0",
64
- "eslint-plugin-package-json": "^0.31.0",
65
- "eslint-plugin-react-compiler": "19.1.0-rc.1",
65
+ "eslint-plugin-package-json": "^0.54.0",
66
+ "eslint-plugin-react-compiler": "19.1.0-rc.2",
66
67
  "eslint-plugin-react-google-translate": "^0.1.1",
67
68
  "eslint-plugin-react-hooks": "^5.2.0",
68
69
  "eslint-plugin-react-refresh": "^0.4.20",
@@ -70,27 +71,31 @@
70
71
  "eslint-plugin-simple-import-sort": "^12.1.1",
71
72
  "eslint-plugin-tailwindcss": "npm:@hyoban/eslint-plugin-tailwindcss@4.0.0-alpha.12",
72
73
  "eslint-plugin-toml": "^0.12.0",
73
- "eslint-plugin-unicorn": "^59.0.1",
74
+ "eslint-plugin-unicorn": "^60.0.0",
74
75
  "eslint-plugin-unused-imports": "^4.1.4",
76
+ "eslint-plugin-vue": "^10.1.0",
75
77
  "eslint-plugin-yml": "^1.18.0",
78
+ "eslint-processor-vue-blocks": "^2.0.0",
76
79
  "globals": "^16.0.0",
77
80
  "jsonc-eslint-parser": "^2.4.0",
78
81
  "local-pkg": "^1.1.1",
79
82
  "toml-eslint-parser": "^0.10.0",
80
83
  "typescript-eslint": "^8.31.0",
84
+ "vue-eslint-parser": "^10.1.3",
81
85
  "yaml-eslint-parser": "^1.3.0"
82
86
  },
83
87
  "devDependencies": {
84
88
  "@eslint/config-inspector": "^1.0.2",
85
89
  "@prettier/plugin-xml": "^3.4.1",
86
90
  "@types/eslint-plugin-tailwindcss": "^3.17.0",
87
- "@types/node": "^22.15.2",
91
+ "@types/node": "^22.17.2",
88
92
  "bumpp": "^10.1.0",
89
93
  "bundle-require": "^5.1.0",
90
94
  "eslint": "^9.25.1",
91
95
  "eslint-typegen": "^2.1.0",
92
96
  "lint-staged": "^16.0.0",
93
97
  "simple-git-hooks": "^2.13.0",
98
+ "tailwindcss": "^4.1.12",
94
99
  "tsup": "^8.4.0",
95
100
  "tsx": "^4.19.3",
96
101
  "typescript": "^5.8.3"